mirror of
https://github.com/XIU2/UserScript.git
synced 2026-07-24 11:03:23 +00:00
新增 [回到顶部](右键点击两侧空白处)功能; 新增 [自动回复、自动无缝翻页、清理置顶帖子] 脚本菜单开关
This commit is contained in:
+56
-37
@@ -1,8 +1,8 @@
|
||||
// ==UserScript==
|
||||
// @name 智友邦论坛增强
|
||||
// @version 1.1.7
|
||||
// @version 1.1.8
|
||||
// @author X.I.U
|
||||
// @description 自动签到、自动回复、自动无缝翻页、清理置顶帖子、简化附件兑换/下载、清理帖子标题〖XXX〗【XXX】文字
|
||||
// @description 自动签到、自动回复、自动无缝翻页、回到顶部(右键点击两侧空白处)、清理置顶帖子、简化附件兑换/下载、清理帖子标题〖XXX〗【XXX】文字
|
||||
// @icon http://bbs.zhiyoo.net/favicon.ico
|
||||
// @match *://bbs.zhiyoo.net/*
|
||||
// @match *://www.zhiyoo.net/search.php*
|
||||
@@ -20,6 +20,10 @@
|
||||
|
||||
(function() {
|
||||
var menu_ALL = [
|
||||
['menu_autoReply', '自动回复', '自动回复', true],
|
||||
['menu_pageLoading', '自动无缝翻页', '自动无缝翻页', true],
|
||||
['menu_backToTop', '回到顶部(右键点击两侧空白处)', '回到顶部', true],
|
||||
['menu_cleanTopPost', '清理置顶帖子', '清理置顶帖子', true],
|
||||
['menu_cleanPostTitle', '清理帖子标题开头〖〗【】文字', '清理帖子标题开头〖〗【】文字', true],
|
||||
['menu_qianDaoRedirectURL', '当前页面设为签到后重定向地址', '已设置当前页面为签到后重定向地址', 'http://bbs.zhiyoo.net/forum.php?mod=forumdisplay&fid=42&filter=author&orderby=dateline']
|
||||
], menu_ID = [];
|
||||
@@ -166,6 +170,7 @@
|
||||
pageLoading(); // 自动无缝翻页
|
||||
break;
|
||||
}
|
||||
backToTop(); // 回到顶部(右键点击两侧空白处)
|
||||
}else if(location.pathname === '/search.php'){
|
||||
curSite = DBSite.search; // 搜索结果列表页(自动翻页)
|
||||
pageLoading(); // 自动无缝翻页
|
||||
@@ -184,29 +189,13 @@
|
||||
}
|
||||
|
||||
|
||||
// 自动翻页
|
||||
function pageLoading() {
|
||||
if (curSite.SiteTypeID > 0){
|
||||
windowScroll(function (direction, e) {
|
||||
if (direction === "down") { // 下滑才准备翻页
|
||||
let scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
|
||||
let scrollDelta = 666;
|
||||
if (document.documentElement.scrollHeight <= document.documentElement.clientHeight + scrollTop + scrollDelta) {
|
||||
ShowPager.loadMorePage();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 自动签到
|
||||
function qiandao(){
|
||||
if (loginStatus){
|
||||
if(document.getElementById("yl"))
|
||||
if(document.getElementById('yl'))
|
||||
{
|
||||
document.querySelector('#yl').click();
|
||||
document.querySelector('.tr3.tac div a').click();
|
||||
document.getElementById('yl').click();
|
||||
document.querySelector('td.tr3.tac div a').click();
|
||||
}
|
||||
setTimeout(location.href=menu_value('menu_qianDaoRedirectURL'), 2000); // 跳转到指定URL
|
||||
}
|
||||
@@ -215,6 +204,7 @@
|
||||
|
||||
// 自动回复
|
||||
function autoReply(){
|
||||
if (!menu_value('menu_autoReply')) return
|
||||
if (loginStatus){
|
||||
// 存在隐藏内容,自动回复
|
||||
if (document.getElementsByClassName("showhide").length == 0){
|
||||
@@ -262,6 +252,45 @@
|
||||
}
|
||||
|
||||
|
||||
// 自动无缝翻页
|
||||
function pageLoading() {
|
||||
if (!menu_value('menu_pageLoading')) return
|
||||
if (curSite.SiteTypeID > 0){
|
||||
windowScroll(function (direction, e) {
|
||||
if (direction === "down") { // 下滑才准备翻页
|
||||
let scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
|
||||
let scrollDelta = 666;
|
||||
if (document.documentElement.scrollHeight <= document.documentElement.clientHeight + scrollTop + scrollDelta) {
|
||||
ShowPager.loadMorePage();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 回到顶部(右键点击空白处)
|
||||
function backToTop() {
|
||||
if (!menu_value('menu_backToTop')) return
|
||||
document.getElementById("nv_forum").oncontextmenu = function(event){
|
||||
if (event.target==this) {
|
||||
event.preventDefault();
|
||||
window.scrollTo(0,0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 清理置顶帖子
|
||||
function cleanTop(){
|
||||
if (!menu_value('menu_cleanTopPost')) return
|
||||
let showhide = document.querySelectorAll("a.showhide.y");
|
||||
if (showhide.length > 0){
|
||||
showhide.forEach(el=>el.click());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 兑换附件后立即返回
|
||||
function attachmentBack() {
|
||||
let attachmentback = document.querySelector('#messagetext p.alert_btnleft a');
|
||||
@@ -295,24 +324,14 @@
|
||||
}
|
||||
|
||||
|
||||
// 清理置顶帖子
|
||||
function cleanTop(){
|
||||
let showhide = document.querySelectorAll("a.showhide.y");
|
||||
if (showhide.length > 0){
|
||||
showhide.forEach(el=>el.click());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 清理帖子列表中帖子标题开头的〖XXX〗【XXX】文字
|
||||
function cleanPostTitle(){
|
||||
if (menu_value('menu_cleanPostTitle')){
|
||||
let cleanposttitle = document.querySelectorAll("a.s.xst");
|
||||
if (cleanposttitle.length > 0){
|
||||
for(let num = postNum;num<cleanposttitle.length;num++){
|
||||
cleanposttitle[num].innerText = cleanposttitle[num].innerText.replace(patt_posttitle, ``);
|
||||
postNum += 1;
|
||||
}
|
||||
if (!menu_value('menu_cleanPostTitle')) return
|
||||
let cleanposttitle = document.querySelectorAll("a.s.xst");
|
||||
if (cleanposttitle.length > 0){
|
||||
for(let num = postNum;num<cleanposttitle.length;num++){
|
||||
cleanposttitle[num].innerText = cleanposttitle[num].innerText.replace(patt_posttitle, ``);
|
||||
postNum += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user