MediaWiki:Common.js: Difference between revisions

From Comprehensible Input Wiki
Content added Content deleted
No edit summary
No edit summary
Line 7: Line 7:
newUrl = currentUrl[1] + "comprehensibleinputwiki.org" + currentUrl[2];
newUrl = currentUrl[1] + "comprehensibleinputwiki.org" + currentUrl[2];
$('#bodyContent').prepend('<div id="newUrlOuter"><div id="newUrlDiv" style="display:none">New URL! Go to <a href="' + newUrl + '">comprehensibleinputwiki.org</a>!</div></div>');
$('#bodyContent').prepend('<div id="newUrlDiv" style="display:none">New URL! Go to <a href="' + newUrl + '"><b>comprehensibleinputwiki.org</b></a>!</div>');
document.querySelector('#newUrlDiv').style.display="block"
document.querySelector('#newUrlDiv').style.display="block"
}
}

Revision as of 23:15, 26 January 2023

/* Any JavaScript here will be loaded for all users on every page load. */
//Wait for page to be parsed
$(document).ready( function () {
	if(window.location.hostname == 'comprehensibleinput.miraheze.org'){
		
		currentUrl = new RegExp("(^.*)" + window.location.hostname + "(.*$)", 'g').exec(window.location);
		newUrl = currentUrl[1] + "comprehensibleinputwiki.org" + currentUrl[2];
		
		$('#bodyContent').prepend('<div id="newUrlDiv" style="display:none">New URL! Go to <a href="' + newUrl + '"><b>comprehensibleinputwiki.org</b></a>!</div>');
		document.querySelector('#newUrlDiv').style.display="block"	
	}

});