User:Starfleet Academy/global.js

//IMPORTS //Importing 'Wikimarks' gadget by Pecoes importScriptPage('Client.js', 'wikimarks'); //END importing gadget //END Imports

//Adds recent changes button to Main header -- by Starfleet Academy $(function navRC { var blankimgurl=mw.config.get('wgBlankImgUrl'); if (mw.config.get('wgAction') == "edit" || mw.config.get('wgPageName') == "User:Starfleet_Academy/Wikimarks") { $('.WikiaHeader .GlobalNavigation').append('RC  ');} else {  $('.WikiaHeader .GlobalNavigation').append('RC  ');} }); //END adding recent changes button

//Adds links to my blog, contribs & watchlist //under talkpage link in account nav (drop-down) -- by Starfleet Academy $(function accnavLinks { $('.WikiaHeader .AccountNavigation .subnav > li:first-child').after('My blog<a data-id="mycontribs" href="/wiki/Special:Contributions/Starfleet_Academy">Contributions</a></li><a data-id="mywatchlist" href="/wiki/Special:Following">Followed pages</a></li>'); }); //END adding links to Account nav

//Adds purge link to edit menu -- by Starfleet Academy $(function purgeLink { var pagename=mw.config.get('wgPageName'); if (mw.config.get('wgPageName') != "User:Starfleet_Academy/Wikimarks") { $('.WikiaPageHeader .wikia-menu-button .WikiaMenuElement > li:first-child').before('<a href="/index.php?title='+ pagename +'&action=purge" data-id="purge">Purge</a></li>'); }; if (mw.config.get('wgCanonicalNamespace') == "User", "User_talk") { $('.UserProfileActionButton .wikia-menu-button .WikiaMenuElement > li:first-child').before('<a href="/index.php?title='+ pagename +'&action=purge" data-id="purge">Purge</a></li>');} }); //END adding purge button

//Adds a "return to page top" link on the toolbar -- by Starfleet Academy $(function backToTheTop { var server=mw.config.get('wgServer'),   pagename=mw.config.get('wgPageName'); if (mw.config.get('wgAction') == "view" || mw.config.get('wgCanonicalNamespace') == "Message_Wall" || mw.config.get('wgCanonicalNamespace') == "Thread") {  $('.skin-oasis .WikiaFooter .toolbar .tools').append('<a href="'+ server +'/wiki/'+ pagename +'#" class="to-top-link" title="Return to page home">Top</a></li>');} }); //END top-returning link

//Adds a cancel button to the editor -- by Starfleet Academy $(function { var server=mw.config.get('wgServer'),   pagename=mw.config.get('wgPageName'); $('body.editor .editpage-rail .module_page_controls .buttons').after('<a href="'+ server +'/wiki/'+ pagename +'" class="wikia-button secondary c-button" style="width: 90px; text-align: center; border-color: red; margin-top: 20px;" tabindex="2">Cancel</a>'); $('#EditPageToolbar').css("height","50px"); }); //END cancel button

//Changes the contribute button to a random page button //And adds a random in cat button on category pages -- by Starfleet Academy $(function { var server=mw.config.get('wgServer'),   title=mw.config.get('wgTitle'); $('.WikiHeaderRestyle .buttons .contribute').replaceWith('<a href="'+ server +'/wiki/Special:Random" title="Random Page" class="wikia-button secondary" data-id="randompage"><img src="data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D" height="0" width="0" class="sprite random" /> Random Page</a>');  if (mw.config.get('wgCanonicalNamespace') == "Category") { $('.WikiHeaderRestyle .buttons').append('<a href="'+ server +'/wiki/Special:RandomInCategory/'+ title +'" title="Random Page" class="wikia-button secondary" data-id="randompage"><img src="data:image/gif;base64,R0lGODlhAQABAIABAAAAAP///yH5BAEAAAEALAAAAAABAAEAQAICTAEAOw%3D%3D" height="0" width="0" class="sprite random" /> RIC</a>');} }); //END random page button.