Ero sivun ”Järjestelmäviesti:Common.js” versioiden välillä
ApoWikistä
(Uutta yritystä.) |
(lisäpainikkeet wikieditoriin (lainaus, rp, etc.)) |
||
(32 välissä olevaa versiota 2 käyttäjän tekeminä ei näytetä) | |||
Rivi 1: | Rivi 1: | ||
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 ); |
Nykyinen versio 9. kesäkuuta 2017 kello 13.29
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 );