User:Fandyllic/wikia.js

// Additional UserRights Icons in profile mastheads importScript('User:Fandyllic/wikia.js/userRightsIcons.js'); // END Additional UserRights Icons in profile mastheads

/* Dynamically replace favicon with the old curly W with JQuery */ $(function {   var link = document.createElement('link');    link.type = 'image/x-icon';    link.rel = 'shortcut icon';    link.href = 'http://images3.wikia.nocookie.net/central/images/archive/6/64/20120405205346%21Favicon.ico';    document.getElementsByTagName('head')[0].appendChild(link); }); /* END dynamically replace favicon with the old curly W */

/* Changes redlinks on Special:WantedFiles to upload links */ $(function {   if ("Special:WantedFiles" == wgPageName) {        $('ol.special a.new').each(function { var m = $(this).attr('href').match(/title=File:([^&]+)/); if (undefined == m[1]) return; $(this).attr('href', '/index.php?title=Special:Upload&wpDestFile=' + m[1]); });   } });

/* Disable for now function ImgDescEditLink2ImgLink { $('ol.special > li > a.new').each(function {   this.setAttribute("href", this.getAttribute("href").replace(/\&action\=edit/, ""));  }); } addOnloadHook(ImgDescEditLink2ImgLink);

/* Disable for now function ImgDescEditLink2Upload { $('ol.special > li > a.new').each(function {   this.setAttribute("href", this.getAttribute("href").replace(/\&action\=edit\&redlink\=1/, ""));    this.setAttribute("href", this.getAttribute("href").replace(/File:/, "Special:Upload&wpDestFile="));  }); } addOnloadHook(ImgDescEditLink2Upload);

function ChangeRCDetailsArrowIcons { /* Details hidden */ $('a.mw-arr-r > img').replaceWith(''); /* Details showing */ $('a.mw-arr-d > img').replaceWith(''); } addOnloadHook(ChangeRCDetailsArrowIcons);

/* Add "View History" button for Message Wall and threads Add "Edit Greeting" when on user MW page to edit MW Greeting */ function WallTools { if (wgCanonicalNamespace == 'Thread') { $('#WallBrickHeader').append('View History'); }	if (wgCanonicalNamespace == 'Message_Wall' && wgAction != 'history') { $('.WikiaMainContent').prepend(' View History '); if (wgTitle == wgUserName) { $('.UserProfileActionButton').prepend(' Edit Greeting	'); }	} } addOnloadHook(WallTools);

/* Add Recent Changes button after Contribute drop-down */ function RecentChangesAfterContribute { $('nav.contribute').after(' RC'); } addOnloadHook(RecentChangesAfterContribute);

/* Change Wikia Activity button into Recent Changes */ /* Doesn't work with New Wiki Navigation function WikiActivity2RecentChanges { $('a.wikia-button[data-id$="wikiactivity"]').replaceWith('Recent Changes'); } addOnloadHook(WikiActivity2RecentChanges); /*

/* Adding the following CSS support is recommended for WikiActivity2RecentChanges... /- Widen area for Random Page and Wiki Activity buttons -/ .WikiHeader .buttons { width: 290px; }

/* Add a history link to most diffs */ function HistoryOnDiff { /* Does not work for "User:" or "User talk:" */ if (wgCanonicalNamespace == "") { $('p > a[accesskey="c"]').after(' &#124; History of this page (' + wgTitle + ')'); } else { $('p > a[accesskey="c"]').after(' &#124; History of this page</a> (' + wgCanonicalNamespace + ':' + wgTitle + ')'); } }

addOnloadHook(HistoryOnDiff);

/* Add History and What Links Here links to 3rd wiki menu after 1st item */ /* function ToolsMenuItems { $('section header nav ul li:nth-last-child(2) ul li:first-child').after('<li>History</a></li><li>What Links here</a></li>'); } addOnloadHook(ToolsMenuItems);

/* Add history to the Edit dropdown menu for User pages */ /* Wikia made this the default functionality and now also for User pages function UserHistoryDropdownMenuItem { if ( (wgCanonicalNamespace == 'User') || (wgCanonicalNamespace == 'User_talk') ) { $('ul.wikia-menu-button li:first-child ul li:first-child').after('<li>History</a></li>'); } }

addOnloadHook(UserHistoryDropdownMenuItem);

/* Works, but disable for now. */ /* function Talk4Forum { if (wgCanonicalNamespace == 'Forum') { $('ul.wikia-menu-button').after('Forum talk</a>'); } } addOnloadHook(Talk4Forum);