Userscript gen

can make simple userscripts

  1. // ==UserScript==
  2. // @name Userscript gen
  3. // @namespace http://tampermonkey.net/
  4. // @version 1
  5. // @description can make simple userscripts
  6. // @author Gosh227
  7. // @match http://*/*
  8. // @match https://*/*
  9. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  10. // @grant none
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. // Create a simple form for userscript generation
  18. const formHtml = `
  19. <div id="script-generator" style="position: fixed; top: 10px; right: 10px; background: white; border: 1px solid #ccc; padding: 10px; z-index: 1000;">
  20. <h3>Userscript Generator</h3>
  21. <label for="scriptName">Script Name:</label><br>
  22. <input type="text" id="scriptName" placeholder="Enter script name"><br>
  23. <label for="scriptDescription">Description:</label><br>
  24. <input type="text" id="scriptDescription" placeholder="Enter description"><br>
  25. <label for="scriptMatch">Match URL:</label><br>
  26. <input type="text" id="scriptMatch" placeholder="Enter match URL (e.g., https://example.com/*)"><br>
  27. <button id="generateScript">Generate Script</button>
  28. <h4>Generated Script:</h4>
  29. <textarea id="generatedScript" rows="10" cols="30" readonly></textarea>
  30. </div>
  31. `;
  32.  
  33. // Append the form to the body
  34. document.body.insertAdjacentHTML('beforeend', formHtml);
  35.  
  36. // Function to generate the userscript
  37. const generateUserscript = () => {
  38. const name = document.getElementById('scriptName').value;
  39. const description = document.getElementById('scriptDescription').value;
  40. const match = document.getElementById('scriptMatch').value;
  41.  
  42. const generatedScript = `// ==User Script==\n` +
  43. `// @name ${name}\n` +
  44. `// @namespace http://tampermonkey.net/\n` +
  45. `// @version 0.1\n` +
  46. `// @description ${description}\n` +
  47. `// @author Your Name\n` +
  48. `// @match ${match}\n` +
  49. `// @grant none\n` +
  50. `// ==/User Script==\n\n` +
  51. `(function() {\n` +
  52. ` 'use strict';\n\n` +
  53. ` // Your code here...\n` +
  54. `})();`;
  55.  
  56. document.getElementById('generatedScript').value = generatedScript;
  57. };
  58.  
  59. // Add event listener to the button
  60. document.getElementById('generateScript').addEventListener('click', generateUserscript);
  61.  
  62. })();