Files
2024-11-11 18:46:54 +01:00

1 line
2.8 KiB
JavaScript

var Submit=document.getElementById("submit");var Submit2=document.getElementById("submit2");var Cancel=document.getElementById("cancel");var iHex=document.getElementById("hex");var iR=document.getElementById("rgb_r");var iG=document.getElementById("rgb_g");var iB=document.getElementById("rgb_b");var iH=document.getElementById("hsv_h");var iS=document.getElementById("hsv_s");var iV=document.getElementById("hsv_v");var cp=ColorPicker(document.getElementById("slide"),document.getElementById("picker"),function(e,t,n,r,i){currentColor=e;ColorPicker.positionIndicators(document.getElementById("slide-indicator"),document.getElementById("picker-indicator"),i,r);color.style.backgroundColor=e;iHex.value=e;iR.value=n.r;iG.value=n.g;iB.value=n.b;iH.value=t.h.toFixed(2);iS.value=t.s.toFixed(2);iV.value=t.v.toFixed(2)});cp.setHex("#ffffff");iHex.onchange=function(){cp.setHex(iHex.value)};iR.onchange=function(){cp.setHex(ColorPicker.rgb2hex({r:iR.value,g:iG.value,b:iB.value}))};iG.onchange=function(){cp.setHex(ColorPicker.rgb2hex({r:iR.value,g:iG.value,b:iB.value}))};iB.onchange=function(){cp.setHex(ColorPicker.rgb2hex({r:iR.value,g:iG.value,b:iB.value}))};iH.onchange=function(){cp.setHex(ColorPicker.hsv2hex({h:iH.value,s:iS.value,v:iV.value}))};iS.onchange=function(){cp.setHex(ColorPicker.hsv2hex({h:iH.value,s:iS.value,v:iV.value}))};iV.onchange=function(){cp.setHex(ColorPicker.hsv2hex({h:iH.value,s:iS.value,v:iV.value}))};document.getElementById("selector1").onclick=function(){cp.setHex("#FFFFFF")};document.getElementById("selector2").onclick=function(){cp.setHex("#D4D4D4")};document.getElementById("selector3").onclick=function(){cp.setHex("#9B9B9B")};document.getElementById("selector4").onclick=function(){cp.setHex("#4A4A4A")};document.getElementById("selector5").onclick=function(){cp.setHex("#000000")};document.getElementById("selector6").onclick=function(){cp.setHex("#D0131A")};document.getElementById("selector7").onclick=function(){cp.setHex("#F5A623")};document.getElementById("selector8").onclick=function(){cp.setHex("#FBE32A")};document.getElementById("selector9").onclick=function(){cp.setHex("#7DD321")};document.getElementById("selector10").onclick=function(){cp.setHex("#228E53")};document.getElementById("selector11").onclick=function(){cp.setHex("#2CA0FD")};document.getElementById("selector12").onclick=function(){cp.setHex("#2446A2")};document.getElementById("selector13").onclick=function(){cp.setHex("#9028FE")};Submit.onclick=function(){parent.tinymce.activeEditor.execCommand("ForeColor",false,iHex.value);parent.tinymce.activeEditor.windowManager.close()};Submit2.onclick=function(){parent.tinymce.activeEditor.execCommand("HiliteColor",false,iHex.value);parent.tinymce.activeEditor.windowManager.close()};Cancel.onclick=function(){parent.tinymce.activeEditor.windowManager.close()}