Youtube - Restore Classic

If youtube is in the new 2017 YouTube Material Redesign, automatically restore classic view

11.11.2017 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

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

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

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

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

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Youtube - Restore Classic
// @version      1.0.1
// @description  If youtube is in the new 2017 YouTube Material Redesign, automatically restore classic view
// @author       Cpt_mathix
// @match        https://www.youtube.com
// @include      https://www.youtube.com/*
// @license      GPL version 2 or any later version; http://www.gnu.org/licenses/gpl-2.0.txt
// @namespace    https://greasyfork.org/users/16080
// @run-at       document-start
// @grant        none
// @noframes
// ==/UserScript==

(function() {
    replaceCookie("PREF");

    function replaceCookie(name) {
        if (document.cookie) {
            var match = document.cookie.match(RegExp('(?:^|;\\s*)' + name + '=([^;]*)'));
            if (match && match[1]) {
                match = match[1];
                if (match[1].search(/f6=(a|b)/) === -1) {
                    if (match.search(/f6=(a|b)/) === -1) {
                        document.cookie = "PREF=" + match + "&f6=a" + ";path=/;domain=.youtube.com";
                    } else if (match.search(/f6=\d/) !== -1) {
                        document.cookie = "PREF=" + match.replace(/f6=\d/, 'f6=a') + ";path=/;domain=.youtube.com";
                    }
                    location.reload();
                }
            } else {
                console.log("PREF cookie not found");
            }
        } else {
            console.log("document.cookie not supported for your browser or you do not allow cookies at all");
        }
    }
})();