From 1a237a6d5b2c88b586ffdb5175171abab018d5ac Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Thu, 24 Feb 2022 12:08:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20[=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E7=BF=BB=E9=A1=B5=E8=A7=84=E5=88=99]=20=E7=BB=86?= =?UTF-8?q?=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Autopage.user.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Autopage.user.js b/Autopage.user.js index 6ea2808..561714b 100644 --- a/Autopage.user.js +++ b/Autopage.user.js @@ -3,7 +3,7 @@ // @name:zh-CN 自动无缝翻页 // @name:zh-TW 自動無縫翻頁 // @name:en AutoPager -// @version 4.9.3 +// @version 4.9.4 // @author X.I.U // @description 无缝拼接下一页内容(瀑布流,追求小而美),目前支持:【所有「Discuz!、Flarum、phpBB、Xiuno、XenForo、NexusPHP」论坛】【百度、谷歌、必应、搜狗、微信、360、Yahoo、Yandex 等搜索引擎】、贴吧、豆瓣、知乎、微博、NGA、V2EX、B 站(Bilibili)、煎蛋网、糗事百科、龙的天空、起点中文、IT之家、千图网、Pixabay、Pixiv、3DM、游侠网、游民星空、NexusMods、Steam 创意工坊、CS.RIN.RU、BT之家、萌番组、动漫花园、樱花动漫、爱恋动漫、AGE 动漫、Nyaa、SrkBT、RARBG、SubHD、423Down、不死鸟、扩展迷、小众软件、【动漫狂、漫画猫、漫画屋、漫画 DB、动漫之家、拷贝漫画、包子漫画、Mangabz、Xmanhua 等漫画网站】、PubMed、Z-Library、GreasyFork、Github、StackOverflow(以上仅一小部分,更多的写不下了... // @description:zh-TW 無縫拼接下一頁內容(瀑布流,追求小而美),支持各種論壇、搜索引擎、漫畫網站~ @@ -7797,16 +7797,17 @@ function: { function customRules() { if (getCSS('#Autopage_customRules')) return - // 插入网页 + let customRules = JSON.stringify(GM_getValue('menu_customRules', {}), null, '\t'); + if (customRules == '{}') customRules = '{\n\t\n}'; // 引导用户插入位置 let _html = `
-

自定义翻页规则(优先于脚本内置规则)

+

自定义翻页规则(优先于脚本内置规则)-【把规则插入默认的 { } 中间】

「 点击展开 查看示例 」(把常用规则都放在一起了,方便需要的时候可复制一份修改使用)

注意:不要完全照搬脚本内置规则,因为和标准 JSON 格式等有所差别,具体请参考下面示例。

@@ -7845,20 +7846,20 @@ function: {
 
- +
` document.documentElement.insertAdjacentHTML('beforeend', _html); document.documentElement.style.overflow = document.body.style.overflow = 'hidden'; // 点击事件 getCSS('#Autopage_customRules_save').onclick = function () { - let rules = getCSS('#Autopage_customRules_textarea').value; - //console.log(rules) - if (!rules) rules = '{}' + customRules = getCSS('#Autopage_customRules_textarea').value; + //console.log(customRules) + if (!customRules) customRules = '{}' try { - rules = JSON.parse(rules) - //console.log(rules) - GM_setValue('menu_customRules', rules) + customRules = JSON.parse(customRules) + //console.log(customRules) + GM_setValue('menu_customRules', customRules) location.reload(); } catch (e) { console.error('自定义规则存在格式错误:\n' + e + '\n\n注意事项:\n规则中冒号 : 左右的内容都需要加上双引号 " 而不能用单引号 \',如果内容中含有双引号则需要对双引号转义(即 \" 这样)或者改用单引号')