MediaWiki:Editpage.js: verschil tussen versies
Uit Wiki
Naar navigatie springenNaar zoeken springen(9 tussenliggende versies door dezelfde gebruiker niet weergegeven) | |||
Regel 8: | Regel 8: | ||
//create a link | //create a link | ||
var lnk = document.createElement('a') | var lnk = document.createElement('a') | ||
− | lnk.href = 'javascript: | + | lnk.href = 'javascript:loadCommonsTools()' |
− | lnk.title = 'Load | + | lnk.title = 'Load Commons-style Edittools' |
− | lnk.id = ' | + | lnk.id = 'loadCommonsEdittools' |
lnk.appendChild(document.createTextNode('[load edittools]')) | lnk.appendChild(document.createTextNode('[load edittools]')) | ||
lnk.style.cssText = 'float:right' | lnk.style.cssText = 'float:right' | ||
box.appendChild(lnk) | box.appendChild(lnk) | ||
} | } | ||
− | function | + | function loadCommonsTools(){ |
− | importScript('MediaWiki: | + | importScript('MediaWiki:Edittools.js') |
− | var lnk = document.getElementById(' | + | var lnk = document.getElementById('loadCommonsEdittools') |
if (lnk) lnk.parentNode.removeChild(lnk) | if (lnk) lnk.parentNode.removeChild(lnk) | ||
} | } | ||
if (doneOnloadHook) createEdittoolsLink() | if (doneOnloadHook) createEdittoolsLink() | ||
else addOnloadHook(createEdittoolsLink) | else addOnloadHook(createEdittoolsLink) | ||
− | + | ||
− | + | ||
//Add Insert Buttons | //Add Insert Buttons | ||
function addInsertButton(img, speedTip, tagOpen, tagClose, sampleText){ | function addInsertButton(img, speedTip, tagOpen, tagClose, sampleText){ | ||
mwCustomEditButtons[mwCustomEditButtons.length] = | mwCustomEditButtons[mwCustomEditButtons.length] = | ||
− | {'imageFile': 'http:// | + | {'imageFile': 'http://upload.wikimedia.org/' + img, |
'speedTip': speedTip, | 'speedTip': speedTip, | ||
'tagOpen': tagOpen, | 'tagOpen': tagOpen, | ||
Regel 33: | Regel 33: | ||
'sampleText': sampleText}; | 'sampleText': sampleText}; | ||
} | } | ||
− | + | ||
− | addInsertButton(' | + | addInsertButton('wikipedia/commons/c/c8/Button_redirect.png','Redirect','#Redirect [[',']]',''); //+ buttons |
− | addInsertButton(' | + | addInsertButton('wikisource/ru/a/a9/Button-dash.png',' — ','—','',''); |
− | addInsertButton(' | + | addInsertButton('wikipedia/commons/1/11/Button_category.png','Category','[[Category:',']]',''); |
− | + | ||
//</nowiki> | //</nowiki> |
Huidige versie van 6 jun 2008 om 09:43
//<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 = 'loadCommonsEdittools' lnk.appendChild(document.createTextNode('[load edittools]')) lnk.style.cssText = 'float:right' box.appendChild(lnk) } function loadCommonsTools(){ importScript('MediaWiki:Edittools.js') var lnk = document.getElementById('loadCommonsEdittools') 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': 'http://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/1/11/Button_category.png','Category','[[Category:',']]',''); //</nowiki>