Codeskulptor AddOn

If the first lines of code have the comment #title=New Title, the page title is renamed to New Title. If the comment is #autorun, the code is automatically run.

  1. // ==UserScript==
  2. // @name Codeskulptor AddOn
  3. // @namespace https://greasyfork.org/users/4756
  4. // @author saibotshamtul (Michael Cimino)
  5. // @version 0.3.3
  6. // @description If the first lines of code have the comment #title=New Title, the page title is renamed to New Title. If the comment is #autorun, the code is automatically run.
  7. // @match http://www.codeskulptor.org/*
  8. // @copyright 2012+, Saibotshamtul
  9. // @grant none
  10. // ==/UserScript==
  11. // previous version available at http://userscripts-mirror.org/scripts/source/179891.user.js
  12.  
  13. function ParseCode(){
  14. for (z=1;z<4;z++) {
  15. t = document.querySelector(".CodeMirror-code div:nth-child("+z+") pre span span").innerHTML;
  16. if (t.substring(0,7)=="#title=") {
  17. document.title=t.substring(7,t.length);
  18. }
  19. if (t.substring(0,8)=="#autorun"){
  20. document.querySelector("#run").click()
  21. }
  22. }
  23. delete t
  24. delete z
  25. }
  26.  
  27. window.setTimeout(ParseCode,1000);