annotate WebContent/jscripts/tiny_mce/plugins/advhr/js/rule.js @ 8:11baadcdd2c8

start of new Annotator API implementation.
author casties
date Mon, 19 Mar 2012 14:50:28 +0100
parents 0be9d53a6967
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1 var AdvHRDialog = {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
2 init : function(ed) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
3 var dom = ed.dom, f = document.forms[0], n = ed.selection.getNode(), w;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
4
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
5 w = dom.getAttrib(n, 'width');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
6 f.width.value = w ? parseInt(w) : (dom.getStyle('width') || '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
7 f.size.value = dom.getAttrib(n, 'size') || parseInt(dom.getStyle('height')) || '';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
8 f.noshade.checked = !!dom.getAttrib(n, 'noshade') || !!dom.getStyle('border-width');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
9 selectByValue(f, 'width2', w.indexOf('%') != -1 ? '%' : 'px');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
10 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
11
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
12 update : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
13 var ed = tinyMCEPopup.editor, h, f = document.forms[0], st = '';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
14
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
15 h = '<hr';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
16
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
17 if (f.size.value) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
18 h += ' size="' + f.size.value + '"';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
19 st += ' height:' + f.size.value + 'px;';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
20 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
21
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
22 if (f.width.value) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
23 h += ' width="' + f.width.value + (f.width2.value == '%' ? '%' : '') + '"';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
24 st += ' width:' + f.width.value + (f.width2.value == '%' ? '%' : 'px') + ';';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
25 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
26
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
27 if (f.noshade.checked) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
28 h += ' noshade="noshade"';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
29 st += ' border-width: 1px; border-style: solid; border-color: #CCCCCC; color: #ffffff;';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
30 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
31
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
32 if (ed.settings.inline_styles)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
33 h += ' style="' + tinymce.trim(st) + '"';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
34
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
35 h += ' />';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
36
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
37 ed.execCommand("mceInsertContent", false, h);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
38 tinyMCEPopup.close();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
39 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
40 };
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
41
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
42 tinyMCEPopup.requireLangPack();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
43 tinyMCEPopup.onInit.add(AdvHRDialog.init, AdvHRDialog);