Built motion from commit ab065936.|2.0.49
[motion2.git] / public / assets / plugins / ckeditor / plugins / image / dialogs / image.js
1 /*
2  Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
3  For licensing, see LICENSE.md or http://ckeditor.com/license
4 */
5 (function() {
6     var v = function(d, l) {
7         function v() {
8             var a = arguments,
9                 b = this.getContentElement("advanced", "txtdlgGenStyle");
10             b && b.commit.apply(b, a);
11             this.foreach(function(b) {
12                 b.commit && "txtdlgGenStyle" != b.id && b.commit.apply(b, a)
13             })
14         }
15
16         function k(a) {
17             if (!w) {
18                 w = 1;
19                 var b = this.getDialog(),
20                     c = b.imageElement;
21                 if (c) {
22                     this.commit(1, c);
23                     a = [].concat(a);
24                     for (var d = a.length, f, g = 0; g < d; g++)(f = b.getContentElement.apply(b, a[g].split(":"))) && f.setup(1, c)
25                 }
26                 w = 0
27             }
28         }
29         var m = /^\s*(\d+)((px)|\%)?\s*$/i,
30             z = /(^\s*(\d+)((px)|\%)?\s*$)|^$/i,
31             r = /^\d+px$/,
32             A = function() {
33                 var a = this.getValue(),
34                     b = this.getDialog(),
35                     c = a.match(m);
36                 c && ("%" == c[2] && n(b, !1), a = c[1]);
37                 b.lockRatio && (c = b.originalElement, "true" == c.getCustomData("isReady") && ("txtHeight" == this.id ? (a && "0" != a && (a = Math.round(a / c.$.height * c.$.width)), isNaN(a) || b.setValueOf("info", "txtWidth", a)) : (a && "0" != a && (a = Math.round(a / c.$.width * c.$.height)), isNaN(a) || b.setValueOf("info", "txtHeight", a))));
38                 e(b)
39             },
40             e = function(a) {
41                 if (!a.originalElement || !a.preview) return 1;
42                 a.commitContent(4, a.preview);
43                 return 0
44             },
45             w, n = function(a,
46                 b) {
47                 if (!a.getContentElement("info", "ratioLock")) return null;
48                 var c = a.originalElement;
49                 if (!c) return null;
50                 if ("check" == b) {
51                     if (!a.userlockRatio && "true" == c.getCustomData("isReady")) {
52                         var d = a.getValueOf("info", "txtWidth"),
53                             f = a.getValueOf("info", "txtHeight"),
54                             c = 1E3 * c.$.width / c.$.height,
55                             g = 1E3 * d / f;
56                         a.lockRatio = !1;
57                         d || f ? isNaN(c) || isNaN(g) || Math.round(c) != Math.round(g) || (a.lockRatio = !0) : a.lockRatio = !0
58                     }
59                 } else void 0 !== b ? a.lockRatio = b : (a.userlockRatio = 1, a.lockRatio = !a.lockRatio);
60                 d = CKEDITOR.document.getById(t);
61                 a.lockRatio ?
62                     d.removeClass("cke_btn_unlocked") : d.addClass("cke_btn_unlocked");
63                 d.setAttribute("aria-checked", a.lockRatio);
64                 CKEDITOR.env.hc && d.getChild(0).setHtml(a.lockRatio ? CKEDITOR.env.ie ? "■" : "▣" : CKEDITOR.env.ie ? "□" : "▢");
65                 return a.lockRatio
66             },
67             B = function(a, b) {
68                 var c = a.originalElement;
69                 if ("true" == c.getCustomData("isReady")) {
70                     var d = a.getContentElement("info", "txtWidth"),
71                         f = a.getContentElement("info", "txtHeight"),
72                         g;
73                     b ? c = g = 0 : (g = c.$.width, c = c.$.height);
74                     d && d.setValue(g);
75                     f && f.setValue(c)
76                 }
77                 e(a)
78             },
79             C = function(a, b) {
80                 function c(a, b) {
81                     var c =
82                         a.match(m);
83                     return c ? ("%" == c[2] && (c[1] += "%", n(d, !1)), c[1]) : b
84                 }
85                 if (1 == a) {
86                     var d = this.getDialog(),
87                         f = "",
88                         g = "txtWidth" == this.id ? "width" : "height",
89                         e = b.getAttribute(g);
90                     e && (f = c(e, f));
91                     f = c(b.getStyle(g), f);
92                     this.setValue(f)
93                 }
94             },
95             x, u = function() {
96                 var a = this.originalElement,
97                     b = CKEDITOR.document.getById(p);
98                 a.setCustomData("isReady", "true");
99                 a.removeListener("load", u);
100                 a.removeListener("error", h);
101                 a.removeListener("abort", h);
102                 b && b.setStyle("display", "none");
103                 this.dontResetSize || B(this, !1 === d.config.image_prefillDimensions);
104                 this.firstLoad &&
105                     CKEDITOR.tools.setTimeout(function() {
106                         n(this, "check")
107                     }, 0, this);
108                 this.dontResetSize = this.firstLoad = !1;
109                 e(this)
110             },
111             h = function() {
112                 var a = this.originalElement,
113                     b = CKEDITOR.document.getById(p);
114                 a.removeListener("load", u);
115                 a.removeListener("error", h);
116                 a.removeListener("abort", h);
117                 a = CKEDITOR.getUrl(CKEDITOR.plugins.get("image").path + "images/noimage.png");
118                 this.preview && this.preview.setAttribute("src", a);
119                 b && b.setStyle("display", "none");
120                 n(this, !1)
121             },
122             q = function(a) {
123                 return CKEDITOR.tools.getNextId() + "_" + a
124             },
125             t = q("btnLockSizes"),
126             y = q("btnResetSize"),
127             p = q("ImagePreviewLoader"),
128             E = q("previewLink"),
129             D = q("previewImage");
130         return {
131             title: d.lang.image["image" == l ? "title" : "titleButton"],
132             minWidth: "moono-lisa" == (CKEDITOR.skinName || d.config.skin) ? 500 : 420,
133             minHeight: 360,
134             onShow: function() {
135                 this.linkEditMode = this.imageEditMode = this.linkElement = this.imageElement = !1;
136                 this.lockRatio = !0;
137                 this.userlockRatio = 0;
138                 this.dontResetSize = !1;
139                 this.firstLoad = !0;
140                 this.addLink = !1;
141                 var a = this.getParentEditor(),
142                     b = a.getSelection(),
143                     c = (b = b && b.getSelectedElement()) && a.elementPath(b).contains("a",
144                         1),
145                     d = CKEDITOR.document.getById(p);
146                 d && d.setStyle("display", "none");
147                 x = new CKEDITOR.dom.element("img", a.document);
148                 this.preview = CKEDITOR.document.getById(D);
149                 this.originalElement = a.document.createElement("img");
150                 this.originalElement.setAttribute("alt", "");
151                 this.originalElement.setCustomData("isReady", "false");
152                 c && (this.linkElement = c, this.addLink = this.linkEditMode = !0, a = c.getChildren(), 1 == a.count() && (d = a.getItem(0), d.type == CKEDITOR.NODE_ELEMENT && (d.is("img") || d.is("input")) && (this.imageElement = a.getItem(0),
153                     this.imageElement.is("img") ? this.imageEditMode = "img" : this.imageElement.is("input") && (this.imageEditMode = "input"))), "image" == l && this.setupContent(2, c));
154                 if (this.customImageElement) this.imageEditMode = "img", this.imageElement = this.customImageElement, delete this.customImageElement;
155                 else if (b && "img" == b.getName() && !b.data("cke-realelement") || b && "input" == b.getName() && "image" == b.getAttribute("type")) this.imageEditMode = b.getName(), this.imageElement = b;
156                 this.imageEditMode && (this.cleanImageElement = this.imageElement,
157                     this.imageElement = this.cleanImageElement.clone(!0, !0), this.setupContent(1, this.imageElement));
158                 n(this, !0);
159                 CKEDITOR.tools.trim(this.getValueOf("info", "txtUrl")) || (this.preview.removeAttribute("src"), this.preview.setStyle("display", "none"))
160             },
161             onOk: function() {
162                 if (this.imageEditMode) {
163                     var a = this.imageEditMode;
164                     "image" == l && "input" == a && confirm(d.lang.image.button2Img) ? (this.imageElement = d.document.createElement("img"), this.imageElement.setAttribute("alt", ""), d.insertElement(this.imageElement)) : "image" != l && "img" ==
165                         a && confirm(d.lang.image.img2Button) ? (this.imageElement = d.document.createElement("input"), this.imageElement.setAttributes({
166                             type: "image",
167                             alt: ""
168                         }), d.insertElement(this.imageElement)) : (this.imageElement = this.cleanImageElement, delete this.cleanImageElement)
169                 } else "image" == l ? this.imageElement = d.document.createElement("img") : (this.imageElement = d.document.createElement("input"), this.imageElement.setAttribute("type", "image")), this.imageElement.setAttribute("alt", "");
170                 this.linkEditMode || (this.linkElement = d.document.createElement("a"));
171                 this.commitContent(1, this.imageElement);
172                 this.commitContent(2, this.linkElement);
173                 this.imageElement.getAttribute("style") || this.imageElement.removeAttribute("style");
174                 this.imageEditMode ? !this.linkEditMode && this.addLink ? (d.insertElement(this.linkElement), this.imageElement.appendTo(this.linkElement)) : this.linkEditMode && !this.addLink && (d.getSelection().selectElement(this.linkElement), d.insertElement(this.imageElement)) : this.addLink ? this.linkEditMode ? this.linkElement.equals(d.getSelection().getSelectedElement()) ?
175                     (this.linkElement.setHtml(""), this.linkElement.append(this.imageElement, !1)) : d.insertElement(this.imageElement) : (d.insertElement(this.linkElement), this.linkElement.append(this.imageElement, !1)) : d.insertElement(this.imageElement)
176             },
177             onLoad: function() {
178                 "image" != l && this.hidePage("Link");
179                 var a = this._.element.getDocument();
180                 this.getContentElement("info", "ratioLock") && (this.addFocusable(a.getById(y), 5), this.addFocusable(a.getById(t), 5));
181                 this.commitContent = v
182             },
183             onHide: function() {
184                 this.preview && this.commitContent(8,
185                     this.preview);
186                 this.originalElement && (this.originalElement.removeListener("load", u), this.originalElement.removeListener("error", h), this.originalElement.removeListener("abort", h), this.originalElement.remove(), this.originalElement = !1);
187                 delete this.imageElement
188             },
189             contents: [{
190                 id: "info",
191                 label: d.lang.image.infoTab,
192                 accessKey: "I",
193                 elements: [{
194                     type: "vbox",
195                     padding: 0,
196                     children: [{
197                         type: "hbox",
198                         widths: ["280px", "110px"],
199                         align: "right",
200                         className: "cke_dialog_image_url",
201                         children: [{
202                             id: "txtUrl",
203                             type: "text",
204                             label: d.lang.common.url,
205                             required: !0,
206                             onChange: function() {
207                                 var a = this.getDialog(),
208                                     b = this.getValue();
209                                 if (0 < b.length) {
210                                     var a = this.getDialog(),
211                                         c = a.originalElement;
212                                     a.preview && a.preview.removeStyle("display");
213                                     c.setCustomData("isReady", "false");
214                                     var d = CKEDITOR.document.getById(p);
215                                     d && d.setStyle("display", "");
216                                     c.on("load", u, a);
217                                     c.on("error", h, a);
218                                     c.on("abort", h, a);
219                                     c.setAttribute("src", b);
220                                     a.preview && (x.setAttribute("src", b), a.preview.setAttribute("src", x.$.src), e(a))
221                                 } else a.preview && (a.preview.removeAttribute("src"), a.preview.setStyle("display",
222                                     "none"))
223                             },
224                             setup: function(a, b) {
225                                 if (1 == a) {
226                                     var c = b.data("cke-saved-src") || b.getAttribute("src");
227                                     this.getDialog().dontResetSize = !0;
228                                     this.setValue(c);
229                                     this.setInitValue()
230                                 }
231                             },
232                             commit: function(a, b) {
233                                 1 == a && (this.getValue() || this.isChanged()) ? (b.data("cke-saved-src", this.getValue()), b.setAttribute("src", this.getValue())) : 8 == a && (b.setAttribute("src", ""), b.removeAttribute("src"))
234                             },
235                             validate: CKEDITOR.dialog.validate.notEmpty(d.lang.image.urlMissing)
236                         }, {
237                             type: "button",
238                             id: "browse",
239                             style: "display:inline-block;margin-top:14px;",
240                             align: "center",
241                             label: d.lang.common.browseServer,
242                             hidden: !0,
243                             filebrowser: "info:txtUrl"
244                         }]
245                     }]
246                 }, {
247                     id: "txtAlt",
248                     type: "text",
249                     label: d.lang.image.alt,
250                     accessKey: "T",
251                     "default": "",
252                     onChange: function() {
253                         e(this.getDialog())
254                     },
255                     setup: function(a, b) {
256                         1 == a && this.setValue(b.getAttribute("alt"))
257                     },
258                     commit: function(a, b) {
259                         1 == a ? (this.getValue() || this.isChanged()) && b.setAttribute("alt", this.getValue()) : 4 == a ? b.setAttribute("alt", this.getValue()) : 8 == a && b.removeAttribute("alt")
260                     }
261                 }, {
262                     type: "hbox",
263                     children: [{
264                         id: "basic",
265                         type: "vbox",
266                         children: [{
267                             type: "hbox",
268                             requiredContent: "img{width,height}",
269                             widths: ["50%", "50%"],
270                             children: [{
271                                 type: "vbox",
272                                 padding: 1,
273                                 children: [{
274                                     type: "text",
275                                     width: "45px",
276                                     id: "txtWidth",
277                                     label: d.lang.common.width,
278                                     onKeyUp: A,
279                                     onChange: function() {
280                                         k.call(this, "advanced:txtdlgGenStyle")
281                                     },
282                                     validate: function() {
283                                         var a = this.getValue().match(z);
284                                         (a = !(!a || 0 === parseInt(a[1], 10))) || alert(d.lang.common.invalidWidth);
285                                         return a
286                                     },
287                                     setup: C,
288                                     commit: function(a, b) {
289                                         var c = this.getValue();
290                                         1 == a ? (c && d.activeFilter.check("img{width,height}") ? b.setStyle("width", CKEDITOR.tools.cssLength(c)) :
291                                             b.removeStyle("width"), b.removeAttribute("width")) : 4 == a ? c.match(m) ? b.setStyle("width", CKEDITOR.tools.cssLength(c)) : (c = this.getDialog().originalElement, "true" == c.getCustomData("isReady") && b.setStyle("width", c.$.width + "px")) : 8 == a && (b.removeAttribute("width"), b.removeStyle("width"))
292                                     }
293                                 }, {
294                                     type: "text",
295                                     id: "txtHeight",
296                                     width: "45px",
297                                     label: d.lang.common.height,
298                                     onKeyUp: A,
299                                     onChange: function() {
300                                         k.call(this, "advanced:txtdlgGenStyle")
301                                     },
302                                     validate: function() {
303                                         var a = this.getValue().match(z);
304                                         (a = !(!a || 0 === parseInt(a[1], 10))) ||
305                                         alert(d.lang.common.invalidHeight);
306                                         return a
307                                     },
308                                     setup: C,
309                                     commit: function(a, b) {
310                                         var c = this.getValue();
311                                         1 == a ? (c && d.activeFilter.check("img{width,height}") ? b.setStyle("height", CKEDITOR.tools.cssLength(c)) : b.removeStyle("height"), b.removeAttribute("height")) : 4 == a ? c.match(m) ? b.setStyle("height", CKEDITOR.tools.cssLength(c)) : (c = this.getDialog().originalElement, "true" == c.getCustomData("isReady") && b.setStyle("height", c.$.height + "px")) : 8 == a && (b.removeAttribute("height"), b.removeStyle("height"))
312                                     }
313                                 }]
314                             }, {
315                                 id: "ratioLock",
316                                 type: "html",
317                                 className: "cke_dialog_image_ratiolock",
318                                 style: "margin-top:30px;width:40px;height:40px;",
319                                 onLoad: function() {
320                                     var a = CKEDITOR.document.getById(y),
321                                         b = CKEDITOR.document.getById(t);
322                                     a && (a.on("click", function(a) {
323                                         B(this);
324                                         a.data && a.data.preventDefault()
325                                     }, this.getDialog()), a.on("mouseover", function() {
326                                         this.addClass("cke_btn_over")
327                                     }, a), a.on("mouseout", function() {
328                                         this.removeClass("cke_btn_over")
329                                     }, a));
330                                     b && (b.on("click", function(a) {
331                                         n(this);
332                                         var b = this.originalElement,
333                                             d = this.getValueOf("info", "txtWidth");
334                                         "true" ==
335                                         b.getCustomData("isReady") && d && (b = b.$.height / b.$.width * d, isNaN(b) || (this.setValueOf("info", "txtHeight", Math.round(b)), e(this)));
336                                         a.data && a.data.preventDefault()
337                                     }, this.getDialog()), b.on("mouseover", function() {
338                                         this.addClass("cke_btn_over")
339                                     }, b), b.on("mouseout", function() {
340                                         this.removeClass("cke_btn_over")
341                                     }, b))
342                                 },
343                                 html: '\x3cdiv\x3e\x3ca href\x3d"javascript:void(0)" tabindex\x3d"-1" title\x3d"' + d.lang.image.lockRatio + '" class\x3d"cke_btn_locked" id\x3d"' + t + '" role\x3d"checkbox"\x3e\x3cspan class\x3d"cke_icon"\x3e\x3c/span\x3e\x3cspan class\x3d"cke_label"\x3e' +
344                                     d.lang.image.lockRatio + '\x3c/span\x3e\x3c/a\x3e\x3ca href\x3d"javascript:void(0)" tabindex\x3d"-1" title\x3d"' + d.lang.image.resetSize + '" class\x3d"cke_btn_reset" id\x3d"' + y + '" role\x3d"button"\x3e\x3cspan class\x3d"cke_label"\x3e' + d.lang.image.resetSize + "\x3c/span\x3e\x3c/a\x3e\x3c/div\x3e"
345                             }]
346                         }, {
347                             type: "vbox",
348                             padding: 1,
349                             children: [{
350                                 type: "text",
351                                 id: "txtBorder",
352                                 requiredContent: "img{border-width}",
353                                 width: "60px",
354                                 label: d.lang.image.border,
355                                 "default": "",
356                                 onKeyUp: function() {
357                                     e(this.getDialog())
358                                 },
359                                 onChange: function() {
360                                     k.call(this,
361                                         "advanced:txtdlgGenStyle")
362                                 },
363                                 validate: CKEDITOR.dialog.validate.integer(d.lang.image.validateBorder),
364                                 setup: function(a, b) {
365                                     if (1 == a) {
366                                         var c;
367                                         c = (c = (c = b.getStyle("border-width")) && c.match(/^(\d+px)(?: \1 \1 \1)?$/)) && parseInt(c[1], 10);
368                                         isNaN(parseInt(c, 10)) && (c = b.getAttribute("border"));
369                                         this.setValue(c)
370                                     }
371                                 },
372                                 commit: function(a, b) {
373                                     var c = parseInt(this.getValue(), 10);
374                                     1 == a || 4 == a ? (isNaN(c) ? !c && this.isChanged() && b.removeStyle("border") : (b.setStyle("border-width", CKEDITOR.tools.cssLength(c)), b.setStyle("border-style",
375                                         "solid")), 1 == a && b.removeAttribute("border")) : 8 == a && (b.removeAttribute("border"), b.removeStyle("border-width"), b.removeStyle("border-style"), b.removeStyle("border-color"))
376                                 }
377                             }, {
378                                 type: "text",
379                                 id: "txtHSpace",
380                                 requiredContent: "img{margin-left,margin-right}",
381                                 width: "60px",
382                                 label: d.lang.image.hSpace,
383                                 "default": "",
384                                 onKeyUp: function() {
385                                     e(this.getDialog())
386                                 },
387                                 onChange: function() {
388                                     k.call(this, "advanced:txtdlgGenStyle")
389                                 },
390                                 validate: CKEDITOR.dialog.validate.integer(d.lang.image.validateHSpace),
391                                 setup: function(a, b) {
392                                     if (1 == a) {
393                                         var c,
394                                             d;
395                                         c = b.getStyle("margin-left");
396                                         d = b.getStyle("margin-right");
397                                         c = c && c.match(r);
398                                         d = d && d.match(r);
399                                         c = parseInt(c, 10);
400                                         d = parseInt(d, 10);
401                                         c = c == d && c;
402                                         isNaN(parseInt(c, 10)) && (c = b.getAttribute("hspace"));
403                                         this.setValue(c)
404                                     }
405                                 },
406                                 commit: function(a, b) {
407                                     var c = parseInt(this.getValue(), 10);
408                                     1 == a || 4 == a ? (isNaN(c) ? !c && this.isChanged() && (b.removeStyle("margin-left"), b.removeStyle("margin-right")) : (b.setStyle("margin-left", CKEDITOR.tools.cssLength(c)), b.setStyle("margin-right", CKEDITOR.tools.cssLength(c))), 1 == a && b.removeAttribute("hspace")) :
409                                         8 == a && (b.removeAttribute("hspace"), b.removeStyle("margin-left"), b.removeStyle("margin-right"))
410                                 }
411                             }, {
412                                 type: "text",
413                                 id: "txtVSpace",
414                                 requiredContent: "img{margin-top,margin-bottom}",
415                                 width: "60px",
416                                 label: d.lang.image.vSpace,
417                                 "default": "",
418                                 onKeyUp: function() {
419                                     e(this.getDialog())
420                                 },
421                                 onChange: function() {
422                                     k.call(this, "advanced:txtdlgGenStyle")
423                                 },
424                                 validate: CKEDITOR.dialog.validate.integer(d.lang.image.validateVSpace),
425                                 setup: function(a, b) {
426                                     if (1 == a) {
427                                         var c, d;
428                                         c = b.getStyle("margin-top");
429                                         d = b.getStyle("margin-bottom");
430                                         c = c && c.match(r);
431                                         d = d && d.match(r);
432                                         c = parseInt(c, 10);
433                                         d = parseInt(d, 10);
434                                         c = c == d && c;
435                                         isNaN(parseInt(c, 10)) && (c = b.getAttribute("vspace"));
436                                         this.setValue(c)
437                                     }
438                                 },
439                                 commit: function(a, b) {
440                                     var c = parseInt(this.getValue(), 10);
441                                     1 == a || 4 == a ? (isNaN(c) ? !c && this.isChanged() && (b.removeStyle("margin-top"), b.removeStyle("margin-bottom")) : (b.setStyle("margin-top", CKEDITOR.tools.cssLength(c)), b.setStyle("margin-bottom", CKEDITOR.tools.cssLength(c))), 1 == a && b.removeAttribute("vspace")) : 8 == a && (b.removeAttribute("vspace"), b.removeStyle("margin-top"), b.removeStyle("margin-bottom"))
442                                 }
443                             }, {
444                                 id: "cmbAlign",
445                                 requiredContent: "img{float}",
446                                 type: "select",
447                                 widths: ["35%", "65%"],
448                                 style: "width:90px",
449                                 label: d.lang.common.align,
450                                 "default": "",
451                                 items: [
452                                     [d.lang.common.notSet, ""],
453                                     [d.lang.common.alignLeft, "left"],
454                                     [d.lang.common.alignRight, "right"]
455                                 ],
456                                 onChange: function() {
457                                     e(this.getDialog());
458                                     k.call(this, "advanced:txtdlgGenStyle")
459                                 },
460                                 setup: function(a, b) {
461                                     if (1 == a) {
462                                         var c = b.getStyle("float");
463                                         switch (c) {
464                                             case "inherit":
465                                             case "none":
466                                                 c = ""
467                                         }!c && (c = (b.getAttribute("align") || "").toLowerCase());
468                                         this.setValue(c)
469                                     }
470                                 },
471                                 commit: function(a,
472                                     b) {
473                                     var c = this.getValue();
474                                     if (1 == a || 4 == a) {
475                                         if (c ? b.setStyle("float", c) : b.removeStyle("float"), 1 == a) switch (c = (b.getAttribute("align") || "").toLowerCase(), c) {
476                                             case "left":
477                                             case "right":
478                                                 b.removeAttribute("align")
479                                         }
480                                     } else 8 == a && b.removeStyle("float")
481                                 }
482                             }]
483                         }]
484                     }, {
485                         type: "vbox",
486                         height: "250px",
487                         children: [{
488                             type: "html",
489                             id: "htmlPreview",
490                             style: "width:95%;",
491                             html: "\x3cdiv\x3e" + CKEDITOR.tools.htmlEncode(d.lang.common.preview) + '\x3cbr\x3e\x3cdiv id\x3d"' + p + '" class\x3d"ImagePreviewLoader" style\x3d"display:none"\x3e\x3cdiv class\x3d"loading"\x3e\x26nbsp;\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d"ImagePreviewBox"\x3e\x3ctable\x3e\x3ctr\x3e\x3ctd\x3e\x3ca href\x3d"javascript:void(0)" target\x3d"_blank" onclick\x3d"return false;" id\x3d"' +
492                                 E + '"\x3e\x3cimg id\x3d"' + D + '" alt\x3d"" /\x3e\x3c/a\x3e' + (d.config.image_previewText || "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas feugiat consequat diam. Maecenas metus. Vivamus diam purus, cursus a, commodo non, facilisis vitae, nulla. Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis aliquam, orci felis euismod neque, sed ornare massa mauris sed velit. Nulla pretium mi et risus. Fusce mi pede, tempor id, cursus ac, ullamcorper nec, enim. Sed tortor. Curabitur molestie. Duis velit augue, condimentum at, ultrices a, luctus ut, orci. Donec pellentesque egestas eros. Integer cursus, augue in cursus faucibus, eros pede bibendum sem, in tempus tellus justo quis ligula. Etiam eget tortor. Vestibulum rutrum, est ut placerat elementum, lectus nisl aliquam velit, tempor aliquam eros nunc nonummy metus. In eros metus, gravida a, gravida sed, lobortis id, turpis. Ut ultrices, ipsum at venenatis fringilla, sem nulla lacinia tellus, eget aliquet turpis mauris non enim. Nam turpis. Suspendisse lacinia. Curabitur ac tortor ut ipsum egestas elementum. Nunc imperdiet gravida mauris.") +
493                                 "\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e\x3c/div\x3e\x3c/div\x3e"
494                         }]
495                     }]
496                 }]
497             }, {
498                 id: "Link",
499                 requiredContent: "a[href]",
500                 label: d.lang.image.linkTab,
501                 padding: 0,
502                 elements: [{
503                     id: "txtUrl",
504                     type: "text",
505                     label: d.lang.common.url,
506                     style: "width: 100%",
507                     "default": "",
508                     setup: function(a, b) {
509                         if (2 == a) {
510                             var c = b.data("cke-saved-href");
511                             c || (c = b.getAttribute("href"));
512                             this.setValue(c)
513                         }
514                     },
515                     commit: function(a, b) {
516                         if (2 == a && (this.getValue() || this.isChanged())) {
517                             var c = this.getValue();
518                             b.data("cke-saved-href", c);
519                             b.setAttribute("href", c);
520                             this.getValue() ||
521                                 !d.config.image_removeLinkByEmptyURL ? this.getDialog().addLink = !0 : this.getDialog().addLink = !1
522                         }
523                     }
524                 }, {
525                     type: "button",
526                     id: "browse",
527                     className: "cke_dialog_image_browse",
528                     filebrowser: {
529                         action: "Browse",
530                         target: "Link:txtUrl",
531                         url: d.config.filebrowserImageBrowseLinkUrl
532                     },
533                     style: "float:right",
534                     hidden: !0,
535                     label: d.lang.common.browseServer
536                 }, {
537                     id: "cmbTarget",
538                     type: "select",
539                     requiredContent: "a[target]",
540                     label: d.lang.common.target,
541                     "default": "",
542                     items: [
543                         [d.lang.common.notSet, ""],
544                         [d.lang.common.targetNew, "_blank"],
545                         [d.lang.common.targetTop,
546                             "_top"
547                         ],
548                         [d.lang.common.targetSelf, "_self"],
549                         [d.lang.common.targetParent, "_parent"]
550                     ],
551                     setup: function(a, b) {
552                         2 == a && this.setValue(b.getAttribute("target") || "")
553                     },
554                     commit: function(a, b) {
555                         2 == a && (this.getValue() || this.isChanged()) && b.setAttribute("target", this.getValue())
556                     }
557                 }]
558             }, {
559                 id: "Upload",
560                 hidden: !0,
561                 filebrowser: "uploadButton",
562                 label: d.lang.image.upload,
563                 elements: [{
564                     type: "file",
565                     id: "upload",
566                     label: d.lang.image.btnUpload,
567                     style: "height:40px",
568                     size: 38
569                 }, {
570                     type: "fileButton",
571                     id: "uploadButton",
572                     filebrowser: "info:txtUrl",
573                     label: d.lang.image.btnUpload,
574                     "for": ["Upload", "upload"]
575                 }]
576             }, {
577                 id: "advanced",
578                 label: d.lang.common.advancedTab,
579                 elements: [{
580                     type: "hbox",
581                     widths: ["50%", "25%", "25%"],
582                     children: [{
583                         type: "text",
584                         id: "linkId",
585                         requiredContent: "img[id]",
586                         label: d.lang.common.id,
587                         setup: function(a, b) {
588                             1 == a && this.setValue(b.getAttribute("id"))
589                         },
590                         commit: function(a, b) {
591                             1 == a && (this.getValue() || this.isChanged()) && b.setAttribute("id", this.getValue())
592                         }
593                     }, {
594                         id: "cmbLangDir",
595                         type: "select",
596                         requiredContent: "img[dir]",
597                         style: "width : 100px;",
598                         label: d.lang.common.langDir,
599                         "default": "",
600                         items: [
601                             [d.lang.common.notSet,
602                                 ""
603                             ],
604                             [d.lang.common.langDirLtr, "ltr"],
605                             [d.lang.common.langDirRtl, "rtl"]
606                         ],
607                         setup: function(a, b) {
608                             1 == a && this.setValue(b.getAttribute("dir"))
609                         },
610                         commit: function(a, b) {
611                             1 == a && (this.getValue() || this.isChanged()) && b.setAttribute("dir", this.getValue())
612                         }
613                     }, {
614                         type: "text",
615                         id: "txtLangCode",
616                         requiredContent: "img[lang]",
617                         label: d.lang.common.langCode,
618                         "default": "",
619                         setup: function(a, b) {
620                             1 == a && this.setValue(b.getAttribute("lang"))
621                         },
622                         commit: function(a, b) {
623                             1 == a && (this.getValue() || this.isChanged()) && b.setAttribute("lang", this.getValue())
624                         }
625                     }]
626                 }, {
627                     type: "text",
628                     id: "txtGenLongDescr",
629                     requiredContent: "img[longdesc]",
630                     label: d.lang.common.longDescr,
631                     setup: function(a, b) {
632                         1 == a && this.setValue(b.getAttribute("longDesc"))
633                     },
634                     commit: function(a, b) {
635                         1 == a && (this.getValue() || this.isChanged()) && b.setAttribute("longDesc", this.getValue())
636                     }
637                 }, {
638                     type: "hbox",
639                     widths: ["50%", "50%"],
640                     children: [{
641                         type: "text",
642                         id: "txtGenClass",
643                         requiredContent: "img(cke-xyz)",
644                         label: d.lang.common.cssClass,
645                         "default": "",
646                         setup: function(a, b) {
647                             1 == a && this.setValue(b.getAttribute("class"))
648                         },
649                         commit: function(a,
650                             b) {
651                             1 == a && (this.getValue() || this.isChanged()) && b.setAttribute("class", this.getValue())
652                         }
653                     }, {
654                         type: "text",
655                         id: "txtGenTitle",
656                         requiredContent: "img[title]",
657                         label: d.lang.common.advisoryTitle,
658                         "default": "",
659                         onChange: function() {
660                             e(this.getDialog())
661                         },
662                         setup: function(a, b) {
663                             1 == a && this.setValue(b.getAttribute("title"))
664                         },
665                         commit: function(a, b) {
666                             1 == a ? (this.getValue() || this.isChanged()) && b.setAttribute("title", this.getValue()) : 4 == a ? b.setAttribute("title", this.getValue()) : 8 == a && b.removeAttribute("title")
667                         }
668                     }]
669                 }, {
670                     type: "text",
671                     id: "txtdlgGenStyle",
672                     requiredContent: "img{cke-xyz}",
673                     label: d.lang.common.cssStyle,
674                     validate: CKEDITOR.dialog.validate.inlineStyle(d.lang.common.invalidInlineStyle),
675                     "default": "",
676                     setup: function(a, b) {
677                         if (1 == a) {
678                             var c = b.getAttribute("style");
679                             !c && b.$.style.cssText && (c = b.$.style.cssText);
680                             this.setValue(c);
681                             var d = b.$.style.height,
682                                 c = b.$.style.width,
683                                 d = (d ? d : "").match(m),
684                                 c = (c ? c : "").match(m);
685                             this.attributesInStyle = {
686                                 height: !!d,
687                                 width: !!c
688                             }
689                         }
690                     },
691                     onChange: function() {
692                         k.call(this, "info:cmbFloat info:cmbAlign info:txtVSpace info:txtHSpace info:txtBorder info:txtWidth info:txtHeight".split(" "));
693                         e(this)
694                     },
695                     commit: function(a, b) {
696                         1 == a && (this.getValue() || this.isChanged()) && b.setAttribute("style", this.getValue())
697                     }
698                 }]
699             }]
700         }
701     };
702     CKEDITOR.dialog.add("image", function(d) {
703         return v(d, "image")
704     });
705     CKEDITOR.dialog.add("imagebutton", function(d) {
706         return v(d, "imagebutton")
707     })
708 })();