diff --git a/3dm-Beautification.user.js b/3dm-Beautification.user.js index 520bd3b..fc451aa 100644 --- a/3dm-Beautification.user.js +++ b/3dm-Beautification.user.js @@ -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); + } })(); \ No newline at end of file diff --git a/52pojie-Beautification.user.js b/52pojie-Beautification.user.js index 225ea8c..2962f6a 100644 --- a/52pojie-Beautification.user.js +++ b/52pojie-Beautification.user.js @@ -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); + } } })(); \ No newline at end of file diff --git a/Zhiyoo-Beautification.user.js b/Zhiyoo-Beautification.user.js index 06a711a..e1bb66d 100644 --- a/Zhiyoo-Beautification.user.js +++ b/Zhiyoo-Beautification.user.js @@ -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); + } })(); \ No newline at end of file