Skip to content

Commit f75f42c

Browse files
committed
新增 [回到顶部] 功能(右键左下角页码)
1 parent 18b1bb8 commit f75f42c

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

Autopage.user.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @name:zh-CN 自动无缝翻页
44
// @name:zh-TW 自動無縫翻頁
55
// @name:en AutoPager
6-
// @version 5.1.8
6+
// @version 5.1.9
77
// @author X.I.U
88
// @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(以上仅一小部分,更多的写不下了...
99
// @description:zh-TW 無縫追加下一頁內容(瀑布流),支持各論壇、社交、遊戲、漫畫、小說、學術、搜索引擎等網站~
@@ -3310,16 +3310,26 @@ function: {
33103310
}
33113311
// 插入网页
33123312
let _style = `<style>#Autopage_number {top: calc(75vh) !important;left: 0 !important;width: 32px;height: 32px;padding: 6px !important;display: flex;position: fixed !important;opacity: 0.3;transition: .2s;z-index: 9999 !important;cursor: pointer;user-select: none !important;flex-direction: column;align-items: center;justify-content: center;box-sizing: content-box;border-radius: 0 50% 50% 0;transform-origin: center !important;transform: translateX(-8px);background-color: #eee;-webkit-tap-highlight-color: transparent;box-shadow: 1px 1px 3px 0px #aaa !important;color: #000 !important;font-size: medium;} #Autopage_number:hover {opacity: 0.8;transform: translateX(0);}</style>`,
3313-
_html = `<div id="Autopage_number" title="1. 此处数字为 [当前页码] (仅指脚本翻了多少页,并非实际页码,可在脚本菜单中关闭)&#10;&#10;2. 鼠标左键点击此处可 [临时暂停翻页](再次点击可恢复)">${pageNum._now}</div>`
3313+
_html = `<div id="Autopage_number" title="1. 此为 [当前页码]仅指脚本翻了多少页,并非实际页码,该页码可在脚本菜单中关闭)&#10;&#10;2. 鼠标 [左键] 点击此处可 [临时暂停翻页](再次点击可恢复)&#10;&#10;3. 鼠标 [右键] 点击此处可 [回到顶部]">${pageNum._now}</div>`
33143314
document.documentElement.insertAdjacentHTML('beforeend', _style + _html);
33153315
// 解决 远景论坛 会清理掉前面插入的 CSS 样式的问题
33163316
if (location.hostname === 'bbs.pcbeta.com') {setTimeout(function(){document.documentElement.insertAdjacentHTML('beforeend', _style);}, 500);}
33173317
if (curSite.pager && curSite.pager.type == 5) window.top.document.xiu_pausePage = pausePage
3318-
// 点击事件(临时暂停翻页)
3319-
getCSS('#Autopage_number').onclick = function () {
3318+
// 左键点击事件(临时暂停翻页)
3319+
getCSS('#Autopage_number').onclick = function(e) {
33203320
if (pausePage) {this.style = 'color: #FF5722 !important; font-style: italic !important;';} else {this.style = '';}
33213321
pausePage = !pausePage;
33223322
if (curSite.pager && curSite.pager.type == 5) window.top.document.xiu_pausePage = pausePage
3323+
e.preventDefault();
3324+
e.stopPropagation();
3325+
return false
3326+
};
3327+
// 右键点击事件(回到顶部)
3328+
getCSS('#Autopage_number').oncontextmenu = function(e) {
3329+
window.scrollTo(0,0);
3330+
e.preventDefault();
3331+
e.stopPropagation();
3332+
return false
33233333
};
33243334
status = getCSS('#Autopage_number');
33253335
set();

other/Autopage/rules.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,8 +1205,7 @@
12051205
"pager": {
12061206
"type": 2,
12071207
"nextL": "button.so-pablo-button",
1208-
"interval": 1500,
1209-
"scrollD": 1500
1208+
"interval": 1500
12101209
}
12111210
},
12121211
"素材中国": {
@@ -1283,8 +1282,7 @@
12831282
"pager": {
12841283
"nextL": "li.next > a",
12851284
"pageE": ".collect-list > div",
1286-
"replaceE": ".pagerbar",
1287-
"scrollD": 1500
1285+
"replaceE": ".pagerbar"
12881286
}
12891287
},
12901288
"普象网 - 作品集/搜索页": {

0 commit comments

Comments
 (0)