User:Danski454/ReviewWarn.js

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{ var revertedpage = $('#mw-content-text .plainlinks a').first.text; window.open('https://en.wikipedia.org/w/index.php?title=User_talk:' + encodeURIComponent(reverteduser.replace(' ', '_')) + '&action=edit&preview=yes&vanarticle=' + encodeURIComponent(revertedpage)); return true; //submit the form }