Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see
Wikipedia:Bypass your cache.
mw.hook('wikipage.content').add(function(){varapi=newmw.Api();varapiRequest=api.get({'action':'query','titles':mw.config.get('wgPageName'),'prop':'categories','clprop':'sortkey|hidden','cllimit':50,'indexpageids':true,'formatversion':2});varapiRequest2=api.loadMessagesIfMissing('pagecategories','colon-separator');$.when(apiRequest,apiRequest2).done(function(data){varcategories=[],response1Data=data0],response2Data=data1];if(!response1Data.query.pages0].categories){return;}functioncategoryHtmlGenerator(element,index,array){if(element.hidden){return;}vartitle=newmw.Title(element.title,mw.config.get('wgNamespaceIds').file);categories.push($('<a>').attr({'href':mw.util.getUrl(element.title)}).append(document.createTextNode(title.getMainText())).get(0));categories.push(', ');}response1Data.query.pages0].categories.forEach(categoryHtmlGenerator);if(categories.length===0){return;}categories.pop();//remove the last commacategories.unshift(document.createTextNode(mw.message('pagecategories').escaped()+mw.message('colon-separator').escaped()+' '));$('.printfooter').after($('<div>').addClass('catlinks').attr('id','catlinks').data('mw','interface').append($('<div>').attr('id','mw-normal-catlink').append(categories)));});});