mNo edit summary
No edit summary
Line 1: Line 1:
var sourceEdit = document.getElementById('ca-edit');
function overrideSourceEdit() {
if (sourceEdit) {
var sourceEdit = document.getElementById('ca-edit');
var url = sourceEdit.getAttribute('href');
if (sourceEdit) {
sourceEdit.setAttribute('href', url.split('&section')[0]);
var url = sourceEdit.getAttribute('href');
sourceEdit.setAttribute('href', url.split('&section')[0]);
}
}
}
function getDarkModePreference() {
return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
}
function applyDarkMode() {
if (getDarkModePreference()) {
var body = document.querySelector('body');
if (!body.classList.contains('dark-mode')) {
body.classList.add('dark-mode');
}
}
}
applyDarkMode();
overrideSourceEdit();

Revision as of 14:31, 16 February 2023

function overrideSourceEdit() {
	var sourceEdit = document.getElementById('ca-edit');
	if (sourceEdit) {
	 var url = sourceEdit.getAttribute('href');
	 sourceEdit.setAttribute('href', url.split('&section')[0]);
	}
}

function getDarkModePreference() {
	return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
}

function applyDarkMode() {
	if (getDarkModePreference()) {
		var body = document.querySelector('body');
		if (!body.classList.contains('dark-mode')) {
			body.classList.add('dark-mode');
		}
	}
}

applyDarkMode();
overrideSourceEdit();