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

ApoWikistä
(+rp testing)
(lisäpainikkeet wikieditoriin (lainaus, rp, etc.))
 
(17 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": "Redirect",
post: "</s>"
    "tagOpen": "#REDIRECT [[",
}
    "tagClose": "]]",
}
    "sampleText": "Insert text"};
}
}
  mwCustomEditButtons[mwCustomEditButtons.length] = {
});
    "imageFile": "http://www.appropedia.org/images/c/c9/Button_strike.png",
 
    "speedTip": "Strike",
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
    "tagOpen": "<s>",
section: 'advanced',
    "tagClose": "</s>",
group: 'format',
    "sampleText": "Strike-through text"};
tools: {
"comment": {
  mwCustomEditButtons[mwCustomEditButtons.length] = {
label: 'Comment',
    "imageFile": "http://www.appropedia.org/images/1/13/Button_enter.png",
type: 'button',
    "speedTip": "Line break",
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": "Superscript",
}
    "tagOpen": "<sup>",
}
    "tagClose": "</sup>",
}
    "sampleText": "Superscript text"};
} );
 
  mwCustomEditButtons[mwCustomEditButtons.length] = {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
    "imageFile": "http://www.appropedia.org/images/7/70/Button_lower_letter.png",
section: 'advanced',
    "speedTip": "Subscript",
group: 'format',
    "tagOpen": "<sub>",
tools: {
    "tagClose": "</sub>",
"math": {
    "sampleText": "Subscript text"};
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": "Insert hidden Comment",
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": "Insert a picture gallery",
}
    "tagOpen": "\n<gallery>\n",
} );
    "tagClose": "\n</gallery>",
    "sampleText": "Image:Example.jpg|Caption1\nImage:Example.jpg|Caption2"};
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://www.appropedia.org/images/f/fd/Button_blockquote.png",
    "speedTip": "Insert block of quoted text",
    "tagOpen": "<blockquote>\n",
    "tagClose": "\n</blockquote>",
    "sampleText": "Block quote"};


  mwCustomEditButtons[mwCustomEditButtons.length] = {
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
    "imageFile": "http://www.appropedia.org/images/6/60/Button_insert_table.png",
section: 'advanced',
    "speedTip": "Insert a table",
group: 'format',
    "tagOpen": '{| class="wikitable"\n|-\n',
tools: {
    "tagClose": "\n|}",
"citation": {
    "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"};
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: "\}\}"
}
}
}
}
} );


  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ää raamatunpaikkalinkin",
/* 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": "Raamatunpaikka"};
// 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 16.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 );