MediaWiki:Common.js

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

var PurgeButtonText = 'Refresh', ajaxPages = ["Special:RecentChanges", "Special:Watchlist", "Special:Log", "Special:Contributions", "Special:WikiActivity", "Blog:Recent_posts"], AjaxRCRefreshText = 'Auto-refresh', EditIntroButtonText = 'Intro';

//preload line to add user category for special:upload and special:multipleupload $(function preloadUploadDesc {   // check wgCanonicalSpecialPageName for upload page    if ( [ 'MultipleUpload', 'Upload' ].indexOf( mw.config.get( 'wgCanonicalSpecialPageName' ) ) > -1 ) {        // append Category:USERNAME to upload desc textarea        $( '#wpUploadDescription').val( $( '#wpUploadDescription').val + '' );    } }); //edit buttons if (mwCustomEditButtons) { mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/central/images/c/c8/Button_redirect.png", "speedTip": "Redirect", "tagOpen": "#REDIRECT ",           "tagClose": "", "sampleText": "Insert page" };   mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/central/images/c/c9/Button_strike.png", "speedTip": "Strike", "tagOpen": " ", "tagClose": " ", "sampleText": "Strike-through text" };   mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/central/images/1/13/Button_enter.png", "speedTip": "Line break", "tagOpen": " ", "tagClose": "", "sampleText": "" };   mwCustomEditButtons[mwCustomEditButtons.length] = { "imageFile": "http://images.wikia.com/central/images/7/74/Button_comment.png", "speedTip": "Comment visible only for editors", "tagOpen": "", "sampleText": "Insert comment here" }; } /* Replaces with the name of the user browsing the page. Requires copying Template:USERNAME. */ $(function UserNameReplace {   if (typeof (disableUsernameReplace) != 'undefined' && disableUsernameReplace || wgUserName === null) return;    $("span.insertusername").html(wgUserName); }); /* End of the replacement */ window.UserTagsJS = { modules: {}, tags: { // group: { associated tag data }, // Titles that have to do with departmentallization CD: { u:'Claiming Department' }, HR: { u:'Human Resources' }, RD: { u:'Recreational Department' }, RDev: { u:'Research and Development' }, AS: { u:'Aid and Support' }, // Titles that have to do with User Rights H: { u:'Camp Helper' }, R: { u:'Rollback' }, B: { u:'Bot' } } }; UserTagsJS.modules.custom = { //CLAIMING DEPT //CRAT

//ADMIN 'Kevin Mo': ['CD'], '~The Musician~': ['CD'], 'Meloney': ['CD'],

//RB 'Omnia Lesvos': ['CD', 'R'], 'Summer June': ['CD', 'R'],

//HUMAN RESOURCES //CRAT 'Eternal Sterek': ['HR'],

//ADMIN 'YorkieWolf': ['HR'],

//RB 'Margaery Tyrell': ['HR', 'R'], 'UniPacific16' : ['HR', 'R'],

//RECREATIONAL DEPT //CRAT

//ADMIN

//RB

//RESEARCH AND DEVELOPMENT //CRAT 'Brocky292': ['RDev'], //ADMIN 'EvilhariboMadness': ['RDev'],

//RB 'A Son of Hades': ['RDev', 'R'], 'DaichiAoi': ['RDev', 'R'],

//AID AND SUPPORT //ADMIN

//RB

//CAMP HELPER 'Nata Roebot': ['H'], 'JustChase': ['H'], 'Nat25': ['H'], 'UniPacific16': ['H'], 'CattyTheOrchid16': ['H'], 'AoCatrene': ['H'], //BOT //Only for accounts with the "bot" user right that have edited on this wiki 'BachBot': ['B'], // Operated by BachLynn23 - inactive bot 'CoreyBot': ['B'], // Operated by Cörey - inactive bot 'Kanade Otonashi': ['B'], // Operated by Slayingthehalcyon - inactive bot 'KevyBot': ['B'], // Operated by Kevin Mo - active bot 'TheTenthEmperor': ['B'] // Operated by LyreOfOrpheHyus - inactive bot }; // Imports importArticles({   type: 'style',    articles: [        'MediaWiki:KevinWordBubble.css',        'MediaWiki:KevinWordBubble2.css',        'MediaWiki:StaffHighlight.css'    ] });

/* IRClogin div */ $(function {   if ($('#IRClogin').length) {        var nick;        if (typeof wgUserName == 'undefined') {            nick = 'wgusername' + Math.floor(Math.random * 100);        } else {            nick = wgUserName.replace(/ /g, "_");        }        $('#IRClogin').html(' ');    } });

/* Portable Infobox JS */ /* Adds parameter brackets ("") prepend and append to the Portable Infobox placeholders */

$('.pi-placeholder').each(function {   $(this).prepend(""); });

/* Adds an image placeholder ("File:|250px]]") if an image is not present in the Portable Infobox */ if($('.pi-image').length === 0){ $('.pi-header:first-of-type').after(" "); $('.pi-image-placeholder').css({       'font-size': '12px',        'text-align': 'center',        'color': '#000000',    }); }

/* jQuery for automatically loading the current season template for the main page right column and automatically loading the current month template for the main page. */

$(function {   var Month = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],        NewDate = new Date,        CurrentMonth = Month[NewDate.getMonth],        CurrentDate = NewDate.getDate,        CurrentYear = NewDate.getFullYear;    if ($(".currentmonth").length) {        $.ajax({ url : "/index.php?title=Template:" + CurrentMonth + "_Month&action=render", type : "get", async: false, timeout: 10000, tryCount: 0, retryLimit: 5, success: function(MonthTemplate) { $('div.tabber > div.tabbertab[title="This Month"]').attr("title", CurrentMonth + " " + CurrentYear); $(".currentmonth").replaceWith(MonthTemplate); },           error: function(xhr, textStatus){ if (textStatus === "timeout" || (xhr.responseText === "" && textStatus === "error")) { this.tryCount++; if (this.tryCount <= this.retryLimit) { $.ajax(this); return; }                               return; }           },            statusCode: { 404: function { $(".currentmonth").text("Unable to load the month template, please reload the page and try again. If this error persists, please contact an administrator!"); }           }        });    }    if ($(".currentseason").length) {        var CurrentSeason;        if (CurrentMonth === "June" && CurrentDate >= 20) {            CurrentSeason = "Summer";        } else if (CurrentMonth === "July" || CurrentMonth === "August") {            CurrentSeason = "Summer";        } else if (CurrentMonth === "September" && CurrentDate < 22) {            CurrentSeason = "Summer";        } else if (CurrentMonth === "September" && CurrentDate >= 22) {            CurrentSeason = "Autumn";        } else if (CurrentMonth === "October" || CurrentMonth === "November") {            CurrentSeason = "Autumn";        } else if (CurrentMonth === "December" && CurrentDate < 21) {            CurrentSeason = "Autumn";        } else if (CurrentMonth === "December" && CurrentDate >= 21) {            CurrentSeason = "Winter";        } else if (CurrentMonth === "January" || CurrentMonth === "February") { CurrentSeason = "Winter"; } else if (CurrentMonth === "March" && CurrentDate < 20) { CurrentSeason = "Winter"; } else { CurrentSeason = "Spring"; }       $.ajax({            url : "/index.php?title=Template:Time" + CurrentSeason + "&action=render",            type : "get",            async: false,            timeout: 10000,            tryCount: 0,            retryLimit: 5,            success:  function(SeasonTemplate) {                $(".currentseason").replaceWith(SeasonTemplate);            },            error: function(xhr, textStatus){                if (textStatus === "timeout" || (xhr.responseText === "" && textStatus === "error")) {                    this.tryCount++;                    if (this.tryCount <= this.retryLimit) {                        $.ajax(this);                        return;                    }                                return;                }            },            statusCode: {                404: function {                    $(".currentseason").text("Unable to load the season template, please reload the page and try again. If this error persists, please contact an administrator!");               }            }        });    } });