User:Technical 13/Scripts/GANreview.js

/*
 * WP:GA reviewer helper script
 * Author: User:Technical_13
 * Description:
 * Finds and updates links to talk pages created by Template:GANentry without using the expensive #ifexist: parser function.

/* Initialize variables */ var talkPage = , talkPageTitle = , talkPageNew = , talkPageLinkTxt = , talkPageURL = '';

/* Loop through ".GAN-review" links and replace href and text as is appropriate */ $( '.GAN-review' ).each( function {   talkPage = $( this ).closest( 'a' ).attr( 'title' );    if ( talkPage.indexOf( ' (page does not exist)' ) !== -1 ) {    	talkPageTitle = talkPage.substring( 0, talkPage.indexOf( ' (page does not exist)' ) ).replace( ' ', '_' );    	talkPageNew = false;    	talkPageLinkTxt = 'Start Review';		talkPageURL = mw.util.getUrl( talkPageTitle, { action: 'edit', editintro: 'Template:GAN/editintro', preload: 'Template:GAN/preload' } );   } else {    	talkPageTitle = talkPage.replace( ' ', '_' );    	talkPageNew = true;    	talkPageLinkTxt = 'Discuss Review';    	talkPageURL = mw.util.getUrl( talkPageTitle, { action: 'edit' } );    }    $( this ).closest( 'a' ).html( $( this ).closest( 'a' ).html.replace( 'Review', talkPageLinkTxt ) ).attr( 'href', talkPageURL ); } );