Built motion from commit 67e5df37.|2.0.66
[motion2.git] / public / assets / plugins / ckeditor / plugins / flash / dialogs / flash.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     function b(a, b, c) {
7         var h = n[this.id];
8         if (h)
9             for (var f = this instanceof CKEDITOR.ui.dialog.checkbox, e = 0; e < h.length; e++) {
10                 var d = h[e];
11                 switch (d.type) {
12                     case 1:
13                         if (!a) continue;
14                         if (null !== a.getAttribute(d.name)) {
15                             a = a.getAttribute(d.name);
16                             f ? this.setValue("true" == a.toLowerCase()) : this.setValue(a);
17                             return
18                         }
19                         f && this.setValue(!!d["default"]);
20                         break;
21                     case 2:
22                         if (!a) continue;
23                         if (d.name in c) {
24                             a = c[d.name];
25                             f ? this.setValue("true" == a.toLowerCase()) : this.setValue(a);
26                             return
27                         }
28                         f && this.setValue(!!d["default"]);
29                         break;
30                     case 4:
31                         if (!b) continue;
32                         if (b.getAttribute(d.name)) {
33                             a = b.getAttribute(d.name);
34                             f ? this.setValue("true" == a.toLowerCase()) : this.setValue(a);
35                             return
36                         }
37                         f && this.setValue(!!d["default"])
38                 }
39             }
40     }
41
42     function c(a, b, c) {
43         var h = n[this.id];
44         if (h)
45             for (var f = "" === this.getValue(), e = this instanceof CKEDITOR.ui.dialog.checkbox, d = 0; d < h.length; d++) {
46                 var g = h[d];
47                 switch (g.type) {
48                     case 1:
49                         if (!a || "data" == g.name && b && !a.hasAttribute("data")) continue;
50                         var m = this.getValue();
51                         f || e && m === g["default"] ? a.removeAttribute(g.name) : a.setAttribute(g.name, m);
52                         break;
53                     case 2:
54                         if (!a) continue;
55                         m = this.getValue();
56                         if (f || e && m === g["default"]) g.name in c && c[g.name].remove();
57                         else if (g.name in c) c[g.name].setAttribute("value", m);
58                         else {
59                             var p = CKEDITOR.dom.element.createFromHtml("\x3ccke:param\x3e\x3c/cke:param\x3e", a.getDocument());
60                             p.setAttributes({
61                                 name: g.name,
62                                 value: m
63                             });
64                             1 > a.getChildCount() ? p.appendTo(a) : p.insertBefore(a.getFirst())
65                         }
66                         break;
67                     case 4:
68                         if (!b) continue;
69                         m = this.getValue();
70                         f || e && m === g["default"] ? b.removeAttribute(g.name) : b.setAttribute(g.name, m)
71                 }
72             }
73     }
74     for (var n = {
75             id: [{
76                 type: 1,
77                 name: "id"
78             }],
79             classid: [{
80                 type: 1,
81                 name: "classid"
82             }],
83             codebase: [{
84                 type: 1,
85                 name: "codebase"
86             }],
87             pluginspage: [{
88                 type: 4,
89                 name: "pluginspage"
90             }],
91             src: [{
92                 type: 2,
93                 name: "movie"
94             }, {
95                 type: 4,
96                 name: "src"
97             }, {
98                 type: 1,
99                 name: "data"
100             }],
101             name: [{
102                 type: 4,
103                 name: "name"
104             }],
105             align: [{
106                 type: 1,
107                 name: "align"
108             }],
109             "class": [{
110                 type: 1,
111                 name: "class"
112             }, {
113                 type: 4,
114                 name: "class"
115             }],
116             width: [{
117                 type: 1,
118                 name: "width"
119             }, {
120                 type: 4,
121                 name: "width"
122             }],
123             height: [{
124                 type: 1,
125                 name: "height"
126             }, {
127                 type: 4,
128                 name: "height"
129             }],
130             hSpace: [{
131                 type: 1,
132                 name: "hSpace"
133             }, {
134                 type: 4,
135                 name: "hSpace"
136             }],
137             vSpace: [{
138                 type: 1,
139                 name: "vSpace"
140             }, {
141                 type: 4,
142                 name: "vSpace"
143             }],
144             style: [{
145                 type: 1,
146                 name: "style"
147             }, {
148                 type: 4,
149                 name: "style"
150             }],
151             type: [{
152                 type: 4,
153                 name: "type"
154             }]
155         }, k = "play loop menu quality scale salign wmode bgcolor base flashvars allowScriptAccess allowFullScreen".split(" "), l = 0; l < k.length; l++) n[k[l]] = [{
156         type: 4,
157         name: k[l]
158     }, {
159         type: 2,
160         name: k[l]
161     }];
162     k = ["play", "loop", "menu"];
163     for (l = 0; l < k.length; l++) n[k[l]][0]["default"] = n[k[l]][1]["default"] = !0;
164     CKEDITOR.dialog.add("flash", function(a) {
165         var l = !a.config.flashEmbedTagOnly,
166             k = a.config.flashAddEmbedTag || a.config.flashEmbedTagOnly,
167             h, f = "\x3cdiv\x3e" + CKEDITOR.tools.htmlEncode(a.lang.common.preview) +
168             '\x3cbr\x3e\x3cdiv id\x3d"cke_FlashPreviewLoader' + CKEDITOR.tools.getNextNumber() + '" style\x3d"display:none"\x3e\x3cdiv class\x3d"loading"\x3e\x26nbsp;\x3c/div\x3e\x3c/div\x3e\x3cdiv id\x3d"cke_FlashPreviewBox' + CKEDITOR.tools.getNextNumber() + '" class\x3d"FlashPreviewBox"\x3e\x3c/div\x3e\x3c/div\x3e';
169         return {
170             title: a.lang.flash.title,
171             minWidth: 420,
172             minHeight: 310,
173             onShow: function() {
174                 this.fakeImage = this.objectNode = this.embedNode = null;
175                 h = new CKEDITOR.dom.element("embed", a.document);
176                 var e = this.getSelectedElement();
177                 if (e && e.data("cke-real-element-type") && "flash" == e.data("cke-real-element-type")) {
178                     this.fakeImage = e;
179                     var d = a.restoreRealElement(e),
180                         g = null,
181                         b = null,
182                         c = {};
183                     if ("cke:object" == d.getName()) {
184                         g = d;
185                         d = g.getElementsByTag("embed", "cke");
186                         0 < d.count() && (b = d.getItem(0));
187                         for (var d = g.getElementsByTag("param", "cke"), f = 0, l = d.count(); f < l; f++) {
188                             var k = d.getItem(f),
189                                 n = k.getAttribute("name"),
190                                 k = k.getAttribute("value");
191                             c[n] = k
192                         }
193                     } else "cke:embed" == d.getName() && (b = d);
194                     this.objectNode = g;
195                     this.embedNode = b;
196                     this.setupContent(g, b, c, e)
197                 }
198             },
199             onOk: function() {
200                 var e =
201                     null,
202                     d = null,
203                     b = null;
204                 this.fakeImage ? (e = this.objectNode, d = this.embedNode) : (l && (e = CKEDITOR.dom.element.createFromHtml("\x3ccke:object\x3e\x3c/cke:object\x3e", a.document), e.setAttributes({
205                     classid: "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",
206                     codebase: "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version\x3d6,0,40,0"
207                 })), k && (d = CKEDITOR.dom.element.createFromHtml("\x3ccke:embed\x3e\x3c/cke:embed\x3e", a.document), d.setAttributes({
208                         type: "application/x-shockwave-flash",
209                         pluginspage: "http://www.macromedia.com/go/getflashplayer"
210                     }),
211                     e && d.appendTo(e)));
212                 if (e)
213                     for (var b = {}, c = e.getElementsByTag("param", "cke"), f = 0, h = c.count(); f < h; f++) b[c.getItem(f).getAttribute("name")] = c.getItem(f);
214                 c = {};
215                 f = {};
216                 this.commitContent(e, d, b, c, f);
217                 e = a.createFakeElement(e || d, "cke_flash", "flash", !0);
218                 e.setAttributes(f);
219                 e.setStyles(c);
220                 this.fakeImage ? (e.replace(this.fakeImage), a.getSelection().selectElement(e)) : a.insertElement(e)
221             },
222             onHide: function() {
223                 this.preview && this.preview.setHtml("")
224             },
225             contents: [{
226                 id: "info",
227                 label: a.lang.common.generalTab,
228                 accessKey: "I",
229                 elements: [{
230                     type: "vbox",
231                     padding: 0,
232                     children: [{
233                         type: "hbox",
234                         widths: ["280px", "110px"],
235                         align: "right",
236                         className: "cke_dialog_flash_url",
237                         children: [{
238                             id: "src",
239                             type: "text",
240                             label: a.lang.common.url,
241                             required: !0,
242                             validate: CKEDITOR.dialog.validate.notEmpty(a.lang.flash.validateSrc),
243                             setup: b,
244                             commit: c,
245                             onLoad: function() {
246                                 var a = this.getDialog(),
247                                     b = function(b) {
248                                         h.setAttribute("src", b);
249                                         a.preview.setHtml('\x3cembed height\x3d"100%" width\x3d"100%" src\x3d"' + CKEDITOR.tools.htmlEncode(h.getAttribute("src")) + '" type\x3d"application/x-shockwave-flash"\x3e\x3c/embed\x3e')
250                                     };
251                                 a.preview = a.getContentElement("info", "preview").getElement().getChild(3);
252                                 this.on("change", function(a) {
253                                     a.data && a.data.value && b(a.data.value)
254                                 });
255                                 this.getInputElement().on("change", function() {
256                                     b(this.getValue())
257                                 }, this)
258                             }
259                         }, {
260                             type: "button",
261                             id: "browse",
262                             filebrowser: "info:src",
263                             hidden: !0,
264                             style: "display:inline-block;margin-top:14px;",
265                             label: a.lang.common.browseServer
266                         }]
267                     }]
268                 }, {
269                     type: "hbox",
270                     widths: ["25%", "25%", "25%", "25%", "25%"],
271                     children: [{
272                         type: "text",
273                         id: "width",
274                         requiredContent: "embed[width]",
275                         style: "width:95px",
276                         label: a.lang.common.width,
277                         validate: CKEDITOR.dialog.validate.htmlLength(a.lang.common.invalidHtmlLength.replace("%1", a.lang.common.width)),
278                         setup: b,
279                         commit: c
280                     }, {
281                         type: "text",
282                         id: "height",
283                         requiredContent: "embed[height]",
284                         style: "width:95px",
285                         label: a.lang.common.height,
286                         validate: CKEDITOR.dialog.validate.htmlLength(a.lang.common.invalidHtmlLength.replace("%1", a.lang.common.height)),
287                         setup: b,
288                         commit: c
289                     }, {
290                         type: "text",
291                         id: "hSpace",
292                         requiredContent: "embed[hspace]",
293                         style: "width:95px",
294                         label: a.lang.flash.hSpace,
295                         validate: CKEDITOR.dialog.validate.integer(a.lang.flash.validateHSpace),
296                         setup: b,
297                         commit: c
298                     }, {
299                         type: "text",
300                         id: "vSpace",
301                         requiredContent: "embed[vspace]",
302                         style: "width:95px",
303                         label: a.lang.flash.vSpace,
304                         validate: CKEDITOR.dialog.validate.integer(a.lang.flash.validateVSpace),
305                         setup: b,
306                         commit: c
307                     }]
308                 }, {
309                     type: "vbox",
310                     children: [{
311                         type: "html",
312                         id: "preview",
313                         style: "width:95%;",
314                         html: f
315                     }]
316                 }]
317             }, {
318                 id: "Upload",
319                 hidden: !0,
320                 filebrowser: "uploadButton",
321                 label: a.lang.common.upload,
322                 elements: [{
323                     type: "file",
324                     id: "upload",
325                     label: a.lang.common.upload,
326                     size: 38
327                 }, {
328                     type: "fileButton",
329                     id: "uploadButton",
330                     label: a.lang.common.uploadSubmit,
331                     filebrowser: "info:src",
332                     "for": ["Upload", "upload"]
333                 }]
334             }, {
335                 id: "properties",
336                 label: a.lang.flash.propertiesTab,
337                 elements: [{
338                     type: "hbox",
339                     widths: ["50%", "50%"],
340                     children: [{
341                         id: "scale",
342                         type: "select",
343                         requiredContent: "embed[scale]",
344                         label: a.lang.flash.scale,
345                         "default": "",
346                         style: "width : 100%;",
347                         items: [
348                             [a.lang.common.notSet, ""],
349                             [a.lang.flash.scaleAll, "showall"],
350                             [a.lang.flash.scaleNoBorder, "noborder"],
351                             [a.lang.flash.scaleFit, "exactfit"]
352                         ],
353                         setup: b,
354                         commit: c
355                     }, {
356                         id: "allowScriptAccess",
357                         type: "select",
358                         requiredContent: "embed[allowscriptaccess]",
359                         label: a.lang.flash.access,
360                         "default": "",
361                         style: "width : 100%;",
362                         items: [
363                             [a.lang.common.notSet, ""],
364                             [a.lang.flash.accessAlways, "always"],
365                             [a.lang.flash.accessSameDomain, "samedomain"],
366                             [a.lang.flash.accessNever, "never"]
367                         ],
368                         setup: b,
369                         commit: c
370                     }]
371                 }, {
372                     type: "hbox",
373                     widths: ["50%", "50%"],
374                     children: [{
375                         id: "wmode",
376                         type: "select",
377                         requiredContent: "embed[wmode]",
378                         label: a.lang.flash.windowMode,
379                         "default": "",
380                         style: "width : 100%;",
381                         items: [
382                             [a.lang.common.notSet, ""],
383                             [a.lang.flash.windowModeWindow, "window"],
384                             [a.lang.flash.windowModeOpaque,
385                                 "opaque"
386                             ],
387                             [a.lang.flash.windowModeTransparent, "transparent"]
388                         ],
389                         setup: b,
390                         commit: c
391                     }, {
392                         id: "quality",
393                         type: "select",
394                         requiredContent: "embed[quality]",
395                         label: a.lang.flash.quality,
396                         "default": "high",
397                         style: "width : 100%;",
398                         items: [
399                             [a.lang.common.notSet, ""],
400                             [a.lang.flash.qualityBest, "best"],
401                             [a.lang.flash.qualityHigh, "high"],
402                             [a.lang.flash.qualityAutoHigh, "autohigh"],
403                             [a.lang.flash.qualityMedium, "medium"],
404                             [a.lang.flash.qualityAutoLow, "autolow"],
405                             [a.lang.flash.qualityLow, "low"]
406                         ],
407                         setup: b,
408                         commit: c
409                     }]
410                 }, {
411                     type: "hbox",
412                     widths: ["50%",
413                         "50%"
414                     ],
415                     children: [{
416                         id: "align",
417                         type: "select",
418                         requiredContent: "object[align]",
419                         label: a.lang.common.align,
420                         "default": "",
421                         style: "width : 100%;",
422                         items: [
423                             [a.lang.common.notSet, ""],
424                             [a.lang.common.alignLeft, "left"],
425                             [a.lang.flash.alignAbsBottom, "absBottom"],
426                             [a.lang.flash.alignAbsMiddle, "absMiddle"],
427                             [a.lang.flash.alignBaseline, "baseline"],
428                             [a.lang.common.alignBottom, "bottom"],
429                             [a.lang.common.alignMiddle, "middle"],
430                             [a.lang.common.alignRight, "right"],
431                             [a.lang.flash.alignTextTop, "textTop"],
432                             [a.lang.common.alignTop, "top"]
433                         ],
434                         setup: b,
435                         commit: function(a, b, f, k, l) {
436                             var h = this.getValue();
437                             c.apply(this, arguments);
438                             h && (l.align = h)
439                         }
440                     }, {
441                         type: "html",
442                         html: "\x3cdiv\x3e\x3c/div\x3e"
443                     }]
444                 }, {
445                     type: "fieldset",
446                     label: CKEDITOR.tools.htmlEncode(a.lang.flash.flashvars),
447                     children: [{
448                         type: "vbox",
449                         padding: 0,
450                         children: [{
451                             type: "checkbox",
452                             id: "menu",
453                             label: a.lang.flash.chkMenu,
454                             "default": !0,
455                             setup: b,
456                             commit: c
457                         }, {
458                             type: "checkbox",
459                             id: "play",
460                             label: a.lang.flash.chkPlay,
461                             "default": !0,
462                             setup: b,
463                             commit: c
464                         }, {
465                             type: "checkbox",
466                             id: "loop",
467                             label: a.lang.flash.chkLoop,
468                             "default": !0,
469                             setup: b,
470                             commit: c
471                         }, {
472                             type: "checkbox",
473                             id: "allowFullScreen",
474                             label: a.lang.flash.chkFull,
475                             "default": !0,
476                             setup: b,
477                             commit: c
478                         }]
479                     }]
480                 }]
481             }, {
482                 id: "advanced",
483                 label: a.lang.common.advancedTab,
484                 elements: [{
485                     type: "hbox",
486                     children: [{
487                         type: "text",
488                         id: "id",
489                         requiredContent: "object[id]",
490                         label: a.lang.common.id,
491                         setup: b,
492                         commit: c
493                     }]
494                 }, {
495                     type: "hbox",
496                     widths: ["45%", "55%"],
497                     children: [{
498                         type: "text",
499                         id: "bgcolor",
500                         requiredContent: "embed[bgcolor]",
501                         label: a.lang.flash.bgcolor,
502                         setup: b,
503                         commit: c
504                     }, {
505                         type: "text",
506                         id: "class",
507                         requiredContent: "embed(cke-xyz)",
508                         label: a.lang.common.cssClass,
509                         setup: b,
510                         commit: c
511                     }]
512                 }, {
513                     type: "text",
514                     id: "style",
515                     requiredContent: "embed{cke-xyz}",
516                     validate: CKEDITOR.dialog.validate.inlineStyle(a.lang.common.invalidInlineStyle),
517                     label: a.lang.common.cssStyle,
518                     setup: b,
519                     commit: c
520                 }]
521             }]
522         }
523     })
524 })();