MediaWiki

Common.js

From Dogcraft Wiki

(removing pride month logos)
m (headbanner)
Line 12: Line 12:


$(document).ready(function() {
$(document).ready(function() {
var pagename = mw.config.get('wgPageName'),
namespace = mw.config.get('wgNamespaceNumber');
// var indicator = document.querySelectorAll(".mw-indicators");
// var indicator = document.querySelectorAll(".mw-indicators");
// var indicator1 = indicator[0];
// var indicator1 = indicator[0];
Line 37: Line 39:
/*== Shows edit button on Rules and Help Resources for those who can edit it ==*/
/*== Shows edit button on Rules and Help Resources for those who can edit it ==*/
var pagename = mw.config.get('wgPageName');
if (pagename === 'Rules' || pagename === 'Help_Resources') {
if (pagename === 'Rules' || pagename === 'Help_Resources') {
if (mw.config.get('wgIsProbablyEditable')) {
if (mw.config.get('wgIsProbablyEditable')) {
Line 43: Line 44:
}
}
}
}
if (namespace === 14) {
var headbanner = document.getElementById("headbanner");
if (headbanner) {
var header = document.getElementById("firstHeading");
if (headbanner.hasAttribute("banner-height")) { header.style.setProperty('--banner-padding', headbanner.attribute.height); }
header.style.setProperty('--banner-image', 'url(' + header.textContent + ')');
header.classList.add('banner');
$("#siteSub").prepend($("#main > .content > .top"));
}
}


});
});

Revision as of 16:03, 30 September 2022

/* Any JavaScript here will be loaded for all users on every page load. */

/* Navigation Popups */
/* Currently Disabled
mw.loader.load('/load.php?modules=ext.gadget.Navigation_popups');
window.popupAdminLinks = false;
window.popupActionsMenu = false;
window.popupStructure = 'lite';
window.popupSubpopups = false;
window.popupSummaryData = false;
*/

$(document).ready(function() {
	var pagename = mw.config.get('wgPageName'),
		namespace = mw.config.get('wgNamespaceNumber');
	// var indicator = document.querySelectorAll(".mw-indicators");
	// var indicator1 = indicator[0];
	
	// if (indicator1.childNodes.length !== 1) {document.getElementById("tagline").innerHTML = indicator1.innerHTML;}
	
	/*== Hides the actions button and indicators while in the Visual editor ==*/
	
	mw.hook( 've.activationComplete' ).add( function () {
		$('.content .top').hide();
	});
	
	mw.hook( 've.deactivationComplete' ).add( function () {
			$('.content .top').show();
	});
	
	/*== Dogcraft.net topbar: Automatically enabled to display the Dogcraft.net topbar on the Help Resources(WIP) and Rules pages. (moved from gadget) ==*/
	$(document).ready(function() {
		if (mw.config.get('wgPageName') === "Rules" || mw.config.get('wgPageName') === "Help_Resources")
		{
			$('.nav .nav-title a span').text('Dogcraft');
			$('#wikiNav').removeClass('expanded');
		}
	});
	
	/*== Shows edit button on Rules and Help Resources for those who can edit it ==*/
	if (pagename === 'Rules' || pagename === 'Help_Resources') {
		if (mw.config.get('wgIsProbablyEditable')) {
			$('#wikiActions').show();
		}
	}
	
	if (namespace === 14) {
		var headbanner = document.getElementById("headbanner");
		if (headbanner) {
			var header = document.getElementById("firstHeading");
			if (headbanner.hasAttribute("banner-height")) { header.style.setProperty('--banner-padding', headbanner.attribute.height); }
			header.style.setProperty('--banner-image', 'url(' + header.textContent + ')');
			header.classList.add('banner');
			$("#siteSub").prepend($("#main > .content > .top"));
		}
	}
	
	

});
This page was last modified on 30 September 2022, at 16:03. (5 months ago)