PageRenderTime 20ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 1ms

/public/javascripts/tinymce-3.5.7/jscripts/tiny_mce/plugins/advhr/js/rule.js

https://bitbucket.org/hamidrezas/melobit
JavaScript | 43 lines | 33 code | 10 blank | 0 comment | 10 complexity | ef46d7c850c8bcc869ea84ed7ac00c49 MD5 | raw file
Possible License(s): AGPL-1.0
  1. var AdvHRDialog = {
  2. init : function(ed) {
  3. var dom = ed.dom, f = document.forms[0], n = ed.selection.getNode(), w;
  4. w = dom.getAttrib(n, 'width');
  5. f.width.value = w ? parseInt(w) : (dom.getStyle('width') || '');
  6. f.size.value = dom.getAttrib(n, 'size') || parseInt(dom.getStyle('height')) || '';
  7. f.noshade.checked = !!dom.getAttrib(n, 'noshade') || !!dom.getStyle('border-width');
  8. selectByValue(f, 'width2', w.indexOf('%') != -1 ? '%' : 'px');
  9. },
  10. update : function() {
  11. var ed = tinyMCEPopup.editor, h, f = document.forms[0], st = '';
  12. h = '<hr';
  13. if (f.size.value) {
  14. h += ' size="' + f.size.value + '"';
  15. st += ' height:' + f.size.value + 'px;';
  16. }
  17. if (f.width.value) {
  18. h += ' width="' + f.width.value + (f.width2.value == '%' ? '%' : '') + '"';
  19. st += ' width:' + f.width.value + (f.width2.value == '%' ? '%' : 'px') + ';';
  20. }
  21. if (f.noshade.checked) {
  22. h += ' noshade="noshade"';
  23. st += ' border-width: 1px; border-style: solid; border-color: #CCCCCC; color: #ffffff;';
  24. }
  25. if (ed.settings.inline_styles)
  26. h += ' style="' + tinymce.trim(st) + '"';
  27. h += ' />';
  28. ed.execCommand("mceInsertContent", false, h);
  29. tinyMCEPopup.close();
  30. }
  31. };
  32. tinyMCEPopup.requireLangPack();
  33. tinyMCEPopup.onInit.add(AdvHRDialog.init, AdvHRDialog);