优化 样式载入成功率

This commit is contained in:
xiu2
2021-05-10 17:17:05 +08:00
parent 59cf6c6793
commit 68fd7cb737
3 changed files with 36 additions and 14 deletions
+13 -4
View File
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 3DM论坛美化
// @version 1.0.0
// @version 1.0.1
// @author X.I.U
// @description 精简多余内容、样式优化
// @icon https://www.3dmgame.com/favicon.ico
@@ -9,9 +9,9 @@
// @run-at document-start
// @namespace https://greasyfork.org/scripts/413593
// ==/UserScript==
(function() {
var style_Add = document.createElement('style');
let style_Add = document.createElement('style');
style_Add.innerHTML = `
[url=home.php?mod=space&uid=945662]@media[/url] (min-width:1366px) {
body {
@@ -87,5 +87,14 @@ textarea#fastpostmessage {
border-top: 0;
border-bottom: 0;
}`;
document.head.appendChild(style_Add);
if (document.head) {
document.head.appendChild(style_Add);
} else {
let timer = setInterval(function(){
if (document.head) {
document.head.appendChild(style_Add);
clearInterval(timer);
}
}, 1);
}
})();
+11 -7
View File
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 吾爱破解论坛美化
// @version 1.0.7
// @version 1.0.8
// @author X.I.U
// @description 精简多余内容、样式优化
// @match *://www.52pojie.cn/*
@@ -149,11 +149,15 @@ textarea#fastpostmessage {
style = style_2
if (menu_value('menu_rule')) style += style_1;
style_Add.innerHTML = style;
let timer = setInterval(function(){
if (document.head) {
document.head.appendChild(style_Add);
clearInterval(timer);
}
}, 10);
if (document.head) {
document.head.appendChild(style_Add);
} else {
let timer = setInterval(function(){
if (document.head) {
document.head.appendChild(style_Add);
clearInterval(timer);
}
}, 1);
}
}
})();
+12 -3
View File
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 智友邦论坛美化
// @version 1.0.1
// @version 1.0.2
// @author X.I.U
// @description 精简多余内容、样式优化、宽屏显示
// @icon http://bbs.zhiyoo.net/favicon.ico
@@ -11,7 +11,7 @@
// ==/UserScript==
(function() {
var style_Add = document.createElement('style');
let style_Add = document.createElement('style');
style_Add.innerHTML = `
/* 精简多于内容 */
.forum_top,#main_sidebar,.drag,.nav,.tps,.bm.bml,.ct2 .sd,.mn div.box.cl:nth-of-type(3),#f_pst,.plc.plm,#diy_like1,#hm_qrcode_main,#ft,.po.bbd.reply_p,.ft_top.cl,div a[href="https://weibo.com/372458419"] {
@@ -43,5 +43,14 @@
#postlist .pcb img {
max-width: 30%;
}`;
document.head.appendChild(style_Add);
if (document.head) {
document.head.appendChild(style_Add);
} else {
let timer = setInterval(function(){
if (document.head) {
document.head.appendChild(style_Add);
clearInterval(timer);
}
}, 1);
}
})();