Revert Blues

use old blues

目前为 2019-01-31 提交的版本。查看 最新版本

// ==UserScript==
// @name         Revert Blues
// @version      4.4
// @namespace    https://greasyfork.org/users/65414
// @description  use old blues
// @author       You
// @match        https://www.tumblr.com/*
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @grant        GM_getValue
// @grant        GM_setValue
// @run-at       document-start
// ==/UserScript==

(function() {

    if (GM_getValue("updateoff") == null) {
        GM_setValue("updateoff", true)
    }

    let repeatRemove = setInterval(() => $("body").toggleClass('flag--accessibility-design-update', !GM_getValue("updateoff")), 1);
    setTimeout(() => { clearInterval(repeatRemove);}, 5000);

    if (window.location.href.indexOf("/settings/dashboard") > -1) {

        function addOption(){
            if ($('#user_enable_uiupdate').length){
                clearInterval(repeatAdd);
            } else {
                $('<div class="checkbox setting"><label class="binary_switch"><input type="checkbox" name="user[enable_uiupdate]" id="user_enable_uiupdate" value="on"'+ (GM_getValue("updateoff") !== true ? ' checked="checked"' : '' ) + '> <span class="binary_switch_track"></span><span class="binary_switch_button"></span></label><label for="user_enable_uiupdate">Enable the accessibility UI design update.</label></div>').appendTo(".interface .group_content");
            }
        }

        let repeatAdd = setInterval(() => addOption(), 1);
    }

    $(window).on('load', function() {
        $('#user_enable_uiupdate').click(function(){
            clearInterval(repeatRemove)
            if (GM_getValue("updateoff") == true){
                GM_setValue("updateoff",false);
            } else {
                GM_setValue("updateoff",true);
            }
            $("body").toggleClass('flag--accessibility-design-update');
        });
    });
})();