Crowdin链接自动转中文界面

自动将Crowdin URL更改为中文版本,避免重复点击

// ==UserScript==
// @name         Crowdin链接自动转中文界面
// @name:en_US   Crowdin URL Auto Change to Chinese
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  自动将Crowdin URL更改为中文版本,避免重复点击
// @description:en_US  Automatically change Crowdin URL to Chinese version to avoid repeated clicks击
// @match        https://crowdin.com/*
// @grant        none
// @license MPL
// ==/UserScript==

(function() {
    'use strict';

    // Get the current URL
    var url = window.location.href;

    // Check if the URL is from Crowdin
    if (url.startsWith("https://crowdin.com/")) {

        // Check if the URL already has "zh." prefix
        if (!url.startsWith("https://zh.crowdin.com/")) {

            // Replace "https://crowdin.com/" with "https://zh.crowdin.com/"
            var newUrl = url.replace("https://crowdin.com/", "https://zh.crowdin.com/");

            // Redirect to the new URL
            window.location.href = newUrl;
        }
    }
})();