flomo.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // ==UserScript==
  2. // @name T-flomo-当天数据背景
  3. // @author tianyunperfect
  4. // @description 简介
  5. // @version 1.0.0
  6. // @update 2023年03月08日16:28:55
  7. // @match https://v.flomoapp.com/mine
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=flomoapp.com
  9. // ==/UserScript==
  10. function contains(selector, text) {
  11. var elements = document.querySelectorAll(selector);
  12. return Array.prototype.filter.call(elements, function (element) {
  13. return RegExp(text).test(element.textContent);
  14. });
  15. }
  16. function getTodayString() {
  17. const today = new Date();
  18. const year = today.getFullYear();
  19. const month = (today.getMonth() + 1).toString().padStart(2, '0');
  20. const date = today.getDate().toString().padStart(2, '0');
  21. const dateString = `${year}-${month}-${date}`;
  22. return dateString;
  23. }
  24. console.log(getTodayString());
  25. (async () => {
  26. if (window.top !== window.self) {
  27. return;
  28. }
  29. setInterval(() => {
  30. let contains1 = contains("span", getTodayString());
  31. for (const dom of contains1) {
  32. dom.style.backgroundColor = 'yellow'
  33. }
  34. }, 2000)
  35. })();