个人工具

MediaWiki:Editpage.js

出自Meshal Lite

(修订版本间的差异)
跳转到: 导航, 搜索
(以内容“// <nowiki> // dynamically load Commons-style Edittools function createEdittoolsLink(){ // get div.mw-editTools var box = document.getElementById('wpTextbox1'); whil...”创建新页面)
 
第43行: 第43行:
 
addInsertButton( 'wikipedia/commons/c/c8/Button_redirect.png', 'Redirect', '#REDIRECT [[', ']]', '' ); //+ buttons
 
addInsertButton( 'wikipedia/commons/c/c8/Button_redirect.png', 'Redirect', '#REDIRECT [[', ']]', '' ); //+ buttons
 
addInsertButton( 'wikisource/ru/a/a9/Button-dash.png', ' — ', '—', '', '' );
 
addInsertButton( 'wikisource/ru/a/a9/Button-dash.png', ' — ', '—', '', '' );
addInsertButton( 'wikipedia/commons/2/2a/Button_category_plus.png', 'Category', '[[Category:', ']]', '' );
+
addInsertButton( 'wikipedia/commons/2/2a/Button_category_plus.png', 'Category', '[[Category:\n', ']]', '' );
 
   
 
   
 
// </nowiki>
 
// </nowiki>

在2011年11月11日 (五) 06:52所做的修订版本

// <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': '//upload.wikimedia.org/' + img,
		'speedTip': speedTip,
		'tagOpen': tagOpen,
		'tagClose': tagClose,
		'sampleText': sampleText
	};
}
 
addInsertButton( 'wikipedia/commons/c/c8/Button_redirect.png', 'Redirect', '#REDIRECT [[', ']]', '' ); //+ buttons
addInsertButton( 'wikisource/ru/a/a9/Button-dash.png', ' — ', '—', '', '' );
addInsertButton( 'wikipedia/commons/2/2a/Button_category_plus.png', 'Category', '[[Category:\n', ']]', '' );
 
// </nowiki>