w/extensions/FlaggedRevs/frontend/modules/ext.flaggedRevs.review.js
/*
	 * Submit a revision review via AJAX and update form elements.
	 *
	 * Note: requestArgs build-up from radios/checkboxes
	 * based on patch by Daniel Arnold (bug 13744)
	 */
Submit a revision review via AJAX and update form elements.
Note: requestArgs build-up from radios/checkboxes
based on patch by Daniel Arnold (bug 13744)
Submit a revision review via AJAX and update form elements . Note : requestArgs build - up from radios / checkboxes based on patch by Daniel Arnold ( bug 13744 )
function submitRevisionReview( button, form ) {
		var i, l, requestArgs, inputs, input, selects, select, soption,
			postData;
		lockReviewForm( form ); 
		requestArgs = []; 
		inputs = form.find( 'input' );
		for ( i = 0; i < inputs.length; i++ ) {
			input = inputs.eq( i );
			if ( input.prop( 'name' ) === 'title' || input.prop( 'name' ) === 'action' ) {
				continue; 
			} else if ( input.prop( 'type' ) === 'submit' ) {
				if ( input.prop( 'id' ) === button.id ) {
					requestArgs.push( input.prop( 'name' ) + '|1' );
					input.val( mw.msg( 'revreview-submitting' ) );
				}
			} else if ( input.prop( 'type' ) === 'checkbox' ) {
				requestArgs.push( input.prop( 'name' ) + '|' + 
					( input.prop( 'checked' ) ? input.val() : 0 ) );
			} else if ( input.prop( 'type' ) === 'radio' ) {
				if ( input.prop( 'checked' ) ) { 
					requestArgs.push( input.prop( 'name' ) + '|' + input.val() );
				}
			} else {
				requestArgs.push( input.prop( 'name' ) + '|' + input.val() ); 
			}
		}
		selects = form.find( 'select' );
		for ( i = 0, l = selects.length; i < l; i++ ) {
			select = selects.eq( i );
			if ( select.prop( 'selectedIndex' ) >= 0 ) {
				soption = select.find( 'option' ).eq( select.prop( 'selectedIndex' ) );
				requestArgs.push( select.prop( 'name' ) + '|' + soption.val() );
			}
		}
		postData = 'action=ajax&rs=RevisionReview::AjaxReview';
		for ( i = 0; i < requestArgs.length; i++ ) {
			postData += '&rsargs[]=' + encodeURIComponent( requestArgs[ i ] );
		}
		$.ajax( {
			url: mw.util.wikiScript( 'index' ),
			type: 'POST',
			data: postData,
			dataType: 'html', 
			success: function ( response ) {
				postSubmitRevisionReview( form, response );
			},
			error: function () {
				unlockReviewForm( form );
			}
		} );
	}
function submitRevisionReview ( button , form ) { var i , l , requestArgs , inputs , input , selects , select , soption , postData ; lockReviewForm ( form ) ; requestArgs = [ ] ; inputs = form . find ( 'input' ) ; for ( i = 0 ; i < inputs . length ; i ++ ) { input = inputs . eq ( i ) ; if ( input . prop ( 'name' ) === 'title' || input . prop ( 'name' ) === 'action' ) { continue ; } else if ( input . prop ( 'type' ) === 'submit' ) { if ( input . prop ( 'id' ) === button . id ) { requestArgs . push ( input . prop ( 'name' ) + '|1' ) ; input . val ( mw . msg ( 'revreview-submitting' ) ) ; } } else if ( input . prop ( 'type' ) === 'checkbox' ) { requestArgs . push ( input . prop ( 'name' ) + '|' + ( input . prop ( 'checked' ) ? input . val ( ) : 0 ) ) ; } else if ( input . prop ( 'type' ) === 'radio' ) { if ( input . prop ( 'checked' ) ) { requestArgs . push ( input . prop ( 'name' ) + '|' + input . val ( ) ) ; } } else { requestArgs . push ( input . prop ( 'name' ) + '|' + input . val ( ) ) ; } } selects = form . find ( 'select' ) ; for ( i = 0 , l = selects . length ; i < l ; i ++ ) { select = selects . eq ( i ) ; if ( select . prop ( 'selectedIndex' ) >= 0 ) { soption = select . find ( 'option' ) . eq ( select . prop ( 'selectedIndex' ) ) ; requestArgs . push ( select . prop ( 'name' ) + '|' + soption . val ( ) ) ; } } postData = 'action=ajax&rs=RevisionReview::AjaxReview' ; for ( i = 0 ; i < requestArgs . length ; i ++ ) { postData += '&rsargs[]=' + encodeURIComponent ( requestArgs [ i ] ) ; } $ . ajax ( { url : mw . util . wikiScript ( 'index' ) , type : 'POST' , data : postData , dataType : 'html' , success : function ( response ) { postSubmitRevisionReview ( form , response ) ; } , error : function ( ) { unlockReviewForm ( form ) ; } } ) ; }
Submit a revision review via AJAX and update form elements.
Submit a revision review via AJAX and update form elements .
// disallow submissions // Build up arguments array and update submit button text... // array of strings of the format <"pname|pval">. // Different input types may occur depending on tags... // No need to send these... // Show that we are submitting via this button // must send a number // must be checked // text/hiddens... // Get the selected tag level... // Send encoded function plus all arguments... // Send POST request via AJAX! // response type