Jump to content

User:Chrs/common.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.
if(mw.config.get("wgPageName") == "Wikipedia:Miscellany_for_deletion" && !window.location.hash && !window.location.pathname.includes("index.php")) { 
	window.location = window.location.origin + window.location.pathname + "#toc"
}

if(mw.config.get("wgPageName") != "Main_Page"){
	mw.loader.load( '/w/index.php?title=User:RedWarn/.js&action=raw&ctype=text/javascript' );
}

$( document ).ready( function() {
  mw.util.addPortletLink(
    'p-interaction',
    'https://en.wikipedia.org/w/index.php?title=Special:Log&limit=500&type=newusers&subtype=create',
    'Recent new users',
    't-newusers',
    'New users log'
  );
  if(mw.config.get("wgPageName") == "Special:Log"){
	$(mw.util.addPortletLink(
	  'p-interaction',
	  '',
	  'Filter new users',
	  't-newusers-filter',
	  'Filter new users'
	)).on('click', function(e){
	  $(".mw-logline-newusers").filter(function(index){
	    return !!$(this).find(".mw-usertoollinks-contribs.new").length;
	  }).remove();
	  e.preventDefault();
	});
  }
});