Merge branch '2.0'
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / js / 3rdParty / codemirror / addon / hint / html-hint.js
1 (function(mod) {
2 if (typeof exports == "object" && typeof module == "object") // CommonJS
3 mod(require("../../lib/codemirror"));
4 else if (typeof define == "function" && define.amd) // AMD
5 define(["../../lib/codemirror"], mod);
6 else // Plain browser env
7 mod(CodeMirror);
8 })(function(CodeMirror) {
9 "use strict";
10
11 var langs = "ab aa af ak sq am ar an hy as av ae ay az bm ba eu be bn bh bi bs br bg my ca ch ce ny zh cv kw co cr hr cs da dv nl dz en eo et ee fo fj fi fr ff gl ka de el gn gu ht ha he hz hi ho hu ia id ie ga ig ik io is it iu ja jv kl kn kr ks kk km ki rw ky kv kg ko ku kj la lb lg li ln lo lt lu lv gv mk mg ms ml mt mi mr mh mn na nv nb nd ne ng nn no ii nr oc oj cu om or os pa pi fa pl ps pt qu rm rn ro ru sa sc sd se sm sg sr gd sn si sk sl so st es su sw ss sv ta te tg th ti bo tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa cy wo fy xh yi yo za zu".split(" ");
12 var targets = ["_blank", "_self", "_top", "_parent"];
13 var charsets = ["ascii", "utf-8", "utf-16", "latin1", "latin1"];
14 var methods = ["get", "post", "put", "delete"];
15 var encs = ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"];
16 var media = ["all", "screen", "print", "embossed", "braille", "handheld", "print", "projection", "screen", "tty", "tv", "speech",
17 "3d-glasses", "resolution [>][<][=] [X]", "device-aspect-ratio: X/Y", "orientation:portrait",
18 "orientation:landscape", "device-height: [X]", "device-width: [X]"];
19 var s = { attrs: {} }; // Simple tag, reused for a whole lot of tags
20
21 var data = {
22 a: {
23 attrs: {
24 href: null, ping: null, type: null,
25 media: media,
26 target: targets,
27 hreflang: langs
28 }
29 },
30 abbr: s,
31 acronym: s,
32 address: s,
33 applet: s,
34 area: {
35 attrs: {
36 alt: null, coords: null, href: null, target: null, ping: null,
37 media: media, hreflang: langs, type: null,
38 shape: ["default", "rect", "circle", "poly"]
39 }
40 },
41 article: s,
42 aside: s,
43 audio: {
44 attrs: {
45 src: null, mediagroup: null,
46 crossorigin: ["anonymous", "use-credentials"],
47 preload: ["none", "metadata", "auto"],
48 autoplay: ["", "autoplay"],
49 loop: ["", "loop"],
50 controls: ["", "controls"]
51 }
52 },
53 b: s,
54 base: { attrs: { href: null, target: targets } },
55 basefont: s,
56 bdi: s,
57 bdo: s,
58 big: s,
59 blockquote: { attrs: { cite: null } },
60 body: s,
61 br: s,
62 button: {
63 attrs: {
64 form: null, formaction: null, name: null, value: null,
65 autofocus: ["", "autofocus"],
66 disabled: ["", "autofocus"],
67 formenctype: encs,
68 formmethod: methods,
69 formnovalidate: ["", "novalidate"],
70 formtarget: targets,
71 type: ["submit", "reset", "button"]
72 }
73 },
74 canvas: { attrs: { width: null, height: null } },
75 caption: s,
76 center: s,
77 cite: s,
78 code: s,
79 col: { attrs: { span: null } },
80 colgroup: { attrs: { span: null } },
81 command: {
82 attrs: {
83 type: ["command", "checkbox", "radio"],
84 label: null, icon: null, radiogroup: null, command: null, title: null,
85 disabled: ["", "disabled"],
86 checked: ["", "checked"]
87 }
88 },
89 data: { attrs: { value: null } },
90 datagrid: { attrs: { disabled: ["", "disabled"], multiple: ["", "multiple"] } },
91 datalist: { attrs: { data: null } },
92 dd: s,
93 del: { attrs: { cite: null, datetime: null } },
94 details: { attrs: { open: ["", "open"] } },
95 dfn: s,
96 dir: s,
97 div: s,
98 dl: s,
99 dt: s,
100 em: s,
101 embed: { attrs: { src: null, type: null, width: null, height: null } },
102 eventsource: { attrs: { src: null } },
103 fieldset: { attrs: { disabled: ["", "disabled"], form: null, name: null } },
104 figcaption: s,
105 figure: s,
106 font: s,
107 footer: s,
108 form: {
109 attrs: {
110 action: null, name: null,
111 "accept-charset": charsets,
112 autocomplete: ["on", "off"],
113 enctype: encs,
114 method: methods,
115 novalidate: ["", "novalidate"],
116 target: targets
117 }
118 },
119 frame: s,
120 frameset: s,
121 h1: s, h2: s, h3: s, h4: s, h5: s, h6: s,
122 head: {
123 attrs: {},
124 children: ["title", "base", "link", "style", "meta", "script", "noscript", "command"]
125 },
126 header: s,
127 hgroup: s,
128 hr: s,
129 html: {
130 attrs: { manifest: null },
131 children: ["head", "body"]
132 },
133 i: s,
134 iframe: {
135 attrs: {
136 src: null, srcdoc: null, name: null, width: null, height: null,
137 sandbox: ["allow-top-navigation", "allow-same-origin", "allow-forms", "allow-scripts"],
138 seamless: ["", "seamless"]
139 }
140 },
141 img: {
142 attrs: {
143 alt: null, src: null, ismap: null, usemap: null, width: null, height: null,
144 crossorigin: ["anonymous", "use-credentials"]
145 }
146 },
147 input: {
148 attrs: {
149 alt: null, dirname: null, form: null, formaction: null,
150 height: null, list: null, max: null, maxlength: null, min: null,
151 name: null, pattern: null, placeholder: null, size: null, src: null,
152 step: null, value: null, width: null,
153 accept: ["audio/*", "video/*", "image/*"],
154 autocomplete: ["on", "off"],
155 autofocus: ["", "autofocus"],
156 checked: ["", "checked"],
157 disabled: ["", "disabled"],
158 formenctype: encs,
159 formmethod: methods,
160 formnovalidate: ["", "novalidate"],
161 formtarget: targets,
162 multiple: ["", "multiple"],
163 readonly: ["", "readonly"],
164 required: ["", "required"],
165 type: ["hidden", "text", "search", "tel", "url", "email", "password", "datetime", "date", "month",
166 "week", "time", "datetime-local", "number", "range", "color", "checkbox", "radio",
167 "file", "submit", "image", "reset", "button"]
168 }
169 },
170 ins: { attrs: { cite: null, datetime: null } },
171 kbd: s,
172 keygen: {
173 attrs: {
174 challenge: null, form: null, name: null,
175 autofocus: ["", "autofocus"],
176 disabled: ["", "disabled"],
177 keytype: ["RSA"]
178 }
179 },
180 label: { attrs: { "for": null, form: null } },
181 legend: s,
182 li: { attrs: { value: null } },
183 link: {
184 attrs: {
185 href: null, type: null,
186 hreflang: langs,
187 media: media,
188 sizes: ["all", "16x16", "16x16 32x32", "16x16 32x32 64x64"]
189 }
190 },
191 map: { attrs: { name: null } },
192 mark: s,
193 menu: { attrs: { label: null, type: ["list", "context", "toolbar"] } },
194 meta: {
195 attrs: {
196 content: null,
197 charset: charsets,
198 name: ["viewport", "application-name", "author", "description", "generator", "keywords"],
199 "http-equiv": ["content-language", "content-type", "default-style", "refresh"]
200 }
201 },
202 meter: { attrs: { value: null, min: null, low: null, high: null, max: null, optimum: null } },
203 nav: s,
204 noframes: s,
205 noscript: s,
206 object: {
207 attrs: {
208 data: null, type: null, name: null, usemap: null, form: null, width: null, height: null,
209 typemustmatch: ["", "typemustmatch"]
210 }
211 },
212 ol: { attrs: { reversed: ["", "reversed"], start: null, type: ["1", "a", "A", "i", "I"] } },
213 optgroup: { attrs: { disabled: ["", "disabled"], label: null } },
214 option: { attrs: { disabled: ["", "disabled"], label: null, selected: ["", "selected"], value: null } },
215 output: { attrs: { "for": null, form: null, name: null } },
216 p: s,
217 param: { attrs: { name: null, value: null } },
218 pre: s,
219 progress: { attrs: { value: null, max: null } },
220 q: { attrs: { cite: null } },
221 rp: s,
222 rt: s,
223 ruby: s,
224 s: s,
225 samp: s,
226 script: {
227 attrs: {
228 type: ["text/javascript"],
229 src: null,
230 async: ["", "async"],
231 defer: ["", "defer"],
232 charset: charsets
233 }
234 },
235 section: s,
236 select: {
237 attrs: {
238 form: null, name: null, size: null,
239 autofocus: ["", "autofocus"],
240 disabled: ["", "disabled"],
241 multiple: ["", "multiple"]
242 }
243 },
244 small: s,
245 source: { attrs: { src: null, type: null, media: null } },
246 span: s,
247 strike: s,
248 strong: s,
249 style: {
250 attrs: {
251 type: ["text/css"],
252 media: media,
253 scoped: null
254 }
255 },
256 sub: s,
257 summary: s,
258 sup: s,
259 table: s,
260 tbody: s,
261 td: { attrs: { colspan: null, rowspan: null, headers: null } },
262 textarea: {
263 attrs: {
264 dirname: null, form: null, maxlength: null, name: null, placeholder: null,
265 rows: null, cols: null,
266 autofocus: ["", "autofocus"],
267 disabled: ["", "disabled"],
268 readonly: ["", "readonly"],
269 required: ["", "required"],
270 wrap: ["soft", "hard"]
271 }
272 },
273 tfoot: s,
274 th: { attrs: { colspan: null, rowspan: null, headers: null, scope: ["row", "col", "rowgroup", "colgroup"] } },
275 thead: s,
276 time: { attrs: { datetime: null } },
277 title: s,
278 tr: s,
279 track: {
280 attrs: {
281 src: null, label: null, "default": null,
282 kind: ["subtitles", "captions", "descriptions", "chapters", "metadata"],
283 srclang: langs
284 }
285 },
286 tt: s,
287 u: s,
288 ul: s,
289 "var": s,
290 video: {
291 attrs: {
292 src: null, poster: null, width: null, height: null,
293 crossorigin: ["anonymous", "use-credentials"],
294 preload: ["auto", "metadata", "none"],
295 autoplay: ["", "autoplay"],
296 mediagroup: ["movie"],
297 muted: ["", "muted"],
298 controls: ["", "controls"]
299 }
300 },
301 wbr: s
302 };
303
304 var globalAttrs = {
305 accesskey: ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
306 "class": null,
307 contenteditable: ["true", "false"],
308 contextmenu: null,
309 dir: ["ltr", "rtl", "auto"],
310 draggable: ["true", "false", "auto"],
311 dropzone: ["copy", "move", "link", "string:", "file:"],
312 hidden: ["hidden"],
313 id: null,
314 inert: ["inert"],
315 itemid: null,
316 itemprop: null,
317 itemref: null,
318 itemscope: ["itemscope"],
319 itemtype: null,
320 lang: ["en", "es"],
321 spellcheck: ["true", "false"],
322 style: null,
323 tabindex: ["1", "2", "3", "4", "5", "6", "7", "8", "9"],
324 title: null,
325 translate: ["yes", "no"],
326 onclick: null,
327 rel: ["stylesheet", "alternate", "author", "bookmark", "help", "license", "next", "nofollow", "noreferrer", "prefetch", "prev", "search", "tag"]
328 };
329 function populate(obj) {
330 for (var attr in globalAttrs) if (globalAttrs.hasOwnProperty(attr))
331 obj.attrs[attr] = globalAttrs[attr];
332 }
333
334 populate(s);
335 for (var tag in data) if (data.hasOwnProperty(tag) && data[tag] != s)
336 populate(data[tag]);
337
338 CodeMirror.htmlSchema = data;
339 function htmlHint(cm, options) {
340 var local = {schemaInfo: data};
341 if (options) for (var opt in options) local[opt] = options[opt];
342 return CodeMirror.hint.xml(cm, local);
343 }
344 CodeMirror.registerHelper("hint", "html", htmlHint);
345 });