forSPAMlol

ALIVE CHAT

  1. // ==UserScript==
  2. // @name forSPAMlol
  3. // @namespace forspamlol
  4. // @description ALIVE CHAT
  5. // @include https://www.twitch.tv/*
  6. // @version forsenE
  7. // @run-at document-end
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function(){
  12. var a, b, button, d = document, html, i, fn, fn2, fn3, fn4, timer, images, add, stor, pos, ui, sub, spamming;
  13. stor = localStorage;
  14. html = '<tr><td><input title="Real input. Supports /me, but nothing else" style="color: #eee; background: transparent; box-sizing: border-box; border: 1px solid #6441a4; width: 84px;"></td><td><input title="No. of times to repeat input" style="color: #eee; background: transparent; box-sizing: border-box; border: 1px solid #6441a4; width: 43px; margin-right: 2px;"><input title="Milliseconds between messages" style="color: #eee; background: transparent; box-sizing: border-box; border: 1px solid #6441a4; width: 43px;"></td></tr><tr><td><input title="Text to fill in between repeated input. Double click for superlongspam" style="color: #eee; background: transparent; box-sizing: border-box; border: 1px solid #6441a4; width: 84px;"></td><td style="transform: translateY(-1px); color: transparent;"><button style="background: rgb(0,200,90); box-sizing: border-box; border: 1px solid #6441a4; width: 19px; margin-right: 4px; border-radius: 2px; height: 19px;" title="Start spamming">|</button><button title="Test your message once in chat" style="background: rgb(0,150,200); box-sizing: border-box; border: 1px solid #6441a4; width: 19px; border-radius: 2px; height: 19px; margin-right: 4px;">|</button><button title="Are you a sub?" style="background: ' + (stor.subspam ? "rgb(0,200,90)" : "transparent") + '; box-sizing: border-box; border: 1px solid #6441a4; width: 19px; border-radius: 2px; height: 19px; color: rgb(255,255,0); font-weight: 900;">$</button></td></tr>';
  15. a = d.createElement("table");
  16. add = d.createElement("a");
  17. pos = 0;
  18. spamming = false;
  19. fn = function() {
  20. var _new = d.createElement("div"), process = w => {
  21. var img = d.createElement("img"), fn = e => {
  22. e.preventDefault();
  23. e.stopPropagation();
  24. if (e.button != 0) {
  25. let array, edit;
  26. array = JSON.parse(stor.spamimages);
  27. edit = array.splice(Number(e.target.dataset.pos), 1);
  28. if (e.button == 1) {
  29. add.click();
  30. edit = edit[0];
  31. i[4].value = edit[0];
  32. i[5].value = edit[1];
  33. i[6].value = edit[2];
  34. i[7].value = edit[3];
  35. i[8].value = edit[4];
  36. }
  37. e.target.remove();
  38. stor.spamimages = JSON.stringify(images = array);
  39. pos = 0;
  40. [].slice.call(d.querySelectorAll("div>img[data-pos]")).forEach(a=>{
  41. a.dataset.pos="";
  42. a.dataset.pos=pos++
  43. });
  44. } else {
  45. i[0].value = w[2];
  46. i[1].value = w[4];
  47. i[3].value = w[3];
  48. }
  49. }, fn2 = e => e.target.remove();
  50. img.setAttribute("src", w[0]);
  51. img.alt = img.title = w[1];
  52. img.onmouseup = fn;
  53. img.className = "emoticon";
  54. img.style.margin = "1px";
  55. img.style.cursor = "pointer";
  56. img.style.minWidth = img.style.minHeight = "10px";
  57. img.style.maxWidth = img.style.maxHeight = "35px";
  58. img.dataset.pos = pos++;
  59. ui.insertBefore(img, add);
  60. }, close = () => {
  61. i[4].value = i[5].value = i[6].value = i[7].value = i[8].value = "";
  62. _new.style.display = "none";
  63. add.hidden = false;
  64. };
  65. a.innerHTML = html;
  66. a.style = "width: 178px; max-width: 178px; color: #eee; margin: 0 auto -2px;";
  67. ui.appendChild(add);
  68. add.innerHTML = '<svg width="30" height="30" xmlns="http://www.w3.org/2000/svg" style="cursor: pointer; margin: 1px 0;"><g><line fill="none" stroke="#aaa" stroke-width="4" x1="4" y1="15" x2="26" y2="15"/><line fill="none" stroke="#aaa" stroke-width="4" x1="15" y1="4" x2="15" y2="26"/></g></svg>';
  69. add.title = "Add new shortcut spam. Right click on saved spam icons to remove them from the shortcuts, middle click to delete the icon and copy the spam into the editor";
  70. ui.appendChild(_new);
  71. _new.style = "display: none; margin-bottom: 2px; border-top: 1px solid #6441a4; padding: 2px 0 0 2px";
  72. _new.innerHTML = 'Icon URL: <input style="color: white; background: transparent; box-sizing: border-box; border: 1px solid #6441a4; width: 105px; margin-right: 2px; float: right;" title="Right click on the desired icon in chat then select \'Copy Image Location\'">Tooltip: &nbsp; &nbsp; &nbsp;<input style="color: white; background: transparent; box-sizing: border-box; border: 1px solid #6441a4; width: 105px; margin-right: 2px; float: right;" title="The text that appears when you hover over the icon. Optional">Input: &nbsp; &nbsp; &nbsp; &nbsp;<input title="The text you want to spam gachiBASS" style="color: white; background: transparent; box-sizing: border-box; border: 1px solid #6441a4; width: 105px; margin-right: 2px; float: right;">Fill text: <input title="Filler between the repeated input text. Optional" style="color: white; background: transparent; box-sizing: border-box; border: 1px solid #6441a4; width: 105px; margin-right: 2px; float: right;">Repeats: <input title="No. of times to repeat input" style="color: white; background: transparent; box-sizing: border-box; border: 1px solid #6441a4; width: 105px; margin-right: 2px; float: right;"><button style="background: transparent none repeat scroll 0% 0%; box-sizing: border-box; border: 1px solid #6441a4; margin-right: 12px; border-radius: 2px; height: 19px; width: 50px;">Cancel</button><button style="background: transparent none repeat scroll 0% 0%; box-sizing: border-box; border: 1px solid #6441a4; border-radius: 2px; height: 19px; width: 50px; margin-right: 12px;" title="Copy the current spam from the top into this shortcut">Copy</button><button style="background: transparent none repeat scroll 0% 0%; box-sizing: border-box; border: 1px solid #6441a4; border-radius: 2px; height: 19px; width: 50px;">Save</button>';
  73. i = ui.querySelectorAll("input");
  74. b = ui.querySelectorAll("button");
  75. i[0].value = "gachiBASS";
  76. i[1].value = "15";
  77. i[2].value = "2000";
  78. i[3].addEventListener("dblclick", () => {i[3].value="                       "}, false);
  79. b[1].onclick = fn2;
  80. b[0].onclick = fn3;
  81. add.onclick = () => {
  82. add.hidden = true;
  83. i[5].value = "New Shortcut";
  84. i[8].value = "1";
  85. _new.style.display = "block";
  86. };
  87. b[2].onclick = () => {
  88. if (stor.subspam) {
  89. stor.subspam = "";
  90. b[2].style.backgroundColor = "transparent";
  91. } else {
  92. stor.subspam = "true";
  93. b[2].style.backgroundColor = "rgb(0,200,90)";
  94. }
  95. };
  96. b[3].onclick = close;
  97. b[4].onclick = () => {
  98. i[6].value = i[0].value;
  99. i[7].value = i[3].value;
  100. i[8].value = i[1].value;
  101. };
  102. b[5].onclick = () => {
  103. var new_img = [i[4].value, i[5].value, i[6].value, i[7].value, i[8].value];
  104. try {process(new_img)}
  105. catch(e){return close()}
  106. images.push(new_img);
  107. stor.spamimages = JSON.stringify(images);
  108. close();
  109. };
  110. images.forEach(process);
  111. };
  112. fn2 = function() {
  113. var chat, m;
  114. chat = d.querySelector("#right-column .chat-input > textarea");
  115. if (!button) button = d.querySelector(".chat-buttons-container > button.button:last-of-type");
  116. m = Array(parseInt(i[1].value)).fill(i[0].value).join(" "+i[3].value+" ");
  117. if (m.substr(0, 3) === "/me") m = "/me " + m.replace(/\/me /g, "");
  118. else m = ". " + m;
  119. chat.value = m;
  120. button.click();
  121. };
  122. fn3 = function() {
  123. if (!spamming) {
  124. spamming = true;
  125. b[0].style.backgroundColor = "rgb(200,0,0)";
  126. b[0].title = "Stop spamming";
  127. fn2();
  128. timer = setInterval(fn2, Number(i[2].value));
  129. } else {
  130. spamming = false;
  131. b[0].style.backgroundColor = "rgb(0,200,90)";
  132. b[0].title = "Start spamming";
  133. clearInterval(timer);
  134. }
  135. };
  136. fn4 = function() {
  137. var cb, fancy;
  138. if (document.location.pathname.indexOf("/forsenlol") != 0) {
  139. try {
  140. ui.remove();
  141. ui = null;
  142. } catch(e){}
  143. return;
  144. }
  145. else if (document.location.pathname.indexOf("/forsenlol") == 0 && ui) return;
  146. ui = d.createElement('div');
  147. cb = function(e) {
  148. var pos = [ui.offsetLeft,ui.offsetTop], origin = getCoors(e);
  149. function getCoors(e) {
  150. var coors = new Array(2);
  151. coors[0] = e.clientX;
  152. coors[1] = e.clientY;
  153. return coors;
  154. }
  155. function moveDrag(e) {
  156. var currentPos = getCoors(e);
  157. var rect = ui.getBoundingClientRect();
  158. ui.style.right = "";
  159. var deltaX = currentPos[0] - origin[0];
  160. var deltaY = currentPos[1] - origin[1];
  161. var destX = pos[0] + deltaX;
  162. var destY = pos[1] + deltaY;
  163. if(destX < 0) destX = 0;
  164. if(destX > (d.documentElement.clientWidth - rect.width)) destX = d.documentElement.clientWidth - rect.width;
  165. if(destY < 0) destY = 0;
  166. if(destY > (d.documentElement.clientHeight - rect.height)) destY = d.documentElement.clientHeight - rect.height;
  167. ui.style.left = stor.leleft = destX + 'px';
  168. ui.style.top = stor.letop = destY + 'px';
  169. }
  170. d.onmousemove = moveDrag;
  171. d.onmouseup = function () {
  172. d.onmousemove = null;
  173. d.onmouseup = null;
  174. };
  175. return false;
  176. };
  177. ui.style.cssText = 'position: absolute; top: ' + (stor.letop || '16px') + '; ' + (stor.leleft ? ('left: '+stor.leleft+';') : 'right: 300px;') + ' width: 180px; background-color: rgb(20,20,20); color: #eee; border: 1px solid #6441a4; z-index: 9420';
  178. ui.innerHTML = '<center style="cursor: move; padding: 5px;">Forspam</center><span style="display: block; width: 100%; border-bottom-style: solid; border-bottom-width: 1px; border-color: #6441a4"></span>';
  179. d.body.appendChild(ui);
  180. ui.querySelector("center").onmousedown = cb;
  181. ui.appendChild(a);
  182. if (!stor.spamimages) {
  183. fancy = "/me ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬ forsenPls forsenPls forsenPls forsenPls forsenPls forsenPls forsenPls forsenPls forsenPls forsenPls ▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬";
  184. images = [
  185. ["//cdn.betterttv.net/emote/55e2096ea6fa8b261f81b12a/1x", "fancydance", fancy, "", 1],
  186. ["//cdn.betterttv.net/emote/5608cf93fdaf5f3275fe39cd/1x", "weebdance", fancy.replace(/forsenPls/g, "nyanPls"), "", 1],
  187. ["//cdn.betterttv.net/emote/566c9fc265dbbdab32ec053b/1x", "had to report", "/me SORRY FORSEN I HAD TO REPORT YOU", "FeelsBadMan", 4]
  188. ];
  189. stor.spamimages = JSON.stringify(images);
  190. } else {
  191. images = JSON.parse(stor.spamimages);
  192. }
  193. fn();
  194. };
  195. setInterval(fn4, 1000);
  196. }())

QingJ © 2025

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