mirror of
https://gitee.com/bitdance-team/chrome-extension
synced 2025-01-10 13:48:14 +08:00
阅读原文自动展开、鼠标样式、鼠标特效代码优化
This commit is contained in:
parent
55c2f64ed6
commit
c454f72ecb
@ -1,25 +1,37 @@
|
||||
/**
|
||||
* TODO: 实现CSDN自动展开全文
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
console.log("[BitDance extension] 学生助手插件 - CSDN阅读全文自动展开模块加载成功");
|
||||
// 全文自动展开
|
||||
console.log("[BitDance extension] 学生助手插件 - 阅读全文自动展开模块加载成功");
|
||||
// 删除DOM
|
||||
function removeDOM(querySelector) {
|
||||
let element = document.querySelector(querySelector)
|
||||
if (element != null) {
|
||||
element.parentNode.removeChild(element);
|
||||
}
|
||||
}
|
||||
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");
|
||||
}
|
||||
})
|
||||
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");
|
||||
}
|
||||
})
|
||||
}
|
||||
break;
|
||||
|
||||
case "www.it1352.com": // it1352
|
||||
console.log("[BitDance extension] 学生助手插件 - it1352");
|
||||
window.onload = () => {
|
||||
$('.arc-body-main').height("initial")
|
||||
$('.arc-body-main-more').remove()
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -1,5 +0,0 @@
|
||||
console.log("[BitDance extension] 学生助手插件 - it1352阅读全文自动展开模块加载成功");
|
||||
window.onload = () => {
|
||||
$('.arc-body-main').height("initial")
|
||||
$('.arc-body-main-more').remove()
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
/**
|
||||
* TODO: 鼠标点击效果
|
||||
* 鼠标点击效果
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
console.log("[BitDance extension] 学生助手插件 - 点击特效模块加载成功");
|
||||
// 控制功能是否开启
|
||||
chrome.storage.sync.get('State_MouseEffect', function(budget) {
|
||||
// 得到按钮开关状态
|
||||
if (budget.State_MouseEffect == false || budget.State_MouseEffect == undefined) {
|
||||
// console.log('click功能启动');
|
||||
console.log("[BitDance extension] 学生助手插件 - 点击特效模块加载成功");
|
||||
|
||||
var hearts = [];
|
||||
|
||||
walk();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* TODO: 鼠标样式
|
||||
* 鼠标样式
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
@ -10,19 +10,13 @@ $(function() {
|
||||
if (budget.State_MouseStyle == false || budget.State_MouseStyle == undefined) {
|
||||
let style = document.getElementsByTagName('style');
|
||||
// console.log(style[0]);
|
||||
let css = "* {cursor: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c%0A6QAABPxJREFUWEe9lltIalkYx9feak1hDBonIvVM0ZyKLmAM3YyIqB6KCgrK%0Abj710G1gKooJJrCYiB4q6qHefIgoKoaChpiieojQJIWiy0GygzaO0RVhSDTb%0Ae+1hOSlb3d56aL+Iur/1/db3/77/Whj4/6kGAOgAAPq37x/2gQEAyrRa7V9s%0ANhuTSqXk5eXlGUVRTR8FgwC+HB0dfc3JyWG7tq3RaAiZTAY/AgYBgNTU1Bed%0AThfBVHcE09DQQFxfX1+EUJkoAMAnAMDfoWroBMAwTAsh/ClYUACYIQzDfkeg%0ACQkJ5Pz8PG6xWB4oihIEW9MJwCRDsECVSoUqQ97c3BgrKioS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BRZ2cnzM/Po+hgcXHR%0A6O/vZ5qbm439/X0GhY/3KUkSKIoCY2NjMD4+DqiTUChkHBwcMBcXF0iMg8Vd%0ATHJ7dnY2MTo6WpKEJRA86OrqgtXVVXNe8zwPeIeyLFsZmb941traSre3t03R%0AYjCIdblc3zVNu2WX3Y1oNJqamJiwzRzvFwVmrUAgAKlUCjY3N6GtrY3GYjF2%0AaGgof454rAR+MBiWZT0AkC07uQYGBmg8Hnc02VZWVoyenh4mHo/D4OBg2d5u%0AbGyEw8PD3+1UBlkVDoczMzMzjsj/Nsmwh30+3z0A+Jrv4yuM5N7e3szy8jKO%0AuooXlliW5U+Kojy0nDjJhgsGgzpOo0qWqqrg9Xo/6Lr+uNDeCbGJb2pqMnZ3%0Ad6+cz5ZjVPXp6Sn4/X5CKbWtlmNidCoIwjNK6ZOrMhdFMaNp2kdCSOwq3C/H%0Acfgu+27rfgAAAABJRU5ErkJggg==), crosshair}"
|
||||
style[0].appendChild(document.createTextNode(css));
|
||||
style[1].appendChild(document.createTextNode(css1))
|
||||
style[0].appendChild(document.createTextNode(css+css1));
|
||||
console.log(style[0]);
|
||||
console.log(style[1]);
|
||||
// $('a').hover(function() {
|
||||
// $(this).css("cursor", "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAAAXNSR0IArs4c%0A6QAAA35JREFUSEvtVk1IG1EQnv1PNhEhVEloRa22gXqw3jyU5qAUQWk9iKjQ%0Ag7SIpIfmnJMHxaNQsYJUkLQSqAcP1VPFS6EeqwepFqOCaQ8x/kRo3N3se1tm%0AYdM02dhtrvVBEt6+b+abmffNbBhwvqpZlv0MADddLtf7bDY74ty0FMk4MRYE%0A4X4ikfhSV1dnwgkh4PF4FFVV3U7s7TCOiDs6Ouja2tofWEopyLL8UlXVV5WQ%0AOyI2DMModo6P3G63pqqqdE3spALXpbat0rW4sCz/Xzth1ufn5yWa0DQNtra2%0AoLu7W6GUjhBC3lY8Mu3E5aRX8Tpqa2shnU7jTFcKbSruYyfEFmZhYYEODw/f%0ABYCE9SxPLEnSo5qamtVwOMzPzc0ZyWTyga7r+BpEIZXM6n8hRmw0GjUmJyd5%0AAKC4N4klSbqTTqe/eb3evL9kMgn19fUvKKWv7Yjx1chxXFl+u3Oe53OEEDFP%0AzPM8yeVybLGXk5MTCAQCzzVNe4Mk6MxauD8+Pgafz1dCvrOzAy0tLaDrOjAM%0AA5lMxsSdnZ1BdXW1maz5FYlEjKmpKdvoLy8v8fVnZpfL5YBlWTMAURRNVVdV%0AVZXY7e3tQTAYzBNns1kTh/aiKL4jhDw1iVmW1QghQrm6WUQWMf4JEAQhH0ix%0AHbYUBmvhC/eCIPyklHotcXEbGxt6e3u7LbdFbJVuenraiEQijLW3M8IKra+v%0AQygUgqOjI2hoaDArxXGcTikVCtvJv7S09KOvr8+2xdBRZ2cnzM/Po+hgcXHR%0A6O/vZ5qbm439/X0GhY/3KUkSKIoCY2NjMD4+DqiTUChkHBwcMBcXF0iMg8Vd%0ATHJ7dnY2MTo6WpKEJRA86OrqgtXVVXNe8zwPeIeyLFsZmb941traSre3t03R%0AYjCIdblc3zVNu2WX3Y1oNJqamJiwzRzvFwVmrUAgAKlUCjY3N6GtrY3GYjF2%0AaGgof454rAR+MBiWZT0AkC07uQYGBmg8Hnc02VZWVoyenh4mHo/D4OBg2d5u%0AbGyEw8PD3+1UBlkVDoczMzMzjsj/Nsmwh30+3z0A+Jrv4yuM5N7e3szy8jKO%0AuooXlliW5U+Kojy0nDjJhgsGgzpOo0qWqqrg9Xo/6Lr+uNDeCbGJb2pqMnZ3%0Ad6+cz5ZjVPXp6Sn4/X5CKbWtlmNidCoIwjNK6ZOrMhdFMaNp2kdCSOwq3C/H%0Acfgu+27rfgAAAABJRU5ErkJggg==), crosshair");
|
||||
// });
|
||||
} else {
|
||||
('*').hover(function() {
|
||||
$(this).css("cursor", "auto");
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -45,6 +45,22 @@ $(function() {
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Expand Fulltext
|
||||
*/
|
||||
const btnExpandFulltext = document.querySelector("#btnExpandFulltext");
|
||||
// 页面加载时,更新界面开关状态
|
||||
chrome.storage.sync.get("State_ExpandFulltext", ({ State_ExpandFulltext }) => {
|
||||
btnExpandFulltext.checked = !State_ExpandFulltext;
|
||||
});
|
||||
|
||||
// 点击开关时存储按钮状态并刷新页面
|
||||
btnExpandFulltext.addEventListener("change", () => {
|
||||
chrome.storage.sync.set({ State_ExpandFulltext: !btnExpandFulltext.checked });
|
||||
refreshPage('Expand Fulltext');
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Google广告拦截
|
||||
*/
|
||||
|
@ -52,7 +52,8 @@
|
||||
{
|
||||
"_______commit": "自动展开模块",
|
||||
"matches": [
|
||||
"*://blog.csdn.net/*"
|
||||
"*://blog.csdn.net/*",
|
||||
"*://www.it1352.com/*"
|
||||
],
|
||||
"js": [
|
||||
"assets/js/lib/jquery.min.js",
|
||||
@ -60,16 +61,6 @@
|
||||
],
|
||||
"run_at": "document_start"
|
||||
},
|
||||
{
|
||||
"_______commit": "自动展开模块",
|
||||
"matches": [
|
||||
"*://www.it1352.com/*"
|
||||
],
|
||||
"js": [
|
||||
"assets/js/expand-full-text/www.it1352.com.js"
|
||||
],
|
||||
"run_at": "document_start"
|
||||
},
|
||||
{
|
||||
"_______commit": "自动搜索模块",
|
||||
"matches": [
|
||||
|
@ -72,6 +72,26 @@
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="setting-item">
|
||||
<span>确认访问页自动跳转</span>
|
||||
<div class="button">
|
||||
<input type="checkbox" id="btnDirectUrl" class="checkbox" />
|
||||
<div class="knobs"></div>
|
||||
<div class="layer"></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="setting-item">
|
||||
<span>阅读原文自动展开</span>
|
||||
<div class="button">
|
||||
<input type="checkbox" id="btnExpandFulltext" class="checkbox" />
|
||||
<div class="knobs"></div>
|
||||
<div class="layer"></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="setting-item">
|
||||
<span>鼠标样式</span>
|
||||
@ -92,16 +112,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="setting-item">
|
||||
<span>确认访问页自动跳转</span>
|
||||
<div class="button">
|
||||
<input type="checkbox" id="btnDirectUrl" class="checkbox" />
|
||||
<div class="knobs"></div>
|
||||
<div class="layer"></div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user