MediaWiki:Common.js

// Tags window.UserTagsJS = { tags: { armadillo: 'Armadillo', bureaucrat: { link: 'Special:ListUsers/bureaucrat' },       butternut: 'Butternut', chatmoderator: { link: 'Special:ListUsers/chatmoderator' },       coda: 'Coda', generation: '4th Generation Owner', kittycat: 'Kittycat', manaphy: 'Manaphy', nutty: '#1 Nutty Fan', rollback: { link: 'Special:ListUsers/rollback' },       shellington: 'Shellington', penguin: 'Emperor Penguin', sysop: { link: 'Special:ListUsers/sysop' }   },    modules: { autoconfirmed: true, custom: { 'Ailourophile': ['kittycat', 'nutty'], 'Killer365': ['armadillo', 'butternut', 'penguin'], 'Randomced859': ['coda', 'generation', 'manaphy', 'shellington'] },       inactive: { days: 60, namespaces: [0], zeroIsInactive: true },       mwGroups: ['bannedfromchat', 'bureaucrat', 'chatmoderator', 'sysop', 'rollback'], newuser: true } };

// Tabber var Tabs = { switchDuration: 400, selectorDuration: 200, inactiveOpacity: 0.25, hoverOpacity: 0.6, tab1: null, tab2: null, tab3: null, tab4: null, tab5: null, tab6: null, tab7: null, tab8: null, tab9: null, tab10: null, tab1Selector: null, tab2Selector: null, tab3Selector: null, tab4Selector: null, tab5Selector: null, tab6Selector: null, tab7Selector: null, tab8Selector: null, tab9Selector: null, tab10Selector: null, selected: 1, hoverTab: function (tab) { "use strict"; if (tab === Tabs.selected) { return; }       if (tab === 1) { Tabs.tab1Selector.animate({               opacity: Tabs.hoverOpacity            }, Tabs.selectorDuration); }       if (tab === 2) { Tabs.tab2Selector.animate({               opacity: Tabs.hoverOpacity            }, Tabs.selectorDuration); }       if (tab === 3) { Tabs.tab3Selector.animate({               opacity: Tabs.hoverOpacity            }, Tabs.selectorDuration); }       if (tab === 4) { Tabs.tab4Selector.animate({               opacity: Tabs.hoverOpacity            }, Tabs.selectorDuration); }       if (tab === 5) { Tabs.tab5Selector.animate({               opacity: Tabs.hoverOpacity            }, Tabs.selectorDuration); }       if (tab === 6) { Tabs.tab6Selector.animate({               opacity: Tabs.hoverOpacity            }, Tabs.selectorDuration); }       if (tab === 7) { Tabs.tab7Selector.animate({               opacity: Tabs.hoverOpacity            }, Tabs.selectorDuration); }       if (tab === 8) { Tabs.tab8Selector.animate({               opacity: Tabs.hoverOpacity            }, Tabs.selectorDuration); }       if (tab === 9) { Tabs.tab9Selector.animate({               opacity: Tabs.hoverOpacity            }, Tabs.selectorDuration); }       if (tab === 10) { Tabs.tab10Selector.animate({               opacity: Tabs.hoverOpacity            }, Tabs.selectorDuration); }   },    unhoverTab: function (tab) { "use strict"; if (tab === Tabs.selected) { return; }       if (tab === 1) { Tabs.tab1Selector.animate({               opacity: Tabs.inactiveOpacity            }, Tabs.selectorDuration); }       if (tab === 2) { Tabs.tab2Selector.animate({               opacity: Tabs.inactiveOpacity            }, Tabs.selectorDuration); }       if (tab === 3) { Tabs.tab3Selector.animate({               opacity: Tabs.inactiveOpacity            }, Tabs.selectorDuration); }       if (tab === 4) { Tabs.tab4Selector.animate({               opacity: Tabs.inactiveOpacity            }, Tabs.selectorDuration); }       if (tab === 5) { Tabs.tab5Selector.animate({               opacity: Tabs.inactiveOpacity            }, Tabs.selectorDuration); }       if (tab === 6) { Tabs.tab6Selector.animate({               opacity: Tabs.inactiveOpacity            }, Tabs.selectorDuration); }       if (tab === 7) { Tabs.tab7Selector.animate({               opacity: Tabs.inactiveOpacity            }, Tabs.selectorDuration); }       if (tab === 8) { Tabs.tab8Selector.animate({               opacity: Tabs.inactiveOpacity            }, Tabs.selectorDuration); }       if (tab === 9) { Tabs.tab9Selector.animate({               opacity: Tabs.inactiveOpacity            }, Tabs.selectorDuration); }       if (tab === 10) { Tabs.tab10Selector.animate({               opacity: Tabs.inactiveOpacity            }, Tabs.selectorDuration); }   },    changeTab: function (tab) { "use strict"; if (tab === Tabs.selected) { return; }       if (Tabs.selected === 1) { Tabs.tab1.hide(Tabs.switchDuration); Tabs.tab1Selector.animate({               opacity: Tabs.inactiveOpacity            }, Tabs.selectorDuration); }       if (Tabs.selected === 2) { Tabs.tab2.hide(Tabs.switchDuration); Tabs.tab2Selector.animate({               opacity: Tabs.inactiveOpacity            }, Tabs.selectorDuration); }       if (Tabs.selected === 3) { Tabs.tab3.hide(Tabs.switchDuration); Tabs.tab3Selector.animate({               opacity: Tabs.inactiveOpacity            }, Tabs.selectorDuration); }       if (Tabs.selected === 4) { Tabs.tab4.hide(Tabs.switchDuration); Tabs.tab4Selector.animate({               opacity: Tabs.inactiveOpacity            }, Tabs.selectorDuration); }       if (Tabs.selected === 5) { Tabs.tab5.hide(Tabs.switchDuration); Tabs.tab5Selector.animate({               opacity: Tabs.inactiveOpacity            }, Tabs.selectorDuration); }       if (Tabs.selected === 6) { Tabs.tab6.hide(Tabs.switchDuration); Tabs.tab6Selector.animate({               opacity: Tabs.inactiveOpacity            }, Tabs.selectorDuration); }       if (Tabs.selected === 7) { Tabs.tab7.hide(Tabs.switchDuration); Tabs.tab7Selector.animate({               opacity: Tabs.inactiveOpacity            }, Tabs.selectorDuration); }       if (Tabs.selected === 8) { Tabs.tab8.hide(Tabs.switchDuration); Tabs.tab8Selector.animate({               opacity: Tabs.inactiveOpacity            }, Tabs.selectorDuration); }       if (Tabs.selected === 9) { Tabs.tab9.hide(Tabs.switchDuration); Tabs.tab9Selector.animate({               opacity: Tabs.inactiveOpacity            }, Tabs.selectorDuration); }       if (Tabs.selected === 10) { Tabs.tab10.hide(Tabs.switchDuration); Tabs.tab10Selector.animate({               opacity: Tabs.inactiveOpacity            }, Tabs.selectorDuration); }       Tabs.selected = tab; if (tab === 1) { Tabs.tab1.show(Tabs.switchDuration); Tabs.tab1Selector.animate({               opacity: 1            }, Tabs.selectorDuration); }       if (tab === 2) { Tabs.tab2.show(Tabs.switchDuration); Tabs.tab2Selector.animate({               opacity: 1            }, Tabs.selectorDuration); }       if (tab === 3) { Tabs.tab3.show(Tabs.switchDuration); Tabs.tab3Selector.animate({               opacity: 1            }, Tabs.selectorDuration); }       if (tab === 4) { Tabs.tab4.show(Tabs.switchDuration); Tabs.tab4Selector.animate({               opacity: 1            }, Tabs.selectorDuration); }       if (tab === 5) { Tabs.tab5.show(Tabs.switchDuration); Tabs.tab5Selector.animate({               opacity: 1            }, Tabs.selectorDuration); }       if (tab === 6) { Tabs.tab6.show(Tabs.switchDuration); Tabs.tab6Selector.animate({               opacity: 1            }, Tabs.selectorDuration); }       if (tab === 7) { Tabs.tab7.show(Tabs.switchDuration); Tabs.tab7Selector.animate({               opacity: 1            }, Tabs.selectorDuration); }       if (tab === 8) { Tabs.tab8.show(Tabs.switchDuration); Tabs.tab8Selector.animate({               opacity: 1            }, Tabs.selectorDuration); }       if (tab === 9) { Tabs.tab9.show(Tabs.switchDuration); Tabs.tab9Selector.animate({               opacity: 1            }, Tabs.selectorDuration); }       if (tab === 10) { Tabs.tab10.show(Tabs.switchDuration); Tabs.tab10Selector.animate({               opacity: 1            }, Tabs.selectorDuration); }   },    init: function  { "use strict"; Tabs.tab1 = $('#content-1'); Tabs.tab1Selector = $('#selector-1').click(function {            Tabs.changeTab(1);            return false;        }).css('opacity', 1); Tabs.tab1Selector.hover(function {            Tabs.hoverTab(1);        }, function  {            Tabs.unhoverTab(1);        }); Tabs.tab2 = $('#content-2'); Tabs.tab2Selector = $('#selector-2').click(function {            Tabs.changeTab(2);            return false;        }).css('opacity', Tabs.inactiveOpacity); Tabs.tab2Selector.hover(function {            Tabs.hoverTab(2);        }, function  {            Tabs.unhoverTab(2);        }); Tabs.tab3 = $('#content-3'); Tabs.tab3Selector = $('#selector-3').click(function {            Tabs.changeTab(3);            return false;        }).css('opacity', Tabs.inactiveOpacity); Tabs.tab3Selector.hover(function {            Tabs.hoverTab(3);        }, function  {            Tabs.unhoverTab(3);        }); Tabs.tab4 = $('#content-4'); Tabs.tab4Selector = $('#selector-4').click(function {            Tabs.changeTab(4);            return false;        }).css('opacity', Tabs.inactiveOpacity); Tabs.tab4Selector.hover(function {            Tabs.hoverTab(4);        }, function  {            Tabs.unhoverTab(4);        }); Tabs.tab5 = $('#content-5'); Tabs.tab5Selector = $('#selector-5').click(function {            Tabs.changeTab(5);            return false;        }).css('opacity', Tabs.inactiveOpacity); Tabs.tab5Selector.hover(function {            Tabs.hoverTab(5);        }, function  {            Tabs.unhoverTab(5);        }); Tabs.tab6 = $('#content-6'); Tabs.tab6Selector = $('#selector-6').click(function {            Tabs.changeTab(6);            return false;        }).css('opacity', Tabs.inactiveOpacity); Tabs.tab6Selector.hover(function {            Tabs.hoverTab(6);        }, function  {            Tabs.unhoverTab(6);        }); Tabs.tab7 = $('#content-7'); Tabs.tab7Selector = $('#selector-7').click(function {            Tabs.changeTab(7);            return false;        }).css('opacity', Tabs.inactiveOpacity); Tabs.tab7Selector.hover(function {            Tabs.hoverTab(7);        }, function  {            Tabs.unhoverTab(7);        }); Tabs.tab8 = $('#content-8'); Tabs.tab8Selector = $('#selector-8').click(function {            Tabs.changeTab(8);            return false;        }).css('opacity', Tabs.inactiveOpacity); Tabs.tab8Selector.hover(function {            Tabs.hoverTab(8);        }, function  {            Tabs.unhoverTab(8);        }); Tabs.tab9 = $('#content-9'); Tabs.tab9Selector = $('#selector-9').click(function {            Tabs.changeTab(9);            return false;        }).css('opacity', Tabs.inactiveOpacity); Tabs.tab9Selector.hover(function {            Tabs.hoverTab(9);        }, function  {            Tabs.unhoverTab(9);        }); Tabs.tab10 = $('#content-10'); Tabs.tab10Selector = $('#selector-10').click(function {            Tabs.changeTab(10);            return false;        }).css('opacity', Tabs.inactiveOpacity); Tabs.tab10Selector.hover(function {            Tabs.hoverTab(10);        }, function  {            Tabs.unhoverTab(10);        }); } }; Tabs.init;

// Show username function userNameReplace { "use strict"; var disableUsernameReplace; if (typeof (disableUsernameReplace) !== 'undefined' && disableUsernameReplace || mw.config.get('wgUserName') === null) { return; }   $("span.insertusername").html(mw.config.get('wgUserName')); } addOnloadHook(userNameReplace);

// Add custom edit buttons if (mw.config.get('mwCustomEditButtons')) { mw.config.get('mwCustomEditButtons')[mw.config.get('mwCustomEditButtons').length] = { 'imageFile': 'http://images1.wikia.nocookie.net/central/images/8/8c/Button_RedX.png', 'speedTip': 'request delete', 'tagOpen': '', 'sampleText': 'your reason here' };   mw.config.get('mwCustomEditButtons')[mw.config.get('mwCustomEditButtons').length] = { 'imageFile': 'http://images2.wikia.nocookie.net/__cb20100821183407/bleach/en/images/e/e1/O_Accent_Button.png', 'speedTip': 'Add the ō character', 'tagOpen': 'ō', 'tagClose': '', 'sampleText': '' };   mw.config.get('mwCustomEditButtons')[mw.config.get('mwCustomEditButtons').length] = { 'imageFile': 'http://images4.wikia.nocookie.net/__cb20100821183407/bleach/en/images/d/db/U_Accent_Button.png', 'speedTip': 'Add the ū character', 'tagOpen': 'ū', 'tagClose': '', 'sampleText': '' };   mw.config.get('mwCustomEditButtons')[mw.config.get('mwCustomEditButtons').length] = { 'imageFile': 'http://images1.wikia.nocookie.net/naruto/images/7/79/Button_reflink.png', 'speedTip': 'Add a Reference', 'tagOpen': ' ', 'sampleText': '' }; }

// Time var refreshDate;

function addDate { "use strict"; var UTCDate = ((new Date).toUTCString).replace("GMT", "(UTC)"); $('#showdate').empty.append(' ' + UTCDate.substring(5) + ' '); clearTimeout(refreshDate); refreshDate = setTimeout(addDate, 1000); }

// Chat description if ($('section.ChatModule').length > 0) { $.get('/wiki/MediaWiki:Chat-headline?action=raw', function (result) {       "use strict";        if ($('p.chat-name').length > 0) {            $('p.chat-name').html(result);        } else {            var chatDescInt = setInterval(function  { if ($('p.chat-name').length > 0) { $('p.chat-name').html(result); clearInterval(chatDescInt); }           }, 50);        }    }); }

$(function {    "use strict";    if (mw.config.get('skin') === 'oasis') {        $(' ').appendTo('#GlobalNavigation');    } else {        $('#p-personal ul').prepend(' ');    }

addDate; refreshDate = setTimeout(addDate, 5000);

$('#displayTimer').css('font-size', '12px');

// Change title var newTitle = $('#title-meta').html, edits = $('#user_masthead_since').text;

if (!newTitle) { return; }

$('.firstHeading, #WikiaUserPagesHeader h1, #WikiaPageHeader h1').html(newTitle); $('.#user_masthead_head h2').html(newTitle + '' + edits + ' '); });

// Message wall icons // By User:AnimatedCartoons setInterval(function {    "use strict";    $('.comments li.message blockquote .MiniEditorWrapper .edited-by a:not(.subtle)').each(function  { var $user = $(this).text; if ($user.match(/Randomced859/g)) { $(this).addClass('bureaucrat'); }       if ($user.match(/Chibitracy|Miggy7215/g)) { $(this).addClass('chat-mod'); }       if ($user.match(/Ailourophile|AnimatedCartoons|Gumballamiyumi|InvaderrrZIM|Killer365|MisterJim/g)) { $(this).addClass('admin'); }   }); }, 1);

// Import scripts from Wikia Developers' Wiki importArticles({   type: 'script',    articles: ['u:dev:ArchiveTool/code.js', 'u:dev:Countdown/code.js', 'u:dev:FloatingToc/code.js', 'u:dev:PurgeButton/code.js', 'u:dev:ReferencePopups/code.js', 'u:dev:SexyUserPage/code.js', 'u:dev:SignatureCheck/code.js', 'u:dev:UserTags/code.js', 'u:dev:WallGreetingButton/code.js'] });

importScriptPage('AjaxRC/code.js', 'dev');

// Show IP address of anonymous contributors $('a:contains(a new Elmore resident)').append(function {    "use strict";    return ' (' + this.href.match(/(\d{1,3}\.){3}\d{1,3}/)[0] + ')'; });