Greasy Fork

Greasy Fork is available in English.

iCloud full weekday names

Replace abbreviated weekday names with full names based on browser language

当前为 2024-12-22 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        iCloud full weekday names
// @description Replace abbreviated weekday names with full names based on browser language
// @namespace   https://gitlab.com/breatfr
// @match       https://www.icloud.com/applications/calendar/*
// @version     1.0.0
// @homepageURL https://gitlab.com/breatfr/icloud
// @supportURL  https://discord.gg/Q8KSHzdBxs
// @author      BreatFR
// @copyright   2024, BreatFR (https://breat.fr)
// @grant       none
// @icon        https://www.icloud.com/system/icloud.com/2426Hotfix51/721bdfc3241b42114d62842854461ae7.png
// @license     BY-NC-ND; https://creativecommons.org/licenses/by-nc-nd/4.0/
// ==/UserScript==

(function() {
    'use strict';

    // Obtenir les abréviations de jours dans la langue du navigateur
    function getAbbreviatedDays() {
        const formatterShort = new Intl.DateTimeFormat(navigator.language, { weekday: 'short' });
        const formatterLong = new Intl.DateTimeFormat(navigator.language, { weekday: 'long' });
        const abbreviatedToFull = {};

        // Créer une correspondance entre les abréviations et les noms complets
        for (let i = 0; i < 7; i++) {
            const date = new Date(Date.UTC(2024, 0, 1 + i)); // Une semaine fictive en janvier 2024
            const shortName = formatterShort.format(date).replace('.', '').trim(); // Supprime les points
            const fullName = formatterLong.format(date).trim();
            abbreviatedToFull[shortName] = fullName;
        }

        return abbreviatedToFull;
    }

    const daysMap = getAbbreviatedDays();

    // Fonction pour remplacer les abréviations
    function replaceDays() {
        const elements = document.querySelectorAll('span.css-1fdlgye, span.css-p0zmmh, div.css-1ttvfef');
        elements.forEach(el => {
            const text = el.textContent.trim().replace('.', ''); // Supprime le point final
            if (daysMap[text]) {
                el.textContent = daysMap[text];
            }
        });
    }

    // Observer pour détecter les modifications dynamiques
    const observer = new MutationObserver(replaceDays);
    observer.observe(document.body, { childList: true, subtree: true });

    // Appliquer la transformation au chargement
    replaceDays();
})();