Stackoverflow.com redirect to archive.org

Auto redirect Stackoverflow to archive.org when super ultra low user experience Cloudflare captcha detected.

اعتبارا من 11-10-2024. شاهد أحدث إصدار.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         Stackoverflow.com redirect to archive.org
// @namespace    https://wsl.moe/
// @version      2024-10-11
// @description  Auto redirect Stackoverflow to archive.org when super ultra low user experience Cloudflare captcha detected.
// @license      WTFPL
// @author       You
// @match        https://*.stackexchange.com/*
// @match        https://*.stackoverflow.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    let executeCount = 0;
    let intervalId = 0;

    intervalId = setInterval(() => {
        if (executeCount > 10) {
            clearInterval(intervalId);
        }
        if (
            document.body.innerText.indexOf('Ray ID: ') !== -1 &&
            document.getElementsByTagName('a')[0].href.indexOf('utm_source=challenge') !== -1 &&
            document.body.innerHTML.indexOf('/cdn-cgi/challenge-platform/') !== -1
        ) {
            const origUrl = location.href;
            location.href = 'https://web.archive.org/web/' + origUrl;
        }
        executeCount += 1;
    }, 2000);
})();