User:CephHunter/wikia.js

//add some fancy links { if (wgNamespaceNumber != -1) { var toggleHidden = function (hid) { if (hid) $('#gaz-links').addClass('gaz-links-hide'); else $('#gaz-links').removeClass('gaz-links-hide'); };	var gazcookie = 'hide-gaz-links'; if ($.cookie(gazcookie) === null) { $.cookie(gazcookie, false, {expires:7, path:'/'}); }	var hidden = $.cookie(gazcookie) === "true"; var h = $('.wds-global-navigation__start-a-wiki a') .removeAttr('href') .text('Toggle links') .attr('title','Toggle sidelinks') .css('width', 'auto') .click(function {		hidden = !hidden;		console.log("toggling hidden status of links to " + hidden);		$.cookie(gazcookie, hidden, {expires:7, path:'/'});		toggleHidden(hidden);	}); var d = $(' '); d.append(' Links '); var l = $(''); var uri = new mw.Uri(mw.util.getUrl(wgPageName)); var pagename = mw.util.wikiUrlencode(wgPageName); uri.query.action = 'view'; l.append('View'); uri.query.action = 'edit'; l.append('Edit'); uri.query.action = 'purge'; l.append('Purge'); uri.query.action = 'history'; l.append('History</a></li>'); l.append('<li id="gaz-links-logs"><a href="/wiki/Special:Log?page=' + pagename + '">Logs</a></li>'); uri.query.action = 'delete'; l.append('<li id="gaz-links-delete"><a href="' + uri.toString + '">Delete</a></li>'); uri.query.action = 'protect'; l.append('<li id="gaz-links-protect"><a href="' + uri.toString + '">Protect</a></li>'); l.append('<li id="gaz-links-move"><a href="/wiki/Special:MovePage/' + pagename + '">Move</a></li>'); l.append('<li id="gaz-links-wlh"><a href="/wiki/Special:WhatLinksHere/' + pagename + '">WhatLinksHere</a></li>'); l.append('<li id="gaz-links-wjlh"><a href="/wiki/Special:WhatLinksHere/' + pagename + '?hideredirs=1&hidetrans=1">WhatJustLinksHere</a></li>'); l.append('<li id="gaz-links-wrh"><a href="/wiki/Special:WhatLinksHere/' + pagename + '?hidelinks=1&hidetrans=1">WhatRedirectsHere</a></li>'); l.append('<li id="gaz-links-wtt"><a href="/wiki/Special:WhatLinksHere/' + pagename + '?hideredirs=1&hidelinks=1">WhatTranscludesThis</a></li>'); var pfi = new mw.Uri(mw.util.getUrl('Special:PrefixIndex')); pfi.query = {prefix: wgTitle, namespace: wgNamespaceNumber}; l.append('<li id="gaz-links-pfi"><a href="' + pfi.toString + '">PrefixIndex</a></li>'); var browse = new mw.Uri(mw.util.getUrl('Special:Browse/'+wgPageName)); l.append('<li id="gaz-links-browse"><a href="' + browse.toString + '">Browse</a></li>'); d.append(l); $('body').append(d); toggleHidden(hidden); } }