cppreference balck mode

cppreference黑夜模式

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         cppreference balck mode
// @description  cppreference黑夜模式
// @license      The Unlicense
// @version      1.1.0
// @author       girl-dream
// @namespace    https://github.com/girl-dream/
// @match        https://cppreference.cn/*
// @match        https://cppreference.dev/*
// @match        https://cppreference.tw/*
// @match        https://*.cppreference.net/*
// @match        https://*.cppreference.dev/*
// @match        https://*.cppreference.com/*
// @icon         https://cppreference.cn/favicon.ico
// ==/UserScript==

(() => {
    if (location.href.indexOf('cppreference.net') == -1) {
        const form = document.querySelector('form')
        const temp = form.querySelector('input')
        form.target = '_blank'
        form.action = 'https://www.bing.com/search'
        temp.name = 'q1'
        temp.value = `site:${location.host}`
    }

    const style = `
ins, .google-auto-placed,[id^="div-gpt-ad,carbonads"],#carbonads,#footer-icons {
    display: none !important;
}

table,
#content *:not(a):not(table):not(th):not(tr):not(tbody):not(.t-mark-rev):not(tt):not(.kw1):not(.co1 span) {
    color: #fff !important;
}

#cpp-content-base,
#cpp-footer-base,
#bodyContent,
body,
#cpp-head-first-base,
#cpp-head-second-base,
.mw-geshi,
#cpp-head-second-base span,
.t-member {
    background: #17181A !important;
}

input[name='q'],
button[type='submit'],
input[type='submit'] {
    background-color: #2d2d2d;
    color: #fff;
    border: 1px solid rgb(85, 85, 85);
    outline: none;
}

a,
tt,
a:visited,
[class^="sy"],
#footer-info-lastmod {
    color: #9198a1 !important;
}

th,
td,
table {
    background: rgb(40, 43, 48) !important;
}

[class^="kw"],
[class^="nu"] {
    color: #f5ab35 !important;
}

.mw-geshi {
    background: none !important;
}

.t-navbar-menu > :first-child {
    background: rgb(40, 43, 48) !important;
}

[class^="st"],
[class^="br"],
[class^="co"] {
    color: #339900 !important;
}

.coliru-btn {
    color: white !important;
    background: rgb(40, 43, 48) !important;
    box-shadow: none !important;
    margin-bottom: 6px !important;
}

.t-inherited {
    background-color: rgb(40, 43, 48) !important;
}
    `
    const styleSheet = new CSSStyleSheet()
    styleSheet.replaceSync(style)
    document.adoptedStyleSheets.push(styleSheet)
})();