个人工具

MediaWiki:Editpage.js

出自Meshal Lite

在2011年11月11日 (五) 08:48由Pucs (讨论 | 贡献)所做的修订版本
跳转到: 导航, 搜索

注意:在保存以后,您必须清除浏览器的缓存才能看到所作出的改变。 Mozilla / Firefox / Safari:按住Shift再点击刷新,或按下Ctrl-F5Ctrl-R(在Macintosh上按下Command-R); Konqueror:只需点击刷新或按下F5Opera:在工具→首选项中完整清除它们的缓存,或按下Alt-F5Internet Explorer:按住Ctrl再点击刷新,或按下Ctrl-F5

// <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/images/lite/' + 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 //images/lite', '{{img|', '}}', 'sample.jpg');
addInsertButton( 'button_category_plus.png', 'Category', '[[category:', ']]', 'CategoryName');
addInsertButton( 'button_redirect.png', 'Redirect', '#REDIRECT [[', ']]', 'DestinationPage');
 
// 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
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', 'Include a Page', '{{:', '}}', 'PageName');
addInsertButton( 'button_groupshow.png', 'Grand Permission to Specific Usergroup to Read the Contents', '{{groupshow|sysop|', '\n}}', 'ContentsToHide');
 
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_addtask.png', 'Add a New task line', '{{:task:', '_{{subst:#time:U}}}}', 'TaskName');
addInsertButton( 'button_taskcode.png', 'Task Details Code', '{{#vardefine:pagename|{{subst:FULLPAGENAME}}}}\n====== [[{{subst:FULLPAGENAME}}|{{subst:PAGENAME}}]] ======\n{{task\n|type=', '\n|brief=\n|stat=\n|owner=--~~~~\n|assign=\n|check=\n|argue=\n}}', '');
addInsertButton( 'button_category_tree.png', 'Insert a Category Tree', '{{categorytree|', '}}', 'RootCategory');
 
// </nowiki>