您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Redirect from leetcode.cn to leetcode.com with a loading animation.
当前为
您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
- // ==UserScript==
- // @name LeetCode CN to COM Redirect with Loading Animation
- // @namespace http://tampermonkey.net/
- // @version 2024-01-12
- // @description Redirect from leetcode.cn to leetcode.com with a loading animation.
- // @author You
- // @match *://leetcode.cn/*
- // @match *://leetcode.com/*
- // @icon https://www.google.com/s2/favicons?sz=64&domain=leetcode.com
- // @grant GM_addStyle
- // @license MIT
- // ==/UserScript==
- (function() {
- 'use strict';
- // Check if the current URL is from leetcode.cn
- if (window.location.host === 'leetcode.cn') {
- // Add a simple loading animation to the body
- document.body.innerHTML = '<div style="display: flex; justify-content: center; align-items: center; height: 100vh;"><div class="loader"></div></div>';
- GM_addStyle(`
- .loader {
- border: 16px solid #f3f3f3;
- border-top: 16px solid #3498db;
- border-radius: 50%;
- width: 120px;
- height: 120px;
- animation: spin 0.5s linear infinite;
- }
- @keyframes spin {
- 0% { transform: rotate(0deg); }
- 100% { transform: rotate(360deg); }
- }
- `);
- // Create the new URL by replacing 'leetcode.cn' with 'leetcode.com'
- var newUrl = window.location.href.replace('leetcode.cn', 'leetcode.com');
- // Redirect to the new URL after a short delay to show the animation
- setTimeout(function() {
- window.location.href = newUrl;
- }, 1); // Adjust the time as needed
- }
- })();