巴哈姆特之在C頁封鎖他人

在C頁的使用者名稱後面新增「封鎖此人」按鈕,以在不進對方小屋前提下封鎖該使用者。

  1. // ==UserScript==
  2. // @name 巴哈姆特之在C頁封鎖他人
  3. // @description 在C頁的使用者名稱後面新增「封鎖此人」按鈕,以在不進對方小屋前提下封鎖該使用者。
  4. // @namespace nathan60107
  5. // @version 1.1
  6. // @author nathan60107(貝果)
  7. // @homepage https://home.gamer.com.tw/homeindex.php?owner=nathan60107
  8. // @match *forum.gamer.com.tw/C*
  9. // @icon https://www.google.com/s2/favicons?domain=gamer.com.tw
  10. // @grant GM_xmlhttpRequest
  11. // @connect gamer.com.tw
  12. // @run-at document-end
  13. // @noframes
  14. // ==/UserScript==
  15.  
  16. (function() {
  17. document.block_button = function (uid){
  18. Dialogify.confirm(`確定封鎖${uid}?`, {
  19. ok: function(){
  20. document.block_user(uid);
  21. },
  22. });
  23. }
  24.  
  25. document.block_user = function(uid){
  26. Dialogify.alert('處理中,請稍候')
  27.  
  28. GM_xmlhttpRequest({
  29. method: "GET",
  30. url: "https://ani.gamer.com.tw/ajax/getCSRFToken.php",
  31. cache: false,
  32. onload: token => {
  33. GM_xmlhttpRequest({
  34. url: 'https://ani.gamer.com.tw/ajax/blackUser.php',
  35. headers: {
  36. "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
  37. },
  38. data: `fid=${uid}&con=0&token=${token.response}`,
  39. responseType: "json",
  40. cache: false,
  41. method: 'POST',
  42. onload: function final(rdata) {
  43. Dialogify.closeAll()
  44. if (rdata.response.error) {
  45. Dialogify.alert(rdata.response.msg)
  46. } else {
  47. Dialogify.alert("封鎖成功")
  48. }
  49. }
  50. })
  51. }
  52. });
  53. };
  54.  
  55. for(let user of jQuery(".c-post__header__author")){
  56. let uid = jQuery(user).find(".userid")[0].innerText
  57. jQuery(user).append(`
  58. <a class="floor tippy-gpbp" data-tooltipped="" data-original-title="封鎖此人" onclick="event.stopPropagation(); block_button('${uid}')">
  59. 封鎖此人
  60. </a>
  61. `)
  62. }
  63. })();

QingJ © 2025

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