76d9c10246d4d451c0d2e2be597f01524ce39335.svn-base 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // ================================================================
  2. // CHEditor 5
  3. // ================================================================
  4. function Dialog(oEditor) {
  5. this.oEditor = oEditor;
  6. }
  7. Dialog.prototype.setDialogCss = function () {
  8. var head = document.getElementsByTagName('head')[0],
  9. css = head.appendChild(document.createElement('link'));
  10. css.setAttribute('type', 'text/css');
  11. css.setAttribute('rel', 'stylesheet');
  12. css.setAttribute('media', 'all');
  13. css.setAttribute('href', this.oEditor.config.cssPath + 'dialog.css');
  14. };
  15. Dialog.prototype.setDialogHeight = function (height) {
  16. this.oEditor.dialog.style.height = (height + 20 || document.body.scrollHeight + 20) + 'px';
  17. this.oEditor.cheditor.popupFrameWrapper.style.height = this.oEditor.dialog.style.height;
  18. };
  19. Dialog.prototype.showButton = function (button) {
  20. var buttonUrl = this.oEditor.config.iconPath + 'button/',
  21. wrapper = document.getElementById('buttonWrapper'),
  22. i, img;
  23. for (i = 0; i < button.length; i++) {
  24. img = new Image();
  25. img.alt = button[i].alt;
  26. if (!this.oEditor.undefined(button[i].hspace)) {
  27. img.hspace = button[i].hspace;
  28. }
  29. img.className = 'button';
  30. img.src = buttonUrl + button[i].img;
  31. img.onclick = button[i].cmd;
  32. wrapper.appendChild(img);
  33. }
  34. };