(Thanks to User:Joeytje50 and User:Gaz_Lloyd) |
m (Wasn't fully functional.) |
||
Line 153: | Line 153: | ||
if(wgCanonicalNamespace != 'Special' && wgPageName.replace(/_/g, ' ') != wgMainPageTitle) {$('#WikiaPageHeader').prepend($('#WikiaSearch').detach().css('float', 'right'));} |
if(wgCanonicalNamespace != 'Special' && wgPageName.replace(/_/g, ' ') != wgMainPageTitle) {$('#WikiaPageHeader').prepend($('#WikiaSearch').detach().css('float', 'right'));} |
||
− | |||
− | /*** BEGIN Search bar fix (source:user:Joeytje50 via user:Gaz_Lloyd) ***/ |
||
− | //Search bar fix |
||
− | if ($('#WikiaSearch').length) { |
||
− | $('#WikiaSearch button.secondary').attr('name','go').val('Go'); |
||
− | } |
||
− | addOnloadHook(function() { |
||
− | if ($('#WikiaSearch').length) { |
||
− | $('#WikiaSearch button.secondary').attr('name','go').val('Go'); |
||
− | } |
||
− | }) |
||
− | |||
− | /*** END Search bar fix (source:user:Joeytje50 via user:Gaz_Lloyd) ***/ |
Latest revision as of 16:15, 5 May 2012
window.wgEnableImageLightboxExt = false;
/* add contribs to user menu - 2/1/11 */
function UserContribsMenuItem() {
$('ul.AccountNavigation li:first-child ul.subnav li:first-child').after('<li><a href="/wiki/Special:Contributions/'+ encodeURIComponent (wgUserName) +'">Contributions</a></li>');
}
addOnloadHook(UserContribsMenuItem);
/* change wiki activity to recent changes - 2/1/11 */
function WikiActivity2RecentChanges() {
$('a.wikia-button[data-id$="wikiactivity"]').replaceWith('<a data-id="recentchanges" class="wikia-button secondary" accesskey="g" title="Special:RecentChanges" href="/wiki/Special:RecentChanges"><img height="0" width="0" class="sprite activity" src="http://images1.wikia.nocookie.net/common/skins/common/blank.gif">Recent Changes</a>');
}
addOnloadHook(WikiActivity2RecentChanges);
/* kill image popups - 3/30/11 */
function changeimagelinks() {
if (window.skin == 'oasis') {
var article = $('#WikiaArticle, .LatestPhotosModule, #article-comments');
}
else {
var article = $('#bodyContent');
}
article.unbind('click.lightbox');
var a = document.getElementsByTagName("a");
for ( var t = 0; t < a.length; ++t ) {
var a2 = a[t];
var img = a2.getElementsByTagName("img");
if ( img[0] != null ) {
if ( a2.href.indexOf("images.wikia.com") != -1 ) {
var link = wgServer + '/wiki/File:' + a2.href.substring(a2.href.lastIndexOf('/') + 1);
a2.setAttribute('href',link);
}
}
}
}
addOnloadHook(changeimagelinks);
// ============================================================
// displayTimer - 2/1/11
// ============================================================
//Add a clock to the WikiHeader
//Modified from work by Patrick Westerhoff [poke]:
//http://bulbapedia.bulbagarden.net/wiki/MediaWiki:Monobook.js
hookEvent( 'load', displayTimer );
function displayTimer ()
{
if ( typeof( timerDisplay ) !== 'undefined' && timerDisplay === false )
return;
var date;
if (skin == 'oasis')
{
var timerParent = document.getElementById( 'WikiHeader' ).getElementsByTagName( 'div' )[0];
}
if (skin == 'monobook')
{
var timerParent = document.getElementById( 'p-personal' ).getElementsByTagName( 'ul' )[0];
}
var timerLink = document.createElement( 'a' );
var timerObj = document.createElement( 'li' );
timerLink.href = '/wiki/' + wgPageName + '?action=purge';
timerLink.title = 'Purge the server cache and update the contents of this page.'
timerObj.id = 'displayTimer';
timerObj.style.textTransform = 'none';
timerObj.style.fontWeight = 'bold';
timerObj.style.fontSize = '100%';
timerObj.appendChild( timerLink );
timerParent.insertBefore( timerObj, timerParent.firstChild );
if (skin == 'oasis')
{
$('#displayTimer').css({'position': "inherit", 'right': "0px", 'top': "-28px"});
}
var month = new Array(12);
month[0] = "Jan";
month[1] = "Feb";
month[2] = "Mar";
month[3] = "Apr";
month[4] = "May";
month[5] = "Jun";
month[6] = "Jul";
month[7] = "Aug";
month[8] = "Sep";
month[9] = "Oct";
month[10] = "Nov";
month[11] = "Dec";
function actualizeUTC ()
{
timerDate = new Date();
timerLink.innerHTML = ( timerDate.getUTCDate() < 10 ? '0' : '' ) + timerDate.getUTCDate() + ' '
+ ( timerDate.getUTCMonth() < 10 ? '' : '' ) + month[timerDate.getUTCMonth()] + ' '
+ ( timerDate.getUTCFullYear() < 10 ? '0' : '' ) + timerDate.getUTCFullYear() + ' '
+ ( timerDate.getUTCHours() < 10 ? '0' : '' ) + timerDate.getUTCHours() + ':'
+ ( timerDate.getUTCMinutes() < 10 ? '0' : '' ) + timerDate.getUTCMinutes() + ':'
+ ( timerDate.getUTCSeconds() < 10 ? '0' : '' ) + timerDate.getUTCSeconds() + ' (UTC)';
}
function actualizeCustom ()
{
timerDate = new Date();
timerDate.setMinutes ( timerDate.getMinutes() + timerDate.getTimezoneOffset() + timerTimezone * 60 );
timerLink.innerHTML = ( timerDate.getDate() < 10 ? '0' : '' ) + timerDate.getDate() + ' '
+ ( timerDate.getMonth() < 10 ? '' : '' ) + month[timerDate.getMonth()] + ' '
+ ( timerDate.getFullYear() < 10 ? '0' : '' ) + timerDate.getFullYear() + ' '
+ ( timerDate.getHours() < 10 ? '0' : '' ) + timerDate.getHours() + ':'
+ ( timerDate.getMinutes() < 10 ? '0' : '' ) + timerDate.getMinutes() + ':'
+ ( timerDate.getSeconds() < 10 ? '0' : '' ) + timerDate.getSeconds()
+ ' (UTC' + ( timerTimezone < 0 ? '' : '+' ) + timerTimezone + ')';
}
// start
if ( typeof( timerTimezone ) !== 'number' )
{
actualizeUTC();
setInterval( actualizeUTC, 1000 );
}
else
{
actualizeCustom();
setInterval( actualizeCustom, 1000 );
}
}
/** Test if an element has a certain class **************************************
*
* Description: Uses regular expressions and caching for better performance.
* Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]
*/
var hasClass = (function () {
var reCache = {};
return function (element, className) {
return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
};
})();
/* Include search bar */
if(wgCanonicalNamespace != 'Special' && wgPageName.replace(/_/g, ' ') != wgMainPageTitle) {$('#WikiaPageHeader').prepend($('#WikiaSearch').detach().css('float', 'right'));}