个人工具

MediaWiki:Editpage.js

出自Meshal Lite

(修订版本间的差异)
跳转到: 导航, 搜索
(以内容“// <nowiki> // dynamically load Commons-style Edittools function createEdittoolsLink(){ // get div.mw-editTools var box = document.getElementById('wpTextbox1'); whil...”创建新页面)
 
 
(由1名用户作出的21个中途修订版本未被显示)
第1行: 第1行:
 
// <nowiki>
 
// <nowiki>
 +
 
// dynamically load Commons-style Edittools
 
// dynamically load Commons-style Edittools
 
function createEdittoolsLink(){
 
function createEdittoolsLink(){
第33行: 第34行:
 
function addInsertButton( img, speedTip, tagOpen, tagClose, sampleText ){
 
function addInsertButton( img, speedTip, tagOpen, tagClose, sampleText ){
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
'imageFile': '//upload.wikimedia.org/' + img,
+
'imageFile': '//www.necroz.com/liteimg/' + img,
 
'speedTip': speedTip,
 
'speedTip': speedTip,
 
'tagOpen': tagOpen,
 
'tagOpen': tagOpen,
第40行: 第41行:
 
};
 
};
 
}
 
}
+
 
addInsertButton( 'wikipedia/commons/c/c8/Button_redirect.png', 'Redirect', '#REDIRECT [[', ']]', '' ); //+ buttons
+
// Customized Quickedit Buttons
addInsertButton( 'wikisource/ru/a/a9/Button-dash.png', ' ', '', '', '' );
+
// addInsertButton( 'image.ext', 'tips', 'tagopen', 'tagclose', 'sampletext');
addInsertButton( 'wikipedia/commons/2/2a/Button_category_plus.png', 'Category', '[[Category:', ']]', '' );
+
 
+
// standard
 +
addInsertButton( 'button_img.png', 'Image Files under /liteimg', '{{img|', '}}', 'sample.jpg');
 +
addInsertButton( 'button_eximg.png', 'External Image Files on internet', '{{eximg|', '}}', 'http://www.sample.com/sample.jpg');
 +
addInsertButton( 'button_imglink.png', 'URL masked with image', '{{imglink|', '|page}}', 'sample.jpg');
 +
 
 +
// tables
 +
addInsertButton( 'button_tab.png', 'Universal Table Frame', '\n{{tab}}\n', '\n|}\n', '');
 +
addInsertButton( 'button_tabsort.png', 'Sortable Table Frame', '\n{{tab_sort}}\n', '\n|}\n', '');
 +
addInsertButton( 'button_tab_collapse.png', 'Collapsible Table Frame', '\n{{tab_collapse|', '}}\n|\n|}\n', 'TableName');
 +
 
 +
// Edits and Templates
 +
addInsertButton( 'button_callpage.png', 'Embed a Page', '{{:', '}}', 'PageName');
 +
addInsertButton( 'button_groupshow.png', 'Grand Permission to Specific Usergroups to Read the Contents', '{{#ifingroup:sysop|', '\n}}', 'ContentsToHide');
 +
 
 +
addInsertButton( 'button_nowiki.png', 'nowiki', '<nowiki>', '</nowiki>', 'Codes in this pair of tag won\'t be parsed as wiki codes');
 +
addInsertButton( 'button_includeonly.png', 'Includeonly Tag', '<includeonly>', '</includeonly>', 'Codes that be included only');
 +
addInsertButton( 'button_noinclude.png', 'Noinclude Tag', '<noinclude>', '</noinclude>', 'Codes that not be included');
 +
addInsertButton( 'button_source.png', 'Render Source Codes', '<source lang="', '">\n\n</source>', 'Codes Language');
 +
addInsertButton( 'button_code.png', 'Inline Code', '<code>', '</code>', 'Code');
 +
 
 +
addInsertButton( 'button_redirect.png', 'Redirect', '#REDIRECT [[', ']]', 'DestinationPage');
 +
addInsertButton( 'button_category_plus.png', 'Category', '[[category:', ']]', 'CategoryName');
 
// </nowiki>
 
// </nowiki>

在2019年1月4日 (五) 05:12的最新修订版本

// <nowiki>
 
// dynamically load Commons-style Edittools
function createEdittoolsLink(){
	// get div.mw-editTools
	var box = document.getElementById('wpTextbox1');
	while( box && box.className != 'mw-editTools' )
		box = box.nextSibling;
	if( !box )
		return;
	// create a link
	var lnk = document.createElement('a');
	lnk.href = 'javascript:loadCommonsTools()';
	lnk.title = 'Load Commons-style Edittools';
	lnk.id = 'loadCommonsEdittoos';
	lnk.appendChild(document.createTextNode('[load edittools]'));
	lnk.style.cssText = 'float:right';
	box.appendChild(lnk);
}
 
function loadCommonsTools(){
	importScript('MediaWiki:Scripts/Edittools1.js');
	var lnk = document.getElementById('loadCommonsEdittoos');
	if( lnk )
		lnk.parentNode.removeChild(lnk);
}
 
if( doneOnloadHook )
	createEdittoolsLink();
else
	addOnloadHook( createEdittoolsLink );
 
// Add Insert Buttons
function addInsertButton( img, speedTip, tagOpen, tagClose, sampleText ){
	mwCustomEditButtons[mwCustomEditButtons.length] = {
		'imageFile': '//www.necroz.com/liteimg/' + img,
		'speedTip': speedTip,
		'tagOpen': tagOpen,
		'tagClose': tagClose,
		'sampleText': sampleText
	};
}
 
// Customized Quickedit Buttons
// addInsertButton( 'image.ext', 'tips', 'tagopen', 'tagclose', 'sampletext');
 
// standard
addInsertButton( 'button_img.png', 'Image Files under /liteimg', '{{img|', '}}', 'sample.jpg');
addInsertButton( 'button_eximg.png', 'External Image Files on internet', '{{eximg|', '}}', 'http://www.sample.com/sample.jpg');
addInsertButton( 'button_imglink.png', 'URL masked with image', '{{imglink|', '|page}}', 'sample.jpg');
 
// tables
addInsertButton( 'button_tab.png', 'Universal Table Frame', '\n{{tab}}\n', '\n|}\n', '');
addInsertButton( 'button_tabsort.png', 'Sortable Table Frame', '\n{{tab_sort}}\n', '\n|}\n', '');
addInsertButton( 'button_tab_collapse.png', 'Collapsible Table Frame', '\n{{tab_collapse|', '}}\n|\n|}\n', 'TableName');
 
// Edits and Templates
addInsertButton( 'button_callpage.png', 'Embed a Page', '{{:', '}}', 'PageName');
addInsertButton( 'button_groupshow.png', 'Grand Permission to Specific Usergroups to Read the Contents', '{{#ifingroup:sysop|', '\n}}', 'ContentsToHide');
 
addInsertButton( 'button_nowiki.png', 'nowiki', '<nowiki>', '</nowiki>', 'Codes in this pair of tag won\'t be parsed as wiki codes');
addInsertButton( 'button_includeonly.png', 'Includeonly Tag', '<includeonly>', '</includeonly>', 'Codes that be included only');
addInsertButton( 'button_noinclude.png', 'Noinclude Tag', '<noinclude>', '</noinclude>', 'Codes that not be included');
addInsertButton( 'button_source.png', 'Render Source Codes', '<source lang="', '">\n\n</source>', 'Codes Language');
addInsertButton( 'button_code.png', 'Inline Code', '<code>', '</code>', 'Code');
 
addInsertButton( 'button_redirect.png', 'Redirect', '#REDIRECT [[', ']]', 'DestinationPage');
addInsertButton( 'button_category_plus.png', 'Category', '[[category:', ']]', 'CategoryName');
// </nowiki>