User:PrimeHunter/Search sister projects.js

From Wikipedia, the free encyclopedia
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.
/* Add a "Sister projects" sidebar link to search pages.
   Click it to repeat the search with sister projects added.
   Install with this in your [[Special:MyPage/common.js]]:

   importScript('User:PrimeHunter/Search_sister_projects.js'); // Linkback: [[User:PrimeHunter/Search sister projects.js]]
*/

// Script is specific to Special:Search
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Search'){
  mw.util.addPortletLink(
    'p-tb',
    location.href.replace( location.hash, '' ) + ( location.search ? '&' : '?' ) + 'cirrusUserTesting=recall_sidebar_results',
    'Sister projects',
    't-sisterprojects',
    'Repeat the search with sister projects added'
  );
}