hwm_spam

hwm spam script

目前为 2024-11-07 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name hwm_spam
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.2
  5. // @author Лосось
  6. // @description hwm spam script
  7. // @match /^https{0,1}:\/\/((www|qrator|my)\.(heroeswm|lordswm)\.(ru|com)|178\.248\.235\.15)\/(sms|sms-create|home).php*/
  8. // @include /^https{0,1}:\/\/((www|qrator|my)\.(heroeswm|lordswm)\.(ru|com)|178\.248\.235\.15)\/(sms|sms-create|home).php*/
  9. // @license MIT
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. 'use strict';
  15. const create_el = (el, style, innerText, className, placeholder) => {
  16. let element = document.createElement(el);
  17. if (style) element.style = style;
  18. if (innerText) element.innerText = innerText;
  19. if (className) element.className = className;
  20. if (placeholder) element.placeholder = placeholder;
  21. return element;
  22. }
  23.  
  24. const links = ['https://my.lordswm.com', 'https://www.heroeswm.ru'];
  25. const link = location.href.slice(0, 22) === 'https://my.lordswm.com' ? links[0] : links[1];
  26.  
  27. //common styles
  28. const common_btn_style = 'border: none; padding:5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #592c08; font-family: verdana,geneva,arial cyr; text-align: center; font-weight: 700; background: url(../i/homeico/art_btn_bg_gold.png) #dab761; background-size: 100% 100%; border-radius: 5px; box-shadow: inset 0 0 0 1px #fce6b0,inset 0 0 0 2px #a78750,0 0 0 1px rgba(0,0,0,.13); line-height: 25px; cursor: pointer; transition: -webkit-filter .15s;transition: filter .15s;'
  29.  
  30. // local storage vars
  31. let spam_list = JSON.parse(localStorage.getItem('spam_list'));
  32. let subjectLS = JSON.parse(localStorage.getItem('subjectLS'));
  33. let msgLS = JSON.parse(localStorage.getItem('msgLS'));
  34. let timerLS = Number(JSON.parse(localStorage.getItem('timerLS')));
  35. let toogleStopSpam = JSON.parse(localStorage.getItem('toogleStopSpam'));
  36. let toogleStopSpamVar = toogleStopSpam;
  37. let isShowScriptLS = JSON.parse(localStorage.getItem('hwmSpamScriptToogle'));
  38. let isShowScript = isShowScriptLS;
  39.  
  40. if (!spam_list) {
  41. localStorage.setItem('spam_list', JSON.stringify([]));
  42. location.reload();
  43. }
  44. if (!subjectLS) {
  45. localStorage.setItem('subjectLS', JSON.stringify('введите тему'));
  46. location.reload();
  47. }
  48. if (!msgLS) {
  49. localStorage.setItem('msgLS', JSON.stringify('введите сообщение'));
  50. location.reload();
  51. }
  52. if (!timerLS) {
  53. localStorage.setItem('timerLS', JSON.stringify(75000));
  54. location.reload();
  55. }
  56. if (toogleStopSpam === null) {
  57. localStorage.setItem('toogleStopSpam', JSON.stringify(false));
  58. location.reload();
  59. }
  60. if (!isShowScriptLS) {
  61. localStorage.setItem('hwmSpamScriptToogle', JSON.stringify(false));
  62. }
  63.  
  64. // ui buttons
  65.  
  66. let showScriptBtn = create_el('button', `position: absolute; left: 10px; top: 2px; z-index: 999997; ${common_btn_style}`, `${isShowScript ? 'Show script' : 'Hide script'}`);
  67.  
  68. let stopSpamBtn = create_el('div', `position: absolute; left: 120px; top: 2px; z-index: 999997; ${common_btn_style}`, `${toogleStopSpam ? 'Остановить спам' : 'Продолжить спам'}`);
  69. let block = create_el('div', 'position: absolute; left: 10px; top: 40px; z-index: 999999; width: 400px; min-height: 50px; background: #f5f3ea; display: flex; flex-direction: column; align-items: center; padding: 5px;');
  70. block.style.visibility = `${isShowScript ? 'visible' : 'hidden'}`
  71.  
  72. let addInputNicks = create_el('input', 'width: 400px; height: 50px; background: transparent; border: 1px solid black; color: black; font-size: 16px; margin-bottom: 3px;','','','вставьте или введите никнеймы');
  73. let addInputNicksBtn = create_el('div', `${common_btn_style} width: 98%`, 'добавить ники');
  74.  
  75. let timerBlock = create_el('div', 'display: flex; flex-direction: column; align-items: center; gap: 5px');
  76.  
  77. let timer = create_el('div', 'color: black', `Таймер ${timerLS / 1000} сек`);
  78.  
  79. let setTimerInput = create_el('input', 'border: 1px solid black; width: 120px; height: 30px; background: transparent; color: black; border-radius: 10px; margin-top: 5px;', '','','введите таймер');
  80.  
  81. let setTimerBtn = create_el('div', `${common_btn_style} width: 100%`, 'задать таймер')
  82.  
  83. let subjectInput = create_el('input', 'width: 400px; height: 50px; background: transparent; border: 1px solid black; color: black; font-size: 16px; margin-bottom: 3px;', '','','введите тему');
  84. subjectInput.value = subjectLS;
  85. let subjectInputBtn = create_el('div', `${common_btn_style} width: 98%`, 'добавить/изменить тему');
  86.  
  87. let msgInput = create_el('textarea', 'width: 400px; height: 150px; background: transparent; border: 1px solid black; black: white; font-size: 16px; margin-bottom: 3px;', '','','введите сообщение');
  88. msgInput.value = msgLS;
  89.  
  90. let addMessageBtn = create_el('button', `${common_btn_style} margin: 5px; width: 100%`, 'Добавить/изменить сообщение');
  91. let uiList = create_el('ol');
  92.  
  93. let deleteAllNicksBtn = create_el('button', `${common_btn_style} margin: 5px; width: 100%`, 'удалить весь список');
  94.  
  95. addInputNicksBtn.addEventListener('click', () => {
  96. let text = addInputNicks.value;
  97. text = text.split(',');
  98. text = text.filter(el => el.length !== 0);
  99. text = text.map(el => el.trim());
  100. spam_list = [...spam_list, ...text];
  101. localStorage.setItem('spam_list', JSON.stringify(spam_list));
  102. location.reload();
  103. });
  104.  
  105. subjectInputBtn.addEventListener('click', (e) => {
  106. localStorage.setItem('subjectLS', JSON.stringify(subjectInput.value));
  107. location.reload();
  108. })
  109.  
  110. deleteAllNicksBtn.addEventListener('click', () => {
  111. let conf = confirm('точно удалить весь список?');
  112. if (!conf) return;
  113. spam_list = [];
  114. localStorage.setItem('spam_list', JSON.stringify(spam_list));
  115. location.reload();
  116. });
  117.  
  118. showScriptBtn.addEventListener('click', () => {
  119. isShowScript = !isShowScript;
  120. localStorage.setItem('hwmSpamScriptToogle', isShowScript);
  121. block.style.visibility = isShowScript ? 'visible' : 'hidden';
  122. showScriptBtn.innerText = `${isShowScript ? 'Show script' : 'Hide script'}`;
  123. })
  124.  
  125. stopSpamBtn.addEventListener('click', () => {
  126. toogleStopSpamVar = !toogleStopSpamVar
  127. localStorage.setItem('toogleStopSpam', toogleStopSpamVar);
  128. location.reload();
  129. })
  130.  
  131. setTimerInput.addEventListener('keypress', (e) => {
  132. if (e.key === 'Enter') {
  133. localStorage.setItem('timerLS', JSON.stringify(Number(setTimerInput.value) * 1000));
  134. location.reload();
  135. }
  136. })
  137.  
  138. setTimerBtn.addEventListener('click', (e) => {
  139. localStorage.setItem('timerLS', JSON.stringify(Number(setTimerInput.value) * 1000));
  140. location.reload();
  141. })
  142.  
  143. subjectInput.addEventListener('keypress', (e) => {
  144. if (e.key === 'Enter') {
  145. localStorage.setItem('subjectLS', JSON.stringify(subjectInput.value));
  146. location.reload();
  147. }
  148. })
  149.  
  150. addMessageBtn.addEventListener('click', () => {
  151. localStorage.setItem('msgLS', JSON.stringify(msgInput.value));
  152. location.reload();
  153. })
  154.  
  155. addInputNicks.addEventListener('keypress', (e) => {
  156. if (e.key === 'Enter') {
  157. let text = addInputNicks.value;
  158. text = text.split(',');
  159. text = text.filter(el => el.length !== 0);
  160. text = text.map(el => el.trim());
  161. spam_list = [...spam_list, ...text];
  162. localStorage.setItem('spam_list', JSON.stringify(spam_list));
  163. location.reload();
  164. }
  165. })
  166.  
  167. spam_list.forEach(el => {
  168. let li = create_el('li');
  169. let nickname = create_el('span','color: black;', el);
  170. let deleteNickBtn = create_el('button', 'cursor: pointer; margin-left: 5px; background-color: transparent; border: none;','χ');
  171. deleteNickBtn.addEventListener('click', () => {
  172. spam_list = spam_list.filter(nick => nick !== el);
  173. localStorage.setItem('spam_list', JSON.stringify(spam_list));
  174. location.reload();
  175. })
  176. li.appendChild(nickname);
  177. li.appendChild(deleteNickBtn);
  178. uiList.appendChild(li);
  179. })
  180. timerBlock.appendChild(setTimerInput);
  181. timerBlock.appendChild(setTimerBtn);
  182. timerBlock.appendChild(timer);
  183.  
  184. block.appendChild(addInputNicks);
  185. block.appendChild(addInputNicksBtn);
  186. block.appendChild(subjectInput);
  187. block.appendChild(subjectInputBtn);
  188. block.appendChild(msgInput);
  189. block.appendChild(addMessageBtn);
  190. block.appendChild(deleteAllNicksBtn);
  191. block.appendChild(timerBlock);
  192. block.appendChild(uiList);
  193. document.body.appendChild(showScriptBtn);
  194. document.body.appendChild(stopSpamBtn);
  195. document.body.appendChild(block);
  196.  
  197. if (toogleStopSpam === false) return;
  198.  
  199. if (location.href === `${link}/sms.php`) {
  200. if (spam_list.length === 0) return;
  201. location.replace(`${link}/sms-create.php`);
  202. }
  203.  
  204. if (location.href === `${link}/sms-create.php`) {
  205. if (spam_list.length === 0) return;
  206. let nickInput = document.getElementsByName("mailto")[0].value = spam_list[0];
  207.  
  208. let subjectInput = document.getElementsByName("subject")[0].value = subjectLS;
  209.  
  210. let msgInput = document.getElementsByName("msg")[0].value = msgLS;
  211.  
  212. setTimeout(() => {
  213. spam_list.shift();
  214. localStorage.setItem('spam_list', JSON.stringify(spam_list));
  215. let submitBtn = document.getElementsByName("subm")[0].click();
  216. }, timerLS);
  217. }
  218.  
  219. })();