annotate WebContent/jscripts/tiny_mce/plugins/advimage/js/image.js @ 6:5bb7cc86069c

restlet.jar
author dwinter
date Wed, 14 Mar 2012 16:21:45 +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 ImageDialog = {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
2 preInit : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
3 var url;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
4
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
5 tinyMCEPopup.requireLangPack();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
6
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
7 if (url = tinyMCEPopup.getParam("external_image_list_url"))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
8 document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
9 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
10
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
11 init : function(ed) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
12 var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, dom = ed.dom, n = ed.selection.getNode(), fl = tinyMCEPopup.getParam('external_image_list', 'tinyMCEImageList');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
13
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
14 tinyMCEPopup.resizeToInnerSize();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
15 this.fillClassList('class_list');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
16 this.fillFileList('src_list', fl);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
17 this.fillFileList('over_list', fl);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
18 this.fillFileList('out_list', fl);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
19 TinyMCE_EditableSelects.init();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
20
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
21 if (n.nodeName == 'IMG') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
22 nl.src.value = dom.getAttrib(n, 'src');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
23 nl.width.value = dom.getAttrib(n, 'width');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
24 nl.height.value = dom.getAttrib(n, 'height');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
25 nl.alt.value = dom.getAttrib(n, 'alt');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
26 nl.title.value = dom.getAttrib(n, 'title');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
27 nl.vspace.value = this.getAttrib(n, 'vspace');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
28 nl.hspace.value = this.getAttrib(n, 'hspace');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
29 nl.border.value = this.getAttrib(n, 'border');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
30 selectByValue(f, 'align', this.getAttrib(n, 'align'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
31 selectByValue(f, 'class_list', dom.getAttrib(n, 'class'), true, true);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
32 nl.style.value = dom.getAttrib(n, 'style');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
33 nl.id.value = dom.getAttrib(n, 'id');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
34 nl.dir.value = dom.getAttrib(n, 'dir');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
35 nl.lang.value = dom.getAttrib(n, 'lang');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
36 nl.usemap.value = dom.getAttrib(n, 'usemap');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
37 nl.longdesc.value = dom.getAttrib(n, 'longdesc');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
38 nl.insert.value = ed.getLang('update');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
39
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
40 if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseover')))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
41 nl.onmouseoversrc.value = dom.getAttrib(n, 'onmouseover').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
42
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
43 if (/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/.test(dom.getAttrib(n, 'onmouseout')))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
44 nl.onmouseoutsrc.value = dom.getAttrib(n, 'onmouseout').replace(/^\s*this.src\s*=\s*\'([^\']+)\';?\s*$/, '$1');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
45
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
46 if (ed.settings.inline_styles) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
47 // Move attribs to styles
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
48 if (dom.getAttrib(n, 'align'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
49 this.updateStyle('align');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
50
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
51 if (dom.getAttrib(n, 'hspace'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
52 this.updateStyle('hspace');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
53
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
54 if (dom.getAttrib(n, 'border'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
55 this.updateStyle('border');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
56
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
57 if (dom.getAttrib(n, 'vspace'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
58 this.updateStyle('vspace');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
59 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
60 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
61
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
62 // Setup browse button
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
63 document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
64 if (isVisible('srcbrowser'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
65 document.getElementById('src').style.width = '260px';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
66
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
67 // Setup browse button
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
68 document.getElementById('onmouseoversrccontainer').innerHTML = getBrowserHTML('overbrowser','onmouseoversrc','image','theme_advanced_image');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
69 if (isVisible('overbrowser'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
70 document.getElementById('onmouseoversrc').style.width = '260px';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
71
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
72 // Setup browse button
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
73 document.getElementById('onmouseoutsrccontainer').innerHTML = getBrowserHTML('outbrowser','onmouseoutsrc','image','theme_advanced_image');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
74 if (isVisible('outbrowser'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
75 document.getElementById('onmouseoutsrc').style.width = '260px';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
76
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
77 // If option enabled default contrain proportions to checked
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
78 if (ed.getParam("advimage_constrain_proportions", true))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
79 f.constrain.checked = true;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
80
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
81 // Check swap image if valid data
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
82 if (nl.onmouseoversrc.value || nl.onmouseoutsrc.value)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
83 this.setSwapImage(true);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
84 else
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
85 this.setSwapImage(false);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
86
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
87 this.changeAppearance();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
88 this.showPreviewImage(nl.src.value, 1);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
89 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
90
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
91 insert : function(file, title) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
92 var ed = tinyMCEPopup.editor, t = this, f = document.forms[0];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
93
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
94 if (f.src.value === '') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
95 if (ed.selection.getNode().nodeName == 'IMG') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
96 ed.dom.remove(ed.selection.getNode());
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
97 ed.execCommand('mceRepaint');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
98 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
99
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
100 tinyMCEPopup.close();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
101 return;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
102 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
103
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
104 if (tinyMCEPopup.getParam("accessibility_warnings", 1)) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
105 if (!f.alt.value) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
106 tinyMCEPopup.confirm(tinyMCEPopup.getLang('advimage_dlg.missing_alt'), function(s) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
107 if (s)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
108 t.insertAndClose();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
109 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
110
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
111 return;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
112 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
113 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
114
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
115 t.insertAndClose();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
116 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
117
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
118 insertAndClose : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
119 var ed = tinyMCEPopup.editor, f = document.forms[0], nl = f.elements, v, args = {}, el;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
120
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
121 tinyMCEPopup.restoreSelection();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
122
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
123 // Fixes crash in Safari
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
124 if (tinymce.isWebKit)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
125 ed.getWin().focus();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
126
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
127 if (!ed.settings.inline_styles) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
128 args = {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
129 vspace : nl.vspace.value,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
130 hspace : nl.hspace.value,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
131 border : nl.border.value,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
132 align : getSelectValue(f, 'align')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
133 };
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
134 } else {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
135 // Remove deprecated values
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
136 args = {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
137 vspace : '',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
138 hspace : '',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
139 border : '',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
140 align : ''
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
141 };
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
142 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
143
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
144 tinymce.extend(args, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
145 src : nl.src.value.replace(/ /g, '%20'),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
146 width : nl.width.value,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
147 height : nl.height.value,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
148 alt : nl.alt.value,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
149 title : nl.title.value,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
150 'class' : getSelectValue(f, 'class_list'),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
151 style : nl.style.value,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
152 id : nl.id.value,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
153 dir : nl.dir.value,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
154 lang : nl.lang.value,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
155 usemap : nl.usemap.value,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
156 longdesc : nl.longdesc.value
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
157 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
158
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
159 args.onmouseover = args.onmouseout = '';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
160
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
161 if (f.onmousemovecheck.checked) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
162 if (nl.onmouseoversrc.value)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
163 args.onmouseover = "this.src='" + nl.onmouseoversrc.value + "';";
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
164
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
165 if (nl.onmouseoutsrc.value)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
166 args.onmouseout = "this.src='" + nl.onmouseoutsrc.value + "';";
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
167 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
168
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
169 el = ed.selection.getNode();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
170
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
171 if (el && el.nodeName == 'IMG') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
172 ed.dom.setAttribs(el, args);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
173 } else {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
174 tinymce.each(args, function(value, name) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
175 if (value === "") {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
176 delete args[name];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
177 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
178 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
179
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
180 ed.execCommand('mceInsertContent', false, tinyMCEPopup.editor.dom.createHTML('img', args), {skip_undo : 1});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
181 ed.undoManager.add();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
182 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
183
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
184 tinyMCEPopup.editor.execCommand('mceRepaint');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
185 tinyMCEPopup.editor.focus();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
186 tinyMCEPopup.close();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
187 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
188
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
189 getAttrib : function(e, at) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
190 var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
191
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
192 if (ed.settings.inline_styles) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
193 switch (at) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
194 case 'align':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
195 if (v = dom.getStyle(e, 'float'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
196 return v;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
197
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
198 if (v = dom.getStyle(e, 'vertical-align'))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
199 return v;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
200
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
201 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
202
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
203 case 'hspace':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
204 v = dom.getStyle(e, 'margin-left')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
205 v2 = dom.getStyle(e, 'margin-right');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
206
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
207 if (v && v == v2)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
208 return parseInt(v.replace(/[^0-9]/g, ''));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
209
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
210 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
211
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
212 case 'vspace':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
213 v = dom.getStyle(e, 'margin-top')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
214 v2 = dom.getStyle(e, 'margin-bottom');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
215 if (v && v == v2)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
216 return parseInt(v.replace(/[^0-9]/g, ''));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
217
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
218 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
219
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
220 case 'border':
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
221 v = 0;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
222
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
223 tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
224 sv = dom.getStyle(e, 'border-' + sv + '-width');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
225
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
226 // False or not the same as prev
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
227 if (!sv || (sv != v && v !== 0)) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
228 v = 0;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
229 return false;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
230 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
231
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
232 if (sv)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
233 v = sv;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
234 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
235
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
236 if (v)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
237 return parseInt(v.replace(/[^0-9]/g, ''));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
238
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
239 break;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
240 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
241 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
242
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
243 if (v = dom.getAttrib(e, at))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
244 return v;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
245
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
246 return '';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
247 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
248
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
249 setSwapImage : function(st) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
250 var f = document.forms[0];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
251
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
252 f.onmousemovecheck.checked = st;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
253 setBrowserDisabled('overbrowser', !st);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
254 setBrowserDisabled('outbrowser', !st);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
255
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
256 if (f.over_list)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
257 f.over_list.disabled = !st;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
258
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
259 if (f.out_list)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
260 f.out_list.disabled = !st;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
261
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
262 f.onmouseoversrc.disabled = !st;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
263 f.onmouseoutsrc.disabled = !st;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
264 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
265
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
266 fillClassList : function(id) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
267 var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
268
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
269 if (v = tinyMCEPopup.getParam('theme_advanced_styles')) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
270 cl = [];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
271
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
272 tinymce.each(v.split(';'), function(v) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
273 var p = v.split('=');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
274
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
275 cl.push({'title' : p[0], 'class' : p[1]});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
276 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
277 } else
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
278 cl = tinyMCEPopup.editor.dom.getClasses();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
279
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
280 if (cl.length > 0) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
281 lst.options.length = 0;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
282 lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
283
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
284 tinymce.each(cl, function(o) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
285 lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
286 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
287 } else
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
288 dom.remove(dom.getParent(id, 'tr'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
289 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
290
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
291 fillFileList : function(id, l) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
292 var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
293
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
294 l = typeof(l) === 'function' ? l() : window[l];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
295 lst.options.length = 0;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
296
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
297 if (l && l.length > 0) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
298 lst.options[lst.options.length] = new Option('', '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
299
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
300 tinymce.each(l, function(o) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
301 lst.options[lst.options.length] = new Option(o[0], o[1]);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
302 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
303 } else
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
304 dom.remove(dom.getParent(id, 'tr'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
305 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
306
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
307 resetImageData : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
308 var f = document.forms[0];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
309
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
310 f.elements.width.value = f.elements.height.value = '';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
311 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
312
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
313 updateImageData : function(img, st) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
314 var f = document.forms[0];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
315
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
316 if (!st) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
317 f.elements.width.value = img.width;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
318 f.elements.height.value = img.height;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
319 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
320
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
321 this.preloadImg = img;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
322 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
323
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
324 changeAppearance : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
325 var ed = tinyMCEPopup.editor, f = document.forms[0], img = document.getElementById('alignSampleImg');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
326
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
327 if (img) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
328 if (ed.getParam('inline_styles')) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
329 ed.dom.setAttrib(img, 'style', f.style.value);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
330 } else {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
331 img.align = f.align.value;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
332 img.border = f.border.value;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
333 img.hspace = f.hspace.value;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
334 img.vspace = f.vspace.value;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
335 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
336 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
337 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
338
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
339 changeHeight : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
340 var f = document.forms[0], tp, t = this;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
341
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
342 if (!f.constrain.checked || !t.preloadImg) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
343 return;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
344 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
345
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
346 if (f.width.value == "" || f.height.value == "")
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
347 return;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
348
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
349 tp = (parseInt(f.width.value) / parseInt(t.preloadImg.width)) * t.preloadImg.height;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
350 f.height.value = tp.toFixed(0);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
351 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
352
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
353 changeWidth : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
354 var f = document.forms[0], tp, t = this;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
355
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
356 if (!f.constrain.checked || !t.preloadImg) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
357 return;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
358 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
359
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
360 if (f.width.value == "" || f.height.value == "")
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
361 return;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
362
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
363 tp = (parseInt(f.height.value) / parseInt(t.preloadImg.height)) * t.preloadImg.width;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
364 f.width.value = tp.toFixed(0);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
365 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
366
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
367 updateStyle : function(ty) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
368 var dom = tinyMCEPopup.dom, b, bStyle, bColor, v, isIE = tinymce.isIE, f = document.forms[0], img = dom.create('img', {style : dom.get('style').value});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
369
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
370 if (tinyMCEPopup.editor.settings.inline_styles) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
371 // Handle align
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
372 if (ty == 'align') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
373 dom.setStyle(img, 'float', '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
374 dom.setStyle(img, 'vertical-align', '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
375
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
376 v = getSelectValue(f, 'align');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
377 if (v) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
378 if (v == 'left' || v == 'right')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
379 dom.setStyle(img, 'float', v);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
380 else
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
381 img.style.verticalAlign = v;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
382 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
383 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
384
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
385 // Handle border
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
386 if (ty == 'border') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
387 b = img.style.border ? img.style.border.split(' ') : [];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
388 bStyle = dom.getStyle(img, 'border-style');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
389 bColor = dom.getStyle(img, 'border-color');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
390
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
391 dom.setStyle(img, 'border', '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
392
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
393 v = f.border.value;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
394 if (v || v == '0') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
395 if (v == '0')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
396 img.style.border = isIE ? '0' : '0 none none';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
397 else {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
398 if (b.length == 3 && b[isIE ? 2 : 1])
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
399 bStyle = b[isIE ? 2 : 1];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
400 else if (!bStyle || bStyle == 'none')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
401 bStyle = 'solid';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
402 if (b.length == 3 && b[isIE ? 0 : 2])
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
403 bColor = b[isIE ? 0 : 2];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
404 else if (!bColor || bColor == 'none')
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
405 bColor = 'black';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
406 img.style.border = v + 'px ' + bStyle + ' ' + bColor;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
407 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
408 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
409 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
410
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
411 // Handle hspace
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
412 if (ty == 'hspace') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
413 dom.setStyle(img, 'marginLeft', '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
414 dom.setStyle(img, 'marginRight', '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
415
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
416 v = f.hspace.value;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
417 if (v) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
418 img.style.marginLeft = v + 'px';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
419 img.style.marginRight = v + 'px';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
420 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
421 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
422
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
423 // Handle vspace
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
424 if (ty == 'vspace') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
425 dom.setStyle(img, 'marginTop', '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
426 dom.setStyle(img, 'marginBottom', '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
427
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
428 v = f.vspace.value;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
429 if (v) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
430 img.style.marginTop = v + 'px';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
431 img.style.marginBottom = v + 'px';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
432 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
433 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
434
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
435 // Merge
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
436 dom.get('style').value = dom.serializeStyle(dom.parseStyle(img.style.cssText), 'img');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
437 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
438 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
439
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
440 changeMouseMove : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
441 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
442
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
443 showPreviewImage : function(u, st) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
444 if (!u) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
445 tinyMCEPopup.dom.setHTML('prev', '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
446 return;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
447 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
448
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
449 if (!st && tinyMCEPopup.getParam("advimage_update_dimensions_onchange", true))
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
450 this.resetImageData();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
451
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
452 u = tinyMCEPopup.editor.documentBaseURI.toAbsolute(u);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
453
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
454 if (!st)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
455 tinyMCEPopup.dom.setHTML('prev', '<img id="previewImg" src="' + u + '" border="0" onload="ImageDialog.updateImageData(this);" onerror="ImageDialog.resetImageData();" />');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
456 else
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
457 tinyMCEPopup.dom.setHTML('prev', '<img id="previewImg" src="' + u + '" border="0" onload="ImageDialog.updateImageData(this, 1);" />');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
458 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
459 };
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
460
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
461 ImageDialog.preInit();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
462 tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog);