css-巴哈姆特開關廣場聊天室

BAHA Chatroom Switch

  1. // ==UserScript==
  2. // @name css-巴哈姆特開關廣場聊天室
  3. // @namespace minorainy
  4. // @version 1.0.1
  5. // @author minorainy(MinoRaiNy)
  6. // @homepage https://home.gamer.com.tw/homeindex.php?owner=r831113
  7. // @match https://forum.gamer.com.tw/B.php*
  8. // @match https://forum.gamer.com.tw/C.php*
  9. // @match https://forum.gamer.com.tw/Co.php*
  10. // @grant none
  11. // @description BAHA Chatroom Switch
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. "use strict";
  16. var _defaultmode = "hide";
  17. var _ShowBlackList = [];
  18. var _HideWhiteList = [];
  19. var _HideSideChat = false;
  20. var _searchpart = location.search.split("&");
  21. var _searchpart2 = _searchpart[0].split("=");
  22. var _bsn = _searchpart2[1];
  23.  
  24. if(location.pathname == "/B.php" && _defaultmode == "hide" && _HideWhiteList.indexOf(_bsn) == -1 || location.pathname == "/B.php" && _defaultmode == "show" && _ShowBlackList.indexOf(_bsn) != -1) {
  25. var _creatediv = document.createElement("div");
  26. _creatediv.id ="toggle_button";
  27. _creatediv.setAttribute("align", "center");
  28. document.getElementById("chatRoom").insertAdjacentHTML('beforebegin',_creatediv.outerHTML);
  29. let changed = false
  30. let interval = setInterval(() => {
  31. console.log(document.getElementById('chatRoom'))
  32. if (document.getElementById('chatRoom').style.height != "0px") {
  33. changed = true
  34. document.getElementById("chatRoom").style.height = "0px";
  35. }
  36. }, 500)
  37. _createButton("show_chat_button", "開啟廣場聊天室", "toggle_button");
  38. let button = document.getElementById("show_chat_button")
  39. document.getElementById("show_chat_button").onclick = function() {
  40. clearInterval(interval)
  41. if(document.getElementById("chatRoom").style.height =="0px") {
  42. button.innerHTML = "關閉廣場聊天室";
  43. var _removechatroom = document.getElementById("chatRoom").style.height = "450px";
  44. var _removeaccogrouplist = document.getElementsByClassName("BH-rbox BH-list1 FM-rbox16");
  45. for(var x=_removeaccogrouplist.length-1;x>=0;x--) {
  46. if(_removeaccogrouplist[x] && _removeaccogrouplist[x].parentElement) {
  47. }
  48. }
  49. var _removeaccogroup = document.getElementsByTagName("h5");
  50. for(var i=_removeaccogroup.length-1;i>=0;i--) {
  51. if(_removeaccogroup[i] && _removeaccogroup[i].parentElement && _removeaccogroup[i].innerHTML == "相關群組") {
  52. _removeaccogroup[i].parentElement.removeChild(_removeaccogroup[i]);
  53. }
  54. }
  55. } else {
  56. var _createchatroom = document.createElement("div");
  57. _createchatroom.id ="chatRoom";
  58. _createchatroom.setAttribute("style", "margin-bottom:10px;");
  59. document.getElementById("chatRoom").style.height = "0px";
  60. button.innerHTML = "開啟廣場聊天室";
  61.  
  62. var im_forum = new BAHA_IM_FORUM('forum',{bsn:_bsn});
  63. }
  64. };
  65. }
  66.  
  67. if(_HideSideChat === true) {
  68. var element = document.getElementById("btn_quick");
  69. }
  70. })();
  71. function _createButton(_id, _text, _place) {
  72. var _create = document.createElement("BUTTON");
  73. _create.id = _id;
  74. _create.appendChild(document.createTextNode(_text));
  75. document.getElementById(_place).appendChild(_create);
  76. }

QingJ © 2025

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