iCloud Beta Redirect

Automatically redirect www.icloud.com to beta.icloud.com.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         iCloud Beta Redirect
// @version      1.1
// @author       SpotlightForBugs
// @description  Automatically redirect www.icloud.com to beta.icloud.com.
// @match        *://www.icloud.com/*
// @run-at       document-start
// @namespace    https://greasyfork.org/en/users/1412746-spotlightforbugs
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to check if the URL matches the target pattern
    function checkURL(url) {
        return url.startsWith('https://www.icloud.com');
    }

    // Function to convert the URL to the beta subdomain
    function newURL(url) {
        return url.replace('www.icloud.com', 'beta.icloud.com');
    }

    // Perform the redirection if the current URL matches
    if (checkURL(window.location.href)) {
        window.location.replace(newURL(window.location.href));
    }
})();