Jump to content

User:Danski454/ReviewWarn.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Danski454 (talk | contribs) at 12:38, 28 August 2018 (Created page with 'var reverteduser = null; $(document).ready(function(){ if(mw.config.get( 'wgPageName' ) === 'Special:RevisionReview' && mw.config.get( 'wgUserGroups' ) !== null...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
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.
var reverteduser = null;
$(document).ready(function(){
	if(mw.config.get( 'wgPageName' ) === 'Special:RevisionReview' && mw.config.get( 'wgUserGroups' ) !== null &&
	( mw.config.get( 'wgUserGroups' ).indexOf('sysop') !== -1 || mw.config.get( 'wgUserGroups' ).indexOf('reviewer') !== -1 )){ //only run if user can review and is on Special:RevisionReview
		$('#mw-content-text bdi').each(function( index ) { // check if all revisions were madeby the same user, if so, reverteduser holds their UN oterwise it is null
			if (index === 0){
				reverteduser = $(this).text();
			} else{
				if (reverteduser !== $(this).text()){
					reverteduser = null;
				}
			}
		});
		if (reverteduser !== null){
			$('form').attr('onsubmit', 'return ReviewWarnLoadUserTalk()');
			console.log('ReviewWarn:: linked reject button to User talk:' + reverteduser);
		}
	}
});

function ReviewWarnLoadUserTalk(){
	
}