支持pdf和web的双击划词翻译脚本,当前使用爱词霸公共api
参考 match_patterns_360 或 match_patterns_Mozilla 或 match_patterns_Google
在js代码的开头有一行注释是:
// @match *://*/*
以上这个匹配模式是匹配所有url网页.
也许你并不像这么做,比如你只想匹配本地打开的pdf,则可以改成:
// @match file:///*/*.pdf
你还可以额外指定包含和排除模式,比如:
// @include https://wiki.greasespot.net/*
// @include http://mozilla.github.io/pdf.js/web/viewer.html
// @include /^(http|https)://en\.people\.cn//
// @exclude https://github.com/*
初衷:
问:js版为什么在代码中嵌入jquery?
答:主要是为了避免脚本冲突以及重复加载,避免对原网站造成干扰。
↓↓↓ 在firefox下浏览本地pdf 以及 在chrome下浏览普通网页 ↓↓↓