',
url = '', _html = '', _gitClone = '';
if (html.nextElementSibling) html.nextElementSibling.hidden = true; // 隐藏右侧复制按钮(考虑到能直接点击复制,就不再重复实现复制按钮事件了)
- if (html.parentElement.nextElementSibling.tagName === 'SPAN'){
- html.parentElement.nextElementSibling.textContent += ' (↑点击上面文字可复制)'
+ if (html.parentElement.nextElementSibling.tagName === 'P'){
+ html.parentElement.nextElementSibling.textContent += ' (↑点击文字自动复制)'
}
if (GM_getValue('menu_gitClone')) {_gitClone='git clone '; html.value = _gitClone + html.value; html.setAttribute('value', html.value);}
// 克隆原 Git Clone 元素
@@ -378,8 +401,8 @@
html_parent = '
',
url = '', _html = '', _gitClone = '';
html.nextElementSibling.hidden = true; // 隐藏右侧复制按钮(考虑到能直接点击复制,就不再重复实现复制按钮事件了)
- if (html.parentElement.nextElementSibling.tagName === 'SPAN'){
- html.parentElement.nextElementSibling.textContent += ' (↑点击文字可复制)'
+ if (html.parentElement.nextElementSibling.tagName === 'P'){
+ html.parentElement.nextElementSibling.textContent += ' (↑点击自动复制)'
}
if (GM_getValue('menu_gitClone')) {_gitClone='git clone '; html.value = _gitClone + html.value; html.setAttribute('value', html.value);}
// 克隆原 Git Clone SSH 元素
@@ -552,4 +575,4 @@
window.dispatchEvent(new Event('urlchange'))
});
}
-})();
+})();
\ No newline at end of file
diff --git a/HTML5Volume.user.js b/HTML5Volume.user.js
index 6bcc4388e..1938bca0f 100644
--- a/HTML5Volume.user.js
+++ b/HTML5Volume.user.js
@@ -3,7 +3,7 @@
// @name:zh-CN HTML5 视频音频默认音量
// @name:zh-TW HTML5 視訊音訊預設音量
// @name:ru Громкость аудио-видео в формате HTML5 по умолчанию
-// @version 1.0.3
+// @version 1.0.5
// @author X.I.U
// @description Avoid being startled by some video/audio with default 100% volume! And support each website to remember the volume separately...
// @description:zh-CN 避免被一些默认 100% 音量的视频/音频吓一跳(或社死)!且支持各网站分别记住音量...
@@ -34,12 +34,58 @@
let nowVolume = ' (跟随全局)'
if (localStorage.getItem('html5_xiu_currentVolume')) nowVolume = ' [ ' + parseInt(localStorage.getItem('html5_xiu_currentVolume')) + '% ]'
menu_ID[1] = GM_registerMenuCommand('🔁 忘记当前网站音量' + nowVolume, function(){resetCurrentVolume()});
- menu_ID[2] = GM_registerMenuCommand('💬 反馈 & 建议', function () {GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true}); GM_openInTab('https://greasyfork.org/zh-CN/scripts/438400/feedback', {active: true,insert: true,setParent: true});});
+ // 强制当前网站使用全局音量(针对部分不支持调节音量的网站)
+ if (menu_forcedToEnable('check')) { // 当前网站是否已存在强制列表中
+ menu_ID[2] = GM_registerMenuCommand('✅ 已强制当前网站使用全局音量 (针对不支持调节音量的)', function(){menu_forcedToEnable('del')});
+ menu_ID[4] = GM_registerMenuCommand('#️⃣ 修改当前网站默认音量 (针对不支持调节音量的)', function(){customCurrentDefaultVolume()});
+ } else {
+ menu_ID[2] = GM_registerMenuCommand('❌ 未强制当前网站使用全局音量 (针对不支持调节音量的)', function(){menu_forcedToEnable('add')});
+ }
+ menu_ID[3] = GM_registerMenuCommand('💬 反馈 & 建议', function () {GM_openInTab('https://github.com/XIU2/UserScript#xiu2userscript', {active: true,insert: true,setParent: true}); GM_openInTab('https://greasyfork.org/zh-CN/scripts/438400/feedback', {active: true,insert: true,setParent: true});});
}
insPage();
currentPage();
+ // 强制当前网站使用全局音量(针对部分不支持调节音量的网站)
+ function menu_forcedToEnable(type) {
+ switch(type) {
+ case 'check':
+ if(check()) return true
+ return false
+ break;
+ case 'add':
+ add();
+ break;
+ case 'del':
+ del();
+ break;
+ }
+
+ function check() { // 存在返回真,不存在返回假
+ let websiteList = GM_getValue('menu_forcedToEnable',[]); // 读取网站列表
+ if (websiteList.indexOf(location.host) === -1) return false // 不存在返回假
+ return true
+ }
+
+ function add() {
+ if (check()) return
+ let websiteList = GM_getValue('menu_forcedToEnable',[]); // 读取网站列表
+ websiteList.push(location.host); // 追加网站域名
+ GM_setValue('menu_forcedToEnable', websiteList); // 写入配置
+ location.reload(); // 刷新网页
+ }
+
+ function del() {
+ if (!check()) return
+ let websiteList = GM_getValue('menu_forcedToEnable',[]), // 读取网站列表
+ index = websiteList.indexOf(location.host);
+ websiteList.splice(index, 1); // 删除网站域名
+ GM_setValue('menu_forcedToEnable', websiteList); // 写入配置
+ location.reload(); // 刷新网页
+ }
+ }
+
// 网页本身的 Video Audio 标签
function currentPage() {
@@ -88,12 +134,16 @@
// 判断该视频/音频元素是否已监听事件
function isFirstEvent(target) {
- if (!target.controls) return; // 如果视频/音频已经有了自己的控件(即没有使用 HTML5 默认的控件),则退出
+ if (!menu_forcedToEnable('check')) { // 如果未强制当前网站使用全局音量(针对部分不支持调节音量的网站)
+ if (!target.controls) return; // 如果视频/音频已经有了自己的控件(即没有使用 HTML5 默认的控件),则退出
+ }
modifyVolume(target);
- // 如果没有该属性,则代表是还未监听事件
- if (target.dataset.html5VolumeXiu != 'true') {
- target.dataset.html5VolumeXiu = 'true'
- target.addEventListener('volumechange', volumeChangeEvent);
+ if (!menu_forcedToEnable('check')) { // 如果未强制当前网站使用全局音量(针对部分不支持调节音量的网站),毕竟不支持音量调节的网站监听音量变化是没有意义的,反而可能会被网站默认静音什么的搞乱
+ // 如果没有该属性,则代表是还未监听事件
+ if (target.dataset.html5VolumeXiu != 'true') {
+ target.dataset.html5VolumeXiu = 'true'
+ target.addEventListener('volumechange', volumeChangeEvent);
+ }
}
}
@@ -111,8 +161,18 @@
// 修改全局默认音量
function customDefaultVolume() {
- let newValue = parseFloat(prompt('修改全局默认音量,不影响各网站记住的音量,当前网页需刷新后生效~\n范围:0~100 (即 0%~100%,不需要加 % 百分号)\n默认:30', GM_getValue('menu_defaultVolume', 30)));
+ let newValue = parseFloat(prompt('修改全局默认音量,不影响各网站记住的音量,修改后当前网页立即生效~\n范围:0~100 (即 0%~100%,不需要加 % 百分号)\n默认:30', GM_getValue('menu_defaultVolume', 30)));
if (!Number.isNaN(newValue) && newValue >= 0 && newValue <= 100) {GM_setValue('menu_defaultVolume', newValue);}
+ currentPage(); // 重置当前网页的音量
+ registerMenuCommand(); // 重新注册菜单(刷新菜单上的音量值)
+ }
+
+
+ // 修改当前网站默认音量 (针对不支持调节音量的网站)
+ function customCurrentDefaultVolume() {
+ let newValue = parseFloat(prompt('修改当前网站默认音量 (针对不支持调节音量的网站),修改后立即生效~\n范围:0~100 (即 0%~100%,不需要加 % 百分号)\n默认:全局默认音量', localStorage.getItem('html5_xiu_currentVolume') || GM_getValue('menu_defaultVolume', 30)));
+ if (!Number.isNaN(newValue) && newValue >= 0 && newValue <= 100) {localStorage.setItem('html5_xiu_currentVolume', newValue);}
+ currentPage(); // 重置当前网页的音量
registerMenuCommand(); // 重新注册菜单(刷新菜单上的音量值)
}
@@ -121,5 +181,6 @@
function resetCurrentVolume() {
if (localStorage.getItem('html5_xiu_currentVolume')) localStorage.removeItem('html5_xiu_currentVolume') // 清理 localStorage
currentPage(); // 重置当前网页的音量
+ registerMenuCommand(); // 重新注册菜单(刷新菜单上的音量值)
}
})();
diff --git a/Hostloc-Enhanced.user.js b/Hostloc-Enhanced.user.js
index 4ab680d1c..2a8b2aaca 100644
--- a/Hostloc-Enhanced.user.js
+++ b/Hostloc-Enhanced.user.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 全球主机交流论坛增强
-// @version 1.4.9
+// @version 1.5.2
// @author X.I.U
// @description 自动签到(访问空间 +22 积分)、屏蔽用户(黑名单)、屏蔽关键词(帖子标题)、回帖小尾巴、自动无缝翻页、快捷回到顶部(右键网页两侧空白处)、收起预览帖子(左键网页两侧空白处)、屏蔽投票贴、快速添加链接、屏蔽阅读权限 255 帖子、预览帖子快速回复带签名、显示是否在线、显示帖子内隐藏回复
// @match *://hostloc.com/*
@@ -20,8 +20,7 @@
// @supportURL https://github.com/XIU2/UserScript
// @homepageURL https://github.com/XIU2/UserScript
// ==/UserScript==
-
-(function() {
+(function () {
'use strict';
var menu_ALL = [
['menu_autoSignIn', '自动签到(22 积分)', '自动签到', true],
@@ -35,48 +34,45 @@
['menu_delate255', '屏蔽阅读权限 255 帖子', '屏蔽阅读权限 255 帖子', true],
['menu_delatePolls', '屏蔽投票帖子', '屏蔽投票帖子', false]
], menu_ID = [];
- for (let i=0;i
menu_ALL.length){ // 如果菜单ID数组多于菜单数组,说明不是首次添加菜单,需要卸载所有脚本菜单
- for (let i=0;i menu_ALL.length) { // 如果菜单ID数组多于菜单数组,说明不是首次添加菜单,需要卸载所有脚本菜单
+ for (let i = 0; i < menu_ID.length; i++) {
GM_unregisterMenuCommand(menu_ID[i]);
}
}
- for (let i=0;i -1) { // 帖子内
if (menu_value('menu_thread_pageLoading')) {
@@ -161,6 +151,7 @@
showPosts(); // 自动显示帖子内被隐藏的回复
blockUsers('thread'); // 屏蔽用户(黑名单)
onlineStatus(); // 显示是否在线
+ addBlockButton(); // 添加屏蔽按钮
replyCustom('thread'); // 回复自定义
} else if (patt_forum.test(location.pathname) || location.search.indexOf('mod=forumdisplay') > -1) { // 各板块帖子列表
curSite = DBSite.forum;
@@ -172,28 +163,25 @@
vfastpostDOMNodeInserted(); // 监听插入事件(预览快速回复带签名)
replyCustom('forum'); // 回复自定义
if (patt_forum.test(location.pathname)) blockDOMNodeInserted(); //监听插入事件(有新的回复主题,点击查看)
- }else if (location.search.indexOf('mod=guide') > -1) { // 导读帖子列表
+ } else if (location.search.indexOf('mod=guide') > -1) { // 导读帖子列表
curSite = DBSite.guide;
- } else if(location.pathname === '/search.php') { // 搜索结果列表
+ } else if (location.pathname === '/search.php') { // 搜索结果列表
curSite = DBSite.search;
blockUsers('search'); // 屏蔽用户(黑名单)
- } else if(location.pathname === '/home.php' && location.search.indexOf('mod=space&do=notice&view=mypost') > -1) { // 消息(帖子/点评/提到)
+ } else if (location.pathname === '/home.php' && location.search.indexOf('mod=space&do=notice&view=mypost') > -1) { // 消息(帖子/点评/提到)
blockUsers('notice'); // 屏蔽用户(黑名单)
- } else if(location.pathname === '/home.php' && location.search.indexOf('mod=space&do=pm') > -1) { // 消息(私人聊天)
+ } else if (location.pathname === '/home.php' && location.search.indexOf('mod=space&do=pm') > -1) { // 消息(私人聊天)
blockUsers('pm'); // 屏蔽用户(黑名单)
- } else if(location.search.indexOf('mod=space') > -1 && location.search.indexOf('&view=me') > -1) { // 别人的主题/回复
+ } else if (location.search.indexOf('mod=space') > -1 && location.search.indexOf('&view=me') > -1) { // 别人的主题/回复
curSite = DBSite.youreply;
- } else if(location.pathname === '/forum.php' && location.search.indexOf('mod=post&action=reply') > -1 || location.pathname === '/forum.php' && location.search.indexOf('mod=post&action=newthread') > -1) { // 回复:高级回复
+ } else if (location.pathname === '/forum.php' && location.search.indexOf('mod=post&action=reply') > -1 || location.pathname === '/forum.php' && location.search.indexOf('mod=post&action=newthread') > -1) { // 回复:高级回复
replyCustom('reply'); // 回复自定义
}
-
curSite.pageUrl = ""; // 下一页URL
pageLoading(); // 自动翻页
- backToTop(); // 回到顶部(右键点击左右两侧空白处)
- if(menu_value('menu_autoSignIn')) autoSignIn(); // 自动签到(访问空间 10 次 = 20 积分)
+ backToTop(); // 回到顶部(右键点击左右两侧空白处)
+ if (menu_value('menu_autoSignIn')) autoSignIn(); // 自动签到(访问空间 10 次 = 20 积分)
//replyIntervalDOMNodeInserted(); // 监听插入事件(回帖间隔)
-
-
// 自动签到(访问空间 10 次 = 20 积分 + 当天首次访问论坛 2 积分)
function autoSignIn() {
if (!loginStatus) return
@@ -201,13 +189,13 @@
timeOld = GM_getValue('menu_signInTime');
if (!timeOld || timeOld != timeNow) { // 是新的一天
GM_setValue('menu_signInTime', timeNow); // 写入签到时间以供后续比较
- GM_notification({text: '请不要关闭/刷新本页!耐心等待 60 秒~\n在此期间可以在 "其他标签页" 浏览论坛!', timeout: 10000});
+ GM_notification({ text: '请不要关闭/刷新本页!耐心等待 60 秒~\n在此期间可以在 "其他标签页" 浏览论坛!', timeout: 10000 });
let url_list = [],
url = 0;
// 随机生成 12 个空间地址(2 个冗余)
- for(let i = 0;i < 12;i++){url_list[i] = "https://" + location.host + "/space-uid-" + Math.floor(Math.random()*(50000-10000+1)+10000) + ".html";}
+ for (let i = 0; i < 12; i++) { url_list[i] = "https://" + location.host + "/space-uid-" + Math.floor(Math.random() * (50000 - 10000 + 1) + 10000) + ".html"; }
// 每 5 秒访问一次(避免触发网站防御机制,而且还可以适当浏览论坛)
- let signIn = setInterval(function(){
+ let signIn = setInterval(function () {
GM_xmlhttpRequest({
url: url_list[url++],
method: 'GET',
@@ -217,25 +205,21 @@
if (url === 11) { // 次数够了就取消定时循环
clearInterval(signIn);
console.log('[全球主机交流论坛 增强] 签到完成!');
- GM_notification({text: '签到完成!积分 +22 ~', timeout: 3500});
+ GM_notification({ text: '签到完成!积分 +22 ~', timeout: 3500 });
}
}, 5000);
}
}
-
-
// 重新签到
function reAutoSignIn() {
GM_setValue('menu_signInTime', '1970/1/1'); // 设置为比当前日期更早
location.reload(); // 刷新网页
}
-
-
// 自定义屏蔽用户
function customBlockUsers() {
let nowBlockUsers = '';
- GM_getValue('menu_customBlockUsers').forEach(function(item){nowBlockUsers += '|' + item})
- let newBlockUsers = prompt('编辑 [自定义屏蔽用户],刷新网页后生效\n(不同用户名之间使用 "|" 分隔,\n(例如:用户A|用户B|用户C,如果只有一个就不需要 "|" 了。', nowBlockUsers.replace('|',''));
+ GM_getValue('menu_customBlockUsers').forEach(function (item) { nowBlockUsers += '|' + item })
+ let newBlockUsers = prompt('编辑 [自定义屏蔽用户],刷新网页后生效\n(不同用户名之间使用 "|" 分隔,\n(例如:用户A|用户B|用户C,如果只有一个就不需要 "|" 了。', nowBlockUsers.replace('|', ''));
if (newBlockUsers === '') {
GM_setValue('menu_customBlockUsers', []);
registerMenuCommand(); // 重新注册脚本菜单
@@ -244,12 +228,10 @@
registerMenuCommand(); // 重新注册脚本菜单
}
};
-
-
// 屏蔽用户
function blockUsers(type) {
if (!menu_value('menu_customBlockUsers') || menu_value('menu_customBlockUsers').length < 1) return
- switch(type) {
+ switch (type) {
case 'thread': // 帖子内
blockUsers_('[id^="post_"]', 'a[href^="space-uid"]');
blockUsers_('[id^="comment_"] > div', 'a.xi2.xw1'); // 点评
@@ -269,10 +251,9 @@
blockUsers_('dl[id^="pmlist_"]', '.ptm.pm_c a[href^="space-uid"]');
break;
}
-
function blockUsers_(list1, list2, type) {
- document.querySelectorAll(list1).forEach(function(item){ // 遍历所有帖子
- menu_value('menu_customBlockUsers').forEach(function(item1){ // 遍历用户黑名单
+ document.querySelectorAll(list1).forEach(function (item) { // 遍历所有帖子
+ menu_value('menu_customBlockUsers').forEach(function (item1) { // 遍历用户黑名单
let itemName = item.querySelector(list2); // 寻找用户名
if (itemName) {
if (type && type === 1 && itemName.textContent.split(' ')[0] === item1) { // 回复引用
@@ -286,12 +267,11 @@
})
})
}
-
function blockUsers_vfastpost() {
let vfastpost = e => {
if (e.target.nodeType == 1 && e.target.outerHTML && e.target.outerHTML.indexOf('class="fastpreview"') > -1) {
- e.target.querySelectorAll('.bm_c > [id^="post_"]').forEach(function(item){ // 遍历所有回复
- menu_value('menu_customBlockUsers').forEach(function(item1){ // 遍历用户黑名单
+ e.target.querySelectorAll('.bm_c > [id^="post_"]').forEach(function (item) { // 遍历所有回复
+ menu_value('menu_customBlockUsers').forEach(function (item1) { // 遍历用户黑名单
let itemName = item.querySelector('a.xi2'); // 寻找用户名
if (itemName && itemName.textContent === item1) {
console.log(`屏蔽用户:${item1}`);
@@ -309,13 +289,11 @@
document.addEventListener('DOMNodeInserted', vfastpost); // 监听插入事件
}
}
-
-
// 自定义屏蔽关键词(帖子标题)
function customBlockKeywords() {
let nowBlockKeywords = '';
- GM_getValue('menu_customBlockKeywords').forEach(function(item){nowBlockKeywords += '|' + item})
- let newBlockKeywords = prompt('编辑 [自定义屏蔽关键词],刷新网页后生效\n(不同关键词之间使用 "|" 分隔,\n(例如:助力|互助|互点,如果只有一个就不需要 "|" 了。', nowBlockKeywords.replace('|',''));
+ GM_getValue('menu_customBlockKeywords').forEach(function (item) { nowBlockKeywords += '|' + item })
+ let newBlockKeywords = prompt('编辑 [自定义屏蔽关键词],刷新网页后生效\n(不同关键词之间使用 "|" 分隔,\n(例如:助力|互助|互点,如果只有一个就不需要 "|" 了。', nowBlockKeywords.replace('|', ''));
if (newBlockKeywords === '') {
GM_setValue('menu_customBlockKeywords', []);
registerMenuCommand(); // 重新注册脚本菜单
@@ -324,13 +302,11 @@
registerMenuCommand(); // 重新注册脚本菜单
}
};
-
-
// 屏蔽关键词(帖子标题)
function blockKeywords() {
if (!menu_value('menu_customBlockKeywords') || menu_value('menu_customBlockKeywords').length < 1) return
- document.querySelectorAll('[id^="normalthread_"]').forEach(function(item){ // 遍历所有帖子标题
- menu_value('menu_customBlockKeywords').forEach(function(item1){ // 遍历关键词
+ document.querySelectorAll('[id^="normalthread_"]').forEach(function (item) { // 遍历所有帖子标题
+ menu_value('menu_customBlockKeywords').forEach(function (item1) { // 遍历关键词
let itemName = item.querySelector('a.s.xst'); // 寻找帖子标题
if (itemName && itemName.textContent.toLowerCase().indexOf(item1.toLowerCase()) > -1) {
console.log(`屏蔽关键词:[${item1}]`, `,帖子标题:[${itemName.textContent}]`);
@@ -339,8 +315,6 @@
})
})
}
-
-
// 监听插入事件(有新的回复主题,点击查看)
function blockDOMNodeInserted() {
let block = e => {
@@ -353,8 +327,6 @@
}
document.addEventListener('DOMNodeInserted', block); // 监听插入事件
}
-
-
// 监听插入事件(预览快速回复带签名)
function vfastpostDOMNodeInserted() {
let vfastpost = e => {
@@ -364,8 +336,6 @@
}
document.addEventListener('DOMNodeInserted', vfastpost); // 监听插入事件
}
-
-
// 自定义小尾巴内容
function customLittleTail() {
let newLittleTail = prompt('编辑 [自定义小尾巴内容],刷新网页后生效(换行请使用 \\n\n提示①:记得在小尾巴前面加上几个 \\n 换行,用来分隔开回帖内容~\n提示②:建议使用 [align=right] 标签来使小尾巴居右~\n提示③:支持论坛富文本标签(建议先找个回复编辑预览好~\n示例:\\n\\n\\n\\n[align=right]第一行内容~\\n第二行内容~[/align]', GM_getValue('menu_customLittleTail'));
@@ -377,11 +347,9 @@
registerMenuCommand(); // 重新注册脚本菜单
}
};
-
-
// 回复自定义
function replyCustom(type) {
- switch(type) {
+ switch (type) {
case 'forum': // 各版块帖子列表的预览帖子
replyCustom_0(); // 预览帖子 快速回复(底部)
replyCustom_1(); // 预览帖子 回复(悬浮)
@@ -394,26 +362,24 @@
replyCustom_3();
break;
}
-
function replyCustom_0() {
let vfastpost = e => {
if (e.target.nodeType == 1 && e.target.innerHTML && e.target.innerHTML.indexOf('id="vfastpost"') > -1) {
let message = e.target.querySelector('input[name="message"]'), id = message.id.match(/\d+/g)[0];
message.parentNode.innerHTML = ``
- document.getElementById(`vreplysubmit_${id}`).onclick = function(){
+ document.getElementById(`vreplysubmit_${id}`).onclick = function () {
if (GM_getValue('menu_customLittleTail')) document.getElementById(`vmessage_${id}`).value += GM_getValue('menu_customLittleTail').replaceAll('\\n', '\n');
}
}
}
document.addEventListener('DOMNodeInserted', vfastpost); // 监听插入事件
}
-
function replyCustom_1() {
let floatlayout_reply = e => {
if (e.target.nodeType == 1 && e.target.innerHTML && e.target.innerHTML.indexOf('id="floatlayout_reply"') > -1) {
// 快速回复(悬浮)中添加 URL 按钮
document.querySelector('#floatlayout_reply .fbld').insertAdjacentHTML('afterend', `URL`);
- document.getElementById('postsubmit').onclick = function(){
+ document.getElementById('postsubmit').onclick = function () {
if (GM_getValue('menu_customLittleTail')) document.getElementById('postmessage').value += GM_getValue('menu_customLittleTail').replaceAll('\\n', '\n');
}
}
@@ -422,24 +388,20 @@
// 快速发帖(各版块帖子列表底部)中添加 URL 按钮
document.querySelector('#fastposteditor .fbld').insertAdjacentHTML('afterend', `URL`);
}
-
function replyCustom_2() { // 帖子底部的回复框
- document.getElementById('fastpostsubmit').onclick = function(){
+ document.getElementById('fastpostsubmit').onclick = function () {
if (GM_getValue('menu_customLittleTail')) document.getElementById('fastpostmessage').value += GM_getValue('menu_customLittleTail').replaceAll('\\n', '\n');
}
}
-
function replyCustom_3() {
let postsubmit = document.getElementById('postsubmit');
if (postsubmit && postsubmit.textContent === '\n参与/回复主题\n' || postsubmit && postsubmit.textContent === '\n发表帖子\n') {
- postsubmit.onclick = function(){
+ postsubmit.onclick = function () {
if (GM_getValue('menu_customLittleTail')) document.getElementById('e_textarea').value += GM_getValue('menu_customLittleTail').replaceAll('\\n', '\n');
}
}
}
}
-
-
// 监听插入事件(回帖间隔)
/*function replyIntervalDOMNodeInserted() {
let replyInterval = e => {
@@ -449,72 +411,113 @@
}
document.addEventListener('DOMNodeInserted', replyInterval); // 监听插入事件
}*/
-
-
// 自动显示帖子内被隐藏的回复
function showPosts() {
- if(menu_value('menu_showhide')){
+ if (menu_value('menu_showhide')) {
let showposts = document.querySelector('#hiddenpoststip a');
- if (showposts){ // 如果存在
+ if (showposts) { // 如果存在
showposts.click();
}
}
}
-
-
// 隐藏帖子内的 [下一页] 按钮
function hidePgbtn() {
document.lastChild.appendChild(document.createElement('style')).textContent = '.pgbtn {display: none;}';
}
-
-
// 快捷回到顶部(右键左右两侧空白处)
function backToTop() {
- document.body.oncontextmenu = function(event){
+ document.body.oncontextmenu = function (event) {
if (event.target == this) {
event.preventDefault();
- window.scrollTo(0,0)
+ window.scrollTo(0, 0)
}
}
}
-
-
// 收起帖子预览(左键左右两侧空白处)
function collapsedNowPost() {
- document.body.onclick = function(event){
+ document.body.onclick = function (event) {
if (event.target == this) {
document.querySelectorAll('[id^="threadPreviewTR_"] .closeprev').forEach(function (el) {
if (!el.parentElement.querySelector('[name="message"]') || el.parentElement.querySelector('[name="message"]').value === '' && !document.getElementById('fwin_reply')) { // 避免快速回复过程中误点收起了
let parentElement = el.parentElement.parentElement.parentElement.parentElement.parentElement,
top = parentElement.offsetTop + parentElement.offsetParent.offsetTop + parentElement.offsetParent.offsetParent.offsetTop; // 元素距离顶部的高度
- if (top < document.documentElement.scrollTop) window.scrollTo(0,top) // 帖子标题在上面时才会滚动到该帖子处
+ if (top < document.documentElement.scrollTop) window.scrollTo(0, top) // 帖子标题在上面时才会滚动到该帖子处
el.click()
}
});
}
}
}
-
-
// 显示在线状态
function onlineStatus() {
- document.querySelectorAll('[id^="favatar"]').forEach(function(item){ // 遍历所有帖子
+ document.querySelectorAll('[id^="favatar"]').forEach(function (item) { // 遍历所有帖子
if (item.querySelector('[id^="userinfo"] > .i.y em')) {
let icon = (item.querySelector('[id^="userinfo"] > .i.y em').textContent === '当前在线') ? '🌝' : '🌚';
let divStatus = document.createElement('div');
- divStatus.style = 'position: absolute;margin: -8px 0 0 8px;padding: 0 1px 1.2px;background-color: #ffffff;border-radius: 50%;';
+ divStatus.style = 'position: absolute;margin: -8px 0 0 8px;padding: 0px 1px;background-color: #ffffff;border-radius: 50%;z-index: 302;';
divStatus.textContent = icon;
let mochu = item.querySelector('.avatar');
- mochu.parentNode.insertBefore(divStatus,mochu);
+ mochu.parentNode.insertBefore(divStatus, mochu);
}
})
}
+ // 添加屏蔽按钮
+ function addBlockButton() {
+ document.querySelectorAll('[id^="favatar"]').forEach(function (item) { // 遍历所有帖子
+ let usernameLink = item.querySelector('a[href^="space-uid"]');
+ if (usernameLink) {
+ const username = usernameLink.textContent, avatar = item.querySelector('.avatar');
+ if (avatar && !avatar.parentNode.querySelector('.XIU-block-button')) {
+ // 创建屏蔽按钮
+ let blockButton = document.createElement('div');
+ blockButton.className = 'XIU-block-button';
+ blockButton.title = `屏蔽用户: ${username}`;
+ blockButton.textContent = '🚫';
+ blockButton.style.cssText = 'position: absolute;margin: -8px 0px 0px 8px;padding: 0px 0.5px;top: 0px;right: 10px;background-color: #F26C4F;border-radius: 50%;cursor: pointer;z-index: 302;box-shadow: 0 2px 4px rgba(0,0,0,0.2);transition: all 0.3s ease;';
+
+ // 鼠标悬停效果
+ if (!document.getElementById('XIU-block-style')) {
+ let blockStyle = document.createElement('style');
+ blockStyle.id = 'XIU-block-style';
+ document.documentElement.appendChild(blockStyle).textContent = '.XIU-block-button:hover{transform: scale(1.2);background-color: #ff6666;}'
+ }
+ // 点击事件
+ blockButton.addEventListener('click', function (e) {
+ e.preventDefault();
+ e.stopPropagation();
+
+ if (confirm(`确定要将用户 "${username}" 添加到黑名单吗?\n添加后该用户发布的任何内容都会被屏蔽`)) {
+ let blockList = GM_getValue('menu_customBlockUsers') || [];
+ if (!blockList.includes(username)) {
+ blockList.push(username);
+ GM_setValue('menu_customBlockUsers', blockList);
+ GM_notification({ text: `已将用户 "${username}" 添加到黑名单!\n刷新页面后生效。`, timeout: 3000 });
+
+ // 立即隐藏当前用户的帖子
+ let postElement = item.closest('[id^="post_"]');
+ if (postElement) {
+ postElement.style.opacity = '0.5';
+ postElement.style.transition = 'opacity 0.5s ease';
+ setTimeout(() => { postElement.hidden = true; }, 500);
+ }
+ } else {
+ GM_notification({ text: `用户 "${username}" 已在黑名单中!`, timeout: 2000 });
+ }
+ }
+ });
+ // 将按钮添加到头像旁边
+ avatar.parentNode.style.position = 'relative';
+ avatar.parentNode.appendChild(blockButton);
+ }
+ }
+ });
+ }
// 屏蔽阅读权限 255 的帖子
function delate255() {
if (!menu_value('menu_delate255')) return
- if (patt_forum.test(location.pathname) || location.search.indexOf('mod=forumdisplay') > -1){
+ if (patt_forum.test(location.pathname) || location.search.indexOf('mod=forumdisplay') > -1) {
document.querySelectorAll('tbody[id^="normalthread_"] .xw1').forEach(function (_this) {
if (_this.textContent === '255') {
_this.parentNode.parentNode.parentNode.hidden = true;
@@ -522,32 +525,28 @@
})
}
}
-
-
// 屏蔽投票贴
function delatePolls() {
if (!menu_value('menu_delatePolls')) return
- if (patt_forum.test(location.pathname) || location.search.indexOf('mod=forumdisplay') > -1){
+ if (patt_forum.test(location.pathname) || location.search.indexOf('mod=forumdisplay') > -1) {
document.querySelectorAll('tbody[id^="normalthread_"] .icn>a>img[alt="投票"]').forEach(function (_this) {
- _this.parentNode.parentNode.parentNode.parentNode.hidden = true;
+ _this.parentNode.parentNode.parentNode.parentNode.hidden = true;
})
}
}
-
-
// 自动翻页
function pageLoading() {
if (!menu_value('menu_pageLoading')) return
- if (curSite.SiteTypeID > 0){
+ if (curSite.SiteTypeID > 0) {
windowScroll(function (direction, e) {
if (direction === 'down') { // 下滑才准备翻页
let scrollTop = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
if (document.documentElement.scrollHeight <= document.documentElement.clientHeight + scrollTop + 999) {
if (curSite.SiteTypeID === SiteType.FORUM) { // 如果是各版块帖子列表则直接点下一页就行了
let autopbn = document.querySelector('#autopbn');
- if (autopbn && autopbn.textContent === "下一页 »"){ // 如果已经在加载中了,就忽略
+ if (autopbn && autopbn.textContent === "下一页 »") { // 如果已经在加载中了,就忽略
autopbn.click();
- let timer = setInterval(function(){ // 在下一页加载完成后
+ let timer = setInterval(function () { // 在下一页加载完成后
if (document.querySelector('#autopbn').textContent === '下一页 »') {
delate255(); // 屏蔽 255 权限帖子
delatePolls(); // 屏蔽投票贴子
@@ -565,12 +564,10 @@
});
}
}
-
-
// 滚动条事件
function windowScroll(fn1) {
var beforeScrollTop = document.documentElement.scrollTop,
- fn = fn1 || function () {};
+ fn = fn1 || function () { };
setTimeout(function () { // 延时执行,避免刚载入到页面就触发翻页事件
window.addEventListener('scroll', function (e) {
var afterScrollTop = document.documentElement.scrollTop,
@@ -581,31 +578,29 @@
}, false);
}, 1000)
}
-
-
// 修改自 https://greasyfork.org/scripts/14178 , https://github.com/machsix/Super-preloader
var ShowPager = {
getFullHref: function (e) {
- if (e != null && e.nodeType === 1 && e.href && e.href.slice(0,4) === 'http') return e.href;
+ if (e != null && e.nodeType === 1 && e.href && e.href.slice(0, 4) === 'http') return e.href;
return '';
},
createDocumentByString: function (e) {
if (e) {
if ('HTML' !== document.documentElement.nodeName) return (new DOMParser).parseFromString(e, 'application/xhtml+xml');
var t;
- try { t = (new DOMParser).parseFromString(e, 'text/html');} catch (e) {}
+ try { t = (new DOMParser).parseFromString(e, 'text/html'); } catch (e) { }
if (t) return t;
if (document.implementation.createHTMLDocument) {
t = document.implementation.createHTMLDocument('ADocument');
} else {
- try {((t = document.cloneNode(!1)).appendChild(t.importNode(document.documentElement, !1)), t.documentElement.appendChild(t.createElement('head')), t.documentElement.appendChild(t.createElement('body')));} catch (e) {}
+ try { ((t = document.cloneNode(!1)).appendChild(t.importNode(document.documentElement, !1)), t.documentElement.appendChild(t.createElement('head')), t.documentElement.appendChild(t.createElement('body'))); } catch (e) { }
}
if (t) {
var r = document.createRange(),
n = r.createContextualFragment(e);
r.selectNodeContents(document.body);
t.body.appendChild(n);
- for (var a, o = { TITLE: !0, META: !0, LINK: !0, STYLE: !0, BASE: !0}, i = t.body, s = i.childNodes, c = s.length - 1; c >= 0; c--) o[(a = s[c]).nodeName] && i.removeChild(a);
+ for (var a, o = { TITLE: !0, META: !0, LINK: !0, STYLE: !0, BASE: !0 }, i = t.body, s = i.childNodes, c = s.length - 1; c >= 0; c--) o[(a = s[c]).nodeName] && i.removeChild(a);
return t;
}
} else console.error('没有找到要转成 DOM 的字符串');
@@ -614,8 +609,8 @@
if (curSite.pager) {
let curPageEle = document.querySelector(curSite.pager.nextLink);
var url = this.getFullHref(curPageEle);
- if(url === '') return;
- if(curSite.pageUrl === url) return;// 不会重复加载相同的页面
+ if (url === '') return;
+ if (curSite.pageUrl === url) return;// 不会重复加载相同的页面
curSite.pageUrl = url;
// 读取下一页的数据
curSite.pager.startFilter && curSite.pager.startFilter();
@@ -632,9 +627,12 @@
let addTo = "beforeend";
if (curSite.pager.HT_insert[1] == 1) addTo = 'beforebegin';
// 插入新页面元素
- pageElems.forEach(function (one) {toElement.insertAdjacentElement(addTo, one);});
+ pageElems.forEach(function (one) { toElement.insertAdjacentElement(addTo, one); });
// 屏蔽用户(黑名单)
- if (patt_thread.test(location.pathname) || location.search.indexOf('mod=viewthread') > -1) {blockUsers('thread');} else if (location.pathname === '/search.php') {blockUsers('search');}
+ if (patt_thread.test(location.pathname) || location.search.indexOf('mod=viewthread') > -1) {
+ blockUsers('thread');
+ addBlockButton(); // 添加屏蔽按钮
+ } else if (location.pathname === '/search.php') { blockUsers('search'); }
delate255(); // 屏蔽 255 权限帖子
delatePolls(); // 屏蔽投票贴子
// 替换待替换元素
diff --git a/Lanzou-Enhanced.user.js b/Lanzou-Enhanced.user.js
index f0a30b9ef..ed8e63cd4 100644
--- a/Lanzou-Enhanced.user.js
+++ b/Lanzou-Enhanced.user.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 蓝奏云网盘增强
-// @version 1.5.6
+// @version 1.5.8
// @author X.I.U
// @description 文件排序、刷新不回根目录、快捷返回上一级(右键网页空白处)、后退返回上一级、右键文件显示菜单、点击直接下载文件、点击空白进入目录、自动显示更多文件、一键复制所有分享链接、自定义分享链接域名、自动打开/复制分享链接、带密码的分享链接自动输密码、拖入文件自动显示上传框、输入密码后回车确认、优化编辑框初始大小
// @match *://lanzou.com/u
@@ -52,6 +52,7 @@
// @match *://*.lanzj.com/*
// @match *://*.lanzl.com/*
// @match *://*.lanzm.com/*
+// @match *://*.lanzn.com/*
// @match *://*.lanzo.com/*
// @match *://*.lanzp.com/*
// @match *://*.lanzq.com/*
@@ -347,10 +348,10 @@
if (iframe) { // 只有找到 iframe 框架时才会继续运行脚本
iframe = iframe.contentWindow;
let timer = setInterval(function(){
- if (iframe.document.querySelector('.load>[href]')) {
- //iframe.document.querySelector('.load>a[href]').target = '_top'
- //iframe.document.querySelector('.load>a[href]').click();
- GM_openInTab(iframe.document.querySelector('.load>a[href]').href, {active: false, insert: true, setParent: false}); // 后台打开
+ if (iframe.document.querySelector('.load [href]')) {
+ //iframe.document.querySelector('.load a[href]').target = '_top'
+ //iframe.document.querySelector('.load a[href]').click();
+ GM_openInTab(iframe.document.querySelector('.load a[href]').href, {active: false, insert: true, setParent: false}); // 后台打开
clearInterval(timer);
// 关闭该后台标签页
if (GM_info.scriptHandler === 'Violentmonkey') { // Violentmonkey 需要延迟一会儿
diff --git a/README.md b/README.md
index bafb2b6bd..d59032f38 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@
## 脚本列表
-> _详细的**脚本介绍、使用说明、截图演示**等信息,请点击 **\[安装\]** 前往 GreasyFork 查看~_
+> _详细的**脚本介绍、使用说明、截图演示**等信息,请点击 **`[安装]`** 查看~(或去本项目 [Wiki](https://github.com/XIU2/UserScript/wiki) 查看_
| | 脚本名称 | 脚本功能 | 安装 \| 备用 |
| :----: | :---- | :---- | :----: |
@@ -33,7 +33,7 @@
| [
](https://www.52pojie.cn) | **吾爱破解论坛 美化** | 精简多余内容、样式优化 | **[安装](https://greasyfork.org/zh-CN/scripts/412681)** \| **[备用](https://bitbucket.org/xiu2/userscript/raw/master/52pojie-Beautification.user.js)** |
| [
](https://www.52pojie.cn) | **吾爱破解论坛 增强** | **自动签到**、自动无缝翻页、屏蔽导读悬赏贴 (最新发表页)... | **[安装](https://greasyfork.org/zh-CN/scripts/412680)** \| **[备用](https://bitbucket.org/xiu2/userscript/raw/master/52pojie-Enhanced.user.js)** |
| [
](https://hostloc.com) | **全球主机交流论坛 增强 \*** | **自动访问空间(22积分)、屏蔽用户**、屏蔽关键词、自动翻... | **[安装](https://greasyfork.org/zh-CN/scripts/414005)** \| **[备用](https://bitbucket.org/xiu2/userscript/raw/master/Hostloc-Enhanced.user.js)** |
-| [
](https://store.steampowered.com) | **Steam 创意工坊大图 修复** | 修复 Steam 创意工坊预览大图无法显示的问题 | **[安装](https://bitbucket.org/xiu2/userscript/raw/master/SteamWorkshopImageRepair.user.js)** \| **[备用](https://bitbucket.org/xiu2/userscript/raw/master/SteamWorkshopImageRepair.user.js)** |
+| [
](https://store.steampowered.com) | **Steam 创意工坊大图 修复** | 修复 Steam 创意工坊预览大图无法显示的问题 | **[安装](https://github.com/XIU2/UserScript/wiki/Steam-%E5%88%9B%E6%84%8F%E5%B7%A5%E5%9D%8A%E5%A4%A7%E5%9B%BE-%E4%BF%AE%E5%A4%8D)** \| **[备用](https://bitbucket.org/xiu2/userscript/raw/master/SteamWorkshopImageRepair.user.js)** |
| [
](https://github.com/XIU2) | **HTML5 视频音频默认音量** | 避免被 100% 音量**吓一跳**!且支持各网站分别记住音量... | **[安装](https://greasyfork.org/zh-CN/scripts/438400)** \| **[备用](https://bitbucket.org/xiu2/userscript/raw/master/HTML5Volume.user.js)** |
| [
](https://github.com/XIU2) | **右键滚动条回到顶部** | 鼠标**右键**网页右侧的**滚动条**即可**回到顶部** | **[安装](https://greasyfork.org/zh-CN/scripts/506959)** \| **[备用](https://bitbucket.org/xiu2/userscript/raw/master/RightClick_ScrollBar_BackToTop.user.js)** |
| [
](https://github.com/XIU2) | **新标签页打开链接 \*** | 将网页中所有链接改为**新标签页打开**(可能存在兼容问题 | **[安装](https://greasyfork.org/zh-CN/scripts/429714)** \| **[备用](https://bitbucket.org/xiu2/userscript/raw/master/TargetBlank.user.js)** |
@@ -49,10 +49,10 @@
## 如何安装/使用脚本?
-要使用任何脚本,首先需要浏览器安装 **Tampermonkey 脚本管理器扩展([Chrome](https://pan.lanpw.com/b073l8d1e)** / **[Firefox](https://addons.mozilla.org/firefox/addon/tampermonkey/)** / **[Edge](https://microsoftedge.microsoft.com/addons/detail/tampermonkey/iikmkjmpaadaobahmlepeloendndfphd?hl=zh-CN))。**
+要使用任何脚本,首先需要浏览器安装 **Tampermonkey 脚本管理器扩展([Chrome](https://xiu.lanzoub.com/b073l8d1e)** / **[Firefox](https://addons.mozilla.org/firefox/addon/tampermonkey/)** / **[Edge](https://microsoftedge.microsoft.com/addons/detail/tampermonkey/iikmkjmpaadaobahmlepeloendndfphd?hl=zh-CN))。**
-- 点击表格 **\[安装\]** 进入 GreasyFork 网页,点击 **\[安装脚本\]** 后弹出扩展提示,再点击 **\[安装\]** 即可。
-- 如果 GreasyFork 访问速度太慢,可以选择点击 **\[备用\]** 后弹出扩展提示,再去点击 **\[安装\]** 即可。
+- 点击表格 **`[安装]`** 进入脚本介绍页,点击 **`[安装此脚本]`** 后弹出扩展提示,再点击 **`[安装]`** 即可。
+- 如果 GreasyFork 访问速度太慢,可以选择点击 **`[备用]`** 后弹出扩展提示,再去点击 **`[安装]`** 即可。
> [!IMPORTANT]
> - _其他基于 **Chromium** 内核的浏览器(如国内套皮浏览器)一般都可以使用 Chrome 扩展。_
@@ -78,6 +78,12 @@ Tampermonkey 为了顺应 Chrome 的 Manifest V3 要求,在 v5.0.0 版本中
****
+## 新版本 Chrome 系浏览器无法运行任何脚本?
+
+新版本需要在**扩展管理**界面 Tampermonkey(篡改猴) 详情中**启用 `允许运行用户脚本`** 才能正常运行脚本!
+
+****
+
## 如果脚本帮到你的话就 "打赏" 一下吧~🎉✨

@@ -88,9 +94,6 @@ Tampermonkey 为了顺应 Chrome 的 Manifest V3 要求,在 v5.0.0 版本中
-> 该赞助者向本项目提供了**公益服务器**用以优化体验!
-> This sponsor has provided **a non-profit server** for this project to enhance the user experience!
-
## License
The GPL-3.0 License.
\ No newline at end of file
diff --git a/Zhihu-Beautification.user.js b/Zhihu-Beautification.user.js
index 528062969..584671e36 100644
--- a/Zhihu-Beautification.user.js
+++ b/Zhihu-Beautification.user.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 知乎美化
-// @version 1.5.16
+// @version 1.5.20
// @author X.I.U
// @description 宽屏显示、暗黑模式(4种)、暗黑模式跟随浏览器、屏蔽首页活动广告、隐藏文章开头大图、调整图片最大高度、向下翻时自动隐藏顶栏
// @match *://www.zhihu.com/*
@@ -44,6 +44,8 @@
}
registerMenuCommand();
addStyle();
+ // 向下翻时自动隐藏顶栏
+ if (menu_value('menu_hideTitle')) setTimeout(hideTitle, 2000);
// 注册脚本菜单
function registerMenuCommand() {
@@ -138,8 +140,10 @@
.zhihuE_SettingRoot .zhihuE_SettingHeader {padding: 10px 20px;color: #fff;font-weight: bold;background-color: #3994ff;border-radius: 3px 3px 0 0;}
.zhihuE_SettingRoot .zhihuE_SettingMain {padding: 10px 20px;border-radius: 0 0 3px 3px;}
.zhihuE_SettingHeader span {float: right;cursor: pointer;}
-.zhihuE_SettingMain input {margin: 10px 6px 10px 0;cursor: pointer;vertical-align:middle}
-.zhihuE_SettingMain label {margin-right: 20px;user-select: none;cursor: pointer;vertical-align:middle}
+.zhihuE_SettingMain input {margin: 10px 6px 10px 0;vertical-align:middle;}
+.zhihuE_SettingMain input[type=text] {margin: 5px 6px 5px 0;padding-block: 0;}
+.zhihuE_SettingMain input[name=zhihuE_Setting_Checkbox] {cursor: pointer;}
+.zhihuE_SettingMain label {margin-right: 20px;user-select: none;cursor: pointer;vertical-align:middle;}
.zhihuE_SettingMain hr {border: 0.5px solid #f4f4f4;}
[data-theme="dark"] .zhihuE_SettingRoot {color: #adbac7;background-color: #343A44;}
[data-theme="dark"] .zhihuE_SettingHeader {color: #d0d0d0;background-color: #2D333B;}
@@ -150,7 +154,7 @@
if (line) _br = '
'
for (let i=0; i${menu[i][2]}:${_br}`
+ _html += `${_br}`
} else if (GM_getValue(menu[i][0])) {
_html += `${_br}`
} else {
@@ -160,15 +164,20 @@
_html += `