TorcAddons-watch-json-file

provides a watch.json button, to spawn a watch.json file, and set it's contents automatically to that to be compatible with torcAddons-ManualUpdate

  1. // ==UserScript==
  2. // @name TorcAddons-watch-json-file
  3. // @namespace http://torcado.com
  4. // @description provides a watch.json button, to spawn a watch.json file, and set it's contents automatically to that to be compatible with torcAddons-ManualUpdate
  5. // @author torcado and J-Tech-Foundation
  6. // @license MIT
  7. // @icon http://torcado.com/torcAddons/icon.png
  8. // @run-at document-start
  9. // @grant none
  10. // @include http*://glitch.com/edit/*
  11. // @version 0.2.11
  12. // ==/UserScript==
  13. (function () {
  14. let t = torcAddons;
  15.  
  16. t.addEventListener('load', ()=>{
  17. let code = `{
  18. "install": {
  19. "include": [
  20. "^.torc-update"
  21. ]
  22. },
  23. "throttle": 10
  24. }`;
  25. var gg = $('<div class="torc-update">Add json</div>').insertAfter($(".show-app-wrapper"))
  26. gg.on("click", function(){
  27. $(gg).remove();
  28. let FI = application.fileByPath("watch.json");
  29. if (FI === undefined) {
  30. application.newFile("watch.json").then(f => {
  31. application.writeToFile(f, code);
  32. });
  33. } else {
  34. application.writeToFile(FI, code);
  35. }
  36. });
  37. })
  38. })();