S1 User Blocker

Block certain user's content

  1. // ==UserScript==
  2. // @name S1 User Blocker
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description Block certain user's content
  6. // @author 冰箱研会长
  7. // @match https://bbs.saraba1st.com/2b/*
  8. // @grant GM_getValue
  9. // @grant GM_setValue
  10. // @require https://gf.qytechs.cn/scripts/420061-super-gm-setvalue-and-gm-getvalue-greasyfork-mirror-js/code/Super_GM_setValue_and_GM_getValue_greasyfork_mirrorjs.js?version=890160
  11. // ==/UserScript==
  12.  
  13. function getElementByXpath(path) {
  14. return document.evaluate(path, document, null,
  15. XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  16. }
  17.  
  18.  
  19.  
  20. function Blockbutton_Appender(HtmlDiv, Block_Target, Hash_Value_P) {
  21. HtmlDiv.innerHTML = HtmlDiv.innerHTML.concat(`
  22. <form method="post" autocomplete="off" name="blackform" action="home.php?mod=spacecp&amp;ac=friend&amp;op=blacklist&amp;start=">
  23. <table class="tfm" cellspacing="0" cellpadding="0">
  24. <tbody><tr>
  25. <td>
  26. <input type="hidden" name="username" value="${Block_Target}" size="0" class="px vm">
  27. <button type="submit" name="blacklistsubmit_btn" id="moodsubmit_btn" value="true" class="pn vm"><em>加入黑名单</em></button>
  28. </td>
  29. </tr>
  30. </tbody></table>
  31. <input type="hidden" name="blacklistsubmit" value="true">
  32. <input type="hidden" name="formhash" value="${Hash_Value_P}">
  33. </form>`);
  34. }
  35.  
  36. function S1_Reply_Blocker(Hash_Value) {
  37. var PostLists = getElementByXpath(`//div[@id='postlist']`);
  38. console.log(PostLists)
  39. if (PostLists) {
  40. var PostCounter = 1;
  41. while (getElementByXpath(`//div[@id='postlist']/div[${PostCounter}]`)) {
  42. var PostAuthor = getElementByXpath(`//div[@id='postlist']/div[${PostCounter}]/table/tbody/tr[1]/td[1]/div/div[1]/div/a`);
  43. var PostAruthorColumn = getElementByXpath(`//div[@id='postlist']/div[${PostCounter}]/table[1]/tbody[1]/tr[1]/td[1]/div[1]`);
  44. if (PostAruthorColumn) {
  45. Blockbutton_Appender(PostAruthorColumn, PostAuthor.innerText, Hash_Value);
  46. }
  47. PostCounter = PostCounter + 1;
  48. }
  49. }
  50. }
  51.  
  52. function GetNSet_FormHash() {
  53. if (getElementByXpath(`//input[@name='formhash']`)) {
  54. GM_SuperValue.set(`formhash`, getElementByXpath(`//input[@name='formhash']`).value);
  55. console.log(`S1用户屏蔽脚本: HASH已经获取! ${getElementByXpath(`//input[@name='formhash']`).value}`);
  56. } else {
  57. console.log(`S1用户屏蔽脚本: 当前页面无法获取HASH!`);
  58. }
  59. }
  60.  
  61.  
  62.  
  63.  
  64.  
  65. //----------------main------------
  66. GetNSet_FormHash();
  67. var Form_Hash = GM_SuperValue.get(`formhash`, `no hash`);
  68. S1_Reply_Blocker(Form_Hash);
  69.  
  70.  
  71.  

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址