Knowledge Base Wiki

Search for LIMS content across all our Wiki Knowledge Bases.

Type a search term to find related articles by LIMS subject matter experts gathered from the most trusted and dynamic collaboration tools in the laboratory informatics industry.

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.
// Creates a button on [[Special:Log]] that swaps the user log and logs on that user
// Original inspiration from [[User:PleaseStand/common.js]]

$(function() {
	if (mw.config.get('wgCanonicalSpecialPageName') === 'Log') {
		mw.loader.using(['oojs-ui-core', 'oojs-ui-widgets'], function () {
			var rsbutton = new OO.ui.ButtonInputWidget({label: 'Swap roles', useInputTag: true});
			rsbutton.$element.children('input').click(function(event) {
				var $user = $(document.getElementById('mw-input-user').firstChild), $page = $(document.getElementById('mw-input-page').firstChild),
					oldUser = $.trim($user.val()), oldPage = /^user:(.+)$/i.exec($.trim($page.val()));
				$page.val(oldUser ? 'User:' + oldUser : '');
				$user.val(oldPage ? oldPage[1] : '');
				event.preventDefault();
			});
			$('.mw-htmlform-submit-buttons').append(rsbutton.$element);
		});
	}
});