From 68fd7cb7374d68aa7386089e1a6de03d793e0a67 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Mon, 10 May 2021 17:17:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E8=BD=BD=E5=85=A5=E6=88=90=E5=8A=9F=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3dm-Beautification.user.js | 17 +++++++++++++---- 52pojie-Beautification.user.js | 18 +++++++++++------- Zhiyoo-Beautification.user.js | 15 ++++++++++++--- 3 files changed, 36 insertions(+), 14 deletions(-) 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