mirror of
https://github.com/XIU2/UserScript.git
synced 2026-09-22 15:06:57 +00:00
新增 [自动屏蔽阅读权限 255 的帖子] 功能
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
// ==UserScript==
|
||||
// @name 全球主机交流论坛增强
|
||||
// @version 1.0.8
|
||||
// @version 1.0.9
|
||||
// @author X.I.U
|
||||
// @description 自动无缝翻页、自动显示帖子内隐藏回复、回到顶部(右键点击两侧空白处)
|
||||
// @description 自动无缝翻页、自动显示帖子内隐藏回复、自动屏蔽阅读权限 255 的帖子、回到顶部(右键点击两侧空白处)
|
||||
// @match *://hostloc.com/*
|
||||
// @icon https://www.hostloc.com/favicon.ico
|
||||
// @grant GM_xmlhttpRequest
|
||||
@@ -21,6 +21,7 @@
|
||||
var menu_ALL = [
|
||||
['menu_thread_pageLoading', '帖子内自动翻页', '帖子内自动翻页', true],
|
||||
['menu_showhide', '自动显示隐藏回复', '自动显示隐藏回复', true],
|
||||
['menu_delate255', '自动屏蔽阅读权限 255 的帖子', '自动屏蔽阅读权限 255 的帖子', true],
|
||||
['menu_backToTop', '回到顶部(右键点击两侧空白处)', '回到顶部', true]
|
||||
], menu_ID = [];
|
||||
for (let i=0;i<menu_ALL.length;i++){ // 如果读取到的值为 null 就写入默认值
|
||||
@@ -124,6 +125,7 @@
|
||||
}else if (patt_forum.test(location.pathname) || location.search.indexOf('mod=forumdisplay') > -1){
|
||||
// 各板块帖子列表
|
||||
curSite = DBSite.forum;
|
||||
if (menu_value('menu_delate255')) delate255(); // 屏蔽阅读权限 255 的帖子
|
||||
}else if (patt_guide.test(location.search)){
|
||||
// 导读帖子列表
|
||||
curSite = DBSite.guide;
|
||||
@@ -143,12 +145,19 @@
|
||||
windowScroll(function (direction, e) {
|
||||
if (direction === "down") { // 下滑才准备翻页
|
||||
let scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
|
||||
let scrollDelta = 766;
|
||||
if (document.documentElement.scrollHeight <= document.documentElement.clientHeight + scrollTop + scrollDelta) {
|
||||
if (document.documentElement.scrollHeight <= document.documentElement.clientHeight + scrollTop + 999) {
|
||||
if (curSite.SiteTypeID === SiteType.FORUM) { // 如果是各版块帖子列表则直接点下一页就行了
|
||||
let autopbn = document.querySelector('#autopbn');
|
||||
if (autopbn && autopbn.innerText == "下一页 »"){ // 如果已经在加载中了,就忽略
|
||||
if (autopbn && autopbn.innerText === "下一页 »"){ // 如果已经在加载中了,就忽略
|
||||
autopbn.click();
|
||||
if (menu_value('menu_delate255')) {
|
||||
let timer = setInterval(function(){
|
||||
if (document.querySelector('#autopbn').innerText === "下一页 »") {
|
||||
delate255();
|
||||
clearInterval(timer);
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
ShowPager.loadMorePage();
|
||||
@@ -190,6 +199,19 @@
|
||||
}
|
||||
|
||||
|
||||
// 屏蔽阅读权限 255 的帖子
|
||||
function delate255() {
|
||||
if (patt_forum.test(location.pathname) || location.search.indexOf('mod=forumdisplay') > -1){
|
||||
let tbody = document.querySelectorAll('tbody[id^="normalthread_"] .common .xw1');
|
||||
Array.from(tbody).forEach(function (_this) {
|
||||
if (_this.innerText === '255') {
|
||||
_this.parentNode.parentNode.parentNode.remove();
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 滚动条事件
|
||||
function windowScroll(fn1) {
|
||||
var beforeScrollTop = document.documentElement.scrollTop,
|
||||
|
||||
Reference in New Issue
Block a user