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

当前为 2020-04-05 提交的版本,查看 最新版本

  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.01.20200221105719
  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 = document.createElement("div")
  26. gg.className = "torc-update"
  27. document.getElementsByTagName("header")[0].appendChild(gg)
  28. gg.addEventListener("click", function(){
  29.  
  30. let FI = application.fileByPath("watch.json");
  31. if (FI === undefined) {
  32. application.newFile("watch.json").then(f => {
  33. application.writeToFile(f, code);
  34. });
  35. } else {
  36. application.writeToFile(FI, code);
  37. }
  38. });
  39. })
  40. })();