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-01-17 提交的版本,查看 最新版本

  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.0.1.20200117000931
  12. // ==/UserScript==
  13. (function () {
  14. let t = torcAddons;
  15. t.addEventListener("load", () => {
  16. let JSON_ = $('<div class="torc-watch">update</div>').insertAfter($('.torc-update'));
  17. JSON_.on("click", function () {
  18. let FI = application.fileByPath("watch.json");
  19. if (!FI) {
  20. FI = application.newFile("watch.json");
  21. }
  22. application.writeToFile(FI, `{
  23. "install": {
  24. "include": [
  25. "^.torc-update"
  26. ]
  27. },
  28. "throttle": 10
  29. }`)
  30. })
  31. });
  32.  
  33. /* ======== css ======== */
  34.  
  35. t.addCSS(`
  36. .torc-json {
  37. line-height: 28px;
  38. border: 1px dashed #666666;
  39. border-radius: 7px;
  40. padding: 0 10px;
  41. margin-left: 16px;
  42. font-size: 12px;
  43. cursor: pointer;
  44. }
  45.  
  46. .torc-json:hover {
  47. background-color: rgba(255,255,255,0.1);
  48. }
  49. .torc-json:active {
  50. background-color: rgba(255,255,255,0);
  51. }
  52. `);
  53.  
  54. })