User:Ilmari Karonen/catsort.js

// Add tab to show sort keys on category pages

if (wgCanonicalNamespace == "Category") { addOnloadHook(function {        var url = wgScriptPath + "/api.php?action=query&list=categorymembers&cmprop=title|sortkey&cmlimit=500&cmtitle=" + encodeURIComponent(mw.config.get('wgPageName'));        mw.util.addPortletLink('p-cactions', url, 'Sortkeys', 'ca-apicmsortkeys', 'API query to show sort keys for pages in this category');    }); }