Run JS in URL | EN

Allows running JS code using URL

目前为 2025-02-10 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Run JS in URL | EN
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.3
  5. // @description Allows running JS code using URL
  6. // @author Belogvardeec
  7. // @license MIT
  8. // @match *://*/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. function executeCodeFromUrl() {
  16. const urlParams = new URLSearchParams(window.location.search);
  17. const code = urlParams.get('console');
  18.  
  19. if (code) {
  20. try {
  21. const decodedCode = decodeURIComponent(code);
  22. eval(decodedCode); // using eval to execute code
  23. } catch (error) {
  24. console.error('Error:', error);
  25. }
  26. }
  27. }
  28.  
  29. // Execute the main function
  30. executeCodeFromUrl();
  31.  
  32. console.log('JS in URL has been launched');
  33. })();