liquid_feedback_frontend

view static/wysihtml/advanced.js @ 1800:b87997219042

Updated spanish translation
author bsw
date Thu Oct 21 15:22:29 2021 +0200 (2021-10-21)
parents 32cc544d5a5b
children
line source
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 wysihtmlParserRules = {
36 /**
37 * CSS Class white-list
38 * Following CSS classes won't be removed when parsed by the wysihtml 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 * The 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 wysihtml.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 * - add_style: converts and deletes the given HTML4 attribute (align) via the given method to a css style
90 * The following methods are implemented in wysihtml.dom.parse:
91 * - align_text: converts align attribute values (right/left/center) to their corresponding css style)
92 * <p align="center">foo</p> ... becomes ... <p style="text-align:center">foo</p>
93 *
94 * - remove: removes the element and its content
95 *
96 * - unwrap removes element but leaves content
97 *
98 * - rename_tag: renames the element to the given tag
99 *
100 * - set_class: adds the given class to the element (note: make sure that the class is in the "classes" white list above)
101 *
102 * - set_attributes: sets/overrides the given attributes
103 *
104 * - check_attributes: checks the given HTML attribute via the given method
105 * - url: allows only valid urls (starting with http:// or https://)
106 * - src: allows something like "/foobar.jpg", "http://google.com", ...
107 * - href: allows something like "mailto:bert@foo.com", "http://google.com", "/foobar.jpg"
108 * - alt: strips unwanted characters. if the attribute is not set, then it gets set (to ensure valid and compatible HTML)
109 * - numbers: ensures that the attribute only contains numeric (integer) characters (no float values or units)
110 * - dimension: for with/height attributes where floating point numbrs and percentages are allowed
111 * - any: allows anything to pass
112 */
113 "tags": {
114 "tr": {
115 "add_class": {
116 "align": "align_text"
117 }
118 },
119 "strike": {
120 "remove": 1
121 },
122 "form": {
123 "rename_tag": "div"
124 },
125 "rt": {
126 "rename_tag": "span"
127 },
128 "code": {},
129 "acronym": {
130 "rename_tag": "span"
131 },
132 "br": {
133 "add_class": {
134 "clear": "clear_br"
135 }
136 },
137 "details": {
138 "rename_tag": "div"
139 },
140 "h4": {
141 "add_class": {
142 "align": "align_text"
143 }
144 },
145 "em": {},
146 "title": {
147 "remove": 1
148 },
149 "multicol": {
150 "rename_tag": "div"
151 },
152 "figure": {
153 "rename_tag": "div"
154 },
155 "xmp": {
156 "rename_tag": "span"
157 },
158 "small": {
159 "rename_tag": "span",
160 "set_class": "wysiwyg-font-size-smaller"
161 },
162 "area": {
163 "remove": 1
164 },
165 "time": {
166 "rename_tag": "span"
167 },
168 "dir": {
169 "rename_tag": "ul"
170 },
171 "bdi": {
172 "rename_tag": "span"
173 },
174 "command": {
175 "remove": 1
176 },
177 "ul": {},
178 "progress": {
179 "rename_tag": "span"
180 },
181 "dfn": {
182 "rename_tag": "span"
183 },
184 "iframe": {
185 "remove": 1
186 },
187 "figcaption": {
188 "rename_tag": "div"
189 },
190 "a": {
191 "check_attributes": {
192 "target": "any",
193 "href": "url" // if you compiled master manually then change this from 'url' to 'href'
194 },
195 "set_attributes": {
196 "rel": "nofollow"
197 }
198 },
199 "img": {
200 "check_attributes": {
201 "width": "dimension",
202 "alt": "alt",
203 "src": "url", // if you compiled master manually then change this from 'url' to 'src'
204 "height": "dimension"
205 },
206 "add_class": {
207 "align": "align_img"
208 }
209 },
210 "rb": {
211 "rename_tag": "span"
212 },
213 "footer": {
214 "rename_tag": "div"
215 },
216 "noframes": {
217 "remove": 1
218 },
219 "abbr": {
220 "rename_tag": "span"
221 },
222 "u": {},
223 "bgsound": {
224 "remove": 1
225 },
226 "address": {
227 "rename_tag": "div"
228 },
229 "basefont": {
230 "remove": 1
231 },
232 "nav": {
233 "rename_tag": "div"
234 },
235 "h1": {
236 "add_class": {
237 "align": "align_text"
238 }
239 },
240 "head": {
241 "remove": 1
242 },
243 "tbody": {
244 "add_class": {
245 "align": "align_text"
246 }
247 },
248 "dd": {
249 "rename_tag": "div"
250 },
251 "s": {
252 "rename_tag": "span"
253 },
254 "li": {},
255 "td": {
256 "check_attributes": {
257 "rowspan": "numbers",
258 "colspan": "numbers"
259 },
260 "add_class": {
261 "align": "align_text"
262 }
263 },
264 "object": {
265 "remove": 1
266 },
267 "div": {
268 "add_class": {
269 "align": "align_text"
270 }
271 },
272 "option": {
273 "rename_tag": "span"
274 },
275 "select": {
276 "rename_tag": "span"
277 },
278 "i": {},
279 "track": {
280 "remove": 1
281 },
282 "wbr": {
283 "remove": 1
284 },
285 "fieldset": {
286 "rename_tag": "div"
287 },
288 "big": {
289 "rename_tag": "span",
290 "set_class": "wysiwyg-font-size-larger"
291 },
292 "button": {
293 "rename_tag": "span"
294 },
295 "noscript": {
296 "remove": 1
297 },
298 "svg": {
299 "remove": 1
300 },
301 "input": {
302 "remove": 1
303 },
304 "table": {},
305 "keygen": {
306 "remove": 1
307 },
308 "h5": {
309 "add_class": {
310 "align": "align_text"
311 }
312 },
313 "meta": {
314 "remove": 1
315 },
316 "map": {
317 "rename_tag": "div"
318 },
319 "isindex": {
320 "remove": 1
321 },
322 "mark": {
323 "rename_tag": "span"
324 },
325 "caption": {
326 "add_class": {
327 "align": "align_text"
328 }
329 },
330 "tfoot": {
331 "add_class": {
332 "align": "align_text"
333 }
334 },
335 "base": {
336 "remove": 1
337 },
338 "video": {
339 "remove": 1
340 },
341 "strong": {},
342 "canvas": {
343 "remove": 1
344 },
345 "output": {
346 "rename_tag": "span"
347 },
348 "marquee": {
349 "rename_tag": "span"
350 },
351 "b": {},
352 "q": {
353 "check_attributes": {
354 "cite": "url"
355 }
356 },
357 "applet": {
358 "remove": 1
359 },
360 "span": {},
361 "rp": {
362 "rename_tag": "span"
363 },
364 "spacer": {
365 "remove": 1
366 },
367 "source": {
368 "remove": 1
369 },
370 "aside": {
371 "rename_tag": "div"
372 },
373 "frame": {
374 "remove": 1
375 },
376 "section": {
377 "rename_tag": "div"
378 },
379 "body": {
380 "rename_tag": "div"
381 },
382 "ol": {},
383 "nobr": {
384 "rename_tag": "span"
385 },
386 "html": {
387 "rename_tag": "div"
388 },
389 "summary": {
390 "rename_tag": "span"
391 },
392 "var": {
393 "rename_tag": "span"
394 },
395 "del": {
396 "remove": 1
397 },
398 "blockquote": {
399 "check_attributes": {
400 "cite": "url"
401 }
402 },
403 "style": {
404 "remove": 1
405 },
406 "device": {
407 "remove": 1
408 },
409 "meter": {
410 "rename_tag": "span"
411 },
412 "h3": {
413 "add_class": {
414 "align": "align_text"
415 }
416 },
417 "textarea": {
418 "rename_tag": "span"
419 },
420 "embed": {
421 "remove": 1
422 },
423 "hgroup": {
424 "rename_tag": "div"
425 },
426 "font": {
427 "rename_tag": "span",
428 "add_class": {
429 "size": "size_font"
430 }
431 },
432 "tt": {
433 "rename_tag": "span"
434 },
435 "noembed": {
436 "remove": 1
437 },
438 "thead": {
439 "add_class": {
440 "align": "align_text"
441 }
442 },
443 "blink": {
444 "rename_tag": "span"
445 },
446 "plaintext": {
447 "rename_tag": "span"
448 },
449 "xml": {
450 "remove": 1
451 },
452 "h6": {
453 "add_class": {
454 "align": "align_text"
455 }
456 },
457 "param": {
458 "remove": 1
459 },
460 "th": {
461 "check_attributes": {
462 "rowspan": "numbers",
463 "colspan": "numbers"
464 },
465 "add_class": {
466 "align": "align_text"
467 }
468 },
469 "legend": {
470 "rename_tag": "span"
471 },
472 "hr": {},
473 "label": {
474 "rename_tag": "span"
475 },
476 "dl": {
477 "rename_tag": "div"
478 },
479 "kbd": {
480 "rename_tag": "span"
481 },
482 "listing": {
483 "rename_tag": "div"
484 },
485 "dt": {
486 "rename_tag": "span"
487 },
488 "nextid": {
489 "remove": 1
490 },
491 "pre": {},
492 "center": {
493 "rename_tag": "div",
494 "set_class": "wysiwyg-text-align-center"
495 },
496 "audio": {
497 "remove": 1
498 },
499 "datalist": {
500 "rename_tag": "span"
501 },
502 "samp": {
503 "rename_tag": "span"
504 },
505 "col": {
506 "remove": 1
507 },
508 "article": {
509 "rename_tag": "div"
510 },
511 "cite": {},
512 "link": {
513 "remove": 1
514 },
515 "script": {
516 "remove": 1
517 },
518 "bdo": {
519 "rename_tag": "span"
520 },
521 "menu": {
522 "rename_tag": "ul"
523 },
524 "colgroup": {
525 "remove": 1
526 },
527 "ruby": {
528 "rename_tag": "span"
529 },
530 "h2": {
531 "add_class": {
532 "align": "align_text"
533 }
534 },
535 "ins": {
536 "rename_tag": "span"
537 },
538 "p": {
539 "add_class": {
540 "align": "align_text"
541 }
542 },
543 "sub": {},
544 "comment": {
545 "remove": 1
546 },
547 "frameset": {
548 "remove": 1
549 },
550 "optgroup": {
551 "rename_tag": "span"
552 },
553 "header": {
554 "rename_tag": "div"
555 },
556 "sup": {}
557 }
558 };

Impressum / About Us