User:Jgjake2/global.js

/* var full = window.location.host; var parts = full.split('.'); var sub = parts[0] + '.' + parts[1]; if(sub == 'ru.elderscrolls') { var set_wikiSubDomain = 'ru.elderscrolls'; importScriptPage('User:Jgjake2/js/Wikia/Popups.js', 'deadisland'); } ( function ( $, mw ) {	var nsNr = mw.config.get( 'wgNamespaceNumber' );	var theText = 'Add CSS';	if ( nsNr < 0 || window.CustomCSSButtonsLoaded || $( '#jgjake2-add-custom-css-btn' ).length ) {		return;	}	window.CustomCSSButtonsLoaded = true; // prevent duplicate running (but not dupe buttons from outside this code)	$( addPurgeButton );	var cssAdded = false;	function addStyle(css, id){		if(css) {			var doc = typeof document !== "undefined" ? document : window.document;			if(doc && doc.head) {				var style = doc.createElement('style');				if(id) style.id = id;				try {					style.innerHTML = css + "";				} catch (x) {					style.innerText = css + "";				}				style.type = 'text/css';				return doc.head.appendChild(style);			}		}	};	function disableButton($link){		$link = $link || $('#jgjake2-add-custom-css-btn');		$link.css({'pointer-events': 'none', 'cursor': 'default'}).addClass('disabled'); $link.parent.css({'pointer-events': 'none', 'cursor': 'default', 'background': 'gray'}); }	function addCSS { if(cssAdded) return; cssAdded = true; if(!$('#jgjake2-add-custom-css-btn').hasClass('disabled') && $('#jgjake2-custom-css').length == 0){ addStyle('@import url(http://fonts.wikijs.org/UprisingSprites);\r\n', 'jgjake2-custom-css'); }		disableButton; }	function addOasisPurgeButton { var selector; switch (nsNr) { case 500: case 502: selector = $( '#WikiaUserPagesHeader' ); break; case 2: case 3: selector = $( '.UserProfileActionButton' ); if ( selector.length ) break; default: selector = $( '#WikiaPageHeader' ); }		selector.find('.wikia-menu-button').first.find('ul') .append(''+ theText + ''); }	function addPurgeButton { switch( mw.config.get( 'skin' ) ) { case 'uncyclopedia': /* monobook clone, pass to monobook */ case 'wowwiki': /* monobook clone, pass to monobook */ case 'lostbook': /* monobook clone, pass to monobook */ case 'monobook': $('#p-cactions > .pBody > ul').append(''+ theText + ''); break; case 'oasis': case 'wikia': addOasisPurgeButton; break; }		$( '#jgjake2-add-custom-css-btn' ).click( addCSS ); }	} ( jQuery, mediaWiki ) );