FSD Variable Storage

Finds the text in the FSD description div, stores it as a variable, and copies it to the clipboard. Also sets focus to "details" in Google Calendar so user can paste description text.

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

  1. // ==UserScript==
  2. // @name FSD Variable Storage
  3. // @namespace https://almedawaterwell.com/
  4. // @version 1.4
  5. // @description Finds the text in the FSD description div, stores it as a variable, and copies it to the clipboard. Also sets focus to "details" in Google Calendar so user can paste description text.
  6. // @author Luke Pyburn
  7. // @include https://reveal.us.fleetmatics.com/fsd/*
  8. // @include https://reveal.fleetmatics.com/fsd/*
  9. // @include https://calendar.google.com/calendar/r/eventedit*true
  10. // @run-at document-idle
  11. // @grant GM_getValue
  12. // @grant GM_setValue
  13. // @grant GM_openInTab
  14. // @grant GM_setClipboard
  15. // @grant unsafeWindow
  16. // @require http://code.jquery.com/jquery-3.4.1.min.js
  17. // ==/UserScript==
  18.  
  19. var descUntouchedGlobal;
  20. var descTouchedGlobal;
  21. var multipleTransfersGlobal;
  22. var $ = window.jQuery;
  23. var checkExist = setInterval(startCheck, 100);
  24. function startCheck() {
  25. if ($('#fsd-sd-text-area__input\\ ng-untouched\\ ng-pristine\\ ng-valid').length) {
  26. descUntouchedGlobal = document.getElementById("fsd-sd-text-area__input ng-untouched ng-pristine ng-valid").value;
  27. console.log("Exists!");
  28. console.log(descUntouchedGlobal);
  29. clearInterval(checkExist);
  30. }
  31. if ($('#fsd-sd-text-area__input\\ ng-pristine\\ ng-valid\\ ng-touched').length) {
  32. descTouchedGlobal = document.getElementById("fsd-sd-text-area__input\\ ng-pristine\\ ng-valid\\ ng-touched").value;
  33. console.log("Exists!");
  34. console.log(descTouchedGlobal);
  35. clearInterval(checkExist);
  36. }
  37. if ($('#description').length) {
  38. multipleTransfersGlobal = document.getElementById("description").value;
  39. console.log("Exists!");
  40. console.log(multipleTransfersGlobal);
  41. GM_setClipboard(multipleTransfersGlobal);
  42. clearInterval(checkExist);
  43. }
  44. }
  45.  
  46. window.addEventListener('load', function checkGoogleCalendar() {
  47. var checkGoogleCalendar = setInterval (function() {
  48. if ($('#T2Ybvb0').length) {
  49. $("#T2Ybvb0").focus();
  50. clearInterval(checkExist);}
  51. }, 500); // Checks every 500 milliseconds
  52. }, false);