iCloud full day events border

Apply the default border with the good color on full day events.

安装此脚本
作者推荐脚本

您可能也喜欢iCloud customizations

安装为用户样式
  1. // ==UserScript==
  2. // @name iCloud full day events border
  3. // @description Apply the default border with the good color on full day events.
  4. // @namespace https://gitlab.com/breatfr
  5. // @match https://www.icloud.com/calendar/
  6. // @version 1.0.0
  7. // @homepageURL https://gitlab.com/breatfr/icloud
  8. // @supportURL https://discord.gg/Q8KSHzdBxs
  9. // @author BreatFR
  10. // @copyright 2024, BreatFR (https://breat.fr)
  11. // @grant none
  12. // @icon https://gitlab.com/uploads/-/system/project/avatar/65415880/icloud.png
  13. // @license AGPL-3.0-or-later; https://www.gnu.org/licenses/agpl-3.0.txt
  14. // ==/UserScript==
  15.  
  16. (function() {
  17. 'use strict';
  18.  
  19. function applyBorderStyle() {
  20. const iframes = document.querySelectorAll('iframe');
  21.  
  22. iframes.forEach(iframe => {
  23. try {
  24. const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
  25. const buttons = iframeDoc.querySelectorAll('div:not(:has(.month-view-event-preview-start-time)) .css-6310j7 > button:not(:has(svg))');
  26.  
  27. buttons.forEach(button => {
  28. const computedStyle = getComputedStyle(button);
  29.  
  30. // Check if a border is defined with a color
  31. if (computedStyle.border && computedStyle.border !== '0px none rgba(0, 0, 0, 0)') {
  32. const borderColor = computedStyle.borderColor || computedStyle.borderLeftColor;
  33.  
  34. // If a color is defined, apply the left border
  35. if (borderColor && borderColor !== 'rgba(0, 0, 0, 0)') {
  36. button.style.borderLeft = `3px solid ${borderColor}`;
  37. }
  38. }
  39. });
  40. } catch (error) {
  41. console.error('Erreur avec un iframe:', error);
  42. }
  43. });
  44. }
  45.  
  46. const observer = new MutationObserver(applyBorderStyle);
  47.  
  48. observer.observe(document.body, {
  49. childList: true,
  50. subtree: true
  51. });
  52.  
  53. applyBorderStyle();
  54. setInterval(applyBorderStyle, 1000);
  55. })();