User:Maxim Masiutin/RefRenamer.js

// This is a fork from User:Nardog/RefRenamer.js by User:Nardog // The fork adds support the pmid (PubMed ID) attribute.

mw.config.get('wgNamespaceNumber') % 2 === 0 && mw.config.get('wgArticleId') && mw.config.get('wgPageContentModel') === 'wikitext' && $.when($.ready, mw.loader.using('mediawiki.util')).then(function refRenamer {	if (!document.getElementById('p-tb')) return;	let messages = Object.assign({ portlet: 'RefRenamer', loading: 'Loading RefRenamer...' }, window.refrenamerMessages);	let clicked;	mw.util.addPortletLink('p-tb', '#', messages.portlet, 't-refrenamer').firstElementChild.addEventListener('click', e => { e.preventDefault; if (clicked) { if (window.refRenamer) window.refRenamer; return; }		clicked = true; mw.loader.load('//en.wikipedia.org/w/index.php?title=User:Maxim_Masiutin/RefRenamer-core.js&action=raw&ctype=text/javascript'); mw.notify(messages.loading, {			autoHideSeconds: 'long',			tag: 'refrenamer'		}); }); });