123456789101112131415161718192021222324252627282930313233 |
- // ==UserScript==
- // @name DuckDuckGo Always Terminal Theme
- // @namespace DuckDuckGoDarkTheme
- // @description Enables Therminal Theme Forever.
- // @author Jesús E.
- // @version 0.1.1
- // @grant none
- // @include /^http(s|)://(www[.]|)duckduckgo[.]com/.*$/
- // @include /^http(s|)://3g2upl4pq6kufc4m[.]onion/.*$/
- // @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');
- }
- }());
|