Diffstat (limited to 'frontend/gamma/js/Clipperz/DOM.js') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/DOM.js | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/frontend/gamma/js/Clipperz/DOM.js b/frontend/gamma/js/Clipperz/DOM.js index 8f24653..1d52a4b 100644 --- a/frontend/gamma/js/Clipperz/DOM.js +++ b/frontend/gamma/js/Clipperz/DOM.js | |||
@@ -1,54 +1,52 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | Copyright 2008-2011 Clipperz Srl | 3 | Copyright 2008-2013 Clipperz Srl |
4 | 4 | ||
5 | This file is part of Clipperz Community Edition. | 5 | This file is part of Clipperz, the online password manager. |
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | 6 | For further information about its features and functionalities please |
8 | refer to http://www.clipperz.com. | 7 | refer to http://www.clipperz.com. |
9 | 8 | ||
10 | * Clipperz Community Edition is free software: you can redistribute | 9 | * Clipperz is free software: you can redistribute it and/or modify it |
11 | it and/or modify it under the terms of the GNU Affero General Public | 10 | under the terms of the GNU Affero General Public License as published |
12 | License as published by the Free Software Foundation, either version | 11 | by the Free Software Foundation, either version 3 of the License, or |
13 | 3 of the License, or (at your option) any later version. | 12 | (at your option) any later version. |
14 | 13 | ||
15 | * Clipperz Community Edition is distributed in the hope that it will | 14 | * Clipperz is distributed in the hope that it will be useful, but |
16 | be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. | 17 | See the GNU Affero General Public License for more details. |
19 | 18 | ||
20 | * You should have received a copy of the GNU Affero General Public | 19 | * You should have received a copy of the GNU Affero General Public |
21 | License along with Clipperz Community Edition. If not, see | 20 | License along with Clipperz. If not, see http://www.gnu.org/licenses/. |
22 | <http://www.gnu.org/licenses/>. | ||
23 | 21 | ||
24 | */ | 22 | */ |
25 | 23 | ||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | 24 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } |
27 | if (typeof(Clipperz.DOM) == 'undefined') { Clipperz.DOM = {}; } | 25 | if (typeof(Clipperz.DOM) == 'undefined') { Clipperz.DOM = {}; } |
28 | 26 | ||
29 | Clipperz.DOM.VERSION = "0.1"; | 27 | Clipperz.DOM.VERSION = "0.1"; |
30 | Clipperz.DOM.NAME = "Clipperz.DOM"; | 28 | Clipperz.DOM.NAME = "Clipperz.DOM"; |
31 | 29 | ||
32 | MochiKit.Base.update(Clipperz.DOM, { | 30 | MochiKit.Base.update(Clipperz.DOM, { |
33 | 31 | ||
34 | //------------------------------------------------------------------------- | 32 | //------------------------------------------------------------------------- |
35 | 33 | ||
36 | '__repr__': function () { | 34 | '__repr__': function () { |
37 | return "[" + this.NAME + " " + this.VERSION + "]"; | 35 | return "[" + this.NAME + " " + this.VERSION + "]"; |
38 | }, | 36 | }, |
39 | 37 | ||
40 | //------------------------------------------------------------------------- | 38 | //------------------------------------------------------------------------- |
41 | 39 | ||
42 | 'toString': function () { | 40 | 'toString': function () { |
43 | return this.__repr__(); | 41 | return this.__repr__(); |
44 | }, | 42 | }, |
45 | 43 | ||
46 | //------------------------------------------------------------------------- | 44 | //------------------------------------------------------------------------- |
47 | 45 | ||
48 | 'selectOptionMatchingValue': function (aSelectElement, aValue, shouldUseCaseInsensitiveTest) { | 46 | 'selectOptionMatchingValue': function (aSelectElement, aValue, shouldUseCaseInsensitiveTest) { |
49 | var selectedOptionIndex; | 47 | var selectedOptionIndex; |
50 | var i, c; | 48 | var i, c; |
51 | 49 | ||
52 | selectedOptionIndex = -1; | 50 | selectedOptionIndex = -1; |
53 | 51 | ||
54 | c = aSelectElement.options.length; | 52 | c = aSelectElement.options.length; |
@@ -77,60 +75,60 @@ MochiKit.Base.update(Clipperz.DOM, { | |||
77 | var i, c; | 75 | var i, c; |
78 | 76 | ||
79 | values = {}; | 77 | values = {}; |
80 | c = someValues[0].length; | 78 | c = someValues[0].length; |
81 | for (i=0; i<c; i++) { | 79 | for (i=0; i<c; i++) { |
82 | values[someValues[0][i]] = someValues[1][i]; | 80 | values[someValues[0][i]] = someValues[1][i]; |
83 | } | 81 | } |
84 | 82 | ||
85 | // var m = MochiKit.Base; | 83 | // var m = MochiKit.Base; |
86 | // var self = MochiKit.DOM; | 84 | // var self = MochiKit.DOM; |
87 | if (typeof(aNode) == "undefined" || aNode === null) { | 85 | if (typeof(aNode) == "undefined" || aNode === null) { |
88 | node = MochiKit.DOM._document.body; | 86 | node = MochiKit.DOM._document.body; |
89 | } else { | 87 | } else { |
90 | node = MochiKit.DOM.getElement(aNode); | 88 | node = MochiKit.DOM.getElement(aNode); |
91 | } | 89 | } |
92 | 90 | ||
93 | MochiKit.Base.nodeWalk(node, function(aNode) { | 91 | MochiKit.Base.nodeWalk(node, function(aNode) { |
94 | var result; | 92 | var result; |
95 | var name; | 93 | var name; |
96 | 94 | ||
97 | result = null; | 95 | result = null; |
98 | name = aNode.name; | 96 | name = aNode.name; |
99 | if (MochiKit.Base.isNotEmpty(name) && (typeof(values[name]) != 'undefined')) { | 97 | if (MochiKit.Base.isNotEmpty(name) && (typeof(values[name]) != 'undefined')) { |
100 | var tagName; | 98 | var tagName; |
101 | 99 | ||
102 | tagName = aNode.tagName.toUpperCase(); | 100 | tagName = aNode.tagName.toUpperCase(); |
103 | if (tagName === "INPUT" && (aNode.type == "radio" || aNode.type == "checkbox")) { | 101 | if (tagName === "INPUT" && (aNode.type == "radio" || aNode.type == "checkbox")) { |
104 | aNode.checked = values[name]; | 102 | aNode.checked = values[name]; |
105 | } else if (tagName === "SELECT") { | 103 | } else if (tagName === "SELECT") { |
106 | if (aNode.type == "select-one") { | 104 | if (aNode.type == "select-one") { |
107 | Clipperz.DOM.selectOptionMatchingValue(aNode, values[name]); | 105 | Clipperz.DOM.selectOptionMatchingValue(aNode, values[name]); |
108 | } else { //aNode.type == "select-multiple" | 106 | } else { //aNode.type == "select-multiple" |
109 | MochiKit.Logging.logWarning("### unhandled Select.type = 'select-multiple' condition"); | 107 | Clipperz.logWarning("### unhandled Select.type = 'select-multiple' condition"); |
110 | } | 108 | } |
111 | } else if (tagName === "FORM" || tagName === "P" || tagName === "SPAN" || tagName === "DIV") { | 109 | } else if (tagName === "FORM" || tagName === "P" || tagName === "SPAN" || tagName === "DIV") { |
112 | result = aNode.childNodes; | 110 | result = aNode.childNodes; |
113 | } else { | 111 | } else { |
114 | aNode.value = values[name] | 112 | aNode.value = values[name] |
115 | } | 113 | } |
116 | } else { | 114 | } else { |
117 | result = aNode.childNodes; | 115 | result = aNode.childNodes; |
118 | } | 116 | } |
119 | 117 | ||
120 | return result; | 118 | return result; |
121 | }); | 119 | }); |
122 | }, | 120 | }, |
123 | 121 | ||
124 | //------------------------------------------------------------------------- | 122 | //------------------------------------------------------------------------- |
125 | 123 | ||
126 | 'get': MochiKit.DOM.getElement, | 124 | 'get': MochiKit.DOM.getElement, |
127 | 125 | ||
128 | //------------------------------------------------------------------------- | 126 | //------------------------------------------------------------------------- |
129 | 127 | ||
130 | 'Helper': Clipperz.YUI.DomHelper, | 128 | 'Helper': Clipperz.YUI.DomHelper, |
131 | 129 | ||
132 | //------------------------------------------------------------------------- | 130 | //------------------------------------------------------------------------- |
133 | __syntaxFix__: "syntax fix" | 131 | __syntaxFix__: "syntax fix" |
134 | 132 | ||
135 | }); | 133 | }); |
136 | 134 | ||