Skip to content

Instantly share code, notes, and snippets.

@Inquisitor-Sasha
Last active December 23, 2015 17:09
Show Gist options
  • Save Inquisitor-Sasha/6666527 to your computer and use it in GitHub Desktop.
Save Inquisitor-Sasha/6666527 to your computer and use it in GitHub Desktop.
This is a script that is intended to create a banner on MediaWiki powered wikis when added to the MediaWiki:Common.js page. It was written for a wiki at Wikia, but it can be modified to be used with any skin, including Vector. To do that, just replace the name of the Oasis skin and change the ID of the page element to add the banner before to th…
/* BANNER FOR THE WIKI
WRITTEN BY: Inquisitor Ehrenstein
CONTRIBUTORS:
LICENSE: CC-BY-SA
*/
//Controls whether the banner will be displayed
//Set this to true if you want the banner to be displayed
//otherwise set it to false
var bannerDisplay = false;
//This is the HTML that will create the banner
var bannerCode = '<p>Hello world!</p>';
//Unless you are intending to reprogram the banner, DO NOT TOUCH THIS!
if (bannerDisplay === true) {
if (skin === 'monobook') {
var bannerRef = document.getElementById('firstHeading');
var bannerParent = bannerRef.parentNode;
var bannerNewLink = document.createElement('div');
bannerNewLink.id = 'wiki-banner';
bannerNewLink.innerHTML = bannerCode;
bannerParent.insertBefore(bannerNewLink, bannerRef);
$('#wiki-banner').css({ 'width' : '600px', 'border' : 'solid 2px #777777', 'background' : '#EEEEEE', 'padding' : '10px' });
}
if (skin === 'oasis') {
var bannerRef = document.getElementById('WikiaArticle');
var bannerParent = bannerRef.parentNode;
var bannerNewLink = document.createElement('div');
bannerNewLink.id = 'wiki-banner';
bannerNewLink.innerHTML = bannerCode;
bannerParent.insertBefore(bannerNewLink, bannerRef);
$('#wiki-banner').css({ 'width' : '600px', 'border' : 'solid 2px #777777', 'background' : '#EEEEEE', 'padding' : '10px' });
}
} else {}
/* ----------------------------------------- */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment