mirror of
https://github.com/XIU2/UserScript.git
synced 2026-09-07 11:27:41 +00:00
优化 [自定义翻页规则] 细节
This commit is contained in:
+12
-11
@@ -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 = `<div id="Autopage_customRules" style="left: 0 !important; right: 0 !important; top: 0 !important; bottom: 0 !important; width: 100% !important; height: 100% !important; margin: auto !important; padding: 25px 10px 10px 10px !important; position: fixed !important; opacity: 0.9 !important; z-index: 99999 !important; background-color: #eee !important; color: #222 !important; font-size: 14px !important; overflow: scroll !important;">
|
||||
<h3><strong>自定义翻页规则(优先于脚本内置规则)</strong></h3>
|
||||
<h3><strong>自定义翻页规则(优先于脚本内置规则)-【把规则插入默认的 { } 中间】</strong></h3>
|
||||
<details>
|
||||
<summary><kbd><strong>「 点击展开 查看示例 」(把常用规则都放在一起了,方便需要的时候可复制一份修改使用)</strong></kbd></summary>
|
||||
<ul style="list-style: disc !important; margin-left: 35px !important;">
|
||||
<li>翻页规则为 JSON 格式,因此大家需要先去<strong>了解一下 JSON 的基本格式</strong>。</li>
|
||||
<li>具体的翻页规则说明、示例,为了方便更新及补充,我都写到 <strong><a href="https://github.com/XIU2/UserScript/issues/176" target="_blank">Github</a> 及 <a href="https://greasyfork.org/scripts/419215" target="_blank">Greasyfork</a></strong> 里面了。</li>
|
||||
<li>该功能只适用于<strong>简单的网站</strong>,当然这类网站占<strong>大多数</strong>,我写的数百规则里大部分都是这类网站。</li>
|
||||
<li>脚本会自动格式化规则,因此<strong>无需手动缩进、换行</strong>。</li>
|
||||
<li>脚本会自动格式化规则,因此<strong>无需手动缩进、换行</strong>,只需把规则<strong>插入默认的 { } 中间</strong>即可。</li>
|
||||
</ul>
|
||||
<p style="color: #ff3535 !important;">注意:不要完全照搬脚本内置规则,因为和标准 JSON 格式等有所差别,具体请参考下面示例。</p>
|
||||
<pre>
|
||||
@@ -7845,20 +7846,20 @@ function: {
|
||||
</pre>
|
||||
</details>
|
||||
|
||||
<textarea id="Autopage_customRules_textarea" style="min-width:95% !important; min-height:75% !important; display: block !important; margin: 10px 0 10px 0; white-space:nowrap !important; overflow:scroll !important; resize: auto !important;" placeholder="留空等于默认的 {}">${JSON.stringify(GM_getValue('menu_customRules', {}), null, '\t')}</textarea>
|
||||
<textarea id="Autopage_customRules_textarea" style="min-width:95% !important; min-height:75% !important; display: block !important; margin: 10px 0 10px 0; white-space:nowrap !important; overflow:scroll !important; resize: auto !important;" placeholder="留空等于默认的 {},请把规则插入 {} 之间">${customRules}</textarea>
|
||||
<button id="Autopage_customRules_save">保存并刷新</button><button id="Autopage_customRules_cancel">取消</button>
|
||||
</div>`
|
||||
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规则中冒号 : 左右的内容都需要加上双引号 " 而不能用单引号 \',如果内容中含有双引号则需要对双引号转义(即 \" 这样)或者改用单引号')
|
||||
|
||||
Reference in New Issue
Block a user