tinymce/3rdparty/plugins/advhr/js/rule.js
author Dan Fuhry <dan@enanocms.org>
Thu, 02 Jun 2011 06:24:03 -0400
changeset 0 c78d206bf01c
permissions -rw-r--r--
First commit... it works I guess
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     1
var AdvHRDialog = {
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     2
	init : function(ed) {
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     3
		var dom = ed.dom, f = document.forms[0], n = ed.selection.getNode(), w;
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     4
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     5
		w = dom.getAttrib(n, 'width');
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     6
		f.width.value = w ? parseInt(w) : (dom.getStyle('width') || '');
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     7
		f.size.value = dom.getAttrib(n, 'size') || parseInt(dom.getStyle('height')) || '';
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     8
		f.noshade.checked = !!dom.getAttrib(n, 'noshade') || !!dom.getStyle('border-width');
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
     9
		selectByValue(f, 'width2', w.indexOf('%') != -1 ? '%' : 'px');
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    10
	},
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    11
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    12
	update : function() {
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    13
		var ed = tinyMCEPopup.editor, h, f = document.forms[0], st = '';
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    14
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    15
		h = '<hr';
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    16
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    17
		if (f.size.value) {
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    18
			h += ' size="' + f.size.value + '"';
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    19
			st += ' height:' + f.size.value + 'px;';
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    20
		}
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    21
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    22
		if (f.width.value) {
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    23
			h += ' width="' + f.width.value + (f.width2.value == '%' ? '%' : '') + '"';
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    24
			st += ' width:' + f.width.value + (f.width2.value == '%' ? '%' : 'px') + ';';
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    25
		}
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    26
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    27
		if (f.noshade.checked) {
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    28
			h += ' noshade="noshade"';
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    29
			st += ' border-width: 1px; border-style: solid; border-color: #CCCCCC; color: #ffffff;';
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    30
		}
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    31
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    32
		if (ed.settings.inline_styles)
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    33
			h += ' style="' + tinymce.trim(st) + '"';
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    34
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    35
		h += ' />';
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    36
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    37
		ed.execCommand("mceInsertContent", false, h);
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    38
		tinyMCEPopup.close();
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    39
	}
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    40
};
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    41
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    42
tinyMCEPopup.requireLangPack();
c78d206bf01c First commit... it works I guess
Dan Fuhry <dan@enanocms.org>
parents:
diff changeset
    43
tinyMCEPopup.onInit.add(AdvHRDialog.init, AdvHRDialog);