blob: 0a4515c5eb7b96ea16a7d54c9ccea6a2ddbd5d02 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// ==UserScript==
// @name DuckDuckGo Always Terminal Theme
// @namespace DuckDuckGoDarkTheme
// @description Enables Therminal Theme Forever.
// @author Jesús E.
// @version 0.1.0
// @grant none
// @match *://duckduckgo.com/*
// @run-at document-start
// @icon https://duckduckgo.com/favicon.ico
// ==/UserScript==
(function main() {
'use strict';
const consoleCSS = 'background: #000; color: #00FF00; padding: 0px 7px; border: 1px solid #00FF00; line-height: 16px;';
const name = GM_info.script.name;
const log = (...args) => console.log('%cUSERSCRIPT | %s: %s', consoleCSS, name, ...args);
log('start');
// set darkmode cookie before page loaded
const cookiePref = document.cookie.replace(/(?:(?:^|.*;\s*)ae\s*=\s*([^;]*).*$)|^.*$/, '$1');
const cookiePrefDark = 't';
const expires = 'max-age=315360000';
if (!cookiePref.includes(cookiePrefDark)) {
document.cookie = `ae=${cookiePrefDark}${cookiePref ? `&${cookiePref}` : ''};path=/;${expires}`;
log('cookie injected');
}
}());
|