User:CalendulaAsteraceae/common.js

// Load jump to file mw.loader.load('//en.wikisource.org/w/index.php?title=User:Inductiveload/jump to file/load.js&action=raw&ctype=text/javascript');

/* * Add several tools useful when proofreading pages in the Page: namespace. * @see https://en.wikisource.org/wiki/Wikisource:TemplateScript */ // I'm not using this now but might want to in future // mw.loader.load('//en.wikisource.org/w/index.php?title=MediaWiki:TemplateScript/proofreading.js&action=raw&ctype=text/javascript');

// First wait for mediawiki.util to load, and the page to be ready. $.when(mw.loader.using('mediawiki.util'), $.ready).then(function {	const title = mw.config.get('wgPageName');	// Add link to toolbar.	mw.util.addPortletLink( 'p-tb', /* portletId */ '/wiki/Special:PrefixIndex/' + title, /* href */ 'Pages with prefix', /* text */ 't-prefixindex', /* id */ 'A list of all wiki pages with this prefix [⌃⌥i]', /* tooltip */ 'i' /* accesskey */ /* '#t-recentchangeslinked' nextnode */ );	// Add warning banner to relevant pages.	// User talk:CalendulaAsteraceae/Archive 7	var titleObject = new mw.Title(title);	if (titleObject.getNamespacePrefix == 'Page:') {		var params = {			action: 'query',			prop: 'revisions',			titles: title,			rvlimit: 'max',			rvprop: 'user',			rvdir: 'newer',			rvuser: 'EncycloPetey',			rvslots: 'main',			formatversion: '2',			format: 'json'		},		api = new mw.Api;	   api.get(params).done(function (data) { var pageData = data.query.pages[0]; if ('revisions' in pageData) { var message = document.createElement('div'); message.setAttribute('class', 'mw-message-box custom-warning-box'); message.textContent = 'EncycloPetey has edited this page. Are you sure you want to remove that unnecessary ?'; $('.prp-page-content').prepend(message); }	   });	} });

// Load sandbox // mw.loader.load('//en.wikisource.org/w/index.php?title=User:CalendulaAsteraceae/sandbox.js&action=raw&ctype=text/javascript');