update domain in click to refresh message
[namibia] / public / js / vendor / wysihtml-advanced.js
1 /**
2  * Full HTML5 compatibility rule set
3  * These rules define which tags and css classes are supported and which tags should be specially treated.
4  *
5  * Examples based on this rule set:
6  *
7  *    <a href="http://foobar.com">foo</a>
8  *    ... becomes ...
9  *    <a href="http://foobar.com" target="_blank" rel="nofollow">foo</a>
10  *
11  *    <img align="left" src="http://foobar.com/image.png">
12  *    ... becomes ...
13  *    <img class="wysiwyg-float-left" src="http://foobar.com/image.png" alt="">
14  *
15  *    <div>foo<script>alert(document.cookie)</script></div>
16  *    ... becomes ...
17  *    <div>foo</div>
18  *
19  *    <marquee>foo</marquee>
20  *    ... becomes ...
21  *    <span>foo</span>
22  *
23  *    foo <br clear="both"> bar
24  *    ... becomes ...
25  *    foo <br class="wysiwyg-clear-both"> bar
26  *
27  *    <div>hello <iframe src="http://google.com"></iframe></div>
28  *    ... becomes ...
29  *    <div>hello </div>
30  *
31  *    <center>hello</center>
32  *    ... becomes ...
33  *    <div class="wysiwyg-text-align-center">hello</div>
34  */
35 var wysihtml5ParserRules = {
36     /**
37      * CSS Class white-list
38      * Following css classes won't be removed when parsed by the wysihtml5 html parser
39      */
40     "classes": {
41         "wysiwyg-clear-both": 1,
42         "wysiwyg-clear-left": 1,
43         "wysiwyg-clear-right": 1,
44         "wysiwyg-color-aqua": 1,
45         "wysiwyg-color-black": 1,
46         "wysiwyg-color-blue": 1,
47         "wysiwyg-color-fuchsia": 1,
48         "wysiwyg-color-gray": 1,
49         "wysiwyg-color-green": 1,
50         "wysiwyg-color-lime": 1,
51         "wysiwyg-color-maroon": 1,
52         "wysiwyg-color-navy": 1,
53         "wysiwyg-color-olive": 1,
54         "wysiwyg-color-purple": 1,
55         "wysiwyg-color-red": 1,
56         "wysiwyg-color-silver": 1,
57         "wysiwyg-color-teal": 1,
58         "wysiwyg-color-white": 1,
59         "wysiwyg-color-yellow": 1,
60         "wysiwyg-float-left": 1,
61         "wysiwyg-float-right": 1,
62         "wysiwyg-font-size-large": 1,
63         "wysiwyg-font-size-larger": 1,
64         "wysiwyg-font-size-medium": 1,
65         "wysiwyg-font-size-small": 1,
66         "wysiwyg-font-size-smaller": 1,
67         "wysiwyg-font-size-x-large": 1,
68         "wysiwyg-font-size-x-small": 1,
69         "wysiwyg-font-size-xx-large": 1,
70         "wysiwyg-font-size-xx-small": 1,
71         "wysiwyg-text-align-center": 1,
72         "wysiwyg-text-align-justify": 1,
73         "wysiwyg-text-align-left": 1,
74         "wysiwyg-text-align-right": 1
75     },
76     /**
77      * Tag list
78      *
79      * Following options are available:
80      *
81      *    - add_class:        converts and deletes the given HTML4 attribute (align, clear, ...) via the given method to a css class
82      *                        The following methods are implemented in wysihtml5.dom.parse:
83      *                          - align_text:  converts align attribute values (right/left/center/justify) to their corresponding css class "wysiwyg-text-align-*")
84                                   <p align="center">foo</p> ... becomes ... <p> class="wysiwyg-text-align-center">foo</p>
85      *                          - clear_br:    converts clear attribute values left/right/all/both to their corresponding css class "wysiwyg-clear-*"
86      *                            <br clear="all"> ... becomes ... <br class="wysiwyg-clear-both">
87      *                          - align_img:    converts align attribute values (right/left) on <img> to their corresponding css class "wysiwyg-float-*"
88      *                          
89      *    - remove:             removes the element and it's content
90      *
91      *    - rename_tag:         renames the element to the given tag
92      *
93      *    - set_class:          adds the given class to the element (note: make sure that the class is in the "classes" white list above)
94      *
95      *    - set_attributes:     sets/overrides the given attributes
96      *
97      *    - check_attributes:   checks the given HTML attribute via the given method
98      *                            - url:      checks whether the given string is an url, deletes the attribute if not
99      *                            - alt:      strips unwanted characters. if the attribute is not set, then it gets set (to ensure valid and compatible HTML)
100      *                            - numbers:  ensures that the attribute only contains numeric characters
101      */
102     "tags": {
103         "tr": {
104             "add_class": {
105                 "align": "align_text"
106             }
107         },
108         "strike": {
109             "remove": 1
110         },
111         "form": {
112             "rename_tag": "div"
113         },
114         "rt": {
115             "rename_tag": "span"
116         },
117         "code": {},
118         "acronym": {
119             "rename_tag": "span"
120         },
121         "br": {
122             "add_class": {
123                 "clear": "clear_br"
124             }
125         },
126         "details": {
127             "rename_tag": "div"
128         },
129         "h4": {
130             "add_class": {
131                 "align": "align_text"
132             }
133         },
134         "em": {},
135         "title": {
136             "remove": 1
137         },
138         "multicol": {
139             "rename_tag": "div"
140         },
141         "figure": {
142             "rename_tag": "div"
143         },
144         "xmp": {
145             "rename_tag": "span"
146         },
147         "small": {
148             "rename_tag": "span",
149             "set_class": "wysiwyg-font-size-smaller"
150         },
151         "area": {
152             "remove": 1
153         },
154         "time": {
155             "rename_tag": "span"
156         },
157         "dir": {
158             "rename_tag": "ul"
159         },
160         "bdi": {
161             "rename_tag": "span"
162         },
163         "command": {
164             "remove": 1
165         },
166         "ul": {},
167         "progress": {
168             "rename_tag": "span"
169         },
170         "dfn": {
171             "rename_tag": "span"
172         },
173         "iframe": {
174             "remove": 1
175         },
176         "figcaption": {
177             "rename_tag": "div"
178         },
179         "a": {
180             "check_attributes": {
181                 "href": "url"
182             },
183             "set_attributes": {
184                 "rel": "nofollow",
185                 "target": "_blank"
186             }
187         },
188         "img": {
189             "check_attributes": {
190                 "width": "numbers",
191                 "alt": "alt",
192                 "src": "url",
193                 "height": "numbers"
194             },
195             "add_class": {
196                 "align": "align_img"
197             }
198         },
199         "rb": {
200             "rename_tag": "span"
201         },
202         "footer": {
203             "rename_tag": "div"
204         },
205         "noframes": {
206             "remove": 1
207         },
208         "abbr": {
209             "rename_tag": "span"
210         },
211         "u": {},
212         "bgsound": {
213             "remove": 1
214         },
215         "sup": {
216             "rename_tag": "span"
217         },
218         "address": {
219             "rename_tag": "div"
220         },
221         "basefont": {
222             "remove": 1
223         },
224         "nav": {
225             "rename_tag": "div"
226         },
227         "h1": {
228             "add_class": {
229                 "align": "align_text"
230             }
231         },
232         "head": {
233             "remove": 1
234         },
235         "tbody": {
236             "add_class": {
237                 "align": "align_text"
238             }
239         },
240         "dd": {
241             "rename_tag": "div"
242         },
243         "s": {
244             "rename_tag": "span"
245         },
246         "li": {},
247         "td": {
248             "check_attributes": {
249                 "rowspan": "numbers",
250                 "colspan": "numbers"
251             },
252             "add_class": {
253                 "align": "align_text"
254             }
255         },
256         "object": {
257             "remove": 1
258         },
259         "div": {
260             "add_class": {
261                 "align": "align_text"
262             }
263         },
264         "option": {
265             "rename_tag": "span"
266         },
267         "select": {
268             "rename_tag": "span"
269         },
270         "i": {},
271         "track": {
272             "remove": 1
273         },
274         "wbr": {
275             "remove": 1
276         },
277         "fieldset": {
278             "rename_tag": "div"
279         },
280         "big": {
281             "rename_tag": "span",
282             "set_class": "wysiwyg-font-size-larger"
283         },
284         "button": {
285             "rename_tag": "span"
286         },
287         "noscript": {
288             "remove": 1
289         },
290         "svg": {
291             "remove": 1
292         },
293         "input": {
294             "remove": 1
295         },
296         "table": {},
297         "keygen": {
298             "remove": 1
299         },
300         "h5": {
301             "add_class": {
302                 "align": "align_text"
303             }
304         },
305         "meta": {
306             "remove": 1
307         },
308         "map": {
309             "rename_tag": "div"
310         },
311         "isindex": {
312             "remove": 1
313         },
314         "mark": {
315             "rename_tag": "span"
316         },
317         "caption": {
318             "add_class": {
319                 "align": "align_text"
320             }
321         },
322         "tfoot": {
323             "add_class": {
324                 "align": "align_text"
325             }
326         },
327         "base": {
328             "remove": 1
329         },
330         "video": {
331             "remove": 1
332         },
333         "strong": {},
334         "canvas": {
335             "remove": 1
336         },
337         "output": {
338             "rename_tag": "span"
339         },
340         "marquee": {
341             "rename_tag": "span"
342         },
343         "b": {},
344         "q": {
345             "check_attributes": {
346                 "cite": "url"
347             }
348         },
349         "applet": {
350             "remove": 1
351         },
352         "span": {},
353         "rp": {
354             "rename_tag": "span"
355         },
356         "spacer": {
357             "remove": 1
358         },
359         "source": {
360             "remove": 1
361         },
362         "aside": {
363             "rename_tag": "div"
364         },
365         "frame": {
366             "remove": 1
367         },
368         "section": {
369             "rename_tag": "div"
370         },
371         "body": {
372             "rename_tag": "div"
373         },
374         "ol": {},
375         "nobr": {
376             "rename_tag": "span"
377         },
378         "html": {
379             "rename_tag": "div"
380         },
381         "summary": {
382             "rename_tag": "span"
383         },
384         "var": {
385             "rename_tag": "span"
386         },
387         "del": {
388             "remove": 1
389         },
390         "blockquote": {
391             "check_attributes": {
392                 "cite": "url"
393             }
394         },
395         "style": {
396             "remove": 1
397         },
398         "device": {
399             "remove": 1
400         },
401         "meter": {
402             "rename_tag": "span"
403         },
404         "h3": {
405             "add_class": {
406                 "align": "align_text"
407             }
408         },
409         "textarea": {
410             "rename_tag": "span"
411         },
412         "embed": {
413             "remove": 1
414         },
415         "hgroup": {
416             "rename_tag": "div"
417         },
418         "font": {
419             "rename_tag": "span",
420             "add_class": {
421                 "size": "size_font"
422             }
423         },
424         "tt": {
425             "rename_tag": "span"
426         },
427         "noembed": {
428             "remove": 1
429         },
430         "thead": {
431             "add_class": {
432                 "align": "align_text"
433             }
434         },
435         "blink": {
436             "rename_tag": "span"
437         },
438         "plaintext": {
439             "rename_tag": "span"
440         },
441         "xml": {
442             "remove": 1
443         },
444         "h6": {
445             "add_class": {
446                 "align": "align_text"
447             }
448         },
449         "param": {
450             "remove": 1
451         },
452         "th": {
453             "check_attributes": {
454                 "rowspan": "numbers",
455                 "colspan": "numbers"
456             },
457             "add_class": {
458                 "align": "align_text"
459             }
460         },
461         "legend": {
462             "rename_tag": "span"
463         },
464         "hr": {},
465         "label": {
466             "rename_tag": "span"
467         },
468         "dl": {
469             "rename_tag": "div"
470         },
471         "kbd": {
472             "rename_tag": "span"
473         },
474         "listing": {
475             "rename_tag": "div"
476         },
477         "dt": {
478             "rename_tag": "span"
479         },
480         "nextid": {
481             "remove": 1
482         },
483         "pre": {},
484         "center": {
485             "rename_tag": "div",
486             "set_class": "wysiwyg-text-align-center"
487         },
488         "audio": {
489             "remove": 1
490         },
491         "datalist": {
492             "rename_tag": "span"
493         },
494         "samp": {
495             "rename_tag": "span"
496         },
497         "col": {
498             "remove": 1
499         },
500         "article": {
501             "rename_tag": "div"
502         },
503         "cite": {},
504         "link": {
505             "remove": 1
506         },
507         "script": {
508             "remove": 1
509         },
510         "bdo": {
511             "rename_tag": "span"
512         },
513         "menu": {
514             "rename_tag": "ul"
515         },
516         "colgroup": {
517             "remove": 1
518         },
519         "ruby": {
520             "rename_tag": "span"
521         },
522         "h2": {
523             "add_class": {
524                 "align": "align_text"
525             }
526         },
527         "ins": {
528             "rename_tag": "span"
529         },
530         "p": {
531             "add_class": {
532                 "align": "align_text"
533             }
534         },
535         "sub": {
536             "rename_tag": "span"
537         },
538         "comment": {
539             "remove": 1
540         },
541         "frameset": {
542             "remove": 1
543         },
544         "optgroup": {
545             "rename_tag": "span"
546         },
547         "header": {
548             "rename_tag": "div"
549         }
550     }
551 };