Built motion from commit 67e5df37.|2.0.62
[motion2.git] / public / assets / plugins / ckeditor / plugins / specialchar / dialogs / specialchar.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 CKEDITOR.dialog.add("specialchar", function(k) {
6     var e, n = k.lang.specialchar,
7         m = function(c) {
8             var b;
9             c = c.data ? c.data.getTarget() : new CKEDITOR.dom.element(c);
10             "a" == c.getName() && (b = c.getChild(0).getHtml()) && (c.removeClass("cke_light_background"), e.hide(), c = k.document.createElement("span"), c.setHtml(b), k.insertText(c.getText()))
11         },
12         p = CKEDITOR.tools.addFunction(m),
13         l, g = function(c, b) {
14             var a;
15             b = b || c.data.getTarget();
16             "span" == b.getName() && (b = b.getParent());
17             if ("a" == b.getName() && (a = b.getChild(0).getHtml())) {
18                 l && d(null, l);
19                 var f = e.getContentElement("info", "htmlPreview").getElement();
20                 e.getContentElement("info", "charPreview").getElement().setHtml(a);
21                 f.setHtml(CKEDITOR.tools.htmlEncode(a));
22                 b.getParent().addClass("cke_light_background");
23                 l = b
24             }
25         },
26         d = function(c, b) {
27             b = b || c.data.getTarget();
28             "span" == b.getName() && (b = b.getParent());
29             "a" == b.getName() && (e.getContentElement("info", "charPreview").getElement().setHtml("\x26nbsp;"), e.getContentElement("info", "htmlPreview").getElement().setHtml("\x26nbsp;"), b.getParent().removeClass("cke_light_background"),
30                 l = void 0)
31         },
32         q = CKEDITOR.tools.addFunction(function(c) {
33             c = new CKEDITOR.dom.event(c);
34             var b = c.getTarget(),
35                 a;
36             a = c.getKeystroke();
37             var f = "rtl" == k.lang.dir;
38             switch (a) {
39                 case 38:
40                     if (a = b.getParent().getParent().getPrevious()) a = a.getChild([b.getParent().getIndex(), 0]), a.focus(), d(null, b), g(null, a);
41                     c.preventDefault();
42                     break;
43                 case 40:
44                     (a = b.getParent().getParent().getNext()) && (a = a.getChild([b.getParent().getIndex(), 0])) && 1 == a.type && (a.focus(), d(null, b), g(null, a));
45                     c.preventDefault();
46                     break;
47                 case 32:
48                     m({
49                         data: c
50                     });
51                     c.preventDefault();
52                     break;
53                 case f ? 37:
54                     39: if (a = b.getParent().getNext()) a = a.getChild(0), 1 == a.type ? (a.focus(), d(null, b), g(null, a), c.preventDefault(!0)) : d(null, b);
55                         else
56                     if (a = b.getParent().getParent().getNext())(a = a.getChild([0, 0])) && 1 == a.type ? (a.focus(), d(null, b), g(null, a), c.preventDefault(!0)) : d(null, b);
57                     break;
58                 case f ? 39:
59                     37: (a = b.getParent().getPrevious()) ? (a = a.getChild(0), a.focus(), d(null, b), g(null, a), c.preventDefault(!0)) : (a = b.getParent().getParent().getPrevious()) ? (a = a.getLast().getChild(0), a.focus(), d(null, b), g(null, a), c.preventDefault(!0)) :
60                         d(null, b)
61             }
62         });
63     return {
64         title: n.title,
65         minWidth: 430,
66         minHeight: 280,
67         buttons: [CKEDITOR.dialog.cancelButton],
68         charColumns: 17,
69         onLoad: function() {
70             for (var c = this.definition.charColumns, b = k.config.specialChars, a = CKEDITOR.tools.getNextId() + "_specialchar_table_label", f = ['\x3ctable role\x3d"listbox" aria-labelledby\x3d"' + a + '" style\x3d"width: 320px; height: 100%; border-collapse: separate;" align\x3d"center" cellspacing\x3d"2" cellpadding\x3d"2" border\x3d"0"\x3e'], d = 0, g = b.length, h, e; d < g;) {
71                 f.push('\x3ctr role\x3d"presentation"\x3e');
72                 for (var l = 0; l < c; l++, d++) {
73                     if (h = b[d]) {
74                         h instanceof Array ? (e = h[1], h = h[0]) : (e = h.replace("\x26", "").replace(";", "").replace("#", ""), e = n[e] || h);
75                         var m = "cke_specialchar_label_" + d + "_" + CKEDITOR.tools.getNextNumber();
76                         f.push('\x3ctd class\x3d"cke_dark_background" style\x3d"cursor: default" role\x3d"presentation"\x3e\x3ca href\x3d"javascript: void(0);" role\x3d"option" aria-posinset\x3d"' + (d + 1) + '"', ' aria-setsize\x3d"' + g + '"', ' aria-labelledby\x3d"' + m + '"', ' class\x3d"cke_specialchar" title\x3d"', CKEDITOR.tools.htmlEncode(e),
77                             '" onkeydown\x3d"CKEDITOR.tools.callFunction( ' + q + ', event, this )" onclick\x3d"CKEDITOR.tools.callFunction(' + p + ', this); return false;" tabindex\x3d"-1"\x3e\x3cspan style\x3d"margin: 0 auto;cursor: inherit"\x3e' + h + '\x3c/span\x3e\x3cspan class\x3d"cke_voice_label" id\x3d"' + m + '"\x3e' + e + "\x3c/span\x3e\x3c/a\x3e")
78                     } else f.push('\x3ctd class\x3d"cke_dark_background"\x3e\x26nbsp;');
79                     f.push("\x3c/td\x3e")
80                 }
81                 f.push("\x3c/tr\x3e")
82             }
83             f.push("\x3c/tbody\x3e\x3c/table\x3e", '\x3cspan id\x3d"' + a + '" class\x3d"cke_voice_label"\x3e' +
84                 n.options + "\x3c/span\x3e");
85             this.getContentElement("info", "charContainer").getElement().setHtml(f.join(""))
86         },
87         contents: [{
88             id: "info",
89             label: k.lang.common.generalTab,
90             title: k.lang.common.generalTab,
91             padding: 0,
92             align: "top",
93             elements: [{
94                 type: "hbox",
95                 align: "top",
96                 widths: ["320px", "90px"],
97                 children: [{
98                     type: "html",
99                     id: "charContainer",
100                     html: "",
101                     onMouseover: g,
102                     onMouseout: d,
103                     focus: function() {
104                         var c = this.getElement().getElementsByTag("a").getItem(0);
105                         setTimeout(function() {
106                             c.focus();
107                             g(null, c)
108                         }, 0)
109                     },
110                     onShow: function() {
111                         var c = this.getElement().getChild([0,
112                             0, 0, 0, 0
113                         ]);
114                         setTimeout(function() {
115                             c.focus();
116                             g(null, c)
117                         }, 0)
118                     },
119                     onLoad: function(c) {
120                         e = c.sender
121                     }
122                 }, {
123                     type: "hbox",
124                     align: "top",
125                     widths: ["100%"],
126                     children: [{
127                         type: "vbox",
128                         align: "top",
129                         children: [{
130                             type: "html",
131                             html: "\x3cdiv\x3e\x3c/div\x3e"
132                         }, {
133                             type: "html",
134                             id: "charPreview",
135                             className: "cke_dark_background",
136                             style: "border:1px solid #eeeeee;font-size:28px;height:40px;width:70px;padding-top:9px;font-family:'Microsoft Sans Serif',Arial,Helvetica,Verdana;text-align:center;",
137                             html: "\x3cdiv\x3e\x26nbsp;\x3c/div\x3e"
138                         }, {
139                             type: "html",
140                             id: "htmlPreview",
141                             className: "cke_dark_background",
142                             style: "border:1px solid #eeeeee;font-size:14px;height:20px;width:70px;padding-top:2px;font-family:'Microsoft Sans Serif',Arial,Helvetica,Verdana;text-align:center;",
143                             html: "\x3cdiv\x3e\x26nbsp;\x3c/div\x3e"
144                         }]
145                     }]
146                 }]
147             }]
148         }]
149     }
150 });