Järjestelmäviesti:Common.js

ApoWikistä
Versio hetkellä 9. kesäkuuta 2017 kello 16.29 – tehnyt Samuli Koivisto (keskustelu | muokkaukset) (lisäpainikkeet wikieditoriin (lainaus, rp, etc.))
(ero) ← Vanhempi versio | Nykyinen versio (ero) | Uudempi versio → (ero)

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.
var customizeToolbar = function() {
$('#wpTextbox1').wikiEditor('addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"strikethrough": {
			label: 'Strike',
			type: 'button',
			icon: '//upload.wikimedia.org/wikipedia/commons/3/30/Btn_toolbar_rayer.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "<s>",
					post: "</s>"
				}
			}
		}
	}
});

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"comment": {
			label: 'Comment',
			type: 'button',
			icon: '//upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "<!-- ",
					post: " -->"
				}
			}
		}
	}
} );

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"math": {
			label: 'Math',
			type: 'button',
			icon: '//upload.wikimedia.org/wikipedia/commons/2/2e/Button_math.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "<math>",
					post: "</math>"
				}
			}
		}
	}
} );

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"citation": {
			label: 'Insert block of quoted text',
			type: 'button',
			icon: '//upload.wikimedia.org/wikipedia/commons/f/fd/Button_blockquote.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "{\{lainaus\|",
					post: "\}\}"
				}
			}
		}
	}
} );

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"refname": {
			label: 'Viittaus, johon viitataan useasti',
			type: 'button',
			icon: '//upload.wikimedia.org/wikipedia/commons/c/c4/Button_ref.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "<ref name=\"\"></ref>",
					post: "<ref name=\"\" />"
				}
			}
		}
	}
} );

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"nviiva": {
			label: 'Lisää n-viivan (ajatusviiva)',
			type: 'button',
			icon: 'https://apowiki.fi/images/9/97/N-viiva.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "–",
					post: ""
				}
			}
		}
	}
} );

$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	section: 'advanced',
	group: 'format',
	tools: {
		"rplinkitys": {
			label: 'Lisää raamatunpaikkalinkin',
			type: 'button',
			icon: 'https://apowiki.fi/images/c/cf/Rp.png',
			action: {
				type: 'encapsulate',
				options: {
					pre: "\{\{rp\|",
					post: "\}\}"
				}
			}
		}
	}
} );

};
 
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar . . . */
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
	mw.loader.using( 'user.options', function () {
		// This can be the string "0" if the user disabled the preference ([[bugzilla:52542#c3]])
		if ( mw.user.options.get( 'usebetatoolbar' ) == 1 && mw.user.options.get( 'showtoolbar' ) == 1 ) {
			$.when(
				mw.loader.using( 'ext.wikiEditor.toolbar' ),
				$.ready
			).then( customizeToolbar );
		}
	} );
}
// Add the customizations to LiquidThreads' edit toolbar, if available
mw.hook( 'ext.lqt.textareaCreated' ).add( customizeToolbar );