hwm_spam

hwm spam script

目前为 2023-11-08 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name hwm_spam
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  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.  
  16. let spam_list = JSON.parse(localStorage.getItem('spam_list'));
  17. let subjectLS = JSON.parse(localStorage.getItem('subjectLS'));
  18. let msgLS = JSON.parse(localStorage.getItem('msgLS'));
  19. let timerLS = Number(JSON.parse(localStorage.getItem('timerLS')));
  20.  
  21. if (!spam_list) {
  22. localStorage.setItem('spam_list', JSON.stringify([]));
  23. location.reload();
  24. }
  25. if (!subjectLS) {
  26. localStorage.setItem('subjectLS', JSON.stringify('введите тему'));
  27. location.reload();
  28. }
  29. if (!msgLS) {
  30. localStorage.setItem('msgLS', JSON.stringify('введите сообщение'));
  31. location.reload();
  32. }
  33. if (!timerLS) {
  34. localStorage.setItem('timerLS', JSON.stringify(60000));
  35. location.reload();
  36. }
  37.  
  38. let showScriptBtn = document.createElement('button');
  39. showScriptBtn.innerText = 'Spam script';
  40. showScriptBtn.style = 'position: absolute; left: 10px; top: 2px; z-index: 999998; '
  41.  
  42. let isShowScriptLS = JSON.parse(localStorage.getItem('hwmSpamScriptToogle'));
  43. let isShowScript = isShowScriptLS;
  44. if (!isShowScriptLS) {
  45. localStorage.setItem('hwmSpamScriptToogle', JSON.stringify(false));
  46. }
  47.  
  48. showScriptBtn.addEventListener('click', () => {
  49. isShowScript = !isShowScript;
  50. localStorage.setItem('hwmSpamScriptToogle', isShowScript);
  51. block.style.visibility = isShowScript ? 'visible' : 'hidden';
  52. })
  53.  
  54. let block = document.createElement('div');
  55. block.style = 'position: absolute; left: 10px; top: 24px; z-index: 999999; width: 400px; min-height: 50px; background: rgb(238,174,202); background: radial-gradient(circle, rgba(238,174,202,1) 0%, rgba(148,187,233,1) 100%); display: flex; flex-direction: column; align-items: center;';
  56. block.style.visibility = isShowScript ? 'visible' : 'hidden';
  57.  
  58. let addInputNicks = document.createElement('input');
  59. addInputNicks.style = 'width: 400px; height: 50px; background: transparent; border: 1px solid white; color: white; font-size: 16px; margin-bottom: 3px;';
  60. addInputNicks.placeholder = 'вставьте или введите никнеймы';
  61.  
  62. let subjectInput = document.createElement('input');
  63. subjectInput.value = subjectLS;
  64. subjectInput.placeholder = 'введите тему';
  65. subjectInput.style = 'width: 400px; height: 50px; background: transparent; border: 1px solid white; color: white; font-size: 16px; margin-bottom: 3px;';
  66.  
  67. subjectInput.addEventListener('keypress', (e) => {
  68. if (e.key === 'Enter') {
  69. localStorage.setItem('subjectLS', JSON.stringify(subjectInput.value));
  70. location.reload();
  71. }
  72. })
  73.  
  74. let msgInput = document.createElement('textarea');
  75. msgInput.value = msgLS;
  76. msgInput.placeholder = 'введите сообщение';
  77. msgInput.style = 'width: 400px; height: 150px; background: transparent; border: 1px solid white; color: white; font-size: 16px; margin-bottom: 3px;';
  78.  
  79. let addMessageBtn = document.createElement('button');
  80. addMessageBtn.innerText = 'Добавить/изменить сообщение';
  81. addMessageBtn.style = 'border: 1px solid white; background: pink; width: 250px; height: 30px; margin-top: 1px; margin-bottom: 3px; cursor: pointer; font-weigth: bold; color: white; border-radius: 10px;'
  82.  
  83. addMessageBtn.addEventListener('click', () => {
  84. localStorage.setItem('msgLS', JSON.stringify(msgInput.value));
  85. location.reload();
  86. })
  87.  
  88. let uiList = document.createElement('ol');
  89. uiList.style = '';
  90.  
  91. let deleteAllNicksBtn = document.createElement('button');
  92. deleteAllNicksBtn.innerText = 'удалить весь список';
  93. deleteAllNicksBtn.style = 'border: 1px solid white; width: 140px; height: 50px; background: transparent; color: white; cursor: pointer; border-radius: 10px;';
  94. deleteAllNicksBtn.addEventListener('click', () => {
  95. let conf = confirm('точно удалить весь список?');
  96. if (!conf) return;
  97. spam_list = [];
  98. localStorage.setItem('spam_list', JSON.stringify(spam_list));
  99. location.reload();
  100. });
  101.  
  102. spam_list.forEach(el => {
  103. let li = document.createElement('li');
  104. let nickname = document.createElement('span');
  105. let deleteNickBtn = document.createElement('button');
  106. deleteNickBtn.style = 'border: 1px dotted red; border-radius: 50%; cursor: pointer; margin-left: 5px;'
  107. deleteNickBtn.innerText = 'x';
  108. nickname.innerText = el;
  109. nickname.style = 'color: white;';
  110. deleteNickBtn.addEventListener('click', () => {
  111. spam_list = spam_list.filter(nick => nick !== el);
  112. localStorage.setItem('spam_list', JSON.stringify(spam_list));
  113. location.reload();
  114. })
  115. li.appendChild(nickname);
  116. li.appendChild(deleteNickBtn);
  117. uiList.appendChild(li);
  118. })
  119.  
  120. addInputNicks.addEventListener('keypress', (e) => {
  121. if (e.key === 'Enter') {
  122. let text = addInputNicks.value;
  123. text = text.split(',');
  124. text = text.filter(el => el.length !== 0);
  125. text = text.map(el => el.trim());
  126. spam_list = [...spam_list, ...text];
  127. localStorage.setItem('spam_list', JSON.stringify(spam_list));
  128. location.reload();
  129. }
  130. })
  131.  
  132. block.appendChild(addInputNicks);
  133. block.appendChild(subjectInput);
  134. block.appendChild(msgInput);
  135. block.appendChild(addMessageBtn);
  136. block.appendChild(deleteAllNicksBtn);
  137. block.appendChild(uiList);
  138. document.body.appendChild(showScriptBtn);
  139. document.body.appendChild(block);
  140.  
  141. if (location.href === 'https://my.lordswm.com/sms.php') {
  142. if (spam_list.length === 0) return;
  143. location.replace('https://my.lordswm.com/sms-create.php');
  144. }
  145.  
  146. if (location.href === 'https://www.heroeswm.ru/sms.php') {
  147. if (spam_list.length === 0) return;
  148. location.replace('https://www.heroeswm.ru/sms-create.php');
  149. }
  150.  
  151. if (location.href === 'https://my.lordswm.com/sms-create.php') {
  152. if (spam_list.length === 0) return;
  153. let nickInput = document.getElementsByName("mailto")[0].value = spam_list[0];
  154.  
  155. let subjectInput = document.getElementsByName("subject")[0].value = subjectLS;
  156.  
  157. let msgInput = document.getElementsByName("msg")[0].value = msgLS;
  158.  
  159. setTimeout(() => {
  160. spam_list.shift();
  161. localStorage.setItem('spam_list', JSON.stringify(spam_list));
  162. let submitBtn = document.getElementsByName("subm")[0].click();
  163. }, timerLS);
  164. }
  165.  
  166. if (location.href === 'https://www.heroeswm.ru/sms-create.php') {
  167. if (spam_list.length === 0) return;
  168. let nickInput = document.getElementsByName("mailto")[0].value = spam_list[0];
  169.  
  170. let subjectInput = document.getElementsByName("subject")[0].value = subjectLS;
  171.  
  172. let msgInput = document.getElementsByName("msg")[0].value = msgLS;
  173.  
  174. setTimeout(() => {
  175. spam_list.shift();
  176. localStorage.setItem('spam_list', JSON.stringify(spam_list));
  177. let submitBtn = document.getElementsByName("subm")[0].click();
  178. }, 45000);
  179. }
  180.  
  181.  
  182. })();