LearnCPP dark mode

Dark mode for LearnCPP.com lessons

Stan na 09-04-2019. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         LearnCPP dark mode
// @namespace    http://gabrielecoen.blogspot.com/
// @version      0.1
// @description  Dark mode for LearnCPP.com lessons
// @author       You
// @match        https://www.learncpp.com/
// @grant        none
// ==/UserScript==

var loadScript = function (src, callback) {
  var elem = document.createElement('script');
  elem.type = 'text/javascript';
  elem.onload = callback;
  elem.src = src;
  document.body.appendChild(elem);
};

function start() {

  var config = {
    fontColor: '#CCCCCC',
    bodyBg: '#353535',
    yellowBg: '#262626',
    pinkBg: '#262626',
    codeBg: '#dddddd',
    commentBg: '#262626',
    authorCommentBg: '#1c1c1c'
  };

  // Common

  //// Background colors
  jQuery('body, middle, .post, .widget_text, .textwidget, .comment-respond').css('background-color', config.bodyBg);
  jQuery('td#middle, ul').css('background', config.bodyBg);
  jQuery('.cpp-lightyellowbackground').css('background-color', config.yellowBg);
  jQuery('.cpp-lightredbackground').css('background-color', config.pinkBg);
  jQuery('.crayon-row').css('background-color', config.codeBg);
  jQuery('.comment-container').css('background-color', config.commentBg);
  jQuery('.comment-container').css('border', config.commentBg);
  jQuery('.bypostauthor').css('background-color', config.authorCommentBg);
  jQuery('.bypostauthor').css('border', config.authorCommentBg);


  //// Text colors
  jQuery('body').css('color', config.fontColor);
  jQuery('table, tr, td').children().css('color', config.fontColor);
  jQuery('font').css('color', config.fontColor);
  jQuery('a:link').css('color', config.fontColor);

}

// Load jQuery, if the current web page does not have it
if (typeof jQuery === 'undefined') {
  loadScript('//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js', start);
} else { start(); }