mirror of
https://github.com/XIU2/UserScript.git
synced 2026-09-22 15:06:57 +00:00
优化 脚本菜单相关代码
This commit is contained in:
+34
-37
@@ -18,47 +18,34 @@
|
||||
// ==/UserScript==
|
||||
|
||||
(function() {
|
||||
var menu_thread_pageLoading = GM_getValue('xiu2_menu_thread_pageLoading'),
|
||||
menu_autoReply = GM_getValue('xiu2_menu_autoReply'),
|
||||
menu_cleanTopPost = GM_getValue('xiu2_menu_cleanTopPost'),
|
||||
menu_scrollToShowhide = GM_getValue('xiu2_menu_scrollToShowhide');
|
||||
var menu_thread_pageLoading_ID, menu_autoReply_ID, menu_cleanTopPost_ID, menu_scrollToShowhide_ID, menu_feedBack_ID;
|
||||
if (menu_thread_pageLoading == null){menu_thread_pageLoading = false; GM_setValue('xiu2_menu_thread_pageLoading', menu_thread_pageLoading)};
|
||||
if (menu_autoReply == null){menu_autoReply = true; GM_setValue('xiu2_menu_autoReply', menu_autoReply)};
|
||||
if (menu_cleanTopPost == null){menu_cleanTopPost = true; GM_setValue('xiu2_menu_cleanTopPost', menu_cleanTopPost)};
|
||||
if (menu_scrollToShowhide == null){menu_scrollToShowhide = true; GM_setValue('xiu2_menu_scrollToShowhide', menu_scrollToShowhide)};
|
||||
var menu_ALL = [
|
||||
['menu_thread_pageLoading', '自动回复', '自动回复', true],
|
||||
['menu_autoReply', '清理置顶帖子', '清理置顶帖子', true],
|
||||
['menu_cleanTopPost', '帖子内自动翻页', '帖子内自动翻页', true],
|
||||
['menu_scrollToShowhide', '自动滚动至隐藏内容', '自动滚动至隐藏内容', true]
|
||||
], menu_ID = [];
|
||||
for (let i=0;i<menu_ALL.length;i++){ // 如果读取到的值为 null 就写入默认值
|
||||
if (GM_getValue(menu_ALL[i][0]) == null){GM_setValue(menu_ALL[i][0], menu_ALL[i][3])};
|
||||
}
|
||||
registerMenuCommand();
|
||||
|
||||
// 注册脚本菜单
|
||||
function registerMenuCommand() {
|
||||
let menu_thread_pageLoading_, menu_autoReply_, menu_cleanTopPost_, menu_scrollToShowhide_;
|
||||
if (menu_feedBack_ID){ // 如果反馈菜单ID不是 null,则删除所有脚本菜单
|
||||
GM_unregisterMenuCommand(menu_thread_pageLoading_ID);
|
||||
GM_unregisterMenuCommand(menu_autoReply_ID);
|
||||
GM_unregisterMenuCommand(menu_cleanTopPost_ID);
|
||||
GM_unregisterMenuCommand(menu_scrollToShowhide_ID);
|
||||
GM_unregisterMenuCommand(menu_feedBack_ID);
|
||||
menu_thread_pageLoading = GM_getValue('xiu2_menu_thread_pageLoading');
|
||||
menu_autoReply = GM_getValue('xiu2_menu_autoReply');
|
||||
menu_cleanTopPost = GM_getValue('xiu2_menu_cleanTopPost');
|
||||
menu_scrollToShowhide = GM_getValue('xiu2_menu_scrollToShowhide');
|
||||
if (menu_ID.length > menu_ALL.length){ // 如果菜单ID数组多于菜单数组,说明不是首次添加菜单,需要卸载所有脚本菜单
|
||||
for (let i=0;i<menu_ID.length;i++){
|
||||
GM_unregisterMenuCommand(menu_ID[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (menu_thread_pageLoading){menu_thread_pageLoading_ = "√";}else{menu_thread_pageLoading_ = "×";}
|
||||
if (menu_autoReply){menu_autoReply_ = "√";}else{menu_autoReply_ = "×";}
|
||||
if (menu_cleanTopPost){menu_cleanTopPost_ = "√";}else{menu_cleanTopPost_ = "×";}
|
||||
if (menu_scrollToShowhide){menu_scrollToShowhide_ = "√";}else{menu_scrollToShowhide_ = "×";}
|
||||
|
||||
menu_autoReply_ID = GM_registerMenuCommand(`[ ${menu_autoReply_} ] 自动回复`, function(){menu_switch(menu_autoReply,'xiu2_menu_autoReply','自动回复')});
|
||||
menu_cleanTopPost_ID = GM_registerMenuCommand(`[ ${menu_cleanTopPost_} ] 清理置顶帖子`, function(){menu_switch(menu_cleanTopPost,'xiu2_menu_cleanTopPost','清理置顶帖子')});
|
||||
menu_thread_pageLoading_ID = GM_registerMenuCommand(`[ ${menu_thread_pageLoading_} ] 帖子内自动翻页`, function(){menu_switch(menu_thread_pageLoading,'xiu2_menu_thread_pageLoading','帖子内自动翻页')});
|
||||
menu_scrollToShowhide_ID = GM_registerMenuCommand(`[ ${menu_scrollToShowhide_} ] 自动滚动至隐藏内容`, function(){menu_switch(menu_scrollToShowhide,'xiu2_menu_scrollToShowhide','自动滚动至隐藏内容')});
|
||||
menu_feedBack_ID = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});});
|
||||
for (let i=0;i<menu_ALL.length;i++){ // 循环注册脚本菜单
|
||||
menu_ALL[i][3] = GM_getValue(menu_ALL[i][0]);
|
||||
menu_ID[i] = GM_registerMenuCommand(`[ ${menu_ALL[i][3]?'√':'×'} ] ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)});
|
||||
}
|
||||
menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});});
|
||||
}
|
||||
|
||||
// 菜单开关
|
||||
function menu_switch(menu_status, Name, Tips) {
|
||||
if (menu_status){
|
||||
if (menu_status == 'true'){
|
||||
GM_setValue(`${Name}`, false);
|
||||
GM_notification({text: `已关闭 [${Tips}] 功能\n(刷新网页后生效)`, timeout: 3500});
|
||||
}else{
|
||||
@@ -68,6 +55,16 @@
|
||||
registerMenuCommand(); // 重新注册脚本菜单
|
||||
};
|
||||
|
||||
// 返回菜单值
|
||||
function menu_value(menuName) {
|
||||
for (let menu of menu_ALL) {
|
||||
if (menu[0] == menuName) {
|
||||
return menu[3]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 随机回复帖子的内容
|
||||
var replyList = [
|
||||
"感谢楼主分享的内容!",
|
||||
@@ -144,14 +141,14 @@
|
||||
// URL 判断
|
||||
if (patt_thread.test(location.pathname) || patt_thread_2.test(location.search)){
|
||||
// 帖子内
|
||||
if(menu_thread_pageLoading)curSite = DBSite.thread;
|
||||
if(menu_autoReply)autoReply(); // 如果有隐藏内容,则自动回复
|
||||
if(menu_value('menu_thread_pageLoading'))curSite = DBSite.thread;
|
||||
if(menu_value('menu_autoReply'))autoReply(); // 如果有隐藏内容,则自动回复
|
||||
pageLoading(); // 自动翻页
|
||||
if(menu_scrollToShowhide)setTimeout(function(){window.scrollTo(0,document.querySelector('.showhide').offsetTop)}, 500); // 滚动至隐藏内容
|
||||
if(menu_value('menu_scrollToShowhide'))setTimeout(function(){window.scrollTo(0,document.querySelector('.showhide').offsetTop)}, 500); // 滚动至隐藏内容
|
||||
}else if (patt_forum.test(location.pathname) || patt_forum_2.test(location.search)){
|
||||
// 各板块帖子列表
|
||||
curSite = DBSite.forum;
|
||||
if(menu_cleanTopPost)cleanTopPost(); // 清理置顶帖子
|
||||
if(menu_value('menu_cleanTopPost'))cleanTopPost(); // 清理置顶帖子
|
||||
pageLoading(); // 自动翻页
|
||||
}else if (patt_guide.test(location.search)){
|
||||
// 导读帖子列表
|
||||
@@ -204,7 +201,7 @@
|
||||
if (autoreply){
|
||||
writeReply();
|
||||
// 滚动至隐藏内容
|
||||
if(menu_scrollToShowhide){
|
||||
if(menu_value('menu_scrollToShowhide')){
|
||||
let showhideTime=setInterval(function(){
|
||||
let showhide=document.querySelector('.showhide')
|
||||
if(showhide){
|
||||
|
||||
@@ -17,39 +17,50 @@
|
||||
// ==/UserScript==
|
||||
|
||||
(function() {
|
||||
var menu_rule = GM_getValue('xiu2_menu_rule');
|
||||
var menu_rule_ID, menu_feedBack_ID;
|
||||
if (menu_rule == null){menu_rule = false; GM_setValue('xiu2_menu_rule', menu_rule)};
|
||||
var menu_ALL = [
|
||||
['menu_rule', '隐藏版规', '隐藏版规', false]
|
||||
], menu_ID = [];
|
||||
for (let i=0;i<menu_ALL.length;i++){ // 如果读取到的值为 null 就写入默认值
|
||||
if (GM_getValue(menu_ALL[i][0]) == null){GM_setValue(menu_ALL[i][0], menu_ALL[i][3])};
|
||||
}
|
||||
registerMenuCommand();
|
||||
addStyle();
|
||||
|
||||
// 注册脚本菜单
|
||||
function registerMenuCommand() {
|
||||
let menu_rule_;
|
||||
if (menu_feedBack_ID){ // 如果反馈菜单ID不是 null,则删除所有脚本菜单
|
||||
GM_unregisterMenuCommand(menu_rule_ID);
|
||||
GM_unregisterMenuCommand(menu_feedBack_ID);
|
||||
menu_rule = GM_getValue('xiu2_menu_rule');
|
||||
if (menu_ID.length > menu_ALL.length){ // 如果菜单ID数组多于菜单数组,说明不是首次添加菜单,需要卸载所有脚本菜单
|
||||
for (let i=0;i<menu_ID.length;i++){
|
||||
GM_unregisterMenuCommand(menu_ID[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (menu_rule){menu_rule_ = "√";}else{menu_rule_ = "×";}
|
||||
|
||||
menu_rule_ID = GM_registerMenuCommand(`[ ${menu_rule_} ] 隐藏版规`, function(){menu_switch(menu_rule,'xiu2_menu_rule','隐藏版规')});
|
||||
menu_feedBack_ID = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});});
|
||||
for (let i=0;i<menu_ALL.length;i++){ // 循环注册脚本菜单
|
||||
menu_ALL[i][3] = GM_getValue(menu_ALL[i][0]);
|
||||
menu_ID[i] = GM_registerMenuCommand(`[ ${menu_ALL[i][3]?'√':'×'} ] ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)});
|
||||
}
|
||||
menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});});
|
||||
}
|
||||
|
||||
// 菜单开关
|
||||
function menu_switch(menu_status, Name, Tips) {
|
||||
if (menu_status){
|
||||
if (menu_status == 'true'){
|
||||
GM_setValue(`${Name}`, false);
|
||||
GM_notification({text: `已关闭 [${Tips}] 功能\n(刷新网页后生效)`, timeout: 3000});
|
||||
GM_notification({text: `已关闭 [${Tips}] 功能\n(刷新网页后生效)`, timeout: 3500});
|
||||
}else{
|
||||
GM_setValue(`${Name}`, true);
|
||||
GM_notification({text: `已开启 [${Tips}] 功能\n(刷新网页后生效)`, timeout: 3000});
|
||||
GM_notification({text: `已开启 [${Tips}] 功能\n(刷新网页后生效)`, timeout: 3500});
|
||||
}
|
||||
registerMenuCommand(); // 重新注册脚本菜单
|
||||
};
|
||||
|
||||
// 返回菜单值
|
||||
function menu_value(menuName) {
|
||||
for (let menu of menu_ALL) {
|
||||
if (menu[0] == menuName) {
|
||||
return menu[3]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addStyle() {
|
||||
let style,
|
||||
style_1 = `.bml {display:none !important;}`,
|
||||
@@ -131,10 +142,9 @@ textarea#fastpostmessage {
|
||||
color: #aaa;
|
||||
}`,
|
||||
style_Add = document.createElement('style');
|
||||
if (menu_rule) {
|
||||
style = style_1 + style_2;
|
||||
}else{
|
||||
style = style_2;
|
||||
style = style_2
|
||||
if (menu_value('menu_rule')) {
|
||||
style += style_1;
|
||||
}
|
||||
style_Add.innerHTML = style;
|
||||
document.head.appendChild(style_Add);
|
||||
|
||||
+30
-24
@@ -2,7 +2,7 @@
|
||||
// @name 吾爱破解论坛增强 - 自动签到、翻页
|
||||
// @version 1.2.4
|
||||
// @author X.I.U
|
||||
// @description 自动签到、自动无缝翻页(全站)
|
||||
// @description 自动签到、自动无缝翻页(全站)、屏蔽导读悬赏贴(最新发表)
|
||||
// @match *://www.52pojie.cn/*
|
||||
// @icon https://www.52pojie.cn/favicon.ico
|
||||
// @grant GM_xmlhttpRequest
|
||||
@@ -18,35 +18,32 @@
|
||||
// ==/UserScript==
|
||||
|
||||
(function() {
|
||||
var menu_thread_pageLoading = GM_getValue('xiu2_menu_thread_pageLoading'),
|
||||
menu_delateReward = GM_getValue('xiu2_menu_delateReward');
|
||||
var menu_feedBack_ID, menu_thread_pageLoading_ID, menu_delateReward_ID;
|
||||
if (menu_thread_pageLoading == null){menu_thread_pageLoading = false; GM_setValue('xiu2_menu_thread_pageLoading', menu_thread_pageLoading)};
|
||||
if (menu_delateReward == null){menu_delateReward = false; GM_setValue('xiu2_menu_delateReward', menu_delateReward)};
|
||||
var menu_ALL = [
|
||||
['menu_thread_pageLoading', '帖子内自动翻页', '帖子内自动翻页', true],
|
||||
['menu_delateReward', '屏蔽导读悬赏贴(最新发表)', '屏蔽导读悬赏贴', true]
|
||||
], menu_ID = [];
|
||||
for (let i=0;i<menu_ALL.length;i++){ // 如果读取到的值为 null 就写入默认值
|
||||
if (GM_getValue(menu_ALL[i][0]) == null){GM_setValue(menu_ALL[i][0], menu_ALL[i][3])};
|
||||
}
|
||||
registerMenuCommand();
|
||||
|
||||
// 注册脚本菜单
|
||||
function registerMenuCommand() {
|
||||
let menu_thread_pageLoading_, menu_delateReward_;
|
||||
if (menu_feedBack_ID){ // 如果反馈菜单ID不是 null,则删除所有脚本菜单
|
||||
GM_unregisterMenuCommand(menu_thread_pageLoading_ID);
|
||||
GM_unregisterMenuCommand(menu_delateReward_ID);
|
||||
GM_unregisterMenuCommand(menu_feedBack_ID);
|
||||
menu_thread_pageLoading = GM_getValue('xiu2_menu_thread_pageLoading');
|
||||
menu_delateReward = GM_getValue('xiu2_menu_delateReward');
|
||||
if (menu_ID.length > menu_ALL.length){ // 如果菜单ID数组多于菜单数组,说明不是首次添加菜单,需要卸载所有脚本菜单
|
||||
for (let i=0;i<menu_ID.length;i++){
|
||||
GM_unregisterMenuCommand(menu_ID[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (menu_thread_pageLoading){menu_thread_pageLoading_ = "√";}else{menu_thread_pageLoading_ = "×";}
|
||||
if (menu_delateReward){menu_delateReward_ = "√";}else{menu_delateReward_ = "×";}
|
||||
|
||||
menu_thread_pageLoading_ID = GM_registerMenuCommand(`[ ${menu_thread_pageLoading_} ] 帖子内自动翻页`, function(){menu_switch(menu_thread_pageLoading,'xiu2_menu_thread_pageLoading','帖子内自动翻页')});
|
||||
menu_delateReward_ID = GM_registerMenuCommand(`[ ${menu_delateReward_} ] 屏蔽悬赏贴(导读 - 最新发表)`, function(){menu_switch(menu_delateReward,'xiu2_menu_delateReward','帖子内自动翻页')});
|
||||
menu_feedBack_ID = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});});
|
||||
for (let i=0;i<menu_ALL.length;i++){ // 循环注册脚本菜单
|
||||
menu_ALL[i][3] = GM_getValue(menu_ALL[i][0]);
|
||||
menu_ID[i] = GM_registerMenuCommand(`[ ${menu_ALL[i][3]?'√':'×'} ] ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)});
|
||||
}
|
||||
menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});});
|
||||
}
|
||||
|
||||
// 菜单开关
|
||||
function menu_switch(menu_status, Name, Tips) {
|
||||
if (menu_status){
|
||||
if (menu_status == 'true'){
|
||||
GM_setValue(`${Name}`, false);
|
||||
GM_notification({text: `已关闭 [${Tips}] 功能\n(刷新网页后生效)`, title: '吾爱破解论坛增强', timeout: 3000});
|
||||
}else{
|
||||
@@ -56,6 +53,15 @@
|
||||
registerMenuCommand(); // 重新注册脚本菜单
|
||||
};
|
||||
|
||||
// 返回菜单值
|
||||
function menu_value(menuName) {
|
||||
for (let menu of menu_ALL) {
|
||||
if (menu[0] == menuName) {
|
||||
return menu[3]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var ShowPager;
|
||||
showPager();
|
||||
// 默认 ID 为 0
|
||||
@@ -131,7 +137,7 @@
|
||||
|
||||
// URL 判断
|
||||
if (patt_thread.test(location.pathname) || patt_thread_2.test(location.search)){
|
||||
if(menu_thread_pageLoading) {
|
||||
if(menu_value('menu_thread_pageLoading')) {
|
||||
curSite = DBSite.thread; // 帖子内
|
||||
hidePgbtn(); // 隐藏帖子内的 [下一页] 按钮
|
||||
}
|
||||
@@ -139,7 +145,7 @@
|
||||
curSite = DBSite.forum; // 各板块帖子列表
|
||||
}else if (patt_guide.test(location.search)){
|
||||
curSite = DBSite.guide; // 导读帖子列表
|
||||
delateReward(); // 屏蔽悬赏贴(导读-最新发表)
|
||||
delateReward(); // 屏蔽导读悬赏贴(最新发表)
|
||||
}else if (patt_collection.test(location.search)){
|
||||
curSite = DBSite.collection; // 淘贴列表
|
||||
}else if(location.pathname === '/search.php'){
|
||||
@@ -189,7 +195,7 @@
|
||||
|
||||
//屏蔽悬赏贴(导读-最新发表)
|
||||
function delateReward(){
|
||||
if(patt_guide_newthread.test(location.search) && menu_delateReward){
|
||||
if(patt_guide_newthread.test(location.search) && menu_value('menu_delateReward')){
|
||||
let table = document.querySelector("#threadlist > div.bm_c > table"),
|
||||
tbodys = table.getElementsByTagName('tbody'),
|
||||
arrs = [];
|
||||
|
||||
+45
-54
@@ -28,68 +28,59 @@
|
||||
// @namespace https://github.com/XIU2/UserScript
|
||||
// ==/UserScript==
|
||||
(function() {
|
||||
var menu_open_fileSha = GM_getValue('xiu2_menu_open_fileSha'),
|
||||
menu_copy_fileSha = GM_getValue('xiu2_menu_copy_fileSha'),
|
||||
menu_refreshCorrection = GM_getValue('xiu2_menu_refreshCorrection'),
|
||||
menu_rightClickMenu = GM_getValue('xiu2_menu_rightClickMenu'),
|
||||
menu_folderDescdesMenu = GM_getValue('xiu2_menu_folderDescdesMenu');
|
||||
var menu_open_fileSha_ID, menu_copy_fileSha_ID, menu_refreshCorrection_ID, menu_rightClickMenu_ID, menu_folderDescdesMenu_ID, menu_feedBack_ID, lastFolderID;
|
||||
if (menu_open_fileSha == null){menu_open_fileSha = true; GM_setValue('xiu2_menu_open_fileSha', menu_open_fileSha)};
|
||||
if (menu_copy_fileSha == null){menu_copy_fileSha = true; GM_setValue('xiu2_menu_copy_fileSha', menu_copy_fileSha)};
|
||||
if (menu_refreshCorrection == null){menu_refreshCorrection = true; GM_setValue('xiu2_menu_refreshCorrection', menu_refreshCorrection)};
|
||||
if (menu_rightClickMenu == null){menu_rightClickMenu = true; GM_setValue('xiu2_menu_rightClickMenu', menu_rightClickMenu)};
|
||||
if (menu_folderDescdesMenu == null){menu_folderDescdesMenu = true; GM_setValue('xiu2_menu_folderDescdesMenu', menu_folderDescdesMenu)};
|
||||
var menu_ALL = [
|
||||
['menu_open_fileSha', '自动打开分享链接', '自动打开分享链接', true],
|
||||
['menu_copy_fileSha', '自动复制分享链接', '自动复制分享链接', true],
|
||||
['menu_refreshCorrection', '刷新不返回根目录', '刷新不返回根目录', true],
|
||||
['menu_rightClickMenu', '右键文件显示菜单', '右键文件显示菜单', true],
|
||||
['menu_folderDescdesMenu', '调整描述(话说)编辑框大小', '调整描述(话说)编辑框大小', true]
|
||||
], menu_ID = [], lastFolderID;
|
||||
for (let i=0;i<menu_ALL.length;i++){ // 如果读取到的值为 null 就写入默认值
|
||||
if (GM_getValue(menu_ALL[i][0]) == null){GM_setValue(menu_ALL[i][0], menu_ALL[i][3])};
|
||||
}
|
||||
registerMenuCommand();
|
||||
|
||||
// 注册脚本菜单
|
||||
function registerMenuCommand() {
|
||||
var menu_open_fileSha_, menu_copy_fileSha_, menu_refreshCorrection_, menu_rightClickMenu_, menu_folderDescdesMenu_;
|
||||
if (menu_feedBack_ID){ // 如果反馈菜单ID不是 null,则删除所有脚本菜单
|
||||
GM_unregisterMenuCommand(menu_open_fileSha_ID);
|
||||
GM_unregisterMenuCommand(menu_copy_fileSha_ID);
|
||||
GM_unregisterMenuCommand(menu_refreshCorrection_ID);
|
||||
GM_unregisterMenuCommand(menu_rightClickMenu_ID);
|
||||
GM_unregisterMenuCommand(menu_folderDescdesMenu_ID);
|
||||
GM_unregisterMenuCommand(menu_feedBack_ID);
|
||||
menu_open_fileSha = GM_getValue('xiu2_menu_open_fileSha');
|
||||
menu_copy_fileSha = GM_getValue('xiu2_menu_copy_fileSha');
|
||||
menu_refreshCorrection = GM_getValue('xiu2_menu_refreshCorrection');
|
||||
menu_rightClickMenu = GM_getValue('xiu2_menu_rightClickMenu');
|
||||
menu_folderDescdesMenu = GM_getValue('xiu2_menu_folderDescdesMenu');
|
||||
if (menu_ID.length > menu_ALL.length){ // 如果菜单ID数组多于菜单数组,说明不是首次添加菜单,需要卸载所有脚本菜单
|
||||
for (let i=0;i<menu_ID.length;i++){
|
||||
GM_unregisterMenuCommand(menu_ID[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (menu_open_fileSha){menu_open_fileSha_ = "√";}else{menu_open_fileSha_ = "×";}
|
||||
if (menu_copy_fileSha){menu_copy_fileSha_ = "√";}else{menu_copy_fileSha_ = "×";}
|
||||
if (menu_refreshCorrection){menu_refreshCorrection_ = "√";}else{menu_refreshCorrection_ = "×";}
|
||||
if (menu_rightClickMenu){menu_rightClickMenu_ = "√";}else{menu_rightClickMenu_ = "×";}
|
||||
if (menu_folderDescdesMenu){menu_folderDescdesMenu_ = "√";}else{menu_folderDescdesMenu_ = "×";}
|
||||
|
||||
menu_open_fileSha_ID = GM_registerMenuCommand(`[ ${menu_open_fileSha_} ] 自动打开分享链接`, function(){menu_switch(menu_open_fileSha,'xiu2_menu_open_fileSha','自动打开分享链接', true)});
|
||||
menu_copy_fileSha_ID = GM_registerMenuCommand(`[ ${menu_copy_fileSha_} ] 自动复制分享链接`, function(){menu_switch(menu_copy_fileSha,'xiu2_menu_copy_fileSha','自动复制分享链接', true)});
|
||||
menu_refreshCorrection_ID = GM_registerMenuCommand(`[ ${menu_refreshCorrection_} ] 刷新不返回根目录`, function(){if(menu_refreshCorrection){UNrefreshCorrection();}else{refreshCorrection();};menu_switch(menu_refreshCorrection,'xiu2_menu_refreshCorrection','刷新不返回根目录', false)});
|
||||
menu_rightClickMenu_ID = GM_registerMenuCommand(`[ ${menu_rightClickMenu_} ] 右键文件显示菜单`, function(){menu_switch(menu_rightClickMenu,'xiu2_menu_rightClickMenu','右键文件显示菜单', true)});
|
||||
menu_folderDescdesMenu_ID = GM_registerMenuCommand(`[ ${menu_folderDescdesMenu_} ] 调整描述(话说)编辑框大小`, function(){menu_switch(menu_folderDescdesMenu,'xiu2_menu_folderDescdesMenu','调整描述(话说)编辑框大小', true)});
|
||||
menu_feedBack_ID = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});});
|
||||
for (let i=0;i<menu_ALL.length;i++){ // 循环注册脚本菜单
|
||||
menu_ALL[i][3] = GM_getValue(menu_ALL[i][0]);
|
||||
if (menu_ALL[i][0] == 'menu_refreshCorrection') {
|
||||
menu_ID[i] = GM_registerMenuCommand(`[ ${menu_ALL[i][3]?'√':'×'} ] ${menu_ALL[i][1]}`, function(){if(menu_value('menu_refreshCorrection')){UNrefreshCorrection();}else{refreshCorrection();};menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)});
|
||||
}else{
|
||||
menu_ID[i] = GM_registerMenuCommand(`[ ${menu_ALL[i][3]?'√':'×'} ] ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)});
|
||||
}
|
||||
}
|
||||
menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});});
|
||||
}
|
||||
|
||||
|
||||
// 菜单开关
|
||||
function menu_switch(menu_status, Name, Tips, RefreshTips) {
|
||||
if(RefreshTips){
|
||||
RefreshTips = "\n(刷新网页后生效)"
|
||||
}else{
|
||||
RefreshTips = ""
|
||||
}
|
||||
if (menu_status){
|
||||
function menu_switch(menu_status, Name, Tips) {
|
||||
let RefreshTips = '\n(刷新网页后生效)';
|
||||
if (Name == 'menu_refreshCorrection')RefreshTips = ''
|
||||
if (menu_status == 'true'){
|
||||
GM_setValue(`${Name}`, false);
|
||||
GM_notification({text: `已关闭 [${Tips}] 功能\n(刷新网页后生效)`, timeout: 3500});
|
||||
GM_notification({text: `已关闭 [${Tips}] 功能${RefreshTips}`, timeout: 3500});
|
||||
}else{
|
||||
GM_setValue(`${Name}`, true);
|
||||
GM_notification({text: `已开启 [${Tips}] 功能\n(刷新网页后生效)`, timeout: 3500});
|
||||
GM_notification({text: `已开启 [${Tips}] 功能${RefreshTips}`, timeout: 3500});
|
||||
}
|
||||
registerMenuCommand(); // 重新注册脚本菜单
|
||||
};
|
||||
|
||||
// 返回菜单值
|
||||
function menu_value(menuName) {
|
||||
for (let menu of menu_ALL) {
|
||||
if (menu[0] == menuName) {
|
||||
return menu[3]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(document.getElementById("infos")){ // 分享链接文件列表页
|
||||
setTimeout(fileMoreS, 300); // 自动显示更多文件
|
||||
@@ -109,7 +100,7 @@
|
||||
mainframe = document.getElementById("mainframe");
|
||||
if(mainframe){ // 只有找到 iframe 框架时才会继续运行脚本
|
||||
mainframe = mainframe.contentWindow;
|
||||
if(menu_refreshCorrection){
|
||||
if(menu_value('menu_refreshCorrection')){
|
||||
refreshCorrection(); // 刷新不返回根目录(F5)
|
||||
}
|
||||
setTimeout(folderDescdes, 200); // 调整话说编辑框初始大小
|
||||
@@ -155,7 +146,7 @@
|
||||
|
||||
// 右键文件显示菜单
|
||||
function rightClickMenu() {
|
||||
if(menu_rightClickMenu){ // 脚本菜单开启时才继续
|
||||
if(menu_value('menu_rightClickMenu')){ // 脚本菜单开启时才继续
|
||||
rightClickMenu_("sub_folder_list", "fols", "folse") // 文件夹
|
||||
rightClickMenu_("filelist", "fs", "fse") // 文件
|
||||
}
|
||||
@@ -208,7 +199,7 @@
|
||||
|
||||
// 调整话说编辑框初始大小
|
||||
function folderDescdes() {
|
||||
if(menu_folderDescdesMenu) {
|
||||
if(menu_value('menu_folderDescdesMenu')) {
|
||||
let folderdescdes = mainframe.document.getElementById("folder_descdes"); // 寻找话说(描述)编辑框
|
||||
if(folderdescdes){ // 判断话说(描述)元素是否存在
|
||||
folderdescdes.style.cssText="margin: 15px 0px; width: 550px; height: 125px;"
|
||||
@@ -245,7 +236,7 @@
|
||||
if(f_sha && f_sha.style.display == "block"){ // 判断信息框是否存在且可见
|
||||
fileSha_Open(); // 自动打开分享链接(点击文件时)
|
||||
fileSha_Copy(); // 自动复制分享链接(点击文件时)
|
||||
if(menu_open_fileSha || menu_copy_fileSha){
|
||||
if(menu_value('menu_open_fileSha') || menu_value('menu_copy_fileSha')){
|
||||
f_sha.style.display = "none"; // 隐藏分享链接(下载链接)信息框
|
||||
}
|
||||
}
|
||||
@@ -254,7 +245,7 @@
|
||||
|
||||
// 自动打开分享链接(点击文件时)
|
||||
function fileSha_Open() {
|
||||
if(menu_open_fileSha){ // 脚本菜单开启时才继续
|
||||
if(menu_value('menu_open_fileSha')){ // 脚本菜单开启时才继续
|
||||
let code = mainframe.document.getElementById("code").getAttribute("title"); // 获取分享链接(下载链接)
|
||||
if(code != ""){ // 确保分享链接(下载链接)不是空
|
||||
window.GM_openInTab(code, {active: true,insert: true,setParent: true}) // 打开分享链接(下载链接)
|
||||
@@ -265,7 +256,7 @@
|
||||
|
||||
// 自动复制分享链接(点击文件时)
|
||||
function fileSha_Copy() {
|
||||
if(menu_copy_fileSha){ // 脚本菜单开启时才继续
|
||||
if(menu_value('menu_copy_fileSha')){ // 脚本菜单开启时才继续
|
||||
let f_sha1 = mainframe.document.getElementById("f_sha1").innerText; // 获取分享链接(下载链接)
|
||||
if(f_sha1 != ""){ // 确保分享链接(下载链接)不是空
|
||||
copyToClipboard(f_sha1); // 复制到剪切板
|
||||
@@ -293,7 +284,7 @@
|
||||
|
||||
// 隐藏分享链接窗口(这样自动打开/复制分享链接时,不会一闪而过)
|
||||
function hideSha(){
|
||||
if(menu_open_fileSha || menu_copy_fileSha){ // [自动复制分享链接] 或 [自动打开分享链接] 任意一个功能开启时才继续
|
||||
if(menu_value('menu_open_fileSha') || menu_value('menu_copy_fileSha')){ // [自动复制分享链接] 或 [自动打开分享链接] 任意一个功能开启时才继续
|
||||
let style_Add = mainframe.document.createElement('style');
|
||||
style_Add.type = 'text/css';
|
||||
style_Add.innerHTML = `#f_sha {display: none !important;}`;
|
||||
|
||||
@@ -18,62 +18,59 @@
|
||||
// ==/UserScript==
|
||||
|
||||
(function() {
|
||||
var menu_widescreenDisplay = GM_getValue('xiu2_menu_widescreenDisplay'),
|
||||
menu_picHeight = GM_getValue('xiu2_menu_picHeight'),
|
||||
menu_postimg = GM_getValue('xiu2_menu_postimg'),
|
||||
menu_hideTitle = GM_getValue('xiu2_menu_hideTitle'),
|
||||
menu_widescreenDisplay_ID, menu_picHeight_ID, menu_postimg_ID, menu_hideTitle_ID, menu_feedBack_ID;
|
||||
if (menu_widescreenDisplay == null){menu_widescreenDisplay = true; GM_setValue('xiu2_menu_widescreenDisplay', menu_widescreenDisplay)};
|
||||
if (menu_picHeight == null){menu_picHeight = true; GM_setValue('xiu2_menu_picHeight', menu_picHeight)};
|
||||
if (menu_postimg == null){menu_postimg = true; GM_setValue('xiu2_menu_postimg', menu_postimg)};
|
||||
if (menu_hideTitle == null){menu_hideTitle = true; GM_setValue('xiu2_menu_hideTitle', menu_hideTitle)};
|
||||
var menu_ALL = [
|
||||
['menu_widescreenDisplay', '宽屏显示', '一键收起回答', true],
|
||||
['menu_picHeight', '调整图片最大高度', '调整图片最大高度', true],
|
||||
['menu_postimg', '隐藏文章开头大图', '隐藏文章开头大图', true],
|
||||
['menu_hideTitle', '隐藏浏览回答标题', '隐藏浏览回答标题', true]
|
||||
], menu_ID = [];
|
||||
for (let i=0;i<menu_ALL.length;i++){ // 如果读取到的值为 null 就写入默认值
|
||||
if (GM_getValue(menu_ALL[i][0]) == null){GM_setValue(menu_ALL[i][0], menu_ALL[i][3])};
|
||||
}
|
||||
registerMenuCommand();
|
||||
addStyle();
|
||||
|
||||
// 注册脚本菜单
|
||||
function registerMenuCommand() {
|
||||
let menu_widescreenDisplay_, menu_picHeight_, menu_postimg_, menu_hideTitle_;
|
||||
if (menu_feedBack_ID){ // 如果反馈菜单ID不是 null,则删除所有脚本菜单
|
||||
GM_unregisterMenuCommand(menu_widescreenDisplay_ID);
|
||||
GM_unregisterMenuCommand(menu_picHeight_ID);
|
||||
GM_unregisterMenuCommand(menu_postimg_ID);
|
||||
GM_unregisterMenuCommand(menu_hideTitle_ID);
|
||||
GM_unregisterMenuCommand(menu_feedBack_ID);
|
||||
menu_widescreenDisplay = GM_getValue('xiu2_menu_widescreenDisplay');
|
||||
menu_picHeight = GM_getValue('xiu2_menu_picHeight');
|
||||
menu_postimg = GM_getValue('xiu2_menu_postimg');
|
||||
menu_hideTitle = GM_getValue('xiu2_menu_hideTitle');
|
||||
if (menu_ID.length > menu_ALL.length){ // 如果菜单ID数组多于菜单数组,说明不是首次添加菜单,需要卸载所有脚本菜单
|
||||
for (let i=0;i<menu_ID.length;i++){
|
||||
GM_unregisterMenuCommand(menu_ID[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (menu_widescreenDisplay){menu_widescreenDisplay_ = "√";}else{menu_widescreenDisplay_ = "×";}
|
||||
if (menu_picHeight){menu_picHeight_ = "√";}else{menu_picHeight_ = "×";}
|
||||
if (menu_postimg){menu_postimg_ = "√";}else{menu_postimg_ = "×";}
|
||||
if (menu_hideTitle){menu_hideTitle_ = "√";}else{menu_hideTitle_ = "×";}
|
||||
|
||||
menu_widescreenDisplay_ID = GM_registerMenuCommand(`[ ${menu_widescreenDisplay_} ] 宽屏显示`, function(){menu_switch(menu_widescreenDisplay,'xiu2_menu_widescreenDisplay','宽屏显示')});
|
||||
menu_picHeight_ID = GM_registerMenuCommand(`[ ${menu_picHeight_} ] 调整图片最大高度`, function(){menu_switch(menu_picHeight,'xiu2_menu_picHeight','调整图片最大高度')});
|
||||
menu_postimg_ID = GM_registerMenuCommand(`[ ${menu_postimg_} ] 隐藏文章开头大图`, function(){menu_switch(menu_postimg,'xiu2_menu_postimg','隐藏文章开头大图')});
|
||||
menu_hideTitle_ID = GM_registerMenuCommand(`[ ${menu_hideTitle_} ] 隐藏浏览回答标题`, function(){menu_switch(menu_hideTitle,'xiu2_menu_hideTitle','隐藏浏览回答标题')});
|
||||
menu_feedBack_ID = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});});
|
||||
for (let i=0;i<menu_ALL.length;i++){ // 循环注册脚本菜单
|
||||
menu_ALL[i][3] = GM_getValue(menu_ALL[i][0]);
|
||||
menu_ID[i] = GM_registerMenuCommand(`[ ${menu_ALL[i][3]?'√':'×'} ] ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)});
|
||||
}
|
||||
menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});});
|
||||
}
|
||||
|
||||
// 菜单开关
|
||||
function menu_switch(menu_status, Name, Tips) {
|
||||
if (menu_status){
|
||||
if (menu_status == 'true'){
|
||||
GM_setValue(`${Name}`, false);
|
||||
GM_notification({text: `已关闭 [${Tips}] 功能\n(刷新网页后生效)`, timeout: 3000});
|
||||
GM_notification({text: `已关闭 [${Tips}] 功能\n(刷新网页后生效)`, timeout: 3500});
|
||||
}else{
|
||||
GM_setValue(`${Name}`, true);
|
||||
GM_notification({text: `已开启 [${Tips}] 功能\n(刷新网页后生效)`, timeout: 3000});
|
||||
GM_notification({text: `已开启 [${Tips}] 功能\n(刷新网页后生效)`, timeout: 3500});
|
||||
}
|
||||
registerMenuCommand(); // 重新注册脚本菜单
|
||||
};
|
||||
|
||||
// 返回菜单值
|
||||
function menu_value(menuName) {
|
||||
for (let menu of menu_ALL) {
|
||||
if (menu[0] == menuName) {
|
||||
return menu[3]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 添加样式
|
||||
function addStyle() {
|
||||
let style = `/* 屏蔽登录提示 */
|
||||
.Question-mainColumnLogin {display: none;}`,
|
||||
.Question-mainColumnLogin {display: none;}
|
||||
`,
|
||||
style_1 = `/* 宽屏显示 */
|
||||
.GlobalSideBar,.Question-sideColumn,.ContentLayout-sideColumn,.SearchSideBar,.Card.QuestionHeaderTopicMeta {
|
||||
display: none !important;
|
||||
@@ -116,19 +113,19 @@ header.is-hidden {
|
||||
`
|
||||
let style_Add = document.createElement('style');
|
||||
// 宽屏显示
|
||||
if (menu_widescreenDisplay) {
|
||||
if (menu_value('menu_widescreenDisplay')) {
|
||||
style += style_1;
|
||||
}
|
||||
// 调整图片最大高度
|
||||
if (menu_picHeight) {
|
||||
if (menu_value('menu_picHeight')) {
|
||||
style += style_5;
|
||||
}
|
||||
// 隐藏文章开头大图
|
||||
if (menu_postimg) {
|
||||
if (menu_value('menu_postimg')) {
|
||||
style += style_2;
|
||||
}
|
||||
// 浏览回答向下翻时自动隐藏标题
|
||||
if (menu_hideTitle) {
|
||||
if (menu_value('menu_hideTitle')) {
|
||||
style += style_4;
|
||||
}
|
||||
// 文章编辑页面与实际文章宽度一致
|
||||
|
||||
+34
-23
@@ -19,43 +19,54 @@
|
||||
// ==/UserScript==
|
||||
|
||||
(function() {
|
||||
var menu_cleanPostTitle = GM_getValue('xiu2_menu_cleanPostTitle'),
|
||||
menu_qianDaoRedirectURL = GM_getValue('xiu2_menu_qianDaoRedirectURL');
|
||||
var menu_cleanPostTitle_ID, menu_qianDaoRedirectURL_ID, menu_feedBack_ID;
|
||||
if (menu_cleanPostTitle == null){menu_cleanPostTitle = true; GM_setValue('xiu2_menu_cleanPostTitle', menu_cleanPostTitle)};
|
||||
if (menu_qianDaoRedirectURL == null){menu_qianDaoRedirectURL = `http://bbs.zhiyoo.net/forum.php?mod=forumdisplay&fid=42&filter=author&orderby=dateline`; GM_setValue('xiu2_menu_qianDaoRedirectURL', menu_qianDaoRedirectURL)};
|
||||
var menu_ALL = [
|
||||
['menu_cleanPostTitle', '清理帖子标题开头〖〗【】文字', '清理帖子标题开头〖〗【】文字', true],
|
||||
['menu_qianDaoRedirectURL', '当前页面设为签到后重定向地址', '已设置当前页面为签到后重定向地址', 'http://bbs.zhiyoo.net/forum.php?mod=forumdisplay&fid=42&filter=author&orderby=dateline']
|
||||
], menu_ID = [];
|
||||
for (let i=0;i<menu_ALL.length;i++){ // 如果读取到的值为 null 就写入默认值
|
||||
if (GM_getValue(menu_ALL[i][0]) == null){GM_setValue(menu_ALL[i][0], menu_ALL[i][3])};
|
||||
}
|
||||
registerMenuCommand();
|
||||
|
||||
// 注册脚本菜单
|
||||
function registerMenuCommand() {
|
||||
let menu_cleanPostTitle_;
|
||||
if (menu_feedBack_ID){ // 如果反馈菜单ID不是 null,则删除所有脚本菜单
|
||||
GM_unregisterMenuCommand(menu_cleanPostTitle_ID);
|
||||
GM_unregisterMenuCommand(menu_qianDaoRedirectURL_ID);
|
||||
GM_unregisterMenuCommand(menu_feedBack_ID);
|
||||
menu_cleanPostTitle = GM_getValue('xiu2_menu_cleanPostTitle');
|
||||
menu_qianDaoRedirectURL = GM_getValue('xiu2_menu_qianDaoRedirectURL');
|
||||
if (menu_ID.length > menu_ALL.length){ // 如果菜单ID数组多于菜单数组,说明不是首次添加菜单,需要卸载所有脚本菜单
|
||||
for (let i=0;i<menu_ID.length;i++){
|
||||
GM_unregisterMenuCommand(menu_ID[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (menu_cleanPostTitle){menu_cleanPostTitle_ = "√";}else{menu_cleanPostTitle_ = "×";}
|
||||
|
||||
menu_cleanPostTitle_ID = GM_registerMenuCommand(`[ ${menu_cleanPostTitle_} ] 清理帖子标题开头〖〗【】文字`, function(){menu_switch(menu_cleanPostTitle,'xiu2_menu_cleanPostTitle','清理帖子标题开头〖〗【】文字')});
|
||||
menu_qianDaoRedirectURL_ID = GM_registerMenuCommand(`当前页面设为签到后重定向地址`, function(){GM_setValue('xiu2_menu_qianDaoRedirectURL', location.href);GM_notification({text: `已设置当前页面为签到后重定向地址`, timeout: 3000});;})
|
||||
menu_feedBack_ID = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});});
|
||||
for (let i=0;i<menu_ALL.length;i++){ // 循环注册脚本菜单
|
||||
menu_ALL[i][3] = GM_getValue(menu_ALL[i][0]);
|
||||
if (menu_ALL[i][0] == 'menu_qianDaoRedirectURL') {
|
||||
menu_ID[i] = GM_registerMenuCommand(`${menu_ALL[i][1]}`, function(){GM_setValue(`${menu_ALL[i][0]}`, location.href);GM_notification({text: `${menu_ALL[i][2]}`, timeout: 3000});})
|
||||
} else {
|
||||
menu_ID[i] = GM_registerMenuCommand(`[ ${menu_ALL[i][3]?'√':'×'} ] ${menu_ALL[i][1]}`, function(){menu_switch(`${menu_ALL[i][3]}`,`${menu_ALL[i][0]}`,`${menu_ALL[i][2]}`)});
|
||||
}
|
||||
}
|
||||
menu_ID[menu_ID.length] = GM_registerMenuCommand('反馈 & 建议', function () {window.GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true});});
|
||||
}
|
||||
|
||||
// 菜单开关
|
||||
function menu_switch(menu_status, Name, Tips) {
|
||||
if (menu_status){
|
||||
if (menu_status == 'true'){
|
||||
GM_setValue(`${Name}`, false);
|
||||
GM_notification({text: `已关闭 [${Tips}] 功能(刷新网页后生效)`, timeout: 3500});
|
||||
GM_notification({text: `已关闭 [${Tips}] 功能\n(刷新网页后生效)`, timeout: 3500});
|
||||
}else{
|
||||
GM_setValue(`${Name}`, true);
|
||||
GM_notification({text: `已开启 [${Tips}] 功能(刷新网页后生效)`, timeout: 3500});
|
||||
GM_notification({text: `已开启 [${Tips}] 功能\n(刷新网页后生效)`, timeout: 3500});
|
||||
}
|
||||
registerMenuCommand(); // 重新注册脚本菜单
|
||||
};
|
||||
|
||||
// 返回菜单值
|
||||
function menu_value(menuName) {
|
||||
for (let menu of menu_ALL) {
|
||||
if (menu[0] == menuName) {
|
||||
return menu[3]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 随机回复帖子的内容
|
||||
var replyList = [
|
||||
@@ -197,7 +208,7 @@
|
||||
document.querySelector('#yl').click();
|
||||
document.querySelector('.tr3.tac div a').click();
|
||||
}
|
||||
setTimeout(location.href=menu_qianDaoRedirectURL, 2000); // 跳转到指定URL
|
||||
setTimeout(location.href=menu_value('menu_qianDaoRedirectURL'), 2000); // 跳转到指定URL
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,7 +306,7 @@
|
||||
|
||||
// 清理帖子列表中帖子标题开头的〖XXX〗【XXX】文字
|
||||
function cleanPostTitle(){
|
||||
if (menu_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++){
|
||||
|
||||
Reference in New Issue
Block a user