Isra.cloud – Restore Original File URL

Displays the original file URL from isra.cloud in the address again, without reloading the page.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         Isra.cloud – Restore Original File URL
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Displays the original file URL from isra.cloud in the address again, without reloading the page.
// @author       Yaknar (high-way.me)
// @match        https://isra.cloud/download*
// @run-at       document-start
// @grant        none
// @license      GPL v3
// ==/UserScript==

(function () {
    'use strict';

    function getCookie(name) {
        const match = document.cookie
            .split('; ')
            .find(row => row.startsWith(name + '='));
        if (!match) return null;
        return decodeURIComponent(match.split('=')[1]);
    }

    function updateUrlFromCookie() {
        const code = getCookie('file_code');
        if (!code) return;

        const desiredPath = '/' + code;
        const currentPath = window.location.pathname;

        // Schon umgestellt? Dann nichts tun.
        if (currentPath === desiredPath) return;

        const newUrl = window.location.origin + desiredPath + window.location.search + window.location.hash;

        // URL in der Adressleiste ändern, ohne Reload
        window.history.replaceState(null, '', newUrl);
    }
    updateUrlFromCookie();
})();