+tinyMCEPopup.requireLangPack();
+
var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false;
-var colors = new Array(
+var colors = [
"#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033",
"#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099",
"#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff",
"#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33",
"#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99",
"#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"
-);
+];
var named = {
'#F0F8FF':'AliceBlue','#FAEBD7':'AntiqueWhite','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige',
};
function init() {
- var inputColor = convertRGBToHex(tinyMCE.getWindowArg('input_color'));
+ var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color'));
- if (tinyMCE.isMSIE)
- tinyMCEPopup.resizeToInnerSize();
+ tinyMCEPopup.resizeToInnerSize();
generatePicker();
}
function insertAction() {
- var color = document.getElementById("color").value;
+ var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func');
+
+ tinyMCEPopup.restoreSelection();
+
+ if (f)
+ f(color);
- tinyMCEPopup.execCommand(tinyMCE.getWindowArg('command'), false, color);
tinyMCEPopup.close();
}
document.getElementById("colorname").innerHTML = name;
document.getElementById("preview").style.backgroundColor = color;
- document.getElementById("color").value = color;
+ document.getElementById("color").value = color.toLowerCase();
}
function convertRGBToHex(col) {
+ '<tr>';
for (i=0; i<colors.length; i++) {
- h += '<td bgcolor="' + colors[i] + '">'
- + '<a href="javascript:insertAction();" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');">'
- + '<img border="0" src="images/spacer.gif" width="10" height="10" title="' + colors[i] + '" alt="' + colors[i] + '" /></a></td>';
+ h += '<td bgcolor="' + colors[i] + '" width="10" height="10">'
+ + '<a href="javascript:insertAction();" onfocus="showColor(\'' + colors[i] + '\');" onmouseover="showColor(\'' + colors[i] + '\');" style="display:block;width:10px;height:10px;overflow:hidden;">'
+ + '</a></td>';
if ((i+1) % 18 == 0)
h += '</tr><tr>';
}
x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0);
y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0);
- partWidth = document.getElementById('colorpicker').width / 6;
+ partWidth = document.getElementById('colors').width / 6;
partDetail = detail / 2;
- imHeight = document.getElementById('colorpicker').height;
+ imHeight = document.getElementById('colors').height;
r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255;
g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255 + (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth);
document.getElementById('color').value = color;
}
-window.focus();
\ No newline at end of file
+tinyMCEPopup.onInit.add(init);