fd601d0d2c419d1e1c476ab620007463f13754ca.svn-base 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // ================================================================
  2. // CHEditor 5
  3. // ================================================================
  4. var oEditor = null;
  5. function popupClose() {
  6. oEditor.popupWinCancel();
  7. }
  8. function insertIcon() {
  9. this.removeAttribute("className");
  10. this.removeAttribute("class");
  11. this.style.margin = '1px 4px';
  12. oEditor.insertHtmlPopup(this.cloneNode(false));
  13. oEditor.popupWinClose();
  14. }
  15. function showContents() {
  16. var block = document.getElementById('iconBlock'),
  17. path = oEditor.config.iconPath + 'em/',
  18. num = 80, i, br, img;
  19. for (i = 40; i < num; i++) {
  20. if (i > 40 && (i % 10) === 0) {
  21. br = document.createElement('br');
  22. block.appendChild(br);
  23. }
  24. img = new Image();
  25. img.src = path + (i + 1) + ".gif";
  26. img.style.width = '16px';
  27. img.style.height = '16px';
  28. img.style.margin = '5px 4px';
  29. img.style.verticalAlign = 'middle';
  30. img.setAttribute('alt', 'Emotion Icon');
  31. img.setAttribute('border', "0");
  32. img.className = 'handCursor';
  33. img.onclick = insertIcon;
  34. block.appendChild(img);
  35. }
  36. }
  37. function init(dialog) {
  38. var button, dlg;
  39. oEditor = this;
  40. oEditor.dialog = dialog;
  41. button = [{ alt : "", img : 'cancel.gif', cmd : popupClose }];
  42. dlg = new Dialog(oEditor);
  43. showContents();
  44. dlg.showButton(button);
  45. dlg.setDialogHeight();
  46. }