Difference between revisions 318911 and 318912 on test2wiki

/*  _____________________________________________________________________________
 * |                                                                             |
 * |                    === WARNING: GLOBAL GADGET FILE ===                      |
 * |                  Changes to this page affect many users.                    |
 * | Please discuss changes on the talk page or on [[WT:Gadget]] before editing. |
 * |_____________________________________________________________________________|
 *
(contracted; show full)					$( '#wpCitations' ).replaceWith( $spinnerspan );
				},
				success: function( data ) {
					expandedText = data.expandedtext;
					editSummary = data.editsummary;
					$( '#loader' ).replaceWith( $citationsButton );
					if ( expandedText ) {
						
//loadDiffWindow( expandedText, editSummary );
					} else {
						$( '#loader' ).replaceWith( $citationsButton );
						alert( 'Error: Replacement text empty' );
					}
				},
				error: function( data ) {
					$( '#loader' ).replaceWith( $citationsButton );
					alert( 'Error: Citations request failed' );
				}
			} );
		};
		diff.parentNode.insertBefore( cbButton, diff.nextSibling );
		diff.parentNode.insertBefore( newline, cbButton );
	}
}


function loadDiffWindow( expandedText, editSummary ) {
	// Populate text box with received expanded text
	$( '#wpTextbox1' ).val( expandedText );
	// Populate edit summary textbox with received edit summary
	$( '#wpSummary' ).val( editSummary );
	// Click 'Show preview' button
	$( '#wpDiff' ).click();
}

var $spinnerspan;

// Add a button to allow expanding citations in the text in the edit textbox
$( document ).ready( function() {
	$spinnerspan = $( '<span id="loader"></span>');
	if ( document.images ) {
		// Loading gif when Citations request is processing
		var spinner = new Image();
		spinner.src = "//upload.wikimedia.org/wikipedia/commons/4/42/Loading.gif";
		$spinnerspan.append( spinner );
	}
	addCitationButton();
} );

// Add a toolbox button that runs doibot.php on the most recent saved revision of the page
if ( $.inArray( mw.config.get( 'skin' ), ['monobook', 'modern', 'vector'] ) !== -1 ) {
  $( addCBToToolbox );
}