Super Simple Highlighter 项目教程

Super Simple Highlighter 项目教程

super-simple-highlighterA chrome extension which highlights text on a web page, and attempts to restore it on returning项目地址:https://gitcode.com/gh_mirrors/su/super-simple-highlighter

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

Super Simple Highlighter 项目的目录结构如下:

super-simple-highlighter/
├── _locales/
│   └── cs/
│       └── messages.json
├── static/
│   ├── css/
│   │   └── style.css
│   └── js/
│       └── script.js
├── gitignore
├── LICENSE
├── README.md
├── manifest.json
├── options.html
├── overview.html
└── popup.html

目录介绍:

  • _locales/: 包含多语言支持的文件夹,目前只有捷克语(cs)的翻译文件。
  • static/: 静态资源文件夹,包含 CSS 和 JS 文件。
  • css/: 存放样式文件。
  • js/: 存放脚本文件。
  • gitignore: Git 忽略文件配置。
  • LICENSE: 项目许可证文件。
  • README.md: 项目说明文档。
  • manifest.json: Chrome 扩展的配置文件。
  • options.html: 扩展选项页面。
  • overview.html: 扩展概览页面。
  • popup.html: 扩展弹出页面。

2. 项目的启动文件介绍

Super Simple Highlighter 的启动文件主要是 manifest.json 文件。这个文件定义了扩展的基本信息和启动配置。

manifest.json 文件内容示例:

{
  "manifest_version": 2,
  "name": "Super Simple Highlighter",
  "version": "1.0",
  "description": "A Chrome extension for highlighting text and automatically attempt to restore highlight on each page revisit.",
  "icons": {
    "16": "icons/icon16.png",
    "48": "icons/icon48.png",
    "128": "icons/icon128.png"
  },
  "permissions": [
    "activeTab"
  ],
  "browser_action": {
    "default_icon": "icons/icon16.png",
    "default_popup": "popup.html"
  },
  "background": {
    "scripts": ["background.js"]
  },
  "content_scripts": [
    {
      "matches": ["<all_urls>"],
      "js": ["content.js"]
    }
  ]
}

启动文件介绍:

  • manifest_version: 指定 manifest 文件的版本。
  • name: 扩展的名称。
  • version: 扩展的版本号。
  • description: 扩展的描述。
  • icons: 扩展的图标。
  • permissions: 扩展所需的权限。
  • browser_action: 浏览器动作配置,包括默认图标和弹出页面。
  • background: 后台脚本配置。
  • content_scripts: 内容脚本配置,指定在哪些页面加载内容脚本。

3. 项目的配置文件介绍

Super Simple Highlighter 的配置文件主要是 manifest.jsonoptions.html

manifest.json 配置文件介绍:

如上所述,manifest.json 文件定义了扩展的基本信息和启动配置,包括扩展的名称、版本、描述、图标、权限、浏览器动作、后台脚本和内容脚本等。

options.html 配置文件介绍:

options.html 文件是扩展的选项页面,用户可以在这里进行一些自定义设置。

options.html 文件内容示例:

<!DOCTYPE html>
<html>
<head>
  <title>Super Simple Highlighter Options</title>
  <link rel="stylesheet" type="text/css" href="static/css/style.css">
</head>
<body>
  <h1>Super Simple Highlighter Options</h1>
  <form>
    <label for="highlightColor">Highlight Color:</label>
    <input type="color" id="highlightColor" name="highlightColor" value="#ffff00">
    <button type="submit">Save</button>
  </form>
  <script src="static/js/options.js"></script>
</body>
</html>

super-simple-highlighterA chrome extension which highlights text on a web page, and attempts to restore it on returning项目地址:https://gitcode.com/gh_mirrors/su/super-simple-highlighter

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

顾能培Wynne

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

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

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

打赏作者

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

抵扣说明:

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

余额充值