Ero sivun ”Järjestelmäviesti:Common.js” versioiden välillä

ApoWikistä
(Final edition.)
(lisäpainikkeet wikieditoriin (lainaus, rp, etc.))
 
(23 välissä olevaa versiota 2 käyttäjän tekeminä ei näytetä)
Rivi 1: Rivi 1:
/* Any JavaScript here will be loaded for all users on every page load. */
var customizeToolbar = function() {
/** Extra toolbar options ******************************************************
$('#wpTextbox1').wikiEditor('addToToolbar', {
  *
section: 'advanced',
  *  Description: Includes a raw wiki page as javascript or CSS,
group: 'format',
  *              used for including user made modules.
tools: {
  *  Imported from: http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js
"strikethrough": {
  *  This is a modified copy of a script by wikipedia User:MarkS for extra features added by User:Voice of All.
label: 'Strike',
  *  This is based on the original code on Wikipedia:Tools/Editing tools
type: 'button',
  *  To disable this script, add <code>mwCustomEditButtons = [];<code> to [[Special:Mypage/monobook.js]]
icon: '//upload.wikimedia.org/wikipedia/commons/3/30/Btn_toolbar_rayer.png',
  */
action: {
if (mwCustomEditButtons) {
type: 'encapsulate',
  mwCustomEditButtons[mwCustomEditButtons.length] = {
options: {
    "imageFile": "http://www.appropedia.org/images/c/c8/Button_redirect.png",
pre: "<s>",
    "speedTip": "Uudelleenohjaus",
post: "</s>"
    "tagOpen": "#REDIRECT [[",
}
    "tagClose": "]]",
}
    "sampleText": "Artikkeli, johon uudelleenohjataan"};
}
}
  mwCustomEditButtons[mwCustomEditButtons.length] = {
});
    "imageFile": "http://www.appropedia.org/images/c/c9/Button_strike.png",
 
    "speedTip": "Yliviivaus",
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
    "tagOpen": "<s>",
section: 'advanced',
    "tagClose": "</s>",
group: 'format',
    "sampleText": ""};
tools: {
"comment": {
  mwCustomEditButtons[mwCustomEditButtons.length] = {
label: 'Comment',
    "imageFile": "http://www.appropedia.org/images/1/13/Button_enter.png",
type: 'button',
    "speedTip": "Rivinvaihto",
icon: '//upload.wikimedia.org/wikipedia/commons/3/37/Btn_toolbar_commentaire.png',
    "tagOpen": "<br />",
action: {
    "tagClose": "",
type: 'encapsulate',
    "sampleText": ""};
options: {
pre: "<!-- ",
  mwCustomEditButtons[mwCustomEditButtons.length] = {
post: " -->"
    "imageFile": "http://www.appropedia.org/images/8/80/Button_upper_letter.png",
}
    "speedTip": "Yläindeksi",
}
    "tagOpen": "<sup>",
}
    "tagClose": "</sup>",
}
    "sampleText": "t"};
} );
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
    "imageFile": "http://www.appropedia.org/images/7/70/Button_lower_letter.png",
section: 'advanced',
    "speedTip": "Alaindeksi",
group: 'format',
    "tagOpen": "<sub>",
tools: {
    "tagClose": "</sub>",
"math": {
    "sampleText": ""};
label: 'Math',
 
type: 'button',
  mwCustomEditButtons[mwCustomEditButtons.length] = {
icon: '//upload.wikimedia.org/wikipedia/commons/2/2e/Button_math.png',
    "imageFile": "http://www.appropedia.org/images/3/34/Button_hide_comment.png",
action: {
    "speedTip": "Piilotettu kommentti lähdekoodiin",
type: 'encapsulate',
    "tagOpen": "<!-- ",
options: {
    "tagClose": " -->",
pre: "<math>",
    "sampleText": "Comment"};
post: "</math>"
}
  mwCustomEditButtons[mwCustomEditButtons.length] = {
}
    "imageFile": "http://www.appropedia.org/images/1/12/Button_gallery.png",
}
    "speedTip": "Kuvagalleria",
}
    "tagOpen": "\n<gallery>\n",
} );
    "tagClose": "\n</gallery>",
 
    "sampleText": "Image:Esimerkki1.jpg|Esimerkki 1.\nImage:Esimerkki2.jpg|Esimerkki 2."};
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
  mwCustomEditButtons[mwCustomEditButtons.length] = {
group: 'format',
    "imageFile": "http://www.appropedia.org/images/f/fd/Button_blockquote.png",
tools: {
    "speedTip": "Sitaatti",
"citation": {
    "tagOpen": "{{sitaatti|",
label: 'Insert block of quoted text',
    "tagClose": "}}",
type: 'button',
    "sampleText": "Lorem ipsum dolor sit amet."};
icon: '//upload.wikimedia.org/wikipedia/commons/f/fd/Button_blockquote.png',
action: {
  mwCustomEditButtons[mwCustomEditButtons.length] = {
type: 'encapsulate',
    "imageFile": "http://www.appropedia.org/images/6/60/Button_insert_table.png",
options: {
    "speedTip": "Taulukko",
pre: "{\{lainaus\|",
    "tagOpen": '{| class="wikitable"\n|-\n',
post: "\}\}"
    "tagClose": "\n|}",
}
    "sampleText": "! header 1\n! header 2\n! header 3\n|-\n| row 1, cell 1\n| row 1, cell 2\n| row 1, cell 3\n|-\n| row 2, cell 1\n| row 2, cell 2\n| row 2, cell 3"};
}
}
}
} );


  mwCustomEditButtons[mwCustomEditButtons.length] = {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
    "imageFile": "http://www.appropedia.org/images/c/c4/Button_ref.png",
section: 'advanced',
    "speedTip": "Insert reference",
group: 'format',
    "tagOpen": "<ref name=\"\"></ref>",
tools: {
    "tagClose": "<ref name=\"\" />",
"refname": {
    "sampleText": ""};
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=\"\" />"
}
}
}
}
} );


  mwCustomEditButtons[mwCustomEditButtons.length] = {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
    "imageFile": "http://www.apologetiikkawiki.org/images/a/a3/Ref-tägi.png",
section: 'advanced',
    "speedTip": "Lisää viitekoodin",
group: 'format',
    "tagOpen": "<ref>",
tools: {
    "tagClose": "</ref>",
"nviiva": {
    "sampleText": ""};
label: 'Lisää n-viivan (ajatusviiva)',
type: 'button',
icon: 'https://apowiki.fi/images/9/97/N-viiva.png',
action: {
type: 'encapsulate',
options: {
pre: "",
post: ""
}
}
}
}
} );


  mwCustomEditButtons[mwCustomEditButtons.length] = {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
    "imageFile": "http://www.apologetiikkawiki.org/images/9/97/N-viiva.png",
section: 'advanced',
    "speedTip": "Lisää n-viivan",
group: 'format',
    "tagOpen": "–",
tools: {
    "tagClose": "",
"rplinkitys": {
    "sampleText": ""};
label: 'Lisää raamatunpaikkalinkin',
type: 'button',
icon: 'https://apowiki.fi/images/c/cf/Rp.png',
action: {
type: 'encapsulate',
options: {
pre: "\{\{rp\|",
post: "\}\}"
}
}
}
}
} );


  mwCustomEditButtons[mwCustomEditButtons.length] = {
};
    "imageFile": "http://www.apologetiikkawiki.org/images/c/cf/Rp.png",
    "speedTip": "Lisää raamatunpaikkalinkki",
/* Check if view is in edit mode and that the required modules are available. Then, customize the toolbar . . . */
    "tagOpen": "{{rp|",
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) {
    "tagClose": "}}",
mw.loader.using( 'user.options', function () {
    "sampleText": "1. Moos. 1:1"};
// 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 );