Password Game Assistant

一个用于Password Game的脚本

  1. // ==UserScript==
  2. // @name Password Game Assistant
  3. // @license MIT
  4. // @namespace https://blog.fyz666.xyz/blog/9097/
  5. // @version 0.0.1
  6. // @description 一个用于Password Game的脚本
  7. // @author Eric Fan
  8. // @match https://neal.fun/password-game/
  9. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. function Rule11() {
  16. let date = new Date();
  17. let year = date.getFullYear();
  18. let month = date.getMonth() + 1;
  19. let day = date.getDate();
  20. let param = `${year}-${month.toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
  21. let url = 'https://neal.fun/api/password-game/wordle?date=' + param;
  22. fetch(url)
  23. .then(r => r.json())
  24. .then(data => {
  25. let ans = data['answer'];
  26. let input = document.querySelector(".ProseMirror");
  27. const p = document.createElement('p');
  28. const span = document.createElement('span');
  29. span.innerText = ans;
  30. p.appendChild(span);
  31. input.appendChild(p);
  32. });
  33. }
  34. function Rule13() {
  35. let phase = "🌑🌒🌓🌔🌕🌖🌗🌘";
  36. let input = document.querySelector(".ProseMirror");
  37. const p = document.createElement('p');
  38. const span = document.createElement('span');
  39. span.innerText = phase;
  40. p.appendChild(span);
  41. input.appendChild(p);
  42. }
  43. function Rule14() {
  44. let iframe = document.querySelector('.geo-wrapper iframe');
  45. if (iframe === null) return;
  46. iframe.style.marginTop = 0;
  47. }
  48. function Rule19() {
  49. function processNodeRule19(textNode) {
  50. const text = textNode.nodeValue;
  51. const parent = textNode.parentNode;
  52.  
  53. const fragments = text.split(/([aeiouyAEIOUY])/);
  54.  
  55. fragments.forEach(fragment => {
  56. if (/[aeiouyAEIOUY]/.test(fragment)) {
  57. const strong = document.createElement('strong');
  58. strong.textContent = fragment;
  59. parent.insertBefore(strong, textNode);
  60. } else {
  61. parent.insertBefore(document.createTextNode(fragment), textNode);
  62. }
  63. });
  64. parent.removeChild(textNode);
  65. }
  66.  
  67. function processRule19(node) {
  68. if (node.nodeType === Node.TEXT_NODE) {
  69. processNodeRule19(node);
  70. } else if (node.nodeType === Node.ELEMENT_NODE) {
  71. Array.from(node.childNodes).forEach(processRule19);
  72. }
  73. }
  74. let paragraphs = document.querySelectorAll('.ProseMirror p');
  75. paragraphs.forEach(processRule19);
  76. }
  77. function Rule20() {
  78. let input = document.querySelector('.ProseMirror');
  79. input.innerHTML = input.innerHTML.replace(/🔥/g, "");
  80. }
  81. function Rule23() {
  82. let input = document.querySelector(".ProseMirror");
  83. const p = document.createElement('p');
  84. const span = document.createElement('span');
  85. span.innerText = "🐛";
  86. p.appendChild(span);
  87. input.appendChild(p);
  88. setTimeout(() => {
  89. let end = setInterval(() => {}, 10000);
  90. for (let i = 1; i <= end; i++) {
  91. clearInterval(i);
  92. }
  93. input.removeChild(input.lastChild);
  94. }, 1000);
  95. }
  96. function Rule28() {
  97. let btn = document.querySelector('.refresh');
  98. if (btn == null) return;
  99. btn.click();
  100. setTimeout(() => {
  101. let color = document.querySelectorAll(".rand-color")[0];
  102. color = color.style.background.match(/\d+/g);
  103. let s = "#";
  104. color.forEach(item => {
  105. s += parseInt(item).toString(16).padStart(2, '0');
  106. });
  107. let input = document.querySelector(".ProseMirror");
  108. const p = document.createElement('p');
  109. const span = document.createElement('span');
  110. span.innerText = s;
  111. p.appendChild(span);
  112. input.appendChild(p);
  113. }, 100);
  114. }
  115. function Rule30() {
  116. function processNodeRule30(textNode) {
  117. const text = textNode.nodeValue;
  118. const parent = textNode.parentNode;
  119. const parentFontFamily = getComputedStyle(parent).fontFamily;
  120.  
  121. const fragments = text.split(/(\d)/);
  122.  
  123. fragments.forEach(fragment => {
  124. if (/\d/.test(fragment)) {
  125. const span = document.createElement('span');
  126. const fontSize = Math.pow(parseInt(fragment), 2);
  127. span.style.fontSize = `${fontSize}px`;
  128. span.style.fontFamily = parentFontFamily;
  129. span.textContent = fragment;
  130. parent.insertBefore(span, textNode);
  131. } else {
  132. parent.insertBefore(document.createTextNode(fragment), textNode);
  133. }
  134. });
  135. parent.removeChild(textNode);
  136. }
  137.  
  138. function processRule30(node) {
  139. if (node.nodeType === Node.TEXT_NODE) {
  140. processNodeRule30(node);
  141. } else if (node.nodeType === Node.ELEMENT_NODE) {
  142. Array.from(node.childNodes).forEach(processRule30);
  143. }
  144. }
  145. let items = document.querySelectorAll(".ProseMirror p");
  146. items.forEach(processRule30);
  147. }
  148. function Rule31() {
  149. let counter = {};
  150. function processNodeRule31(textNode) {
  151. const text = textNode.nodeValue;
  152. const parent = textNode.parentNode;
  153. const parentFontFamily = getComputedStyle(parent).fontFamily;
  154.  
  155. const fragments = text.split(/([a-zA-Z])/);
  156.  
  157. fragments.forEach(fragment => {
  158. if (/[a-zA-Z]/.test(fragment)) {
  159. let letter = fragment.toLowerCase();
  160. counter[letter] = (counter[letter] || 0) + 1;
  161. const span = document.createElement('span');
  162. const fontSize = Math.pow(counter[letter] - 1, 2);
  163. span.style.fontSize = `${fontSize}px`;
  164. span.style.fontFamily = parentFontFamily;
  165. span.textContent = fragment;
  166. parent.insertBefore(span, textNode);
  167. } else {
  168. parent.insertBefore(document.createTextNode(fragment), textNode);
  169. }
  170. });
  171. parent.removeChild(textNode);
  172. }
  173.  
  174. function processRule31(node) {
  175. if (node.nodeType === Node.TEXT_NODE) {
  176. processNodeRule31(node);
  177. } else if (node.nodeType === Node.ELEMENT_NODE) {
  178. Array.from(node.childNodes).forEach(processRule31);
  179. }
  180. }
  181. let items = document.querySelectorAll(".ProseMirror p");
  182. items.forEach(processRule31);
  183. }
  184. function final() {
  185. let p1 = document.querySelector('.password-final');
  186. let p2 = document.querySelector('.complete .ProseMirror');
  187. if (p1 === null || p2 === null) return;
  188. p2.innerHTML = p1.innerHTML;
  189. }
  190. const functions = [Rule11, Rule13, Rule14, Rule19, Rule20, Rule23, Rule28, Rule30, Rule31, final];
  191. const functionNames = ['Rule 11', 'Rule 13', 'Rule 14', 'Rule 19', 'Rule 20', 'Rule 23', 'Rule 28', 'Rule 30', 'Rule 31', 'Final'];
  192.  
  193. var container = document.createElement('div');
  194. container.style.position = 'fixed';
  195. container.style.left = '0';
  196. container.style.top = '50%';
  197. container.style.transform = 'translateY(-50%)';
  198. container.style.zIndex = '1000';
  199.  
  200. functions.forEach((func, index) => {
  201. var button = document.createElement('button');
  202. button.textContent = functionNames[index];
  203. button.style.display = 'block';
  204. button.style.margin = '5px';
  205. button.style.width = '70px';
  206. button.style.padding = '5px';
  207. button.style.border = 'none';
  208. button.style.borderRadius = '5px';
  209. button.style.backgroundColor = '#4CAF50';
  210. button.style.color = 'white';
  211. button.style.textAlign = 'center';
  212. button.style.textDecoration = 'none';
  213. button.style.fontSize = '14px';
  214. button.style.cursor = 'pointer';
  215. button.style.transition = 'background-color 0.3s, transform 0.2s';
  216.  
  217. button.onmouseover = function() {
  218. button.style.backgroundColor = '#45a049';
  219. };
  220. button.onmouseout = function() {
  221. button.style.backgroundColor = '#4CAF50';
  222. };
  223. button.onmousedown = function() {
  224. button.style.transform = 'scale(0.95)';
  225. };
  226. button.onmouseup = function() {
  227. button.style.transform = 'scale(1)';
  228. };
  229.  
  230. button.addEventListener('click', func);
  231. container.appendChild(button);
  232. });
  233.  
  234. document.body.appendChild(container);
  235. })();

QingJ © 2025

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