Rikaikun 开源项目教程

Rikaikun 开源项目教程

rikaikunrikaikun is a Chrome extension that helps you to read Japanese web pages by showing the reading and English definition of Japanese words when you hover over them.项目地址:https://gitcode.com/gh_mirrors/ri/rikaikun

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

Rikaikun 项目的目录结构如下:

rikaikun/
├── _locales/
│   ├── en/
│   └── zh_CN/
├── css/
├── icons/
├── js/
│   ├── background.js
│   ├── content.js
│   ├── options.js
│   └── popup.js
├── manifest.json
├── options.html
├── popup.html
└── README.md

目录结构介绍

  • _locales/: 存放项目的多语言支持文件。
    • en/: 英文语言文件。
    • zh_CN/: 中文语言文件。
  • css/: 存放项目的样式文件。
  • icons/: 存放项目的图标文件。
  • js/: 存放项目的 JavaScript 文件。
    • background.js: 后台脚本文件。
    • content.js: 内容脚本文件。
    • options.js: 选项页面脚本文件。
    • popup.js: 弹出页面脚本文件。
  • manifest.json: 项目的配置文件。
  • options.html: 选项页面 HTML 文件。
  • popup.html: 弹出页面 HTML 文件。
  • README.md: 项目的说明文档。

2. 项目的启动文件介绍

Rikaikun 项目的启动文件主要是 background.jscontent.js

background.js

background.js 是后台脚本文件,负责处理浏览器扩展的后台逻辑,例如消息传递、数据存储等。

content.js

content.js 是内容脚本文件,负责在网页上下文中执行 JavaScript 代码,实现对网页内容的交互和修改。

3. 项目的配置文件介绍

Rikaikun 项目的配置文件是 manifest.json

manifest.json

manifest.json 是 Chrome 扩展的配置文件,定义了扩展的基本信息、权限、资源路径等。

{
  "manifest_version": 2,
  "name": "rikaikun",
  "version": "2.0.0",
  "description": "rikaikun helps you learn Japanese by showing the reading and English definition of Japanese words when you hover over them.",
  "icons": {
    "16": "icons/icon16.png",
    "48": "icons/icon48.png",
    "128": "icons/icon128.png"
  },
  "background": {
    "scripts": ["js/background.js"],
    "persistent": false
  },
  "content_scripts": [
    {
      "matches": ["<all_urls>"],
      "js": ["js/content.js"],
      "css": ["css/content.css"]
    }
  ],
  "permissions": [
    "storage"
  ],
  "browser_action": {
    "default_icon": "icons/icon16.png",
    "default_popup": "popup.html"
  },
  "options_ui": {
    "page": "options.html",
    "open_in_tab": true
  }
}

配置文件介绍

  • manifest_version: 指定 manifest 文件的版本,目前为 2。
  • name: 扩展的名称。
  • version: 扩展的版本号。
  • description: 扩展的描述信息。
  • icons: 扩展的图标路径。
  • background: 后台脚本的配置,包括脚本路径和是否持久化。
  • content_scripts: 内容脚本的配置,包括匹配的 URL 和脚本路径。
  • permissions: 扩展需要的权限,例如存储权限。
  • browser_action: 浏览器动作的配置,包括默认图标和弹出页面。
  • options_ui: 选项页面的配置,包括页面路径和是否在新标签页打开。

rikaikunrikaikun is a Chrome extension that helps you to read Japanese web pages by showing the reading and English definition of Japanese words when you hover over them.项目地址:https://gitcode.com/gh_mirrors/ri/rikaikun

一个为chrome设计的rikaichan港口。翻译日语:在单词上盘旋。 *Version History Below* This is a port of rikaichan to chrome. For arbitrary reasons, I've called it rikaikun. Activate the extension by clicking on the 理 in the top right. Some people have reported that loading might take up to 10 seconds on OSX. When the introductory pop up appears, rikaikun is ready for action. When it's activated, when you hover over Japanese words they'll be translated in a pop up. If you hit shift/enter, you'll see some information about the first Kanji. It's not as done as I wanted, but please file issues at the link provided if you have any problems or feature requests. If you click on the "Details" tab you can find a link to the support page where you can file bugs and feature requests. v0.10.0 Features Scrolling to see >7 dictionary entries by bazzinotti. Add Heisig keywords to Kanji dictionary by Vwing. Add Heisig 6th edition by Vwing. Add Text To Speech support (enable in settings) by MayamaTakeshi. Options appear in pop up instead of new page by darren-lester. Settings use cloud sync and persist across all computers by Deshaun Crawford. Bug Fixes CTRL-C works properly to copy just the word instead of copying the full definition by darren-lester. Google Docs mostly works again after they updated their rendering logic. v0.9.1 Fixes textarea bug. v0.9.0 Faster dictionary loading. Popup delay added and popups can be configured to only show up when a key is pressed. Popup location default can be configured via options. Various bug fixes. v0.8.91 jQuery was removed and a bug common on angular pages. v0.8.9 Names dictionary is added. It's quite large but shouldn't be a problem for modern computers. v0.8.7 Fixed bug where rikaikun would stop working and need to be turned off and on again. v0.8.6 Added readings only mode that can be turned on in the options. It allows you to not see English definitions if you don't want to. v0.8.5 Fixed various bugs. Added text fields and button capability. By default
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

丁战崇Exalted

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

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

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

打赏作者

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

抵扣说明:

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

余额充值