当前位置: 首页 > news >正文

做自媒体资源的网站南京品牌网站设计

做自媒体资源的网站,南京品牌网站设计,有网站怎么做app,godaddy服务器做网站1.background.js与content.js与popup.js对比: background.js 生命周期:一开始就执行#xff0c;最早执行且一直执行#xff1b; 作用#xff1a;放置全局的、需要一直运行的代码#xff0c;权限非常高几乎调用所有Chrome api,还可以发起跨域请求#xff1b; content.js 生…1.background.js与content.js与popup.js对比: background.js 生命周期:一开始就执行最早执行且一直执行 作用放置全局的、需要一直运行的代码权限非常高几乎调用所有Chrome api,还可以发起跨域请求 content.js 生命周期注入页面在刷新当前页面或者打开新的tab页执行 作用范围可以修改页面DOMjs与目标页面隔壁但是css没有 popup.js 生命周期打开 popup 界面执行关闭结束 2.mainfest.json示例: 详细可以参考前端 - Chrome 浏览器插件 V3 版本 Manifest.json 文件全字段解析 - 日升_rs - SegmentFault 思否 {name: Chrome插件V3,version: 1.0,description: V3版本,// Chrome Extension 版本号3表示MV3manifest_version: 3,// background script配置根目录为最终build生成的插件包目录background: {service_worker: background.js 可以跨域请求},// content script配置content_scripts: [{应用于哪些页面地址可以使用正则all_urls表示匹配所有地址matches: [all_urls], 目标页面注入到目标页面的css注意不要污染目标页面的样式css: [content.css],注入到目标页面js这个js是在沙盒里运行与目标页面是隔离的没有污染问题。js: [content.js],代码注入的时机可选document_start、document_end、document_idle默认run_at: document_end}],// 申请chrome extension API权限permissions: [storage,declarativeContent],// 插件涉及的外部请求地址暂未发现影响跨域请求猜测是用于上架商店时方便审核人员查阅host_permissions:[],// 如果向目标页面插入图片或者js需要在这里授权插件本地资源以下仅为示例。web_accessible_resources: [{resources: [ /images/app.png ],matches: [all_urls]},{resources: [ insert.js ],matches: [all_urls]}],// popup页面配置action: {// popup页面的路径根目录为最终build生成的插件包目录default_popup: index.html,// 浏览器插件按钮的图标default_icon: {16: /images/app.png,32: /images/app.png,48: /images/app.png,128: /images/app.png},// 浏览器插件按钮hover显示的文字default_title: Vue CRX MV3},// 插件图标图省事的话所有尺寸都用一个图也行icons: {16: /images/app.png,32: /images/app.png,48: /images/app.png,128: /images/app.png} } 3.chrome.scripting.executeScript(注入js) 当前页面 需要两个参数一个为页面id,另一个为要执行的js 需要在mainfest.json里面配置 permissions: [         activeTab,tabs,scripting     ], 第一种: chrome.scripting.executeScript({                 target: { tabId: tab.id },                 func: 函数名,                  }); 第二种 chrome.scripting.executeScript({                 target: { tabId: tab.id },                 files: [js/options.js],                  }); 这里是设置插入当前页面 document.addEventListener(DOMContentLoaded, async function () { console.log(DOMContentLoaded);const [tab] await chrome.tabs.query({ active: true, currentWindow: true });await chrome.scripting.executeScript({target: { tabId: tab.id },func: text}); })function text() {console.log(改变滤镜);document.documentElement.style.filter hue-rotate(180deg) } 指定页面 //获取当前窗口所有的tab页面chrome.tabs.query({currentWindow: true}, function (tabs) {//console.log(tabs)tabs.forEach(element {//遍历所有tab判断网址if (element.url.includes(www.baidu.com)) {chrome.tabs.update(element.id, {active: true}, function () {//向指定网址注入js代码chrome.scripting.executeScript({target: { tabId: element.id },files: [js/options.js],});})}});})//options.jsalert(我是被注入的js) iframe页面 chrome.scripting.executeScript({target: {tabId: tabId, allFrames: true},files: [script.js],});//指定iframeID执行const frameIds [frameId1, frameId2];chrome.scripting.executeScript({target: {tabId: tabId, frameIds: frameIds},files: [script.js],}); 4. chrome.scripting.insertCSS(注入css) 向当前页面注入css  const css body { background-color: red; };chrome.tabs.query({currentWindow: true,active: true}, function (tabs) {console.log(tabs[0].id)chrome.scripting.insertCSS({target: { tabId: tabs[0].id },css: css,}); }) 5.popup.js 在popop.js里面获取popup.html的元素要放在DOMContentLoaded里面 document.addEventListener(DOMContentLoaded, async function () { const myButton document.getElementById(changeFilterBtn); console.log(DOMContentLoaded);if (myButton) { // 你可以在这里添加事件监听器或其他操作 myButton.addEventListener(click, async function() { 获取当前活动页面 const [tab] await chrome.tabs.query({ active: true, currentWindow: true });await chrome.scripting.executeScript({target: { tabId: tab.id },func: 函数});}); }}) popup.html!DOCTYPE html htmlheadmeta charsetutf-8title更改当前网页滤镜/titlelink relstylesheet hrefpopup.css/headbodyh1更改当前网页滤镜/h1div classboxbutton idchangeFilterBtn更改滤镜/buttonbutton idresetFilterBtn去除滤镜/button/divscript srcpopup.js/script/body/html
文章转载自:
http://www.morning.qkgwz.cn.gov.cn.qkgwz.cn
http://www.morning.rmxk.cn.gov.cn.rmxk.cn
http://www.morning.bkfdf.cn.gov.cn.bkfdf.cn
http://www.morning.mcwgn.cn.gov.cn.mcwgn.cn
http://www.morning.tlpsd.cn.gov.cn.tlpsd.cn
http://www.morning.mlwpr.cn.gov.cn.mlwpr.cn
http://www.morning.gwxwl.cn.gov.cn.gwxwl.cn
http://www.morning.kcdts.cn.gov.cn.kcdts.cn
http://www.morning.rwdbz.cn.gov.cn.rwdbz.cn
http://www.morning.dbphz.cn.gov.cn.dbphz.cn
http://www.morning.xtyyg.cn.gov.cn.xtyyg.cn
http://www.morning.btpzn.cn.gov.cn.btpzn.cn
http://www.morning.qnzk.cn.gov.cn.qnzk.cn
http://www.morning.ggfdq.cn.gov.cn.ggfdq.cn
http://www.morning.qprtm.cn.gov.cn.qprtm.cn
http://www.morning.rnjgh.cn.gov.cn.rnjgh.cn
http://www.morning.xyrss.cn.gov.cn.xyrss.cn
http://www.morning.nrqtk.cn.gov.cn.nrqtk.cn
http://www.morning.xjpnq.cn.gov.cn.xjpnq.cn
http://www.morning.qcwck.cn.gov.cn.qcwck.cn
http://www.morning.fqyxb.cn.gov.cn.fqyxb.cn
http://www.morning.zqbrw.cn.gov.cn.zqbrw.cn
http://www.morning.bncrx.cn.gov.cn.bncrx.cn
http://www.morning.zwndt.cn.gov.cn.zwndt.cn
http://www.morning.yggwn.cn.gov.cn.yggwn.cn
http://www.morning.ymwny.cn.gov.cn.ymwny.cn
http://www.morning.pbsqr.cn.gov.cn.pbsqr.cn
http://www.morning.dpqqg.cn.gov.cn.dpqqg.cn
http://www.morning.jbctp.cn.gov.cn.jbctp.cn
http://www.morning.mwqbp.cn.gov.cn.mwqbp.cn
http://www.morning.bkjhx.cn.gov.cn.bkjhx.cn
http://www.morning.xjpnq.cn.gov.cn.xjpnq.cn
http://www.morning.bklkt.cn.gov.cn.bklkt.cn
http://www.morning.lnnc.cn.gov.cn.lnnc.cn
http://www.morning.tlfzp.cn.gov.cn.tlfzp.cn
http://www.morning.fkmrj.cn.gov.cn.fkmrj.cn
http://www.morning.wpqcj.cn.gov.cn.wpqcj.cn
http://www.morning.mjtgt.cn.gov.cn.mjtgt.cn
http://www.morning.ldsgm.cn.gov.cn.ldsgm.cn
http://www.morning.wfyqn.cn.gov.cn.wfyqn.cn
http://www.morning.wsrcy.cn.gov.cn.wsrcy.cn
http://www.morning.sypzg.cn.gov.cn.sypzg.cn
http://www.morning.fbtgp.cn.gov.cn.fbtgp.cn
http://www.morning.yhtnr.cn.gov.cn.yhtnr.cn
http://www.morning.rrxnz.cn.gov.cn.rrxnz.cn
http://www.morning.wrwcf.cn.gov.cn.wrwcf.cn
http://www.morning.jbkcs.cn.gov.cn.jbkcs.cn
http://www.morning.lcxdm.cn.gov.cn.lcxdm.cn
http://www.morning.hnk25076he.cn.gov.cn.hnk25076he.cn
http://www.morning.wttzp.cn.gov.cn.wttzp.cn
http://www.morning.mlfmj.cn.gov.cn.mlfmj.cn
http://www.morning.wqhlj.cn.gov.cn.wqhlj.cn
http://www.morning.tkflb.cn.gov.cn.tkflb.cn
http://www.morning.zrks.cn.gov.cn.zrks.cn
http://www.morning.wlxfj.cn.gov.cn.wlxfj.cn
http://www.morning.mjjty.cn.gov.cn.mjjty.cn
http://www.morning.hzryl.cn.gov.cn.hzryl.cn
http://www.morning.rjrlx.cn.gov.cn.rjrlx.cn
http://www.morning.gbtty.cn.gov.cn.gbtty.cn
http://www.morning.kscwt.cn.gov.cn.kscwt.cn
http://www.morning.yqpzl.cn.gov.cn.yqpzl.cn
http://www.morning.mlntx.cn.gov.cn.mlntx.cn
http://www.morning.qbwtb.cn.gov.cn.qbwtb.cn
http://www.morning.dgsx.cn.gov.cn.dgsx.cn
http://www.morning.clbzy.cn.gov.cn.clbzy.cn
http://www.morning.rzbcz.cn.gov.cn.rzbcz.cn
http://www.morning.crkhd.cn.gov.cn.crkhd.cn
http://www.morning.mdtfh.cn.gov.cn.mdtfh.cn
http://www.morning.dfndz.cn.gov.cn.dfndz.cn
http://www.morning.hlmkx.cn.gov.cn.hlmkx.cn
http://www.morning.lhhkp.cn.gov.cn.lhhkp.cn
http://www.morning.jlmrx.cn.gov.cn.jlmrx.cn
http://www.morning.wyrkp.cn.gov.cn.wyrkp.cn
http://www.morning.dmsxd.cn.gov.cn.dmsxd.cn
http://www.morning.lqtwb.cn.gov.cn.lqtwb.cn
http://www.morning.rqdx.cn.gov.cn.rqdx.cn
http://www.morning.jcrlx.cn.gov.cn.jcrlx.cn
http://www.morning.jsmyw.cn.gov.cn.jsmyw.cn
http://www.morning.twfdm.cn.gov.cn.twfdm.cn
http://www.morning.mrfnj.cn.gov.cn.mrfnj.cn
http://www.tj-hxxt.cn/news/261710.html

相关文章:

  • 东西湖区网站建设公司企业宣传册版式设计
  • 网站建设技术标书南京企业网站开发公司
  • 无限容量网站赣州市南康建设局网站
  • 网站建设800元全包清远建设局网站
  • 北京建站公司哪家好都选万维科技宣威市网站建设
  • 苏州网站设计制作公司wordpress 手机端页面
  • 网站成功秘诀重庆多功能网站建设
  • 重庆网站设计排名seo网站推广的主要目的
  • 深圳万齐创享网站建设android软件开发工程师
  • wordpress搭建下载站集宁建设局网站
  • 长治网站建设费用网站开发安卓开发
  • 乡村门户网站建设重庆的网站设计公司
  • 学网页制作的网站access数据库网站开发
  • 大公司做网站的优势电商网站建设分析
  • 坪山企业网站建设襄县网站建设
  • 网页设计特效网站wordpress 挣钱
  • 数据网站企业网站的常见类型有什么
  • 网站开发电脑内存要多少钱设计网站如何推广方案
  • 什么网站做跨境电子商务做公众号的网站模板
  • 玉山电商网站建设电子商务是什么
  • seo技术优化整站智能建站代理
  • 怎么看网站的备案信息株洲关键词优化费用
  • 毕业设计论文网站开发需要多少重庆建设工程信息网官网+安全监督+安管人员
  • 漳州城乡和建设局网站html网页制作模板代码
  • 网站中文名要注册的吗wordpress小图标网站
  • 网站设计精美案例网站制作什么样的字体好看
  • 网站买流量是怎么做的酒仙桥网站建设
  • 建设网站备案不通过怎么办百度代理授权查询
  • 网站设计策划WordPress国外音乐播放器
  • 怎么将公司网站设成首页潍坊网站开发weifangwangluo