|
1 | 1 | // ==UserScript== |
2 | 2 | // @name 全球主机交流论坛增强 |
3 | | -// @version 1.3.4 |
| 3 | +// @version 1.3.5 |
4 | 4 | // @author X.I.U |
5 | 5 | // @description 自动签到(访问空间 +22 积分)、屏蔽用户(黑名单)、屏蔽关键词(帖子标题)、回帖小尾巴、自动无缝翻页、快捷回到顶部(右键点击两侧空白处)、收起预览帖子(左键点击两侧空白处)、预览帖子快速回复带签名、显示是否在线、显示帖子内隐藏回复、屏蔽阅读权限 255 帖子 |
6 | 6 | // @match *://hostloc.com/* |
|
29 | 29 | ['menu_customBlockUsers', '自定义屏蔽用户', '自定义屏蔽用户', []], |
30 | 30 | ['menu_blockKeywords', '屏蔽关键词(帖子标题)', '屏蔽关键词(帖子标题)', false], |
31 | 31 | ['menu_customBlockKeywords', '自定义屏蔽关键词', '自定义屏蔽关键词', []], |
32 | | - ['menu_customLittleTail', '自定义小尾巴内容', '自定义小尾巴内容', []], |
| 32 | + ['menu_customLittleTail', '自定义小尾巴内容', '自定义小尾巴内容', ''], |
33 | 33 | ['menu_pageLoading', '自动无缝翻页(总开关)', '自动无缝翻页', true], |
34 | 34 | ['menu_thread_pageLoading', '帖子内自动翻页', '帖子内自动翻页', true], |
35 | 35 | ['menu_backToTop', '快捷回到顶部(右键点击两侧空白处)', '快捷回到顶部', true], |
|
59 | 59 | } else if (menu_ALL[i][0] === 'menu_customBlockKeywords') { |
60 | 60 | menu_ID[i] = GM_registerMenuCommand(`#️⃣ ${menu_ALL[i][1]}`, function(){customBlockKeywords()}); |
61 | 61 | } else if (menu_ALL[i][0] === 'menu_customLittleTail') { |
| 62 | + if (menu_value(menu_ALL[i][0]).length === 0) {GM_setValue(menu_ALL[i][0], '')} // 修改旧版类型 |
62 | 63 | menu_ID[i] = GM_registerMenuCommand(`#️⃣ ${menu_ALL[i][1]}`, function(){customLittleTail()}); |
63 | 64 | } else { |
64 | 65 | 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]}`)}); |
|
163 | 164 | showPosts(); // 自动显示帖子内被隐藏的回复 |
164 | 165 | blockUsers('thread'); // 屏蔽用户(黑名单) |
165 | 166 | if (menu_value('menu_onlineStatus')) onlineStatus(); // 显示是否在线 |
166 | | - littleTail('thread'); // 小尾巴 |
| 167 | + replyCustom('thread'); // 回复自定义 |
167 | 168 | } else if (patt_forum.test(location.pathname) || location.search.indexOf('mod=forumdisplay') > -1) { // 各板块帖子列表 |
168 | 169 | curSite = DBSite.forum; |
169 | 170 | if (menu_value('menu_collapsedNowPost')) collapsedNowPost(); // 收起当前帖子预览(左键左右两侧空白处) |
170 | 171 | if (menu_value('menu_delate255')) delate255(); // 自动隐藏阅读权限 255 的帖子 |
171 | 172 | blockUsers('forum'); // 屏蔽用户(黑名单) |
172 | 173 | blockKeywords(); // 屏蔽关键词(帖子标题) |
173 | 174 | vfastpostDOMNodeInserted(); // 监听插入事件(预览快速回复带签名) |
174 | | - littleTail('forum'); // 小尾巴 |
| 175 | + replyCustom('forum'); // 回复自定义 |
175 | 176 | if (patt_forum.test(location.pathname)) blockDOMNodeInserted(); //监听插入事件(有新的回复主题,点击查看) |
176 | 177 | }else if (location.search.indexOf('mod=guide') > -1) { // 导读帖子列表 |
177 | 178 | curSite = DBSite.guide; |
|
185 | 186 | } else if(location.search.indexOf('mod=space') > -1 && location.search.indexOf('&view=me') > -1) { // 别人的主题/回复 |
186 | 187 | curSite = DBSite.youreply; |
187 | 188 | } 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) { // 回复:高级回复 |
188 | | - littleTail('reply'); // 小尾巴 |
| 189 | + replyCustom('reply'); // 回复自定义 |
189 | 190 | } |
190 | 191 |
|
191 | 192 | curSite.pageUrl = ""; // 下一页URL |
|
368 | 369 | function customLittleTail() { |
369 | 370 | let newLittleTail = prompt('编辑 [自定义小尾巴内容],刷新网页后生效(换行请使用 \\n\n提示①:记得在小尾巴前面加上几个 \\n 换行,用来分隔开回帖内容~\n提示②:建议使用 [align=right] 标签来使小尾巴居右~\n提示③:支持论坛富文本标签(建议先找个回复编辑预览好~\n示例:\\n\\n\\n\\n[align=right]第一行内容~\\n第二行内容~[/align]', GM_getValue('menu_customLittleTail')); |
370 | 371 | if (newLittleTail === '') { |
371 | | - GM_setValue('menu_customLittleTail', []); |
| 372 | + GM_setValue('menu_customLittleTail', ''); |
372 | 373 | registerMenuCommand(); // 重新注册脚本菜单 |
373 | 374 | } else if (newLittleTail != null) { |
374 | 375 | GM_setValue('menu_customLittleTail', newLittleTail); |
|
377 | 378 | }; |
378 | 379 |
|
379 | 380 |
|
380 | | - // 小尾巴 |
381 | | - function littleTail(type) { |
382 | | - if (!menu_value('menu_customLittleTail')) return |
| 381 | + // 回复自定义 |
| 382 | + function replyCustom(type) { |
383 | 383 | switch(type) { |
384 | 384 | case 'forum': // 各版块帖子列表的预览帖子 |
385 | | - littleTail_0(); // 预览帖子 快速回复(底部) |
386 | | - littleTail_1(); // 预览帖子 回复(悬浮) |
| 385 | + replyCustom_0(); // 预览帖子 快速回复(底部) |
| 386 | + replyCustom_1(); // 预览帖子 回复(悬浮) |
387 | 387 | break; |
388 | 388 | case 'thread': // 帖子内 |
389 | | - littleTail_1(); // 快速回复(悬浮) |
390 | | - littleTail_2(); // 回复框(底部) |
| 389 | + replyCustom_1(); // 快速回复(悬浮) |
| 390 | + replyCustom_2(); // 回复框(底部) |
391 | 391 | break; |
392 | 392 | case 'reply': // 高级回复 |
393 | | - littleTail_3(); |
| 393 | + replyCustom_3(); |
394 | 394 | break; |
395 | 395 | } |
396 | 396 |
|
397 | | - function littleTail_0() { |
| 397 | + function replyCustom_0() { |
398 | 398 | let vfastpost = e => { |
399 | 399 | if (e.target.innerHTML && e.target.innerHTML.indexOf('id="vfastpost"') > -1) { |
400 | 400 | let message = e.target.querySelector('input[name="message"]'), id = message.id.match(/\d+/g)[0]; |
|
407 | 407 | document.addEventListener('DOMNodeInserted', vfastpost); // 监听插入事件 |
408 | 408 | } |
409 | 409 |
|
410 | | - function littleTail_1() { |
| 410 | + function replyCustom_1() { |
411 | 411 | let floatlayout_reply = e => { |
412 | 412 | if (e.target.innerHTML && e.target.innerHTML.indexOf('id="floatlayout_reply"') > -1) { |
413 | 413 | document.getElementById('postsubmit').onclick = function(){ |
|
418 | 418 | document.addEventListener('DOMNodeInserted', floatlayout_reply); // 监听插入事件 |
419 | 419 | } |
420 | 420 |
|
421 | | - function littleTail_2() { // 帖子底部的回复框 |
| 421 | + function replyCustom_2() { // 帖子底部的回复框 |
422 | 422 | document.getElementById('fastpostsubmit').onclick = function(){ |
423 | 423 | if (GM_getValue('menu_customLittleTail')) document.getElementById('fastpostmessage').value += GM_getValue('menu_customLittleTail').replaceAll('\\n', '\n'); |
424 | 424 | } |
425 | 425 | } |
426 | 426 |
|
427 | | - function littleTail_3() { |
| 427 | + function replyCustom_3() { |
428 | 428 | let postsubmit = document.getElementById('postsubmit'); |
429 | 429 | if (postsubmit && postsubmit.innerText === '\n参与/回复主题\n' || postsubmit && postsubmit.innerText === '\n发表帖子\n') { |
430 | 430 | postsubmit.onclick = function(){ |
|
0 commit comments