annotate WebContent/jscripts/tiny_mce/plugins/xhtmlxtras/js/attributes.js @ 14:0f64de5fff5a

try to use javax.xml.bind.DatatypeConverter
author casties
date Wed, 21 Mar 2012 16:38:50 +0100
parents 0be9d53a6967
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1 /**
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
2 * attributes.js
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
3 *
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
4 * Copyright 2009, Moxiecode Systems AB
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
5 * Released under LGPL License.
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
6 *
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
7 * License: http://tinymce.moxiecode.com/license
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
8 * Contributing: http://tinymce.moxiecode.com/contributing
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
9 */
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
10
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
11 function init() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
12 tinyMCEPopup.resizeToInnerSize();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
13 var inst = tinyMCEPopup.editor;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
14 var dom = inst.dom;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
15 var elm = inst.selection.getNode();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
16 var f = document.forms[0];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
17 var onclick = dom.getAttrib(elm, 'onclick');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
18
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
19 setFormValue('title', dom.getAttrib(elm, 'title'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
20 setFormValue('id', dom.getAttrib(elm, 'id'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
21 setFormValue('style', dom.getAttrib(elm, "style"));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
22 setFormValue('dir', dom.getAttrib(elm, 'dir'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
23 setFormValue('lang', dom.getAttrib(elm, 'lang'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
24 setFormValue('tabindex', dom.getAttrib(elm, 'tabindex', typeof(elm.tabindex) != "undefined" ? elm.tabindex : ""));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
25 setFormValue('accesskey', dom.getAttrib(elm, 'accesskey', typeof(elm.accesskey) != "undefined" ? elm.accesskey : ""));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
26 setFormValue('onfocus', dom.getAttrib(elm, 'onfocus'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
27 setFormValue('onblur', dom.getAttrib(elm, 'onblur'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
28 setFormValue('onclick', onclick);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
29 setFormValue('ondblclick', dom.getAttrib(elm, 'ondblclick'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
30 setFormValue('onmousedown', dom.getAttrib(elm, 'onmousedown'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
31 setFormValue('onmouseup', dom.getAttrib(elm, 'onmouseup'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
32 setFormValue('onmouseover', dom.getAttrib(elm, 'onmouseover'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
33 setFormValue('onmousemove', dom.getAttrib(elm, 'onmousemove'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
34 setFormValue('onmouseout', dom.getAttrib(elm, 'onmouseout'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
35 setFormValue('onkeypress', dom.getAttrib(elm, 'onkeypress'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
36 setFormValue('onkeydown', dom.getAttrib(elm, 'onkeydown'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
37 setFormValue('onkeyup', dom.getAttrib(elm, 'onkeyup'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
38 className = dom.getAttrib(elm, 'class');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
39
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
40 addClassesToList('classlist', 'advlink_styles');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
41 selectByValue(f, 'classlist', className, true);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
42
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
43 TinyMCE_EditableSelects.init();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
44 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
45
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
46 function setFormValue(name, value) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
47 if(value && document.forms[0].elements[name]){
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
48 document.forms[0].elements[name].value = value;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
49 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
50 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
51
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
52 function insertAction() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
53 var inst = tinyMCEPopup.editor;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
54 var elm = inst.selection.getNode();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
55
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
56 setAllAttribs(elm);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
57 tinyMCEPopup.execCommand("mceEndUndoLevel");
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
58 tinyMCEPopup.close();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
59 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
60
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
61 function setAttrib(elm, attrib, value) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
62 var formObj = document.forms[0];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
63 var valueElm = formObj.elements[attrib.toLowerCase()];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
64 var inst = tinyMCEPopup.editor;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
65 var dom = inst.dom;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
66
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
67 if (typeof(value) == "undefined" || value == null) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
68 value = "";
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
69
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
70 if (valueElm)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
71 value = valueElm.value;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
72 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
73
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
74 dom.setAttrib(elm, attrib.toLowerCase(), value);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
75 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
76
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
77 function setAllAttribs(elm) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
78 var f = document.forms[0];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
79
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
80 setAttrib(elm, 'title');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
81 setAttrib(elm, 'id');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
82 setAttrib(elm, 'style');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
83 setAttrib(elm, 'class', getSelectValue(f, 'classlist'));
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
84 setAttrib(elm, 'dir');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
85 setAttrib(elm, 'lang');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
86 setAttrib(elm, 'tabindex');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
87 setAttrib(elm, 'accesskey');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
88 setAttrib(elm, 'onfocus');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
89 setAttrib(elm, 'onblur');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
90 setAttrib(elm, 'onclick');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
91 setAttrib(elm, 'ondblclick');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
92 setAttrib(elm, 'onmousedown');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
93 setAttrib(elm, 'onmouseup');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
94 setAttrib(elm, 'onmouseover');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
95 setAttrib(elm, 'onmousemove');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
96 setAttrib(elm, 'onmouseout');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
97 setAttrib(elm, 'onkeypress');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
98 setAttrib(elm, 'onkeydown');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
99 setAttrib(elm, 'onkeyup');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
100
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
101 // Refresh in old MSIE
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
102 // if (tinyMCE.isMSIE5)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
103 // elm.outerHTML = elm.outerHTML;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
104 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
105
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
106 function insertAttribute() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
107 tinyMCEPopup.close();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
108 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
109
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
110 tinyMCEPopup.onInit.add(init);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
111 tinyMCEPopup.requireLangPack();