37d64eaffe50d43c694f313fe7196ec4e6bfef74.svn-base 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // ================================================================
  2. // CHEditor 5
  3. // ================================================================
  4. var colour = ["ffffcc","ffcc66","ff9900","ffcc99","ff6633","ffcccc","cc9999","ff6699","ff99cc","ff66cc","ffccff","cc99cc","cc66ff","cc99ff","9966cc","ccccff","9999cc","3333ff","6699ff","0066ff","99ccff","66ccff","99cccc","ccffff","99ffcc","66cc99","66ff99","99ff99","ccffcc","33ff33","66ff00","ccff99","99ff00","ccff66","cccc66","ffffff",
  5. "ffff99","ffcc00","ff9933","ff9966","cc3300","ff9999","cc6666","ff3366","ff3399","ff00cc","ff99ff","cc66cc","cc33ff","9933cc","9966ff","9999ff","6666ff","3300ff","3366ff","0066cc","3399ff","33ccff","66cccc","99ffff","66ffcc","33cc99","33ff99","66ff66","99cc99","00ff33","66ff33","99ff66","99ff33","ccff00","cccc33","cccccc",
  6. "ffff66","ffcc33","cc9966","ff6600","ff3300","ff6666","cc3333","ff0066","ff0099","ff33cc","ff66ff","cc00cc","cc00ff","9933ff","6600cc","6633ff","6666cc","3300cc","0000ff","3366cc","0099ff","00ccff","339999","66ffff","33ffcc","00cc99","00ff99","33ff66","66cc66","00ff00","33ff00","66cc00","99cc66","ccff33","999966","999999",
  7. "ffff33","cc9900","cc6600","cc6633","ff0000","ff3333","993333","cc3366","cc0066","cc6699","ff33ff","cc33cc","9900cc","9900ff","6633cc","6600ff","666699","3333cc","0000cc","0033ff","6699cc","3399cc","669999","33ffff","00ffcc","339966","33cc66","00ff66","669966","00cc00","33cc00","66cc33","99cc00","cccc99","999933","666666",
  8. "ffff00","cc9933","996633","993300","cc0000","ff0033","990033","996666","993366","cc0099","ff00ff","990099","996699","660099","663399","330099","333399","000099","0033cc","003399","336699","0099cc","006666","00ffff","33cccc","009966","00cc66","339933","336633","33cc33","339900","669933","99cc33","666633","999900","333333",
  9. "cccc00","996600","663300","660000","990000","cc0033","330000","663333","660033","990066","cc3399","993399","660066","663366","330033","330066","333366","000066","000033","003366","006699","003333","336666","00cccc","009999","006633","009933","006600","003300","00cc33","009900","336600","669900","333300","666600","000000"],
  10. oEditor = null,
  11. setColor = null,
  12. button = [
  13. { alt: '', img: 'cancel.gif', cmd: popupClose }
  14. ];
  15. function setShowColor() {
  16. var showColor = document.getElementById('show_color'),
  17. color = setColor.selectedCell.getAttribute('bgcolor');
  18. if (color) {
  19. showColor.style.backgroundColor = color;
  20. }
  21. }
  22. function popupClose() {
  23. oEditor.editArea.focus();
  24. oEditor.backupRange(oEditor.restoreRange());
  25. oEditor.clearStoredSelections();
  26. oEditor.popupWinClose();
  27. }
  28. function getColor()
  29. {
  30. var color = this.getAttribute('bgColor');
  31. setColor.func(color);
  32. popupClose();
  33. }
  34. function drawColor(el) {
  35. var table, tr, td, insideTable, k = 0, i, j, tr2, td2,
  36. onMouseOver = function () {
  37. this.className = 'colorCellMouseOver';
  38. },
  39. onMouseOut = function () {
  40. this.className = 'colorCellMouseOut';
  41. };
  42. table = document.createElement('table');
  43. table.cellPadding = 0;
  44. table.cellSpacing = 0;
  45. table.border = 0;
  46. table.align = 'center';
  47. tr = table.insertRow(0);
  48. td = tr.insertCell(0);
  49. td.style.backgroundColor = '#fff';
  50. insideTable = document.createElement('table');
  51. insideTable.border = 0;
  52. insideTable.cellSpacing = 1;
  53. insideTable.cellPadding = 0;
  54. insideTable.align = 'center';
  55. for (i = 0; i < 6; i++) {
  56. tr2 = insideTable.insertRow(i);
  57. for (j = 0; j < 36; j++) {
  58. td2 = tr2.insertCell(j);
  59. td2.setAttribute('bgColor', '#' + colour[k]);
  60. td2.className = 'colorCellMouseOut';
  61. td2.onclick = getColor;
  62. td2.appendChild(document.createTextNode('\u00a0'));
  63. td2.onmouseover = onMouseOver;
  64. td2.onmouseout = onMouseOut;
  65. k++;
  66. }
  67. }
  68. td.appendChild(insideTable);
  69. document.getElementById(el).appendChild(table);
  70. }
  71. function init(dialog, argv) {
  72. var dlg = new Dialog(this);
  73. oEditor = this;
  74. oEditor.dialog = dialog;
  75. setColor = argv;
  76. dlg.showButton(button);
  77. dlg.setDialogHeight();
  78. setShowColor();
  79. }