vPlus

让 v2ex 跟随系统的深色/浅色模式

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey 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 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         vPlus
// @namespace    https://greasyfork.org/en/users/190451-leo-aee
// @version      0.1.4
// @description  让 v2ex 跟随系统的深色/浅色模式
// @author       Leoaee
// @icon         https://cdn.jsdelivr.net/gh/mopig/oss@master/uPic/202005/v_logo.png
// @include      https://*.v2ex.com/*
// @include      https://v2ex.com/*
// @match        <$URL$>
// @grant        none
// @license      LGPLv3
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    function detectColorScheme(){
        var ret = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
        return ret;
    }
    var curScheme = detectColorScheme()
    var curColor = document.querySelector('.light-toggle > img').alt.toLowerCase()
    if(curScheme !== curColor) {
        document.querySelector('.light-toggle').click()
    }
})();