User:SpikeToronto/global.js

// Test if an Element has a Certain Class // Description: Uses regular expressions and caching for better performance. // Maintainers: wikipedia:User:Mike Dillon, wikipedia:User:R. Koot, wikipedia: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 );	}; }); // End Test if an Element has a Certain Class

/* Cookie accessor functions */ function setCookie(name, value, expires) { var d = new Date; d.setDate(d.getDate + expires); document.cookie = name + '=' + escape(value) + ';path=/'; } function getCookie(name) { if (document.cookie.length > 0) { var start = document.cookie.indexOf(name + '='); if (start != -1) { start = start + name.length + 1; var end = document.cookie.indexOf(';', start); if (end == -1) { end = document.cookie.length; }			return unescape(document.cookie.substring(start, end)); } 	}	return ''; } /* End Cookie accessor functions */

// Custom edit buttons importScriptPage('MediaWiki:Common.js/CEB.js', 'admintools'); // End of custom edit buttons

// Add MyContributions to AccountNavigation in the Wikia skin importScriptPage('User:SpikeToronto/common.js/myContribs.js', 'admintools'); // End of MyContributions and AccountNavigation

// Change Wiki Activity to RecentChanges in Wikia skin - 2/1/11 importScriptPage('User:SpikeToronto/wikia.js/wikiActivity.js', 'admintools'); // END Change Wiki Activity to RecentChanges in Wikia skin

// Fix Edit Summary prompt for UNDO importScriptPage('User:SpikeToronto/common.js/undoSummary.js', 'admintools'); // End Fix Edit Summary prompt for UNDO

// Add Purge tab, Popups, & Clock Wikia-wide importScriptURI('http://en.wikipedia.org/w/index.php?title=User:SpikeToronto/OtherWiki.js'    + '&action=raw&ctype=text/javascript'); // End Add Purge tab, Popups, & Clock Wikia-wide

// Add SkinSwitch buttons importScriptPage('User:SpikeToronto/common.js/skinSwitch.js', 'admintools'); // END Add SkinSwitch buttons

// Add link back to Revision History from Diffs in Wikia skin importScriptPage('User:SpikeToronto/common.js/historyDiff.js', 'admintools'); // END Add link back to Revision History from Diffs in Wikia skin

// Convert "Anonymous" to IP Address // importScriptPage('User:SpikeToronto/common.js/ipAnon.js', 'admintools'); // END Convert "Anonymous" to IP Address

// Add additional cookie functions importScriptPage('User:SpikeToronto/common.js/cookieFunctions.js', 'admintools'); // END Add additional cookie functions

// Add Extra Rollback Options // importScriptPage('User:SpikeToronto/common.js/extraRollbacks.js', 'admintools'); // END Add Extra Rollback Options

// Add Ajax Rollback Options // importScriptPage('User:SpikeToronto/common.js/ajaxRollback.js', 'admintools'); // END Add Ajax Rollback Options

// Add Watchlist to AccountNavigation in the Wikia skin importScriptPage('User:SpikeToronto/common.js/watchList.js', 'admintools'); // END Add Watchlist to AccountNavigation in the Wikia skin

/* Ajax auto-refresh */ var ajaxPages = ["Special:RecentChanges", "Special:Watchlist", "Special:Following", "Special:Log", "Special:Contributions", "Special:AbuseLog"]; var AjaxRCRefreshText = 'Auto-refresh'; importScriptPage('MediaWiki:Common.js/ajaxrefresh.js', 'admintools'); /* End of ajax auto-refresh */

/* Collapsible Tables */ importScriptPage('MediaWiki:Common.js/collapsibleTables.js', 'admintools'); /* End of Collapsible Tables */

/* Standard Edit Summaries */ importScriptPage('MediaWiki:Common.js/standardeditsummaries.js', 'admintools'); /* End of Standard Edit Summaries */

/* Added SiteNotice Functionality */ importScriptPage('MediaWiki:Common.js/sitenotice.js', 'admintools'); /* End of added SiteNotice functionality */

/* Dynamic Navigation Bars */ importScriptPage('MediaWiki:Common.js/navigationbars.js', 'admintools'); /* End Dynamic Navigation Bars */

/* Dynamic Navigation Bars (2) */ importScriptPage('MediaWiki:Common.js/navigationbars2.js', 'admintools'); /* End Dynamic Navigation Bars (2) */

/* Restoring Special:Upload functionality */ $(function { if (window.UploadPhotos && window.UploadPhotos.showDialog) { $('a.wikia-button.upphotos').unbind('click',UploadPhotos.showDialog); } }); /* END Restoring Special:Upload functionality */

/* Change PHOTOS to IMAGES for Wikia skin */ function ImagesOnWiki {

$('.LatestPhotosModule details span.fixedwidth').html('images on this wiki');

}

addOnloadHook(ImagesOnWiki); /* END Change PHOTOS to IMAGES for Wikia skin */

// Redirects from /User:UserName/skin.js or .css to the user's actual skin page // Maintainer: Cacycle

if (wgArticleId == 0 && wgUserName) { var slash = wgPageName.indexOf('/'); var norm = wgPageName.substr(0, slash) + wgPageName.substr(slash).toLowerCase; var test = 'User:' + wgUserName.replace(/ /g, '_') + '/skin.'; var ext = null; if (norm == test + 'js') ext = 'js'; else if (norm == test + 'css') ext = 'css'; if (ext != null) window.location.href = window.location.href.replace(/\/skin.(css|js)/i, '/' + skin.replace('oasis', 'wikia') + '.' + ext); } // End of skin redirect code