chrome-plugin-demo/full-chrome-plugin-demo/manifest.json

96 lines
3.1 KiB
JSON
Raw Permalink Normal View History

2017-06-02 19:40:48 +08:00
{
// 清单文件的版本这个必须写而且必须是2
"manifest_version": 2,
// 插件的名称
"name": "demo",
// 插件的版本
"version": "1.0.0",
// 插件描述
2017-06-23 21:11:15 +08:00
"description": "__MSG_pluginDesc__",
2017-06-02 19:40:48 +08:00
// 图标,一般偷懒全部用一个尺寸的也没问题
"icons":
{
"16": "img/icon.png",
"48": "img/icon.png",
"128": "img/icon.png"
},
2017-06-23 21:11:15 +08:00
// 会一直常驻的后台JS或后台页面
2017-06-02 19:40:48 +08:00
"background":
{
2017-06-23 21:11:15 +08:00
// 2种指定方式如果指定JS那么会自动生成一个背景页
"page": "background.html"
//"scripts": ["js/background.js"]
2017-06-02 19:40:48 +08:00
},
// 浏览器右上角图标设置browser_action、page_action、app必须三选一
"browser_action":
{
"default_icon": "img/icon.png",
2017-06-16 18:54:57 +08:00
// 图标悬停时的标题,可选
2017-06-02 19:40:48 +08:00
"default_title": "这是一个示例Chrome插件",
"default_popup": "popup.html"
},
// 当某些特定页面打开才显示的图标
/*"page_action":
{
"default_icon": "img/icon.png",
"default_title": "我是pageAction",
"default_popup": "popup.html"
},*/
// 需要直接注入页面的JS
"content_scripts":
[
{
2017-06-23 21:11:15 +08:00
//"matches": ["http://*/*", "https://*/*"],
// "<all_urls>" 表示匹配所有地址
"matches": ["<all_urls>"],
// 多个JS按顺序注入
2017-06-16 18:54:57 +08:00
"js": ["js/jquery-1.8.3.js", "js/content-script.js"],
2017-06-23 21:11:15 +08:00
// JS的注入可以随便一点但是CSS的注意就要千万小心了因为一不小心就可能影响全局样式
"css": ["css/custom.css"],
2017-06-16 18:54:57 +08:00
// 代码注入的时间,可选值: "document_start", "document_end", or "document_idle"最后一个表示页面空闲时默认document_idle
"run_at": "document_start"
2017-06-23 21:11:15 +08:00
},
// 这里仅仅是为了演示content-script可以配置多个规则
{
"matches": ["*://*/*.png", "*://*/*.jpg", "*://*/*.gif", "*://*/*.bmp"],
"js": ["js/show-image-content-size.js"]
2017-06-02 19:40:48 +08:00
}
],
// 权限申请
"permissions":
[
"contextMenus", // 右键菜单
"tabs", // 标签
2017-06-16 18:54:57 +08:00
"notifications", // 通知
2017-06-23 21:11:15 +08:00
"webRequest", // web请求
2017-07-10 22:36:59 +08:00
"webRequestBlocking", // 阻塞式web请求
2017-06-23 21:11:15 +08:00
"storage", // 插件本地存储
2017-06-16 18:54:57 +08:00
"http://*/*", // 可以通过executeScript或者insertCSS访问的网站
"https://*/*" // 可以通过executeScript或者insertCSS访问的网站
2017-06-02 19:40:48 +08:00
],
2017-06-23 21:11:15 +08:00
// 普通页面能够直接访问的插件资源列表,如果不设置是无法直接访问的
"web_accessible_resources": ["js/inject.js"],
2017-06-02 19:40:48 +08:00
// 插件主页,这个很重要,不要浪费了这个免费广告位
"homepage_url": "https://www.baidu.com",
2017-06-16 18:54:57 +08:00
// 覆盖浏览器默认页面
2017-06-02 19:40:48 +08:00
"chrome_url_overrides":
{
2017-06-16 18:54:57 +08:00
// 覆盖浏览器默认的新标签页
2017-06-26 02:13:17 +08:00
"newtab": "newtab.html"
},
2017-06-23 21:11:15 +08:00
// Chrome40以前的插件配置页写法
"options_page": "options.html",
// Chrome40以后的插件配置页写法如果2个都写新版Chrome只认后面这一个
"options_ui":
{
2017-06-26 02:13:17 +08:00
"page": "options.html",
2017-06-23 21:11:15 +08:00
// 添加一些默认的样式,推荐使用
2017-06-26 02:13:17 +08:00
"chrome_style": true
2017-06-23 21:11:15 +08:00
},
// 向地址栏注册一个关键字以提供搜索建议,只能设置一个关键字
"omnibox": { "keyword" : "go" },
// 默认语言
"default_locale": "zh_CN",
2017-06-16 18:54:57 +08:00
// devtools页面入口注意只能指向一个HTML文件不能是JS文件
2017-06-26 02:13:17 +08:00
"devtools_page": "devtools.html"
2017-06-02 19:40:48 +08:00
}