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