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

建设环境工程技术中心网站门户网站推广方式

建设环境工程技术中心网站,门户网站推广方式,刚做外贸最好用哪个网站,策划大型活动公司【Chrome Extension】一、CSDN计时扩展设计 重点内容内容脚本 content_scripts 文件目录1、整体目录2、manifest.json3、scripts/content.js4、css/content.css 重点内容 内容脚本 content_scripts 1、manifest.json文件配置 {"manifest_version": 3, # *依赖Chro…

【Chrome Extension】一、CSDN计时扩展设计

    • 重点内容
      • 内容脚本 content_scripts
    • 文件目录
        • 1、整体目录
        • 2、manifest.json
        • 3、scripts/content.js
        • 4、css/content.css

重点内容

在这里插入图片描述

内容脚本 content_scripts

1、manifest.json文件配置

{"manifest_version": 3,		# *依赖Chrome插件版本"name": "FeiFeiYeChuan-Tools-CSDN Article Reading Time", # *插件名称"version": "1.0", # *插件版本"description": "Add the reading time to Chrome Extension documentation articles","icons": { # 不同情况下显示的图标"16": "images/logo.png","32": "images/logo.png","48": "images/logo.png","128": "images/logo.png"},"content_scripts": [ # content内容{"js": ["scripts/content.js"],"css": ["css/content.css"],"matches": ["https://*.blog.csdn.net/*","https://blog.csdn.net/*"]}]
}

如上 content_scripts内容脚本:运行读取和修改网页内容的脚本) 主要用于在固定 matches 网页下的执行脚本内容,他们独立于其他扩展程序和托管页面,拥有独立的js,css脚本。

文件目录

1、整体目录

在这里插入图片描述

2、manifest.json
{"manifest_version": 3,"name": "FeiFeiYeChuan-Tools-CSDN Article Reading Time","version": "1.0","description": "Add the reading time to Chrome Extension documentation articles","icons": {"16": "images/logo.png","32": "images/logo.png","48": "images/logo.png","128": "images/logo.png"},"content_scripts": [{"js": ["scripts/content.js"],"css": ["css/content.css"],"matches": ["https://*.blog.csdn.net/*","https://blog.csdn.net/*"]}]
}
3、scripts/content.js
onload = function () {console.log("content.js已加载");const article = document.querySelector(".blog-content-box");console.log('article:', article)// `document.querySelector` may return null if the selector doesn't match anything.if (article) {const text = article.textContent;// console.log('text:', text)const wordMatchRegExp = /\w/g; // Regular expressionconst words = text.matchAll(wordMatchRegExp);// matchAll returns an iterator, convert to array to get word countconst wordCount = [...words].length;console.log("wordCount:", wordCount)const readingTime = Math.round(wordCount / 200);const badge = document.createElement("p");// Use the same styling as the publish information in an article's headerbadge.classList.add("color-secondary-text", "type--caption", 'light');badge.textContent = `⏱️ ${readingTime} min read`;// Support for API reference docsconst heading = document.querySelector(".title-article");heading.insertAdjacentElement("afterend", badge);}
}
4、css/content.css
.light{color: #77a000;
}
http://www.yayakq.cn/news/792516/

相关文章:

  • 百度提交网站wordpress如何修改后台网址
  • c 网站开发视频教程 高清微信管理
  • 网站开发找什么论文请网络推广外包公司有用吗
  • 张家港外贸网站建设wordpress文章缓存清理
  • 做公众号首图网站住房建设官方网站
  • 昌平做网站公司江都建设上海公司网站
  • 清远网站制作百度怎么推广广告
  • 做网站优化最快的方式网站上不去的原因
  • 外链收录网站室内设计师经常用的网站
  • js网站访问计数宜昌网站制作公司亿腾
  • 网站宽度 像素做淘客网站用什么服务器好
  • 建设银行天津分行门户网站青岛建设交易中心网站首页
  • 建站平台备案18款禁用网站app入口
  • 十大房产网站排行榜建设彩票网站犯法吗
  • 网站域名查询官网门户网站的建设要求
  • 威海市文登区城乡建设局网站使用三剑客做网站
  • 网站开发外包项目网站网站建设灬金手指科杰
  • 电商类网站有哪些网站开发成本
  • 福田做网站公司百度快照比网站上线时间早
  • 家居网站建设的需求分析漫画网站源码
  • 做建材的网站旅游网站自己怎么做
  • fomo3d 网站怎么做vue做网站的好处是什么
  • 网站建设技术标书黑马培训价目表
  • 做网站软件下载手机版wordpress php缓存
  • 网站域名到期怎么办可以免费建立网站吗
  • 怎么做短链接网站天宁寺网站建设
  • 银川网站seo常州市做网站
  • 天津地区个人网站备案注册企业邮箱163
  • 电商网站建设建议杭州有没有专业做网站的公司
  • aspcms中引文 网站修改配置二维码网页制作免费网站制作