![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
chrome插件
老懒鸟呀
这个作者很懒,什么都没留下…
展开
-
popup.js获取页面网址和标题
//popup.jschrome.tabs.query({active: true,currentWindow: true},function(tabs) { var url = tabs[0].url; var title = tabs[0].title; alert(title + url); })原创 2020-12-07 20:59:10 · 754 阅读 · 0 评论 -
点击鼠标。一个消息框会提示出您点击了哪个鼠标按键。
<html><head><script type="text/javascript">function whichButton(event){var btnNum = event.button;if (btnNum==2) { alert("您点击了鼠标右键!") }else if(btnNum==0) { alert("您点击了鼠标左键!") }else if(btnNum==1) { alert("您点击了鼠标中键!")原创 2020-10-24 21:35:03 · 255 阅读 · 0 评论 -
div不换行
<div class="parent"><div class="div1"><button id="w2" style="color:#F00">翻译</button></div><div class="div2"><button id="w2" style="color:#F00">翻译</button></div></div><style>.parent {di原创 2020-10-21 23:23:35 · 104 阅读 · 0 评论 -
chrome插件组合快捷键
//manifest.json "commands": { "copy_to_clipboard": { "suggested_key": { "default": "Ctrl+Shift+Z"//Ctrl+C Alt }, "description": "将选中的文本复制到MultiCopy剪贴板" } },//background.jschrome.comma.原创 2020-10-08 13:09:38 · 551 阅读 · 0 评论 -
background访问popup如下(前提是popup已经打开)
var views = chrome.extension.getViews({type:'popup'});//background访问popup如下(前提是popup已经打开)if(views.length > 0) { alert(views[0].location.href); alert(views[0].document.body.outerHTML);}原创 2020-10-07 23:20:31 · 360 阅读 · 0 评论 -
background发消息给content_scripts
//background.jschrome.tabs.query({active: true, currentWindow: true}, function(tabs) { chrome.tabs.sendMessage(tabs[0].id,{from:'background发出的消息1',to:'content_scripts发出的消息2'}, function(response) { alert('收到content_原创 2020-10-03 11:11:38 · 1508 阅读 · 0 评论 -
chrome 插件 右下角提示窗口的实现
"permissions": ["notifications"],//manifest.json权限设置chrome.notifications.create(null, { type:'basic', iconUrl: 'icon/16.png', title: '复制成功!', message: '>>文字说明' // message: '>&原创 2020-09-30 12:53:59 · 1005 阅读 · 0 评论