Copyfish 开源项目教程

Copyfish 开源项目教程

CopyfishCopy, paste and translate text from images, videos and PDFs with this free Chrome extension项目地址:https://gitcode.com/gh_mirrors/co/Copyfish

1. 项目的目录结构及介绍

Copyfish 项目的目录结构如下:

Copyfish/
├── css/
│   ├── content.css
│   └── options.css
├── js/
│   ├── background.js
│   ├── content.js
│   ├── options.js
│   └── popup.js
├── images/
│   ├── icon-128.png
│   ├── icon-16.png
│   └── icon-48.png
├── manifest.json
├── options.html
└── popup.html

目录介绍:

  • css/: 包含项目的样式文件,如 content.cssoptions.css
  • js/: 包含项目的 JavaScript 文件,如 background.js, content.js, options.jspopup.js
  • images/: 包含项目的图标文件,如 icon-128.png, icon-16.pngicon-48.png
  • manifest.json: 项目的配置文件,定义了扩展的基本信息和权限。
  • options.html: 项目的设置页面。
  • popup.html: 项目的弹出页面。

2. 项目的启动文件介绍

Copyfish 项目的启动文件是 manifest.json。这个文件定义了扩展的基本信息、权限、以及启动时加载的脚本和页面。

manifest.json 示例:

{
  "manifest_version": 2,
  "name": "Copyfish 🐟 Free OCR Software",
  "version": "2.7.0",
  "description": "Copy, paste and translate text from any image, video or PDF.",
  "icons": {
    "16": "images/icon-16.png",
    "48": "images/icon-48.png",
    "128": "images/icon-128.png"
  },
  "permissions": [
    "activeTab",
    "storage",
    "contextMenus",
    "notifications",
    "clipboardWrite",
    "clipboardRead"
  ],
  "background": {
    "scripts": ["js/background.js"],
    "persistent": false
  },
  "browser_action": {
    "default_icon": {
      "16": "images/icon-16.png",
      "48": "images/icon-48.png",
      "128": "images/icon-128.png"
    },
    "default_popup": "popup.html"
  },
  "options_ui": {
    "page": "options.html",
    "open_in_tab": true
  },
  "content_scripts": [
    {
      "matches": ["<all_urls>"],
      "js": ["js/content.js"],
      "css": ["css/content.css"]
    }
  ]
}

启动文件介绍:

  • manifest_version: 指定 manifest 文件的版本,通常为 2。
  • name: 扩展的名称。
  • version: 扩展的版本号。
  • description: 扩展的描述。
  • icons: 扩展的图标。
  • permissions: 扩展所需的权限。
  • background: 后台脚本,用于处理后台任务。
  • browser_action: 浏览器动作,定义了扩展的图标和弹出页面。
  • options_ui: 设置页面,用户可以在此配置扩展。
  • content_scripts: 内容脚本,注入到网页中执行的脚本。

3. 项目的配置文件介绍

Copyfish 项目的配置文件是 manifest.json。这个文件包含了扩展的所有配置信息,如名称、版本、权限、后台脚本、浏览器动作等。

配置文件介绍:

  • manifest_version: 指定 manifest 文件的版本。
  • name: 扩展的名称。
  • version: 扩展的版本号。
  • description: 扩展的描述。
  • icons: 扩展的图标。

CopyfishCopy, paste and translate text from images, videos and PDFs with this free Chrome extension项目地址:https://gitcode.com/gh_mirrors/co/Copyfish

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

包力文Hardy

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值