个人工具

MediaWiki:Editpage.js

出自Meshal Lite

(修订版本间的差异)
跳转到: 导航, 搜索
 
(由1名用户作出的12个中途修订版本未被显示)
第34行: 第34行:
 
function addInsertButton( img, speedTip, tagOpen, tagClose, sampleText ){
 
function addInsertButton( img, speedTip, tagOpen, tagClose, sampleText ){
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
 
mwCustomEditButtons[mwCustomEditButtons.length] = {
'imageFile': '//www.necroz.com/dev/homes/lite/' + img,
+
'imageFile': '//www.necroz.com/liteimg/' + img,
 
'speedTip': speedTip,
 
'speedTip': speedTip,
 
'tagOpen': tagOpen,
 
'tagOpen': tagOpen,
第46行: 第46行:
  
 
// standard
 
// standard
addInsertButton( 'button_img.png', 'Image Files under //dev/homes/lite', '{{img|', '}}', 'sample.jpg');
+
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');
// h1~h6 frame
+
addInsertButton( 'button_s1.png', 'Frame Level 1 (not recommended)', '\n= ', ' =\n{{!}}\n\n|}\n', 'Title');
+
addInsertButton( 'button_s2.png', 'Frame Level 2', '\n== ', ' ==\n{{!}}\n\n|}\n', 'Title');
+
addInsertButton( 'button_s3.png', 'Frame Level 3', '\n=== ', ' ===\n{{!}}\n\n|}\n', 'Title');
+
addInsertButton( 'button_s4.png', 'Frame Level 4', '\n==== ', ' ====\n{{!}}\n\n|}\n', 'Title');
+
addInsertButton( 'button_s5.png', 'Frame Level 5', '\n===== ', ' =====\n{{!}}\n\n|}\n', 'Title');
+
addInsertButton( 'button_s6.png', 'Frame Level 6', '\n====== ', ' ======\n{{!}}\n\n|}\n', 'Title');
+
  
 
// tables
 
// tables
第63行: 第56行:
  
 
// Edits and Templates
 
// Edits and Templates
addInsertButton( 'button_callpage.png', 'Include a Page', '{{:', '}}', 'PageName');
+
addInsertButton( 'button_callpage.png', 'Embed a Page', '{{:', '}}', 'PageName');
addInsertButton( 'button_groupshow.png', 'Grand Permission to Specific Usergroup to Read the Contents', '{{groupshow|sysop|', '\n}}', 'ContentsToHide');
+
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_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_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_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_redirect.png', 'Redirect', '#REDIRECT [[', ']]', 'DestinationPage');
 
addInsertButton( 'button_category_plus.png', 'Category', '[[category:', ']]', 'CategoryName');
 
addInsertButton( 'button_category_plus.png', 'Category', '[[category:', ']]', 'CategoryName');
addInsertButton( 'button_category_tree.png', 'Insert a Category Tree', '{{categorytree|', '}}', 'RootCategory');
 
 
 
// </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>