/*
{{Projet:JavaScript/Script}}
*/
addOnloadHook(AjoutAcaiToolbar); // Ajout Toolbar au Skin Açai
function AjoutAcaiToolbar(){
addOnloadHook(NewAcaiToolbar);
}
function NewAcaiToolbar(){
var Edition = document.getElementById("editform");
if(!Edition)return;
var AcaiToolbar = document.createElement("div");
AcaiToolbar.setAttribute("id", "Oldbar");
Edition.insertBefore(AcaiToolbar, Edition.firstChild);
for (var i = 0; i < mwEditButtons.length; i++) {
Acai_mwInsertEditButton(AcaiToolbar, mwEditButtons);
}
for (var i = 0; i < mwCustomEditButtons.length; i++) {
Acai_mwInsertEditButton(AcaiToolbar, mwCustomEditButtons);
}
var ToolBar = document.getElementById("toolbar");
if(ToolBar){
AcaiToolbar.innerHTML += ToolBar.innerHTML;
ToolBar.style.display = 'none';
ToolBar.innerHTML = '';
}
}
function Acai_mwInsertEditButton(parent, item) {
var image = document.createElement("img");
image.width = 23;
image.height = 22;
image.className = "mw-toolbar-editbutton";
if (item.imageId) image.id = item.imageId;
image.src = item.imageFile;
image.border = 0;
image.alt = item.speedTip;
var link = document.createElement("a");
link.title = item.speedTip;
link.href= "javascript:insertTags(\'"
+ item.tagOpen.replace(/'/g, "\\'").replace(/"/g, '\\"')
+ "\',\'"
+ item.tagClose.replace(/'/g, "\\'").replace(/"/g, '\\"')
+"\',\'"
+ item.sampleText.replace(/'/g, "\\'").replace(/"/g, '\\"')
+ "\');";
link.appendChild(image);
parent.appendChild(link);
return true;
}