Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
mw.hook( 'wikipage.editform' ).add( function () {
	var contentModel = mw.config.get( 'wgPageContentModel' );
	if ( contentModel === 'javascript' || contentModel === 'css' || contentModel === 'sanitized-css' || contentModel === 'Scribunto' ) {
		$( '#wpSave' ).on( 'click', function () {
			var $button = $( this );
			var value = $button.val();
			$button.val( 'Publishing...' );
			var page = mw.config.get( 'wgPageName' );
			var text = $( '#wpTextbox1' ).textSelection( 'getContents' );
			var minor = $( '#wpMinoredit' ).prop( 'checked' );
			var summary = $( '#wpSummary' ).val();
			new mw.Api().edit( page, function () {
				return { text: text, minor: minor, summary: summary };
			} ).then( function () {
				$button.val( value );
			} ).fail( console.log );
			return false;
		} );
	}
} );
Cookies help us deliver our services. By using our services, you agree to our use of cookies.