Jump to content

User:Jorm/inthroughtheoutdoor.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/*
 * inthroughtheoutdoor.js
 *
 * Detect if the body of a page contains an external link and highlight it so that it can be examined.
 *
 */
$( function() {
    // body.ns-0 div.mw-parser-output *:not(.reflist) a.external
	let links = document.querySelectorAll('body.ns-0 div.mw-parser-output *:not(.reflist) a.external');
	for (let l of links) {
		l.style.backgroundColor = 'rgba(145, 0, 0, 0.25)';
		l.style.color = '#222';
		l.style.borderStyle = 'dashed';
		l.style.borderColor = '#910000';
		l.style.borderLeftWidth = 0;
		l.style.borderRightWidth = 0;
		l.style.borderTopWidth = '0.1em';
		l.style.borderBottomWidth = '0.1em';
	}

});