Käyttäjä:Stryn/painikkeita.js

Wikipediasta
Siirry navigaatioon Siirry hakuun

Huomautus: Selaimen välimuisti pitää tyhjentää asetusten tallentamisen jälkeen, jotta muutokset tulisivat voimaan.

  • Firefox ja Safari: Napsauta Shift-näppäin pohjassa Päivitä, tai paina Ctrl-F5 tai Ctrl-R (⌘-R Macilla)
  • Google Chrome: Paina Ctrl-Shift-R (⌘-Shift-R Macilla)
  • Internet Explorer ja Edge: Napsauta Ctrl-näppäin pohjassa Päivitä tai paina Ctrl-F5
  • Opera: Paina Ctrl-F5.
mw.hook( 've.activationComplete' )
// 1 //
.add( function () {
	button=$("<button>Lisää allekirjoitus</button>").click(function(event) {
		event.stopPropagation();	
		var surfaceModel = ve.init.target.getSurface().getModel();
		surfaceModel.getFragment().collapseToEnd().insertContent(
		  [
			 {
				'type': 'mwTransclusionInline',
				'attributes': {
					'mw': {
						'parts': [ '~~' + '~~' ]
					}
				}
			 }
		  ]
		).collapseToEnd().select();
	});
	$("#footer").append(button);	
} )
// 2 //
.add( function () {
	button=$("<button>1. varoitus</button>").click(function(event) {
		event.stopPropagation();	
		var surfaceModel = ve.init.target.getSurface().getModel();
		surfaceModel.getFragment().collapseToEnd().insertContent(
		  [
			 {
				'type': 'mwTransclusionInline',
				'attributes': {
					'mw': {
						'parts': [ '{{subst:'+'Test}'+'} ' + '~~' + '~~' ]
					}
				}
			 }
		  ]
		).collapseToEnd().select();
	});
	$("#footer").append(button);	
} )
// 3 //
.add( function () {
	button=$("<button>2. varoitus</button>").click(function(event) {
		event.stopPropagation();	
		var surfaceModel = ve.init.target.getSurface().getModel();
		surfaceModel.getFragment().collapseToEnd().insertContent(
		  [
			 {
				'type': 'mwTransclusionInline',
				'attributes': {
					'mw': {
						'parts': [ '{{subst:'+'Test2}'+'} ' + '~~' + '~~' ]
					}
				}
			 }
		  ]
		).collapseToEnd().select();
	});
	$("#footer").append(button);	
} )
// 4 //
.add( function () {
	button=$("<button>3. varoitus</button>").click(function(event) {
		event.stopPropagation();	
		var surfaceModel = ve.init.target.getSurface().getModel();
		surfaceModel.getFragment().collapseToEnd().insertContent(
		  [
			 {
				'type': 'mwTransclusionInline',
				'attributes': {
					'mw': {
						'parts': [ '{{subst:'+'Vandalismia}'+'} ' + '~~' + '~~' ]
					}
				}
			 }
		  ]
		).collapseToEnd().select();
	});
	$("#footer").append(button);	
} )
// 5 //
.add( function () {
	button=$("<button>Sotkemista</button>").click(function(event) {
		event.stopPropagation();	
		var surfaceModel = ve.init.target.getSurface().getModel();
		surfaceModel.getFragment().collapseToEnd().insertContent(
		  [
			 {
				'type': 'mwTransclusionInline',
				'attributes': {
					'mw': {
						'parts': [ 'Sotkemista.' + '~~' + '~~' ]
					}
				}
			 }
		  ]
		).collapseToEnd().select();
	});
	$("#footer").append(button);	
} )
// 6 //
.add( function () {
	button=$("<button>Esto 1 pvä</button>").click(function(event) {
		event.stopPropagation();	
		var surfaceModel = ve.init.target.getSurface().getModel();
		surfaceModel.getFragment().collapseToEnd().insertContent(
		  [
			 {
				'type': 'mwTransclusionInline',
				'attributes': {
					'mw': {
						'parts': [ 'Estetty sotkemisen takia päiväksi.' + '~~' + '~~' ]
					}
				}
			 }
		  ]
		).collapseToEnd().select();
	});
	$("#footer").append(button);	
} );