Jump to content

User:Benhaldenby/monobook.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.
var metaTag=document.createElement('meta');
metaTag.name = "viewport"
metaTag.content = "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
document.getElementsByTagName('head')[0].appendChild(metaTag);



/*

(function() {
    // load jquery asynchronously      
    var jq = document.createElement('script');
    jq.async = true;
    jq.src = '//code.jquery.com/jquery-1.10.1.min.js';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(jq, s);
})();

function fixAmpersands() {
	// entity encodes only ampersands that aren't already encoded
	$("h1,h2,h3,p:contains('&')", document.body).each(function() {
		if( this.nodeType == 3 ) {
			$(this).html( $(this).html().replace( /&(?![a-zA-Z]{2,6};|#[0-9]{2,4};)/g, "&" ) );
		}
	});
}
function dressUpAmpersands() {
	// adds a span with class 'amp' to the entity-encoded ampersands
	$("h1,h2,h3,p:contains('&')", document.body).each(function() {
		$(this).html( $(this).html().replace( /&/g, "<span class='amp'>&</span>" ) );
	});
}
$(document).ready(function() {
	fixAmpersands();
	dressUpAmpersands();
});

*/