User:PrimeHunter/Articles in category.js

/* This script adds a "Search articles" link under "Tools" in the sidebar on category pages. The link makes a search which only shows articles in the category. There is also a "Not articles" link which shows everything except articles. The order of the articles is determined by the search function and not the category. To use the script, add the following line to Special:MyPage/common.js: importScript('User:PrimeHunter/Articles_in_category.js'); // Linkback: User:PrimeHunter/Articles in category.js



$.when( mw.loader.using( 'mediawiki.util' ), $.ready ).then( function {   if ( mw.config.get( 'wgNamespaceNumber' ) === 14 ) {    mw.util.addPortletLink( 'p-tb', 'https://en.wikipedia.org/w/index.php?title=Special:Search&profile=advanced&search=incategory%3A%22' + encodeURIComponent(mw.config.get( 'wgTitle' )) + '%22&ns0=1', 'Search articles', 'pt-articlesincategory', 'Search for articles in this category', null, '#t-info' );   mw.util.addPortletLink( 'p-tb', 'https://en.wikipedia.org/w/index.php?title=Special:Search&profile=advanced&search=incategory%3A%22' + encodeURIComponent(mw.config.get( 'wgTitle' )) + '%22' + '&ns1=1&ns2=1&ns3=1&ns4=1&ns5=1&ns6=1&ns7=1&ns8=1&ns9=1&ns10=1&ns11=1&ns12=1&ns13=1' + '&ns14=1&ns15=1&ns100=1&ns101=1&ns108=1&ns109=1&ns118=1&ns119=1&ns446=1&ns447=1' + '&ns710=1&ns711=1&ns828=1&ns829=1&ns2300=1&ns2301=1&ns2302=1&ns2303=1', 'Not articles', 'pt-notarticlesincategory', 'Search everything except articles in this category', null, '#t-info' ); } });