Jump to content

MediaWiki:Editpage.js

From Wikipedia, the free encyclopedia
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
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)