MediaWiki:Wikia.js

/* */

/* --- Global variable used for referencing current page URL --- */

var siteURL = location.protocol + "//" + location.host + location.pathname;

/* --- Removes the need for adding a surfeit amount of attributes --- */ /* --- by making the desirable ones the default. --- */

$(".wikia-gallery").removeClass.addClass("wikia-gallery wikia-gallery-caption-below wikia-gallery-position-center wikia-gallery-spacing-small wikia-gallery-border-none wikia-gallery-captions-center wikia-gallery-caption-size-medium");

/* --- Auto-inject a talk page message on every talk page --- */

var talkp__content__header__html = 'This talk page is only for discussing improvements to the page "' + wgTitle + '".';

var talkp__content__text__html = 'It is not the place for general discussion or sharing stories about the topic of this article. Click here to start a new topic.'; var talkp = document.createElement("div"); $(talkp).addClass("mbox"); var talkp__content = document.createElement("div"); $(talkp__content).addClass("mbox__content"); $(talkp).prepend(talkp__content); var talkp__content__header = document.createElement("div"); $(talkp__content__header).addClass("mbox__content__header"); $(talkp__content__header).html(talkp__content__header__html); $(talkp__content).prepend(talkp__content__header); var talkp__content__text = document.createElement("div"); $(talkp__content__text).addClass("mbox__content__text"); $(talkp__content__text).html(talkp__content__text__html); $(talkp__content).append(talkp__content__text); var talkp__close = document.createElement("div"); $(talkp__close).addClass("mbox__close"); $(talkp__close).attr("title", "Dismiss"); $(talkp__close).html("×"); $(talkp__content).append(talkp__close);

if(   	$("body").hasClass("ns-1")    	&& !( $("body").hasClass("action-edit") )    	&& !( $("body").hasClass("editor") )    ) { $("#mw-content-text").prepend(talkp); }

/* --- Special:Upload template preload --- */

var matches = window.location.href.match(/wpForReUpload/); if( matches && matches.length ) { var mwct; } else { $("#mw-content-text #mw-upload-form fieldset #mw-htmlform-description tbody .mw-htmlform-field-HTMLTextAreaField .mw-input #wpUploadDescription").html("\n\n[[Category:]]"); $("#mw-upload-form fieldset table#mw-htmlform-description tbody tr.mw-htmlform-field-Licenses").hide; }   /* --- Real edit count --- */ if( $("#mw-content-text p em.tally").length ) { var real_editcount = $("#mw-content-text p em.tally").html; $("#UserProfileMasthead .masthead-info .masthead-info-lower .tally em").html(real_editcount); $("#mw-content-text p em.tally").css("display", "none"); }

/* --- Display game images on right rail (Template:Games) --- */

$(function{   var icons = document.getElementsByClassName('appicon');    if (icons.length > 0) {        $(' Appears in: ').appendTo('#WikiaRail');        var artinf = document.getElementById("apprail");        var j = icons.length;        for (i = 0; i < j; i++) artinf.appendChild(icons[0]);    }    $(".appicon").show; });

/* --- Mbox template close function --- */ $('.mbox .mbox__close').on('click', function {   $(this).parent.parent.fadeOut(500); });

/* */