diff --git a/README.md b/README.md index eb59a55..4ea277c 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ GitHub仓库:https://github.com/bitdance-team/chrome-extension 郑丽:天气展示功能,翻译功能(使用轻服务云函数构建Api) -张君秋:网页截图功能 +张君秋:网页截图功能,PPT制作 张松:确认页直接跳转功能,番茄钟 diff --git a/packages/shell-chrome/assets/js/expand-full-text/expand.js b/packages/shell-chrome/assets/js/expand-full-text/expand.js index 0801fa5..8b8efe4 100644 --- a/packages/shell-chrome/assets/js/expand-full-text/expand.js +++ b/packages/shell-chrome/assets/js/expand-full-text/expand.js @@ -1,5 +1,5 @@ -$(function() { - console.log("[BitDance extension] 学生助手插件 - 阅读全文自动展开模块加载成功"); + + (async function() { // 删除DOM function removeDOM(querySelector) { let element = document.querySelector(querySelector) @@ -7,22 +7,38 @@ $(function() { element.parentNode.removeChild(element); } } + + // 插件刚开始加载时,先读取一次状态 + var isExpandFulltextActived = true; + isExpandFulltextActived = await new Promise((resolve) => { + chrome.storage.sync.get('State_ExpandFulltext', function (State) { + resolve(State.State_ExpandFulltext); + }); + }); + console.log(`isExpandFulltextActived: ${isExpandFulltextActived}`); + if(!isExpandFulltextActived) + return; + + console.log("[BitDance extension] 学生助手插件 - 阅读全文自动展开模块加载成功"); + switch (window.location.host) { default: break; case "blog.csdn.net": // CSDN博客 - removeDOM(".hide-article-box"); - $(".article_content").removeAttr('style'); - window.onload = () => { - // 代码块自动展开 - document.querySelectorAll("pre").forEach(targetNode => { - removeDOM(".hide-preCode-box"); - if (targetNode.classList.contains("set-code-hide")) { - targetNode.classList.remove("set-code-hide"); - } - }) - } + $(function () { + removeDOM(".hide-article-box"); + $(".article_content").removeAttr('style'); + window.onload = () => { + // 代码块自动展开 + document.querySelectorAll("pre").forEach(targetNode => { + removeDOM(".hide-preCode-box"); + if (targetNode.classList.contains("set-code-hide")) { + targetNode.classList.remove("set-code-hide"); + } + }) + } + }) break; case "www.it1352.com": // it1352 @@ -34,4 +50,4 @@ $(function() { break; } -}) +})();