【工具】-屏蔽烦你的id插件

版主: huangchong

头像
supermassive楼主
职业作家
职业作家
帖子: 591
注册时间: 7月 31, 2022, 4:58 pm
昵称(选填): 泥橙

Re: [bug警告]-屏蔽烦你的id插件

帖子 supermassive楼主 »

huangchong 写了: 8月 10, 2022, 11:40 pm 要是在版面列表上也可以直接点就更好了。不过没有这功能也差不多。

是不是换个机器 黑名单列表会失效?有没有办法同步?
可以同步吧,用

代码: 全选

storage.sync.get()
我用chuanjuan老哥的脚本时是自己在笔记本里面留了一份手动同步
雅利安正牌婆罗门大厨
头像
huangchong
论坛元老
论坛元老
帖子: 25553
注册时间: 7月 22, 2022, 1:22 am
昵称(选填): 净坛使者

Re: 【工具】-屏蔽烦你的id插件

帖子 huangchong »

这个帖你们可以回复吗?
头像
supermassive楼主
职业作家
职业作家
帖子: 591
注册时间: 7月 31, 2022, 4:58 pm
昵称(选填): 泥橙

Re: 【工具】-屏蔽烦你的id插件

帖子 supermassive楼主 »

huangchong 写了: 8月 11, 2022, 4:20 pm 这个帖你们可以回复吗?
必须可以的
雅利安正牌婆罗门大厨
头像
huangchong
论坛元老
论坛元老
帖子: 25553
注册时间: 7月 22, 2022, 1:22 am
昵称(选填): 净坛使者

Re: 【工具】-屏蔽烦你的id插件

帖子 huangchong »

supermassive 写了: 8月 11, 2022, 4:22 pm 必须可以的
甚好 我刚才担心置顶以后不能回了
头像
supermassive楼主
职业作家
职业作家
帖子: 591
注册时间: 7月 31, 2022, 4:58 pm
昵称(选填): 泥橙

Re: 【工具】-屏蔽烦你的id插件

帖子 supermassive楼主 »

huangchong 写了: 8月 11, 2022, 4:24 pm 甚好 我刚才担心置顶以后不能回了
自由蓝星确实是不能回(被锁定了)
雅利安正牌婆罗门大厨
头像
huangchong
论坛元老
论坛元老
帖子: 25553
注册时间: 7月 22, 2022, 1:22 am
昵称(选填): 净坛使者

Re: 【工具】-屏蔽烦你的id插件

帖子 huangchong »

supermassive 写了: 8月 11, 2022, 4:26 pm 自由蓝星确实是不能回(被锁定了)
是的 贼啊米建议锁定 免得好像本版成天策划叛逃
头像
pia
论坛点评
论坛点评
帖子: 2715
注册时间: 7月 22, 2022, 12:55 pm

Re: 【工具】-屏蔽烦你的id插件

帖子 pia »

好像必须得登录才管用
头像
supermassive楼主
职业作家
职业作家
帖子: 591
注册时间: 7月 31, 2022, 4:58 pm
昵称(选填): 泥橙

Re: 【工具】-屏蔽烦你的id插件

帖子 supermassive楼主 »

pia 写了: 8月 13, 2022, 5:20 pm 好像必须得登录才管用
是啊,不登陆用户名的xPath不一样的,是个link,登陆后就没link了
雅利安正牌婆罗门大厨
头像
pingshantang
见习写手
见习写手
帖子: 116
注册时间: 7月 27, 2022, 1:03 pm

Re: 【工具】-屏蔽烦你的id插件

帖子 pingshantang »

谢谢。善莫大焉!终于不用看SB的帖了。
头像
pingshantang
见习写手
见习写手
帖子: 116
注册时间: 7月 27, 2022, 1:03 pm

Re: 【工具】-屏蔽烦你的id插件

帖子 pingshantang »

最大的好处是可以屏蔽SB版主
mrchabuduo
知名作家
知名作家
帖子: 810
注册时间: 7月 22, 2022, 7:21 pm

Re: 【工具】-屏蔽烦你的id插件

帖子 mrchabuduo »

屏蔽button没有显示出来
头像
huangchong
论坛元老
论坛元老
帖子: 25553
注册时间: 7月 22, 2022, 1:22 am
昵称(选填): 净坛使者

Re: 【工具】-屏蔽烦你的id插件

帖子 huangchong »

mrchabuduo 写了: 8月 27, 2022, 12:25 pm 屏蔽button没有显示出来
在帖子里才有,版面列表上没有
头像
happyvalley
著名点评
著名点评
帖子: 4614
注册时间: 8月 2, 2022, 5:35 pm

Re: 【工具】-屏蔽烦你的id插件

帖子 happyvalley »

supermassive 写了: 8月 9, 2022, 2:11 pm (Huangchong 编辑)https://www.tampermonkey.net/

从春卷老师的脚本改的,使用方法:
  • tampermonkey打开dashboard
  • 点+号,新建脚本,copy&paste
已知问题:
  • 在supernova主题下无效
  • 未登录无效
如果发现bug想要俺修,请确认是最新的脚本.
thanks for the efforts !
头像
happyvalley
著名点评
著名点评
帖子: 4614
注册时间: 8月 2, 2022, 5:35 pm

Re: 【工具】-屏蔽烦你的id插件

帖子 happyvalley »

c
上次由 happyvalley 在 11月 11, 2022, 10:24 am,总共编辑 1 次。
mrchabuduo
知名作家
知名作家
帖子: 810
注册时间: 7月 22, 2022, 7:21 pm

Re: 【工具】-屏蔽烦你的id插件

帖子 mrchabuduo »

还是不能屏蔽主题,这能屏蔽帖子
头像
huangchong
论坛元老
论坛元老
帖子: 25553
注册时间: 7月 22, 2022, 1:22 am
昵称(选填): 净坛使者

Re: 【工具】-屏蔽烦你的id插件

帖子 huangchong »

happyvalley 写了: 8月 29, 2022, 7:34 pm 装个这个extension后, 好像一会就自动登出账号, 这code里也没啥问题, 奇怪...
现在就是登出速度很快。手机放一下不看就自己登出了。跟这个插件没关系。
tmbb2010
见习点评
见习点评
帖子: 1687
注册时间: 7月 27, 2022, 4:32 am

Re: 【工具】-屏蔽烦你的id插件

帖子 tmbb2010 »

##########我来修正吧,用于屏蔽主题 2022/09/06 ########

(Huangchong 编辑)https://www.tampermonkey.net/
  • tampermonkey打开dashboard
  • 点+号,新建脚本,copy&paste
已知问题:
  • 在supernova主题下无效
  • 未登录无效
如果发现bug想要俺修,请确认是最新的脚本.

代码: 全选

      // ==UserScript==
      // @name         NewMitbbs-bot-blocker
      // @namespace    http://tampermonkey.net/
      // @version      0.2
      // @description  Manages and blocks bot generated content. Shamelessly modified from chunjuan's script at https://greasyfork.org/en/scripts/29195-mitbbs-bot-blocker/code, which was inspired by Smalltalk80's original GM script, http://userscripts-mirror.org/scripts/review/78633
      // @author       Sagittarius A*
      // @match        http://newmitbbs.com/*
      // @match        https://newmitbbs.com/*
      // @grant        GM_addStyle
      // @run-at       document-idle
      // ==/UserScript==
      // debugger;
      (function() {
        'use strict';

        var storageKey = 'new.mitbbs.blocklist';
        
        function getBlocklist() {
          var blockList = localStorage.getItem(storageKey);
          if (blockList === null) {
            setBlocklist([]);
            blockList = localStorage.getItem(storageKey);
          }

          try {
            blockList = JSON.parse(blockList);
          } catch (error) {
            blockList = [];
            setBlocklist(blockList);
          }

          blockList = Array.isArray(blockList) ? blockList : [];
          return blockList;
        }

        function setBlocklist(idNameList) {
          // remove duplicate items
          // todo: babel output for this one doesn't really work, have to revert back to old fashion way
          // idNameList = [...new Set(idNameList)]
          var uniqueidNameList = idNameList.filter(function (elem, index, self) {
            return index === self.indexOf(elem);
          });
          uniqueidNameList = uniqueidNameList.sort(function (a, b) {
            // defer from localeCompare for better browser support
            if (a.toLowerCase() < b.toLowerCase()) return -1;
            if (a.toLowerCase() > b.toLowerCase()) return 1;
            return 0;
          });
          localStorage.setItem(storageKey, JSON.stringify(uniqueidNameList));
          document.getElementById('blockListInput').value = uniqueidNameList;
        }

        function getBlockFlag() {
          var blockFlag = localStorage.getItem(storageKey + '.flag');
          if (blockFlag === null) {
            setBlockFlag(0);
            blockFlag = localStorage.getItem(storageKey + '.flag');
          }
          //  js, just being js
          return parseInt(blockFlag);
        }

        function setBlockFlag(flag) {
          localStorage.setItem(storageKey + '.flag', flag);
        }

        function changePostVisibility() {
          var blockList = getBlocklist();
          var flag = getBlockFlag();
          // if list is not empty
          var counter = 0;
          if (blockList) {
            var taolunDiv = document.querySelector('div.forumbg:not(.announcement)');
            // yeah yeah yeah magic number, whatever
            // this will miss the first one though, nice try langfang coder
            var userIDtdNodeList = taolunDiv.querySelectorAll('li.row');
            userIDtdNodeList.forEach(function (td) {
              // damn, now i miss jquery/zepto
              var id = td.querySelector('div.responsive-show').querySelector('span.username').textContent;
              //  reset all reply to visible. This is a hack-ish method to fix content not being displayed after userID has been removed from blocklist.
              //  TODO: maybe in the near future, we should keep a local copy of blocklist so that we can compare the changes and show/hide content intelligently, maybe
              td.style.display = '';
              //  yeah, nested if statements
              if (blockList.indexOf(id) > -1) {
                if (flag) {
                  td.style.display = 'none';
                  counter += 1;
                } else {
                  td.style.display = '';
                }
              }
            });
            counter = flag ? counter : 0;
            document.getElementById('blockCounter').innerHTML = counter;
          }
        }

        function changeReplyVisibility() {
          //  now we on individual post page
          var blockList = getBlocklist();
          var flag = getBlockFlag();
          var counter = 0;
          var sideBarBG = document.querySelectorAll('div.post.has-profile');
          sideBarBG.forEach(function (reply) {
            // var post = reply.parentElement.parentElement.parentElement.parentElement.parentElement;
            var userID = reply.querySelector('span.username').textContent;
            //  another magic number!
            var userMenu = reply.querySelector('strong');
            var hasButton = userMenu.querySelector('span.button') !== null;
            if (!hasButton) {
              var blockButton = document.createElement('span');
              blockButton.setAttribute('class', 'button');
              blockButton.innerHTML = '&nbsp;&nbsp;<button class="addToBlock" title="' + userID + '">屏蔽!</button>';
              userMenu.appendChild(blockButton); 
            }
            if(!flag) userMenu.querySelector('span.button').style.display = 'none';
            else userMenu.querySelector('span.button').style.display = '';
            //  reset all reply to visible. This is a hack-ish method to fix content not being displayed after userID has been removed from blocklist.
            //  TODO: maybe in the near future, we should keep a local copy of blocklist so that we can compare the changes and show/hide content intelligently, maybe
            reply.style.display = '';
            if (blockList.indexOf(userID) > -1) {
              if (flag) {
                reply.style.display = 'none';
                counter += 1;
              } else {
                reply.style.display = '';
              }
            }
            counter = flag ? counter : 0;
            document.getElementById('blockCounter').innerHTML = counter;
          });

          var allBlockButton = document.querySelectorAll('.addToBlock');
          Array.from(allBlockButton).forEach(function (button) {
            var userID = button.getAttribute('title');
            button.addEventListener('click', function () {
              var yesBlock = confirm('Block ' + userID + ' ?');
              if (yesBlock) {
                blockList.push(userID);
                setBlocklist(blockList);
                document.getElementById('blockListInput').value = getBlocklist().join();
                // toggleBlockedContent();
                // copy & paste from above code to refresh the page with newly added id
                sideBarBG.forEach(function (reply) {
                  // var post = reply.parentElement.parentElement.parentElement.parentElement.parentElement;
                  var userID = reply.querySelector('span.username').textContent;
                  //  another magic number!
                  var userMenu = reply.querySelector('strong');
                  var hasButton = userMenu.querySelector('span.button') !== null;
                  if (!hasButton) {
                    var blockButton = document.createElement('span');
                    blockButton.setAttribute('class', 'button');
                    blockButton.innerHTML = '&nbsp;&nbsp;<button class="addToBlock" title="' + userID + '">屏蔽!</button>';
                    userMenu.appendChild(blockButton); 
                  }
                  if(!flag) userMenu.querySelector('span.button').style.display = 'none';
                  else userMenu.querySelector('span.button').style.display = '';
                  //  reset all reply to visible. This is a hack-ish method to fix content not being displayed after userID has been removed from blocklist.
                  //  TODO: maybe in the near future, we should keep a local copy of blocklist so that we can compare the changes and show/hide content intelligently, maybe
                  reply.style.display = '';
                  if (blockList.indexOf(userID) > -1) {
                    if (flag) {
                      reply.style.display = 'none';
                      counter += 1;
                    } else {
                      reply.style.display = '';
                    }
                  }
                  counter = flag ? counter : 0;
                  document.getElementById('blockCounter').innerHTML = counter;
                });
              }
            });
          });
        }

        function toggleBlockedContent() {
          document.getElementById('isBlocking').checked ? setBlockFlag(1) : setBlockFlag(0);
          var pageType = locationGuesser();
          switch (pageType) {
            case 1:
              changeReplyVisibility();
              break;
            case -1:
              changePostVisibility();
              break;
          }
        }

        function locationGuesser() {
          var pageType = void 0;
          var url = window.location.href;
          if (url.indexOf('viewtopic') > -1) {
            pageType = 1;
          } else if (url.indexOf('viewforum') > -1) {
            pageType = -1;
          } else {
            pageType = 0;
          }

          return pageType;
        }

        // callback for when clicking 黑名单 button
        function changeBlockListVisibility() {
          var notVisible = document.getElementById('blockListPop').style.display === 'none';
          if (notVisible) {
            // show block list pop up
            document.getElementById('blockListInput').value = getBlocklist().join();
            document.getElementById('blockListPop').style.display = '';
          } else {
            // close block list pop up
            document.getElementById('blockListPop').style.display = 'none';
            // update blocklist when closing the pop up
            updateBlockList();
          }
        }

        function updateBlockList() {
          var newBlockList = document.getElementById('blockListInput').value;
          //  remove line break, space, trailing comma
          newBlockList = newBlockList.replace(/(\r\n|\n|\r)/gm, '').replace(/\s/g, '').replace(/,+$/, '');
          newBlockList = newBlockList.split(',');
          setBlocklist(newBlockList);

          // re-filter existing content
          toggleBlockedContent();
        }

        function hideBlockList() {
          document.getElementById('blockListPop').style.display = 'none';
        }

        function prepPage() {
          var flag = getBlockFlag();
          getBlocklist();
          if (flag) {
            document.getElementById('isBlocking').checked = true;
            toggleBlockedContent();
          }
        }

        function pageOnLoad() {
          //  build blocker control gui
          var blockerDiv = document.createElement('div');
          blockerDiv.innerHTML = '<button id="showBlocklist" class="button">黑名单</button><input type="checkbox" id="isBlocking" /><span id="blockCounter" title="Currently Blocked"></span>';
          blockerDiv.style.cssText = 'position:fixed; bottom:2em; right:0.5em; width:9em; padding:0.5em; border-radius:0.25em; background-color:#D7EAF9; box-shadow:2px 2px 4px 0px rgba(0,0,0,0.5); text-align:center; cursor:pointer;';
          document.body.appendChild(blockerDiv);

          document.getElementById('showBlocklist').addEventListener('click', changeBlockListVisibility);
          document.getElementById('blockCounter').style.cssText = 'padding:0 4px; font-weight:bold';
          document.getElementById('isBlocking').addEventListener('change', toggleBlockedContent);

          //  block list
          var blockListDiv = document.createElement('div');
          blockListDiv.setAttribute('id', 'blockListPop');
          blockListDiv.innerHTML = '<span>修改ID,用逗号分隔,大小写敏感!</span>' + '<br/>' + '<textarea rows="10" cols="40" id="blockListInput" style="background-color:orange;color:black;font-size:10pt;"></textarea>' + '<br/>' + '<button id="updateBlockList">Update</button><span style="width:2em"></span><button id="closePop">Close</button>';
          blockListDiv.style.cssText = 'position:fixed; bottom:5.3em; right:0.5em; padding:0.5em; border-radius:0.25em; background-color:#D7EAF9; box-shadow:2px 2px 4px 0px rgba(0,0,0,0.5); text-align:center; display:none';
          document.body.appendChild(blockListDiv);
          document.getElementById('updateBlockList').addEventListener('click', updateBlockList);
          document.getElementById('closePop').addEventListener('click', hideBlockList);

          prepPage();
        }

        function ready(fn) {
          if (document.readyState !== 'loading') {
            fn();
          } else {
            document.addEventListener('DOMContentLoaded', fn);
          }
        }

        ready(pageOnLoad);
        })();
Hof
论坛点评
论坛点评
Hof 的博客
帖子: 2089
注册时间: 8月 15, 2022, 3:09 am

Re: 【工具】-屏蔽烦你的id插件

帖子 Hof »

EDIT: 发现还是需要滴
---
谢分享,老站我也写个GM script,主要是机器人和网管BM无力,
不过NMB还需要这个吗?我还没看见需要屏蔽的,骂人发黄文的,已举报,马上就办了。
supermassive 写了: 8月 9, 2022, 2:11 pm (Huangchong 编辑)https://www.tampermonkey.net/

从春卷老师的脚本改的,使用方法:
  • tampermonkey打开dashboard
  • 点+号,新建脚本,copy&paste
已知问题:
  • 在supernova主题下无效
  • 未登录无效
如果发现bug想要俺修,请确认是最新的脚本.

代码: 全选

      // ==UserScript==
      // @name         NewMitbbs-bot-blocker
      // @namespace    http://tampermonkey.net/
      // @version      0.1
      // @description  Manages and blocks bot generated content. Shamelessly modified from chunjuan's script at https://greasyfork.org/en/scripts/29195-mitbbs-bot-blocker/code, which was inspired by Smalltalk80's original GM script, http://userscripts-mirror.org/scripts/review/78633
      // @author       Sagittarius A*
      // @match        http://newmitbbs.com/*
      // @match        https://newmitbbs.com/*
      // @grant        GM_addStyle
      // @run-at       document-idle
      // ==/UserScript==
      // debugger;
      (function() {
        'use strict';

        var storageKey = 'new.mitbbs.blocklist';
        
        function getBlocklist() {
          var blockList = localStorage.getItem(storageKey);
          if (blockList === null) {
            setBlocklist([]);
            blockList = localStorage.getItem(storageKey);
          }

          try {
            blockList = JSON.parse(blockList);
          } catch (error) {
            blockList = [];
            setBlocklist(blockList);
          }

          blockList = Array.isArray(blockList) ? blockList : [];
          return blockList;
        }

        function setBlocklist(idNameList) {
          // remove duplicate items
          // todo: babel output for this one doesn't really work, have to revert back to old fashion way
          // idNameList = [...new Set(idNameList)]
          var uniqueidNameList = idNameList.filter(function (elem, index, self) {
            return index === self.indexOf(elem);
          });
          uniqueidNameList = uniqueidNameList.sort(function (a, b) {
            // defer from localeCompare for better browser support
            if (a.toLowerCase() < b.toLowerCase()) return -1;
            if (a.toLowerCase() > b.toLowerCase()) return 1;
            return 0;
          });
          localStorage.setItem(storageKey, JSON.stringify(uniqueidNameList));
          document.getElementById('blockListInput').value = uniqueidNameList;
        }

        function getBlockFlag() {
          var blockFlag = localStorage.getItem(storageKey + '.flag');
          if (blockFlag === null) {
            setBlockFlag(0);
            blockFlag = localStorage.getItem(storageKey + '.flag');
          }
          //  js, just being js
          return parseInt(blockFlag);
        }

        function setBlockFlag(flag) {
          localStorage.setItem(storageKey + '.flag', flag);
        }

        function changePostVisibility() {
          var blockList = getBlocklist();
          var flag = getBlockFlag();
          // if list is not empty
          var counter = 0;
          if (blockList) {
            var taolunDiv = document.querySelector('div.forumbg:not(.announcement)');
            // yeah yeah yeah magic number, whatever
            // this will miss the first one though, nice try langfang coder
            var userIDtdNodeList = taolunDiv.querySelectorAll('li.row');
            userIDtdNodeList.forEach(function (td) {
              // damn, now i miss jquery/zepto
              var id = td.querySelector('div.topic-poster').querySelector('span.username').textContent;
              //  reset all reply to visible. This is a hack-ish method to fix content not being displayed after userID has been removed from blocklist.
              //  TODO: maybe in the near future, we should keep a local copy of blocklist so that we can compare the changes and show/hide content intelligently, maybe
              td.style.display = '';
              //  yeah, nested if statements
              if (blockList.indexOf(id) > -1) {
                if (flag) {
                  td.style.display = 'none';
                  counter += 1;
                } else {
                  td.style.display = '';
                }
              }
            });
            counter = flag ? counter : 0;
            document.getElementById('blockCounter').innerHTML = counter;
          }
        }

        function changeReplyVisibility() {
          //  now we on individual post page
          var blockList = getBlocklist();
          var flag = getBlockFlag();
          var counter = 0;
          var sideBarBG = document.querySelectorAll('div.post.has-profile');
          sideBarBG.forEach(function (reply) {
            // var post = reply.parentElement.parentElement.parentElement.parentElement.parentElement;
            var userID = reply.querySelector('span.username').textContent;
            //  another magic number!
            var userMenu = reply.querySelector('strong');
            var hasButton = userMenu.querySelector('span.button') !== null;
            if (!hasButton) {
              var blockButton = document.createElement('span');
              blockButton.setAttribute('class', 'button');
              blockButton.innerHTML = '&nbsp;&nbsp;<button class="addToBlock" title="' + userID + '">屏蔽!</button>';
              userMenu.appendChild(blockButton); 
            }
            if(!flag) userMenu.querySelector('span.button').style.display = 'none';
            else userMenu.querySelector('span.button').style.display = '';
            //  reset all reply to visible. This is a hack-ish method to fix content not being displayed after userID has been removed from blocklist.
            //  TODO: maybe in the near future, we should keep a local copy of blocklist so that we can compare the changes and show/hide content intelligently, maybe
            reply.style.display = '';
            if (blockList.indexOf(userID) > -1) {
              if (flag) {
                reply.style.display = 'none';
                counter += 1;
              } else {
                reply.style.display = '';
              }
            }
            counter = flag ? counter : 0;
            document.getElementById('blockCounter').innerHTML = counter;
          });

          var allBlockButton = document.querySelectorAll('.addToBlock');
          Array.from(allBlockButton).forEach(function (button) {
            var userID = button.getAttribute('title');
            button.addEventListener('click', function () {
              var yesBlock = confirm('Block ' + userID + ' ?');
              if (yesBlock) {
                blockList.push(userID);
                setBlocklist(blockList);
                document.getElementById('blockListInput').value = getBlocklist().join();
                // toggleBlockedContent();
                // copy & paste from above code to refresh the page with newly added id
                sideBarBG.forEach(function (reply) {
                  // var post = reply.parentElement.parentElement.parentElement.parentElement.parentElement;
                  var userID = reply.querySelector('span.username').textContent;
                  //  another magic number!
                  var userMenu = reply.querySelector('strong');
                  var hasButton = userMenu.querySelector('span.button') !== null;
                  if (!hasButton) {
                    var blockButton = document.createElement('span');
                    blockButton.setAttribute('class', 'button');
                    blockButton.innerHTML = '&nbsp;&nbsp;<button class="addToBlock" title="' + userID + '">屏蔽!</button>';
                    userMenu.appendChild(blockButton); 
                  }
                  if(!flag) userMenu.querySelector('span.button').style.display = 'none';
                  else userMenu.querySelector('span.button').style.display = '';
                  //  reset all reply to visible. This is a hack-ish method to fix content not being displayed after userID has been removed from blocklist.
                  //  TODO: maybe in the near future, we should keep a local copy of blocklist so that we can compare the changes and show/hide content intelligently, maybe
                  reply.style.display = '';
                  if (blockList.indexOf(userID) > -1) {
                    if (flag) {
                      reply.style.display = 'none';
                      counter += 1;
                    } else {
                      reply.style.display = '';
                    }
                  }
                  counter = flag ? counter : 0;
                  document.getElementById('blockCounter').innerHTML = counter;
                });
              }
            });
          });
        }

        function toggleBlockedContent() {
          document.getElementById('isBlocking').checked ? setBlockFlag(1) : setBlockFlag(0);
          var pageType = locationGuesser();
          switch (pageType) {
            case 1:
              changeReplyVisibility();
              break;
            case -1:
              changePostVisibility();
              break;
          }
        }

        function locationGuesser() {
          var pageType = void 0;
          var url = window.location.href;
          if (url.indexOf('viewtopic') > -1) {
            pageType = 1;
          } else if (url.indexOf('viewforum') > -1) {
            pageType = -1;
          } else {
            pageType = 0;
          }

          return pageType;
        }

        // callback for when clicking 黑名单 button
        function changeBlockListVisibility() {
          var notVisible = document.getElementById('blockListPop').style.display === 'none';
          if (notVisible) {
            // show block list pop up
            document.getElementById('blockListInput').value = getBlocklist().join();
            document.getElementById('blockListPop').style.display = '';
          } else {
            // close block list pop up
            document.getElementById('blockListPop').style.display = 'none';
            // update blocklist when closing the pop up
            updateBlockList();
          }
        }

        function updateBlockList() {
          var newBlockList = document.getElementById('blockListInput').value;
          //  remove line break, space, trailing comma
          newBlockList = newBlockList.replace(/(\r\n|\n|\r)/gm, '').replace(/\s/g, '').replace(/,+$/, '');
          newBlockList = newBlockList.split(',');
          setBlocklist(newBlockList);

          // re-filter existing content
          toggleBlockedContent();
        }

        function hideBlockList() {
          document.getElementById('blockListPop').style.display = 'none';
        }

        function prepPage() {
          var flag = getBlockFlag();
          getBlocklist();
          if (flag) {
            document.getElementById('isBlocking').checked = true;
            toggleBlockedContent();
          }
        }

        function pageOnLoad() {
          //  build blocker control gui
          var blockerDiv = document.createElement('div');
          blockerDiv.innerHTML = '<button id="showBlocklist" class="button">黑名单</button><input type="checkbox" id="isBlocking" /><span id="blockCounter" title="Currently Blocked"></span>';
          blockerDiv.style.cssText = 'position:fixed; bottom:2em; right:0.5em; width:9em; padding:0.5em; border-radius:0.25em; background-color:#D7EAF9; box-shadow:2px 2px 4px 0px rgba(0,0,0,0.5); text-align:center; cursor:pointer;';
          document.body.appendChild(blockerDiv);

          document.getElementById('showBlocklist').addEventListener('click', changeBlockListVisibility);
          document.getElementById('blockCounter').style.cssText = 'padding:0 4px; font-weight:bold';
          document.getElementById('isBlocking').addEventListener('change', toggleBlockedContent);

          //  block list
          var blockListDiv = document.createElement('div');
          blockListDiv.setAttribute('id', 'blockListPop');
          blockListDiv.innerHTML = '<span>修改ID,用逗号分隔,大小写敏感!</span>' + '<br/>' + '<textarea rows="10" cols="40" id="blockListInput" style="background-color:orange;color:black;font-size:10pt;"></textarea>' + '<br/>' + '<button id="updateBlockList">Update</button><span style="width:2em"></span><button id="closePop">Close</button>';
          blockListDiv.style.cssText = 'position:fixed; bottom:5.3em; right:0.5em; padding:0.5em; border-radius:0.25em; background-color:#D7EAF9; box-shadow:2px 2px 4px 0px rgba(0,0,0,0.5); text-align:center; display:none';
          document.body.appendChild(blockListDiv);
          document.getElementById('updateBlockList').addEventListener('click', updateBlockList);
          document.getElementById('closePop').addEventListener('click', hideBlockList);

          prepPage();
        }

        function ready(fn) {
          if (document.readyState !== 'loading') {
            fn();
          } else {
            document.addEventListener('DOMContentLoaded', fn);
          }
        }

        ready(pageOnLoad);
        })();
上次由 Hof 在 9月 11, 2022, 2:27 pm,总共编辑 1 次。
I would recommend all to write in English, in order to make it a bit difficult for MaskMan to manipulate this community.
头像
(ヅ)
著名点评
著名点评
帖子: 5022
注册时间: 8月 21, 2022, 2:20 pm

Re: 【工具】-屏蔽烦你的id插件

帖子 (ヅ) »

这个插件是不是坏了,用ne-blackscreen主题在版面无效;在帖子内部有效.
图片
头像
huangchong
论坛元老
论坛元老
帖子: 25553
注册时间: 7月 22, 2022, 1:22 am
昵称(选填): 净坛使者

Re: 【工具】-屏蔽烦你的id插件

帖子 huangchong »

(ヅ) 写了: 9月 9, 2022, 6:45 pm 这个插件是不是坏了,用ne-blackscreen主题在版面无效;在帖子内部有效.
军版有人说,把这个改改,还能去屏蔽youtube的恶心推荐
回复

回到 “肚皮舞运动(Joke)”