Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
/** * User script to fix the redlinks of categories so they never link to the edit * page * (c) 2021 by [[User:So9q]]. GPLv3 or later. *///(function () {//( function ( mw, $ ) {console.log("redlinks running");varnamespace=mw.config.get('wgNamespaceNumber');if(namespace==6// File: namespace ||namespace==14// Category: namespace ){varcategory=[];// arrayvarlinks=$('a.new');$.each(links,function(){vartest=$(this).attr("href").includes("Category:");console.log("category found: "+test);if(test){category.push($(this));}});console.log("found links:"+links);$.each(links,function(){varlinktext=$(this).text();$(this).attr("href",'https://commons.wikimedia.org/wiki/Category:'+linktext);});}//});