PageSourceSearch

https://www.kn4goi.net/log/assets/js/darkmodehelpers.js

js kn4goi.net collected 2026-10-08 02:33:35 UTC 963 bytes, 41 lines download raw bytes

1// use closure to cache result (color is only read once)
2function _getBodyBackground() {
3	var result = null;
4	function inner() {
5		if (result === null) {
6			result = $('body').css( "background-color");
7		}
8		return result;
9	}
10	return inner;
11}
12getBodyBackground = _getBodyBackground();
13
14// use closure to cache result (check it once is enough)
15function _isDarkModeTheme() {
16	var result = null;
17	function inner() {
18		if (result === null) {
19			// TODO use better solution as soon as the themes know if they are dark or not
20			// check if background color is white
21			result = false;
22			var background = getBodyBackground();
23			if (background != ('rgb(255, 255, 255)')) {
24				result = true;
25			}
26		}
27		return result;
28	}
29	return inner;
30}
31isDarkModeTheme = _isDarkModeTheme();
32
33function ifDarkModeThemeReturn(darkModeValue, notDarkModeValue) {
34	if (isDarkModeTheme()) {
35		return darkModeValue;
36	}
37	if (!notDarkModeValue) {
38		return null;
39	}
40	return notDarkModeValue;
41}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.