MoveChat · Bonk.io

Adds a button to the top bar to move the chat position. Click to rotate through the four corners and full screen.

当前为 2023-01-12 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name MoveChat · Bonk.io
  3. // @namespace https://greasyfork.org/en/users/962705
  4. // @version 1.1.0
  5. // @license GPL-3.0
  6. // @description Adds a button to the top bar to move the chat position. Click to rotate through the four corners and full screen.
  7. // @author rrreddd
  8. // @match https://bonk.io/*
  9. // @run-at document-start
  10. // @grant GM_addStyle
  11. // ==/UserScript==
  12.  
  13. GM_addStyle (`
  14. #ingamechatbox {
  15. position: absolute !important;
  16. bottom: 10px !important;
  17. top: unset !important;
  18. left: 10px !important;
  19. right: unset !important;
  20. margin: 0px !important;
  21. width: 422px !important;
  22. height: 250px !important;
  23. }
  24.  
  25. #ingamechatcontent {
  26. bottom: 27px !important;
  27. top: unset !important;
  28. left: 5px !important;
  29. right: unset !important;
  30. margin: 0px !important;
  31. max-height: 250px !important;
  32. height: auto !important;
  33. width: auto !important;
  34. }
  35. `);
  36.  
  37. var chatBtn = document.createElement ('div');
  38. var topBar = document.getElementById ('pretty_top_bar');
  39. var chatBox = document.getElementById ('ingamechatbox');
  40. var chatCont = document.getElementById ('ingamechatcontent');
  41. var chatPos = 'TL';
  42.  
  43. chatBtn.setAttribute ('id', 'pretty_top_movechat');
  44. chatBtn.setAttribute ('class', 'pretty_top_button niceborderleft');
  45. topBar.appendChild (chatBtn);
  46.  
  47. chatBtn.style.cssText = (`
  48. position: absolute;
  49. top: 0;
  50. right: 290px;
  51. height: 34px;
  52. width: 58px;
  53. background-image: url(https://i.imgur.com/gXPdjBE.png);
  54. background-repeat: no-repeat;
  55. background-position: center;
  56. `);
  57.  
  58. document.getElementById ("pretty_top_movechat").addEventListener ("click", chatBtnClick, false);
  59. document.getElementById ("pretty_top_movechat").addEventListener ("mouseenter", (`
  60. function () {
  61. J4z.M7Z();
  62. var d1o = [arguments];
  63. d1o[4] = L$Fvm;
  64. if (!V5F[25][d1o[4][400]]) {
  65. if (V5F[25][d1o[4][1077]]) {
  66. V5F[39][d1o[4][1095]]();
  67. V5F[39][d1o[4][406]]();
  68. } else {
  69. ;
  70. }
  71. }
  72. };
  73. `), false);
  74.  
  75. function chatBtnClick () {
  76. switch (chatPos) {
  77. case 'BL':
  78. GM_addStyle (`
  79. #ingamechatbox {
  80. bottom: 10px !important;
  81. top: unset !important;
  82. left: 10px !important;
  83. right: unset !important;
  84. width: 422px !important;
  85. height: 250px !important;
  86. }
  87.  
  88. #ingamechatcontent {
  89. top: unset !important;
  90. max-height: 250px;
  91. }
  92. `);
  93. chatPos = 'TL';
  94. break;
  95.  
  96. case 'TL':
  97. GM_addStyle (`
  98. #ingamechatbox {
  99. bottom: unset !important;
  100. top: 10px !important;
  101. left: 10px !important;
  102. right: unset !important;
  103. width: 422px !important;
  104. height: 250px !important;
  105. }
  106.  
  107. #ingamechatcontent {
  108. top: 0px !important;
  109. }
  110. `);
  111. chatPos = 'TR';
  112. break;
  113.  
  114. case 'TR':
  115. GM_addStyle (`
  116. #ingamechatbox {
  117. bottom: unset !important;
  118. top: 10px !important;
  119. left: unset !important;
  120. right: 10px !important;
  121. width: 422px !important;
  122. height: 250px !important;
  123. }
  124.  
  125. #ingamechatcontent {
  126. top: 0px !important;
  127. }
  128. `);
  129. chatPos = 'BR';
  130. break;
  131.  
  132. case 'BR':
  133. GM_addStyle (`
  134. #ingamechatbox {
  135. bottom: 10px !important;
  136. top: unset !important;
  137. left: unset !important;
  138. right: 10px !important;
  139. width: 422px !important;
  140. height: 128px !important;
  141. }
  142.  
  143. #ingamechatcontent {
  144. top: unset !important;
  145. }
  146. `);
  147. chatPos = 'FS';
  148. break;
  149.  
  150. case 'FS':
  151. GM_addStyle (`
  152. #ingamechatbox {
  153. bottom: unset !important;
  154. top: 0px !important;
  155. left: 0px !important;
  156. right: unset !important;
  157. width: 100% !important;
  158. height: 100% !important;
  159. }
  160.  
  161. #ingamechatcontent {
  162. top: 0px !important;
  163. max-height: 100% !important;
  164. margin: 5px !important;
  165. }
  166. `);
  167. chatPos = 'BL';
  168. break;
  169. };
  170. };