Jump to content

MediaWiki:Editpage.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//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:Edittools.js')
 var lnk = document.getElementById('loadCommonsEdittoos')
 if (lnk) lnk.parentNode.removeChild(lnk)
}
$(createEdittoolsLink)