From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.

//<nowiki>

( function ( mw, $ ) {

	function processResult( doAction ) {

		var txt = $( '#wpTextbox1' ).val();

		var summary = $( '#wpSummary' ).val();

		if ( !txt ) return;

		switch ( doAction ) {

			case 'nfr' :

				txt = '{{Non-free'+' reduce}}\n' + txt;

				summary += 'Tagging image - non free reduce - for image reduction as per non-free guideline [[Wikipedia:Image resolution]]';

				break;

			case 'nor' :

				txt = '{{Non-free'+' no reduce}}\n' + txt;

				summary += 'Tagging image for no reduction';

				break;	

            case 'ncs' :

				txt.replace( /\{\{[\s\t\n\r]*([mc]t?w?c|needs[ -_]commons[ -_]category|((copy|move)[ -_]?)?to[ -_]?(wikimedia[ -_])?commons)[\s\t\n\r]*\}\}/ig, '' );

				txt = '{{Now'+' Commons}}\n\n' + txt;

				summary += 'Tagging image as on already on commons ({{[[TemplateNowCommons|NowCommons]]}})';

				break;

			case 'mtc' :

				txt = '\{\{Copy to Wikimedia Commons|human=' + mw.config.get( 'wgUserName' ) + '\}\}\n\n' + txt;

				summary += 'Tagging image to be [[WP:MITTC|Copied to Wikimedia Commons]] ({{[[Template:Copy to Wikimedia Commons|Copy to Wikimedia Commons]]}})';

				break;

			case 'dnm' :

				txt = '\{\{Do not move to Commons|' + 'reason=USonly\}\}\n' + txt;

				summary += 'Tagging image "Do not move to Commons"';

				break;

			default :

				alert( 'There was an error processing your request.\n\n\t\t\t\t\tPlease try again.' );

				return;					

		}

		$( '#wpTextbox1' ).val( txt );

		$( '#wpSummary' ).val( summary );

		$( '#editform' ).submit();// uncomment this line when you're sure it's working as intended and you won't have to hit [Save page]

	}

 

	function getEdit( doAction ) {

		if ( doAction && ( mw.config.get( 'wgAction' ) === 'edit' || mw.config.get( 'wgAction' ) === 'submit' ) ) {

			processResult( doAction );

		} else {

			location.assign( mw.util.getUrl( mw.config.get( 'wgPageName' ), { action: 'edit', runThis: doAction } ) );

		}

	}

 

	if ( mw.config.get( 'wgNamespaceNumber' ) === 6 ) {

		var runThis = mw.util.getParamValue( 'runThis' );

		if ( runThis ) {

			getEdit( runThis );

		} else {

			var doNfr = mw.util.addPortletLink( 'p-cactions', '#', 'nfr', 'ca-nfr' );

			$( doNfr ).click( function ( e ) {

				e.preventDefault();

				getEdit( 'nfr' );

			} );

			var donor = mw.util.addPortletLink( 'p-cactions', '#', 'nor', 'ca-nor' );

			$( donor ).click( function ( e ) {

				e.preventDefault();

				getEdit( 'nor' );

			} );

			var doMtc = mw.util.addPortletLink( 'p-cactions', '#', 'mtc', 'ca-mtc' );

			$( doMtc ).click( function ( e ) {

				e.preventDefault();

				getEdit( 'mtc' );

			} );

			var dodnm = mw.util.addPortletLink( 'p-cactions', '#', 'dnm', 'ca-dnm' );

			$( dodnm ).click( function ( e ) {

				e.preventDefault();

				getEdit( 'dnm' );

			} );

			var doNcs = mw.util.addPortletLink( 'p-cactions', '#', 'ncs', 'ca-ncs' );

			$( doNcs ).click( function ( e ) {

				e.preventDefault();

				getEdit( 'ncs' );

			} );

		}

	}

} ( mediaWiki, jQuery ) );

//</nowiki>
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.

//<nowiki>

( function ( mw, $ ) {

	function processResult( doAction ) {

		var txt = $( '#wpTextbox1' ).val();

		var summary = $( '#wpSummary' ).val();

		if ( !txt ) return;

		switch ( doAction ) {

			case 'nfr' :

				txt = '{{Non-free'+' reduce}}\n' + txt;

				summary += 'Tagging image - non free reduce - for image reduction as per non-free guideline [[Wikipedia:Image resolution]]';

				break;

			case 'nor' :

				txt = '{{Non-free'+' no reduce}}\n' + txt;

				summary += 'Tagging image for no reduction';

				break;	

            case 'ncs' :

				txt.replace( /\{\{[\s\t\n\r]*([mc]t?w?c|needs[ -_]commons[ -_]category|((copy|move)[ -_]?)?to[ -_]?(wikimedia[ -_])?commons)[\s\t\n\r]*\}\}/ig, '' );

				txt = '{{Now'+' Commons}}\n\n' + txt;

				summary += 'Tagging image as on already on commons ({{[[TemplateNowCommons|NowCommons]]}})';

				break;

			case 'mtc' :

				txt = '\{\{Copy to Wikimedia Commons|human=' + mw.config.get( 'wgUserName' ) + '\}\}\n\n' + txt;

				summary += 'Tagging image to be [[WP:MITTC|Copied to Wikimedia Commons]] ({{[[Template:Copy to Wikimedia Commons|Copy to Wikimedia Commons]]}})';

				break;

			case 'dnm' :

				txt = '\{\{Do not move to Commons|' + 'reason=USonly\}\}\n' + txt;

				summary += 'Tagging image "Do not move to Commons"';

				break;

			default :

				alert( 'There was an error processing your request.\n\n\t\t\t\t\tPlease try again.' );

				return;					

		}

		$( '#wpTextbox1' ).val( txt );

		$( '#wpSummary' ).val( summary );

		$( '#editform' ).submit();// uncomment this line when you're sure it's working as intended and you won't have to hit [Save page]

	}

 

	function getEdit( doAction ) {

		if ( doAction && ( mw.config.get( 'wgAction' ) === 'edit' || mw.config.get( 'wgAction' ) === 'submit' ) ) {

			processResult( doAction );

		} else {

			location.assign( mw.util.getUrl( mw.config.get( 'wgPageName' ), { action: 'edit', runThis: doAction } ) );

		}

	}

 

	if ( mw.config.get( 'wgNamespaceNumber' ) === 6 ) {

		var runThis = mw.util.getParamValue( 'runThis' );

		if ( runThis ) {

			getEdit( runThis );

		} else {

			var doNfr = mw.util.addPortletLink( 'p-cactions', '#', 'nfr', 'ca-nfr' );

			$( doNfr ).click( function ( e ) {

				e.preventDefault();

				getEdit( 'nfr' );

			} );

			var donor = mw.util.addPortletLink( 'p-cactions', '#', 'nor', 'ca-nor' );

			$( donor ).click( function ( e ) {

				e.preventDefault();

				getEdit( 'nor' );

			} );

			var doMtc = mw.util.addPortletLink( 'p-cactions', '#', 'mtc', 'ca-mtc' );

			$( doMtc ).click( function ( e ) {

				e.preventDefault();

				getEdit( 'mtc' );

			} );

			var dodnm = mw.util.addPortletLink( 'p-cactions', '#', 'dnm', 'ca-dnm' );

			$( dodnm ).click( function ( e ) {

				e.preventDefault();

				getEdit( 'dnm' );

			} );

			var doNcs = mw.util.addPortletLink( 'p-cactions', '#', 'ncs', 'ca-ncs' );

			$( doNcs ).click( function ( e ) {

				e.preventDefault();

				getEdit( 'ncs' );

			} );

		}

	}

} ( mediaWiki, jQuery ) );

//</nowiki>

Videos

Youtube | Vimeo | Bing

Websites

Google | Yahoo | Bing

Encyclopedia

Google | Yahoo | Bing

Facebook