author | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-31 13:42:04 (UTC) |
commit | 07d0357beef5d9328a2dd8d07ad7b39c87ac55e4 (patch) (unidiff) | |
tree | f7a4aed8848302db153c2a211f8e58b944eb4c5b /frontend/beta/js/Clipperz/YUI | |
parent | 767a3dcf48b6ac911c088af5dd7738a728eb6b99 (diff) | |
download | clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.zip clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.gz clipperz-07d0357beef5d9328a2dd8d07ad7b39c87ac55e4.tar.bz2 |
Updated Copyright claims
- updated reference dates;
- removed reference to Community Edition;
- normalized logging using Clipperz.log[Warn|Error|Debug]
Diffstat (limited to 'frontend/beta/js/Clipperz/YUI') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/beta/js/Clipperz/YUI/Collapser.js | 22 | ||||
-rw-r--r-- | frontend/beta/js/Clipperz/YUI/DomHelper.js | 22 | ||||
-rw-r--r-- | frontend/beta/js/Clipperz/YUI/DomQuery.js | 22 | ||||
-rw-r--r-- | frontend/beta/js/Clipperz/YUI/Drawer.js | 22 | ||||
-rw-r--r-- | frontend/beta/js/Clipperz/YUI/IBLayoutManager.js | 22 | ||||
-rw-r--r-- | frontend/beta/js/Clipperz/YUI/IBLayoutRegion.js | 22 | ||||
-rw-r--r-- | frontend/beta/js/Clipperz/YUI/MessageBox.js | 22 |
7 files changed, 70 insertions, 84 deletions
diff --git a/frontend/beta/js/Clipperz/YUI/Collapser.js b/frontend/beta/js/Clipperz/YUI/Collapser.js index b104877..849cbe9 100644 --- a/frontend/beta/js/Clipperz/YUI/Collapser.js +++ b/frontend/beta/js/Clipperz/YUI/Collapser.js | |||
@@ -1,70 +1,68 @@ | |||
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.YUI) == 'undefined') { Clipperz.YUI = {}; } | 25 | if (typeof(Clipperz.YUI) == 'undefined') { Clipperz.YUI = {}; } |
28 | 26 | ||
29 | //found on YUI-EXT forum (http://www.yui-ext.com/forum/viewtopic.php?t=683&highlight=accordion) | 27 | //found on YUI-EXT forum (http://www.yui-ext.com/forum/viewtopic.php?t=683&highlight=accordion) |
30 | Clipperz.YUI.Collapser = function(clickEl, collapseEl, initiallyCollapsed) { | 28 | Clipperz.YUI.Collapser = function(clickEl, collapseEl, initiallyCollapsed) { |
31 | this.clickEl = getEl(clickEl); | 29 | this.clickEl = getEl(clickEl); |
32 | this.collapseEl = getEl(collapseEl); | 30 | this.collapseEl = getEl(collapseEl); |
33 | this.clickEl.addClass('collapser-expanded'); | 31 | this.clickEl.addClass('collapser-expanded'); |
34 | if (initiallyCollapsed == true) { | 32 | if (initiallyCollapsed == true) { |
35 | this.afterCollapse(); | 33 | this.afterCollapse(); |
36 | } | 34 | } |
37 | this.clickEl.mon('click', function(){ | 35 | this.clickEl.mon('click', function(){ |
38 | this.collapsed === true ? this.expand() : this.collapse(); | 36 | this.collapsed === true ? this.expand() : this.collapse(); |
39 | }, this, true); | 37 | }, this, true); |
40 | }; | 38 | }; |
41 | 39 | ||
42 | Clipperz.YUI.Collapser.prototype = { | 40 | Clipperz.YUI.Collapser.prototype = { |
43 | 'collapse': function(){ | 41 | 'collapse': function(){ |
44 | this.collapseEl.clip(); | 42 | this.collapseEl.clip(); |
45 | this.collapseEl.setHeight(1, true, .35, this.afterCollapse.createDelegate(this), YAHOO.util.Easing.easeOut); | 43 | this.collapseEl.setHeight(1, true, .35, this.afterCollapse.createDelegate(this), YAHOO.util.Easing.easeOut); |
46 | this.clickEl.replaceClass('collapser-expanded','collapser-collapsed'); | 44 | this.clickEl.replaceClass('collapser-expanded','collapser-collapsed'); |
47 | }, | 45 | }, |
48 | 46 | ||
49 | 'afterCollapse': function(){ | 47 | 'afterCollapse': function(){ |
50 | this.collapsed = true; | 48 | this.collapsed = true; |
51 | this.collapseEl.setDisplayed(false); | 49 | this.collapseEl.setDisplayed(false); |
52 | this.clickEl.replaceClass('collapser-expanded','collapser-collapsed'); | 50 | this.clickEl.replaceClass('collapser-expanded','collapser-collapsed'); |
53 | }, | 51 | }, |
54 | 52 | ||
55 | 'expand': function(){ | 53 | 'expand': function(){ |
56 | this.collapseEl.setDisplayed(true); | 54 | this.collapseEl.setDisplayed(true); |
57 | this.collapseEl.autoHeight(true, .35, this.afterExpand.createDelegate(this), YAHOO.util.Easing.easeOut); | 55 | this.collapseEl.autoHeight(true, .35, this.afterExpand.createDelegate(this), YAHOO.util.Easing.easeOut); |
58 | this.clickEl.replaceClass('collapser-collapsed','collapser-expanded'); | 56 | this.clickEl.replaceClass('collapser-collapsed','collapser-expanded'); |
59 | }, | 57 | }, |
60 | 58 | ||
61 | 'afterExpand': function(){ | 59 | 'afterExpand': function(){ |
62 | this.collapsed = false; | 60 | this.collapsed = false; |
63 | this.collapseEl.unclip(); | 61 | this.collapseEl.unclip(); |
64 | this.collapseEl.setStyle('height', ''); | 62 | this.collapseEl.setStyle('height', ''); |
65 | this.clickEl.replaceClass('collapser-collapsed','collapser-expanded'); | 63 | this.clickEl.replaceClass('collapser-collapsed','collapser-expanded'); |
66 | }, | 64 | }, |
67 | 65 | ||
68 | //----------------------------------------------------- | 66 | //----------------------------------------------------- |
69 | __syntaxFix__: '__syntaxFix__' | 67 | __syntaxFix__: '__syntaxFix__' |
70 | }; | 68 | }; |
diff --git a/frontend/beta/js/Clipperz/YUI/DomHelper.js b/frontend/beta/js/Clipperz/YUI/DomHelper.js index 05edc49..2c0ba34 100644 --- a/frontend/beta/js/Clipperz/YUI/DomHelper.js +++ b/frontend/beta/js/Clipperz/YUI/DomHelper.js | |||
@@ -1,406 +1,404 @@ | |||
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.ext) == 'undefined') { Clipperz.ext = {}; } | 25 | if (typeof(Clipperz.ext) == 'undefined') { Clipperz.ext = {}; } |
28 | 26 | ||
29 | /** | 27 | /** |
30 | * @class Clipperz.YUI.DomHelper | 28 | * @class Clipperz.YUI.DomHelper |
31 | * Utility class for working with DOM and/or Templates. It transparently supports using HTML fragments or DOM. | 29 | * Utility class for working with DOM and/or Templates. It transparently supports using HTML fragments or DOM. |
32 | * For more information see <a href="http://www.jackslocum.com/yui/2006/10/06/domhelper-create-elements-using-dom-html-fragments-or-templates/">this blog post with examples</a>. | 30 | * For more information see <a href="http://www.jackslocum.com/yui/2006/10/06/domhelper-create-elements-using-dom-html-fragments-or-templates/">this blog post with examples</a>. |
33 | * @singleton | 31 | * @singleton |
34 | */ | 32 | */ |
35 | Clipperz.YUI.DomHelper = new function(){ | 33 | Clipperz.YUI.DomHelper = new function(){ |
36 | /**@private*/ | 34 | /**@private*/ |
37 | var d = document; | 35 | var d = document; |
38 | var tempTableEl = null; | 36 | var tempTableEl = null; |
39 | /** True to force the use of DOM instead of html fragments @type Boolean */ | 37 | /** True to force the use of DOM instead of html fragments @type Boolean */ |
40 | this.useDom = false; | 38 | this.useDom = false; |
41 | var emptyTags = /^(?:base|basefont|br|frame|hr|img|input|isindex|link|meta|nextid|range|spacer|wbr|audioscope|area|param|keygen|col|limittext|spot|tab|over|right|left|choose|atop|of)$/i; | 39 | var emptyTags = /^(?:base|basefont|br|frame|hr|img|input|isindex|link|meta|nextid|range|spacer|wbr|audioscope|area|param|keygen|col|limittext|spot|tab|over|right|left|choose|atop|of)$/i; |
42 | /** | 40 | /** |
43 | * Applies a style specification to an element | 41 | * Applies a style specification to an element |
44 | * @param {String/HTMLElement} el The element to apply styles to | 42 | * @param {String/HTMLElement} el The element to apply styles to |
45 | * @param {String/Object/Function} styles A style specification string eg "width:100px", or object in the form {width:"100px"}, or | 43 | * @param {String/Object/Function} styles A style specification string eg "width:100px", or object in the form {width:"100px"}, or |
46 | * a function which returns such a specification. | 44 | * a function which returns such a specification. |
47 | */ | 45 | */ |
48 | this.applyStyles = function(el, styles){ | 46 | this.applyStyles = function(el, styles){ |
49 | if(styles){ | 47 | if(styles){ |
50 | var D = YAHOO.util.Dom; | 48 | var D = YAHOO.util.Dom; |
51 | if (typeof styles == "string"){ | 49 | if (typeof styles == "string"){ |
52 | var re = /\s?([a-z\-]*)\:([^;]*);?/gi; | 50 | var re = /\s?([a-z\-]*)\:([^;]*);?/gi; |
53 | var matches; | 51 | var matches; |
54 | while ((matches = re.exec(styles)) != null){ | 52 | while ((matches = re.exec(styles)) != null){ |
55 | D.setStyle(el, matches[1], matches[2]); | 53 | D.setStyle(el, matches[1], matches[2]); |
56 | } | 54 | } |
57 | }else if (typeof styles == "object"){ | 55 | }else if (typeof styles == "object"){ |
58 | for (var style in styles){ | 56 | for (var style in styles){ |
59 | D.setStyle(el, style, styles[style]); | 57 | D.setStyle(el, style, styles[style]); |
60 | } | 58 | } |
61 | }else if (typeof styles == "function"){ | 59 | }else if (typeof styles == "function"){ |
62 | Clipperz.YUI.DomHelper.applyStyles(el, styles.call()); | 60 | Clipperz.YUI.DomHelper.applyStyles(el, styles.call()); |
63 | } | 61 | } |
64 | } | 62 | } |
65 | }; | 63 | }; |
66 | 64 | ||
67 | // build as innerHTML where available | 65 | // build as innerHTML where available |
68 | /** @ignore */ | 66 | /** @ignore */ |
69 | var createHtml = function(o){ | 67 | var createHtml = function(o){ |
70 | var b = ''; | 68 | var b = ''; |
71 | 69 | ||
72 | if(typeof(o['html']) != 'undefined') { | 70 | if(typeof(o['html']) != 'undefined') { |
73 | o['html'] = Clipperz.Base.sanitizeString(o['html']); | 71 | o['html'] = Clipperz.Base.sanitizeString(o['html']); |
74 | } else if (typeof(o['htmlString']) != 'undefined') { | 72 | } else if (typeof(o['htmlString']) != 'undefined') { |
75 | o['html'] = o['htmlString']; | 73 | o['html'] = o['htmlString']; |
76 | delete o.htmlString; | 74 | delete o.htmlString; |
77 | } | 75 | } |
78 | 76 | ||
79 | b += '<' + o.tag; | 77 | b += '<' + o.tag; |
80 | for(var attr in o){ | 78 | for(var attr in o){ |
81 | if(attr == 'tag' || attr == 'children' || attr == 'html' || typeof o[attr] == 'function') continue; | 79 | if(attr == 'tag' || attr == 'children' || attr == 'html' || typeof o[attr] == 'function') continue; |
82 | if(attr == 'style'){ | 80 | if(attr == 'style'){ |
83 | var s = o['style']; | 81 | var s = o['style']; |
84 | if(typeof s == 'function'){ | 82 | if(typeof s == 'function'){ |
85 | s = s.call(); | 83 | s = s.call(); |
86 | } | 84 | } |
87 | if(typeof s == 'string'){ | 85 | if(typeof s == 'string'){ |
88 | b += ' style="' + s + '"'; | 86 | b += ' style="' + s + '"'; |
89 | }else if(typeof s == 'object'){ | 87 | }else if(typeof s == 'object'){ |
90 | b += ' style="'; | 88 | b += ' style="'; |
91 | for(var key in s){ | 89 | for(var key in s){ |
92 | if(typeof s[key] != 'function'){ | 90 | if(typeof s[key] != 'function'){ |
93 | b += key + ':' + s[key] + ';'; | 91 | b += key + ':' + s[key] + ';'; |
94 | } | 92 | } |
95 | } | 93 | } |
96 | b += '"'; | 94 | b += '"'; |
97 | } | 95 | } |
98 | }else{ | 96 | }else{ |
99 | if(attr == 'cls'){ | 97 | if(attr == 'cls'){ |
100 | b += ' class="' + o['cls'] + '"'; | 98 | b += ' class="' + o['cls'] + '"'; |
101 | }else if(attr == 'htmlFor'){ | 99 | }else if(attr == 'htmlFor'){ |
102 | b += ' for="' + o['htmlFor'] + '"'; | 100 | b += ' for="' + o['htmlFor'] + '"'; |
103 | }else{ | 101 | }else{ |
104 | b += ' ' + attr + '="' + o[attr] + '"'; | 102 | b += ' ' + attr + '="' + o[attr] + '"'; |
105 | } | 103 | } |
106 | } | 104 | } |
107 | } | 105 | } |
108 | if(emptyTags.test(o.tag)){ | 106 | if(emptyTags.test(o.tag)){ |
109 | b += ' />'; | 107 | b += ' />'; |
110 | }else{ | 108 | }else{ |
111 | b += '>'; | 109 | b += '>'; |
112 | if(o.children){ | 110 | if(o.children){ |
113 | for(var i = 0, len = o.children.length; i < len; i++) { | 111 | for(var i = 0, len = o.children.length; i < len; i++) { |
114 | b += createHtml(o.children[i], b); | 112 | b += createHtml(o.children[i], b); |
115 | } | 113 | } |
116 | } | 114 | } |
117 | if(o.html){ | 115 | if(o.html){ |
118 | b += o.html; | 116 | b += o.html; |
119 | } | 117 | } |
120 | b += '</' + o.tag + '>'; | 118 | b += '</' + o.tag + '>'; |
121 | } | 119 | } |
122 | return b; | 120 | return b; |
123 | } | 121 | } |
124 | 122 | ||
125 | // build as dom | 123 | // build as dom |
126 | /** @ignore */ | 124 | /** @ignore */ |
127 | var createDom = function(o, parentNode){ | 125 | var createDom = function(o, parentNode){ |
128 | var el = d.createElement(o.tag); | 126 | var el = d.createElement(o.tag); |
129 | var useSet = el.setAttribute ? true : false; // In IE some elements don't have setAttribute | 127 | var useSet = el.setAttribute ? true : false; // In IE some elements don't have setAttribute |
130 | for(var attr in o){ | 128 | for(var attr in o){ |
131 | if(attr == 'tag' || attr == 'children' || attr == 'html' || attr == 'style' || typeof o[attr] == 'function') continue; | 129 | if(attr == 'tag' || attr == 'children' || attr == 'html' || attr == 'style' || typeof o[attr] == 'function') continue; |
132 | if(attr=='cls'){ | 130 | if(attr=='cls'){ |
133 | el.className = o['cls']; | 131 | el.className = o['cls']; |
134 | }else{ | 132 | }else{ |
135 | if(useSet) el.setAttribute(attr, o[attr]); | 133 | if(useSet) el.setAttribute(attr, o[attr]); |
136 | else el[attr] = o[attr]; | 134 | else el[attr] = o[attr]; |
137 | } | 135 | } |
138 | } | 136 | } |
139 | Clipperz.YUI.DomHelper.applyStyles(el, o.style); | 137 | Clipperz.YUI.DomHelper.applyStyles(el, o.style); |
140 | if(o.children){ | 138 | if(o.children){ |
141 | for(var i = 0, len = o.children.length; i < len; i++) { | 139 | for(var i = 0, len = o.children.length; i < len; i++) { |
142 | createDom(o.children[i], el); | 140 | createDom(o.children[i], el); |
143 | } | 141 | } |
144 | } | 142 | } |
145 | if(o.html){ | 143 | if(o.html){ |
146 | el.innerHTML = o.html; | 144 | el.innerHTML = o.html; |
147 | } | 145 | } |
148 | if(parentNode){ | 146 | if(parentNode){ |
149 | parentNode.appendChild(el); | 147 | parentNode.appendChild(el); |
150 | } | 148 | } |
151 | return el; | 149 | return el; |
152 | }; | 150 | }; |
153 | 151 | ||
154 | /** | 152 | /** |
155 | * @ignore | 153 | * @ignore |
156 | * Nasty code for IE's broken table implementation | 154 | * Nasty code for IE's broken table implementation |
157 | */ | 155 | */ |
158 | var insertIntoTable = function(tag, where, el, html){ | 156 | var insertIntoTable = function(tag, where, el, html){ |
159 | if(!tempTableEl){ | 157 | if(!tempTableEl){ |
160 | tempTableEl = document.createElement('div'); | 158 | tempTableEl = document.createElement('div'); |
161 | } | 159 | } |
162 | var node; | 160 | var node; |
163 | if(tag == 'table' || tag == 'tbody'){ | 161 | if(tag == 'table' || tag == 'tbody'){ |
164 | tempTableEl.innerHTML = '<table><tbody>'+html+'</tbody></table>'; | 162 | tempTableEl.innerHTML = '<table><tbody>'+html+'</tbody></table>'; |
165 | node = tempTableEl.firstChild.firstChild.firstChild; | 163 | node = tempTableEl.firstChild.firstChild.firstChild; |
166 | }else{ | 164 | }else{ |
167 | tempTableEl.innerHTML = '<table><tbody><tr>'+html+'</tr></tbody></table>'; | 165 | tempTableEl.innerHTML = '<table><tbody><tr>'+html+'</tr></tbody></table>'; |
168 | node = tempTableEl.firstChild.firstChild.firstChild.firstChild; | 166 | node = tempTableEl.firstChild.firstChild.firstChild.firstChild; |
169 | } | 167 | } |
170 | if(where == 'beforebegin'){ | 168 | if(where == 'beforebegin'){ |
171 | el.parentNode.insertBefore(node, el); | 169 | el.parentNode.insertBefore(node, el); |
172 | return node; | 170 | return node; |
173 | }else if(where == 'afterbegin'){ | 171 | }else if(where == 'afterbegin'){ |
174 | el.insertBefore(node, el.firstChild); | 172 | el.insertBefore(node, el.firstChild); |
175 | return node; | 173 | return node; |
176 | }else if(where == 'beforeend'){ | 174 | }else if(where == 'beforeend'){ |
177 | el.appendChild(node); | 175 | el.appendChild(node); |
178 | return node; | 176 | return node; |
179 | }else if(where == 'afterend'){ | 177 | }else if(where == 'afterend'){ |
180 | el.parentNode.insertBefore(node, el.nextSibling); | 178 | el.parentNode.insertBefore(node, el.nextSibling); |
181 | return node; | 179 | return node; |
182 | } | 180 | } |
183 | } | 181 | } |
184 | 182 | ||
185 | /** | 183 | /** |
186 | * Inserts an HTML fragment into the Dom | 184 | * Inserts an HTML fragment into the Dom |
187 | * @param {String} where Where to insert the html in relation to el - beforeBegin, afterBegin, beforeEnd, afterEnd. | 185 | * @param {String} where Where to insert the html in relation to el - beforeBegin, afterBegin, beforeEnd, afterEnd. |
188 | * @param {HTMLElement} el The context element | 186 | * @param {HTMLElement} el The context element |
189 | * @param {String} html The HTML fragmenet | 187 | * @param {String} html The HTML fragmenet |
190 | * @return {HTMLElement} The new node | 188 | * @return {HTMLElement} The new node |
191 | */ | 189 | */ |
192 | this.insertHtml = function(where, el, html){ | 190 | this.insertHtml = function(where, el, html){ |
193 | where = where.toLowerCase(); | 191 | where = where.toLowerCase(); |
194 | if(el.insertAdjacentHTML){ | 192 | if(el.insertAdjacentHTML){ |
195 | var tag = el.tagName.toLowerCase(); | 193 | var tag = el.tagName.toLowerCase(); |
196 | if(tag == 'table' || tag == 'tbody' || tag == 'tr'){ | 194 | if(tag == 'table' || tag == 'tbody' || tag == 'tr'){ |
197 | return insertIntoTable(tag, where, el, html); | 195 | return insertIntoTable(tag, where, el, html); |
198 | } | 196 | } |
199 | switch(where){ | 197 | switch(where){ |
200 | case 'beforebegin': | 198 | case 'beforebegin': |
201 | el.insertAdjacentHTML(where, html); | 199 | el.insertAdjacentHTML(where, html); |
202 | return el.previousSibling; | 200 | return el.previousSibling; |
203 | case 'afterbegin': | 201 | case 'afterbegin': |
204 | el.insertAdjacentHTML(where, html); | 202 | el.insertAdjacentHTML(where, html); |
205 | return el.firstChild; | 203 | return el.firstChild; |
206 | case 'beforeend': | 204 | case 'beforeend': |
207 | el.insertAdjacentHTML(where, html); | 205 | el.insertAdjacentHTML(where, html); |
208 | return el.lastChild; | 206 | return el.lastChild; |
209 | case 'afterend': | 207 | case 'afterend': |
210 | el.insertAdjacentHTML(where, html); | 208 | el.insertAdjacentHTML(where, html); |
211 | return el.nextSibling; | 209 | return el.nextSibling; |
212 | } | 210 | } |
213 | throw 'Illegal insertion point -> "' + where + '"'; | 211 | throw 'Illegal insertion point -> "' + where + '"'; |
214 | } | 212 | } |
215 | var range = el.ownerDocument.createRange(); | 213 | var range = el.ownerDocument.createRange(); |
216 | var frag; | 214 | var frag; |
217 | switch(where){ | 215 | switch(where){ |
218 | case 'beforebegin': | 216 | case 'beforebegin': |
219 | range.setStartBefore(el); | 217 | range.setStartBefore(el); |
220 | frag = range.createContextualFragment(html); | 218 | frag = range.createContextualFragment(html); |
221 | el.parentNode.insertBefore(frag, el); | 219 | el.parentNode.insertBefore(frag, el); |
222 | return el.previousSibling; | 220 | return el.previousSibling; |
223 | case 'afterbegin': | 221 | case 'afterbegin': |
224 | if(el.firstChild){ // faster | 222 | if(el.firstChild){ // faster |
225 | range.setStartBefore(el.firstChild); | 223 | range.setStartBefore(el.firstChild); |
226 | }else{ | 224 | }else{ |
227 | range.selectNodeContents(el); | 225 | range.selectNodeContents(el); |
228 | range.collapse(true); | 226 | range.collapse(true); |
229 | } | 227 | } |
230 | frag = range.createContextualFragment(html); | 228 | frag = range.createContextualFragment(html); |
231 | el.insertBefore(frag, el.firstChild); | 229 | el.insertBefore(frag, el.firstChild); |
232 | return el.firstChild; | 230 | return el.firstChild; |
233 | case 'beforeend': | 231 | case 'beforeend': |
234 | if(el.lastChild){ | 232 | if(el.lastChild){ |
235 | range.setStartAfter(el.lastChild); // faster | 233 | range.setStartAfter(el.lastChild); // faster |
236 | }else{ | 234 | }else{ |
237 | range.selectNodeContents(el); | 235 | range.selectNodeContents(el); |
238 | range.collapse(false); | 236 | range.collapse(false); |
239 | } | 237 | } |
240 | frag = range.createContextualFragment(html); | 238 | frag = range.createContextualFragment(html); |
241 | el.appendChild(frag); | 239 | el.appendChild(frag); |
242 | return el.lastChild; | 240 | return el.lastChild; |
243 | case 'afterend': | 241 | case 'afterend': |
244 | range.setStartAfter(el); | 242 | range.setStartAfter(el); |
245 | frag = range.createContextualFragment(html); | 243 | frag = range.createContextualFragment(html); |
246 | el.parentNode.insertBefore(frag, el.nextSibling); | 244 | el.parentNode.insertBefore(frag, el.nextSibling); |
247 | return el.nextSibling; | 245 | return el.nextSibling; |
248 | } | 246 | } |
249 | throw 'Illegal insertion point -> "' + where + '"'; | 247 | throw 'Illegal insertion point -> "' + where + '"'; |
250 | }; | 248 | }; |
251 | 249 | ||
252 | /** | 250 | /** |
253 | * Creates new Dom element(s) and inserts them before el | 251 | * Creates new Dom element(s) and inserts them before el |
254 | * @param {String/HTMLElement/Element} el The context element | 252 | * @param {String/HTMLElement/Element} el The context element |
255 | * @param {Object} o The Dom object spec (and children) | 253 | * @param {Object} o The Dom object spec (and children) |
256 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element | 254 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element |
257 | * @return {HTMLElement} The new node | 255 | * @return {HTMLElement} The new node |
258 | */ | 256 | */ |
259 | this.insertBefore = function(el, o, returnElement){ | 257 | this.insertBefore = function(el, o, returnElement){ |
260 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); | 258 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); |
261 | var newNode; | 259 | var newNode; |
262 | if(this.useDom){ | 260 | if(this.useDom){ |
263 | newNode = createDom(o, null); | 261 | newNode = createDom(o, null); |
264 | el.parentNode.insertBefore(newNode, el); | 262 | el.parentNode.insertBefore(newNode, el); |
265 | }else{ | 263 | }else{ |
266 | var html = createHtml(o); | 264 | var html = createHtml(o); |
267 | newNode = this.insertHtml('beforeBegin', el, html); | 265 | newNode = this.insertHtml('beforeBegin', el, html); |
268 | } | 266 | } |
269 | return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode; | 267 | return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode; |
270 | }; | 268 | }; |
271 | 269 | ||
272 | /** | 270 | /** |
273 | * Creates new Dom element(s) and inserts them after el | 271 | * Creates new Dom element(s) and inserts them after el |
274 | * @param {String/HTMLElement/Element} el The context element | 272 | * @param {String/HTMLElement/Element} el The context element |
275 | * @param {Object} o The Dom object spec (and children) | 273 | * @param {Object} o The Dom object spec (and children) |
276 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element | 274 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element |
277 | * @return {HTMLElement} The new node | 275 | * @return {HTMLElement} The new node |
278 | */ | 276 | */ |
279 | this.insertAfter = function(el, o, returnElement){ | 277 | this.insertAfter = function(el, o, returnElement){ |
280 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); | 278 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); |
281 | var newNode; | 279 | var newNode; |
282 | if(this.useDom){ | 280 | if(this.useDom){ |
283 | newNode = createDom(o, null); | 281 | newNode = createDom(o, null); |
284 | el.parentNode.insertBefore(newNode, el.nextSibling); | 282 | el.parentNode.insertBefore(newNode, el.nextSibling); |
285 | }else{ | 283 | }else{ |
286 | var html = createHtml(o); | 284 | var html = createHtml(o); |
287 | newNode = this.insertHtml('afterEnd', el, html); | 285 | newNode = this.insertHtml('afterEnd', el, html); |
288 | } | 286 | } |
289 | return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode; | 287 | return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode; |
290 | }; | 288 | }; |
291 | 289 | ||
292 | /** | 290 | /** |
293 | * Creates new Dom element(s) and appends them to el | 291 | * Creates new Dom element(s) and appends them to el |
294 | * @param {String/HTMLElement/Element} el The context element | 292 | * @param {String/HTMLElement/Element} el The context element |
295 | * @param {Object} o The Dom object spec (and children) | 293 | * @param {Object} o The Dom object spec (and children) |
296 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element | 294 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element |
297 | * @return {HTMLElement} The new node | 295 | * @return {HTMLElement} The new node |
298 | */ | 296 | */ |
299 | this.append = function(el, o, returnElement){ | 297 | this.append = function(el, o, returnElement){ |
300 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); | 298 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); |
301 | var newNode; | 299 | var newNode; |
302 | if(this.useDom){ | 300 | if(this.useDom){ |
303 | newNode = createDom(o, null); | 301 | newNode = createDom(o, null); |
304 | el.appendChild(newNode); | 302 | el.appendChild(newNode); |
305 | }else{ | 303 | }else{ |
306 | var html = createHtml(o); | 304 | var html = createHtml(o); |
307 | newNode = this.insertHtml('beforeEnd', el, html); | 305 | newNode = this.insertHtml('beforeEnd', el, html); |
308 | } | 306 | } |
309 | return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode; | 307 | return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode; |
310 | }; | 308 | }; |
311 | 309 | ||
312 | /** | 310 | /** |
313 | * Creates new Dom element(s) and overwrites the contents of el with them | 311 | * Creates new Dom element(s) and overwrites the contents of el with them |
314 | * @param {String/HTMLElement/Element} el The context element | 312 | * @param {String/HTMLElement/Element} el The context element |
315 | * @param {Object} o The Dom object spec (and children) | 313 | * @param {Object} o The Dom object spec (and children) |
316 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element | 314 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element |
317 | * @return {HTMLElement} The new node | 315 | * @return {HTMLElement} The new node |
318 | */ | 316 | */ |
319 | this.overwrite = function(el, o, returnElement){ | 317 | this.overwrite = function(el, o, returnElement){ |
320 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); | 318 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); |
321 | el.innerHTML = createHtml(o); | 319 | el.innerHTML = createHtml(o); |
322 | return returnElement ? YAHOO.ext.Element.get(el.firstChild, true) : el.firstChild; | 320 | return returnElement ? YAHOO.ext.Element.get(el.firstChild, true) : el.firstChild; |
323 | }; | 321 | }; |
324 | 322 | ||
325 | /** | 323 | /** |
326 | * Creates a new Clipperz.YUI.DomHelper.Template from the Dom object spec | 324 | * Creates a new Clipperz.YUI.DomHelper.Template from the Dom object spec |
327 | * @param {Object} o The Dom object spec (and children) | 325 | * @param {Object} o The Dom object spec (and children) |
328 | * @return {Clipperz.YUI.DomHelper.Template} The new template | 326 | * @return {Clipperz.YUI.DomHelper.Template} The new template |
329 | */ | 327 | */ |
330 | this.createTemplate = function(o){ | 328 | this.createTemplate = function(o){ |
331 | var html = createHtml(o); | 329 | var html = createHtml(o); |
332 | return new Clipperz.YUI.DomHelper.Template(html); | 330 | return new Clipperz.YUI.DomHelper.Template(html); |
333 | }; | 331 | }; |
334 | }(); | 332 | }(); |
335 | 333 | ||
336 | /** | 334 | /** |
337 | * @class Clipperz.YUI.DomHelper.Template | 335 | * @class Clipperz.YUI.DomHelper.Template |
338 | * Represents an HTML fragment template. | 336 | * Represents an HTML fragment template. |
339 | * For more information see <a href="http://www.jackslocum.com/yui/2006/10/06/domhelper-create-elements-using-dom-html-fragments-or-templates/">this blog post with examples</a>. | 337 | * For more information see <a href="http://www.jackslocum.com/yui/2006/10/06/domhelper-create-elements-using-dom-html-fragments-or-templates/">this blog post with examples</a>. |
340 | * <br> | 338 | * <br> |
341 | * <b>This class is also available as YAHOO.ext.Template</b>. | 339 | * <b>This class is also available as YAHOO.ext.Template</b>. |
342 | * @constructor | 340 | * @constructor |
343 | * @param {String/Array} html The HTML fragment or an array of fragments to join('') or multiple arguments to join('') | 341 | * @param {String/Array} html The HTML fragment or an array of fragments to join('') or multiple arguments to join('') |
344 | */ | 342 | */ |
345 | Clipperz.YUI.DomHelper.Template = function(html){ | 343 | Clipperz.YUI.DomHelper.Template = function(html){ |
346 | if(html instanceof Array){ | 344 | if(html instanceof Array){ |
347 | html = html.join(''); | 345 | html = html.join(''); |
348 | }else if(arguments.length > 1){ | 346 | }else if(arguments.length > 1){ |
349 | html = Array.prototype.join.call(arguments, ''); | 347 | html = Array.prototype.join.call(arguments, ''); |
350 | } | 348 | } |
351 | /**@private*/ | 349 | /**@private*/ |
352 | this.html = html; | 350 | this.html = html; |
353 | }; | 351 | }; |
354 | Clipperz.YUI.DomHelper.Template.prototype = { | 352 | Clipperz.YUI.DomHelper.Template.prototype = { |
355 | /** | 353 | /** |
356 | * Returns an HTML fragment of this template with the specified values applied | 354 | * Returns an HTML fragment of this template with the specified values applied |
357 | * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) | 355 | * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) |
358 | * @return {String} | 356 | * @return {String} |
359 | */ | 357 | */ |
360 | applyTemplate : function(values){ | 358 | applyTemplate : function(values){ |
361 | if(this.compiled){ | 359 | if(this.compiled){ |
362 | return this.compiled(values); | 360 | return this.compiled(values); |
363 | } | 361 | } |
364 | var empty = ''; | 362 | var empty = ''; |
365 | var fn = function(match, index){ | 363 | var fn = function(match, index){ |
366 | if(typeof values[index] != 'undefined'){ | 364 | if(typeof values[index] != 'undefined'){ |
367 | return values[index]; | 365 | return values[index]; |
368 | }else{ | 366 | }else{ |
369 | return empty; | 367 | return empty; |
370 | } | 368 | } |
371 | } | 369 | } |
372 | return this.html.replace(this.re, fn); | 370 | return this.html.replace(this.re, fn); |
373 | }, | 371 | }, |
374 | 372 | ||
375 | /** | 373 | /** |
376 | * The regular expression used to match template variables | 374 | * The regular expression used to match template variables |
377 | * @type RegExp | 375 | * @type RegExp |
378 | * @property | 376 | * @property |
379 | */ | 377 | */ |
380 | re : /\{([\w|-]+)\}/g, | 378 | re : /\{([\w|-]+)\}/g, |
381 | 379 | ||
382 | /** | 380 | /** |
383 | * Compiles the template into an internal function, eliminating the RegEx overhead | 381 | * Compiles the template into an internal function, eliminating the RegEx overhead |
384 | */ | 382 | */ |
385 | compile : function(){ | 383 | compile : function(){ |
386 | var body = ["this.compiled = function(values){ return ['"]; | 384 | var body = ["this.compiled = function(values){ return ['"]; |
387 | body.push(this.html.replace(this.re, "', values['$1'], '")); | 385 | body.push(this.html.replace(this.re, "', values['$1'], '")); |
388 | body.push("'].join('');};"); | 386 | body.push("'].join('');};"); |
389 | eval(body.join('')); | 387 | eval(body.join('')); |
390 | return this; | 388 | return this; |
391 | }, | 389 | }, |
392 | 390 | ||
393 | /** | 391 | /** |
394 | * Applies the supplied values to the template and inserts the new node(s) before el | 392 | * Applies the supplied values to the template and inserts the new node(s) before el |
395 | * @param {String/HTMLElement/Element} el The context element | 393 | * @param {String/HTMLElement/Element} el The context element |
396 | * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) | 394 | * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}) |
397 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element | 395 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.ext.Element |
398 | * @return {HTMLElement} The new node | 396 | * @return {HTMLElement} The new node |
399 | */ | 397 | */ |
400 | insertBefore: function(el, values, returnElement){ | 398 | insertBefore: function(el, values, returnElement){ |
401 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); | 399 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); |
402 | var newNode = Clipperz.YUI.DomHelper.insertHtml('beforeBegin', el, this.applyTemplate(values)); | 400 | var newNode = Clipperz.YUI.DomHelper.insertHtml('beforeBegin', el, this.applyTemplate(values)); |
403 | return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode; | 401 | return returnElement ? YAHOO.ext.Element.get(newNode, true) : newNode; |
404 | }, | 402 | }, |
405 | 403 | ||
406 | /** | 404 | /** |
diff --git a/frontend/beta/js/Clipperz/YUI/DomQuery.js b/frontend/beta/js/Clipperz/YUI/DomQuery.js index 4ad4193..6e54b6c 100644 --- a/frontend/beta/js/Clipperz/YUI/DomQuery.js +++ b/frontend/beta/js/Clipperz/YUI/DomQuery.js | |||
@@ -1,406 +1,404 @@ | |||
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 | /* | 24 | /* |
27 | * yui-ext 0.40 | 25 | * yui-ext 0.40 |
28 | * Copyright(c) 2006, Jack Slocum. | 26 | * Copyright(c) 2006, Jack Slocum. |
29 | */ | 27 | */ |
30 | 28 | ||
31 | /** | 29 | /** |
32 | * @class Ext.DomQuery | 30 | * @class Ext.DomQuery |
33 | * Provides high performance selector/xpath processing by compiling queries into reusable functions. | 31 | * Provides high performance selector/xpath processing by compiling queries into reusable functions. |
34 | * New pseudo classes and matchers can be plugged. It works on HTML and XML documents (if a content node is passed in). | 32 | * New pseudo classes and matchers can be plugged. It works on HTML and XML documents (if a content node is passed in). |
35 | * @singleton | 33 | * @singleton |
36 | */ | 34 | */ |
37 | Ext.DomQuery = function(){ | 35 | Ext.DomQuery = function(){ |
38 | var cache = {}, simpleCache = {}, valueCache = {}; | 36 | var cache = {}, simpleCache = {}, valueCache = {}; |
39 | var nonSpace = /\S/; | 37 | var nonSpace = /\S/; |
40 | var trimRe = /^\s*(.*?)\s*$/; | 38 | var trimRe = /^\s*(.*?)\s*$/; |
41 | var tplRe = /\{(\d+)\}/g; | 39 | var tplRe = /\{(\d+)\}/g; |
42 | var modeRe = /^(\s?[\/>]\s?|\s|$)/; | 40 | var modeRe = /^(\s?[\/>]\s?|\s|$)/; |
43 | var clsRes = {}; | 41 | var clsRes = {}; |
44 | 42 | ||
45 | function child(p, index){ | 43 | function child(p, index){ |
46 | var i = 0; | 44 | var i = 0; |
47 | var n = p.firstChild; | 45 | var n = p.firstChild; |
48 | while(n){ | 46 | while(n){ |
49 | if(n.nodeType == 1){ | 47 | if(n.nodeType == 1){ |
50 | i++; | 48 | i++; |
51 | if(i == index){ | 49 | if(i == index){ |
52 | return n; | 50 | return n; |
53 | } | 51 | } |
54 | } | 52 | } |
55 | n = n.nextSibling; | 53 | n = n.nextSibling; |
56 | } | 54 | } |
57 | return null; | 55 | return null; |
58 | }; | 56 | }; |
59 | 57 | ||
60 | function next(d){ | 58 | function next(d){ |
61 | var n = d.nextSibling; | 59 | var n = d.nextSibling; |
62 | while(n && n.nodeType != 1){ | 60 | while(n && n.nodeType != 1){ |
63 | n = n.nextSibling; | 61 | n = n.nextSibling; |
64 | } | 62 | } |
65 | return n; | 63 | return n; |
66 | }; | 64 | }; |
67 | 65 | ||
68 | function prev(d){ | 66 | function prev(d){ |
69 | var n = d.previousSibling; | 67 | var n = d.previousSibling; |
70 | while(n && n.nodeType != 1){ | 68 | while(n && n.nodeType != 1){ |
71 | n = n.previousSibling; | 69 | n = n.previousSibling; |
72 | } | 70 | } |
73 | return n; | 71 | return n; |
74 | }; | 72 | }; |
75 | 73 | ||
76 | function clean(d){ | 74 | function clean(d){ |
77 | var n = d.firstChild, ni = -1; | 75 | var n = d.firstChild, ni = -1; |
78 | while(n){ | 76 | while(n){ |
79 | var nx = n.nextSibling; | 77 | var nx = n.nextSibling; |
80 | if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){ | 78 | if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){ |
81 | d.removeChild(n); | 79 | d.removeChild(n); |
82 | }else{ | 80 | }else{ |
83 | n.nodeIndex = ++ni; | 81 | n.nodeIndex = ++ni; |
84 | } | 82 | } |
85 | n = nx; | 83 | n = nx; |
86 | } | 84 | } |
87 | return this; | 85 | return this; |
88 | }; | 86 | }; |
89 | 87 | ||
90 | function byClassName(c, a, v){ | 88 | function byClassName(c, a, v){ |
91 | if(!v){ | 89 | if(!v){ |
92 | return c; | 90 | return c; |
93 | } | 91 | } |
94 | var re = clsRes[v]; | 92 | var re = clsRes[v]; |
95 | if(!re){ | 93 | if(!re){ |
96 | re = new RegExp('(?:^|\\s)(?:' + v + ')(?:\\s|$)'); | 94 | re = new RegExp('(?:^|\\s)(?:' + v + ')(?:\\s|$)'); |
97 | clsRes[v] = re; | 95 | clsRes[v] = re; |
98 | } | 96 | } |
99 | var r = []; | 97 | var r = []; |
100 | for(var i = 0, ci; ci = c[i]; i++){ | 98 | for(var i = 0, ci; ci = c[i]; i++){ |
101 | if(re.test(ci.className)){ | 99 | if(re.test(ci.className)){ |
102 | r[r.length] = ci; | 100 | r[r.length] = ci; |
103 | } | 101 | } |
104 | } | 102 | } |
105 | return r; | 103 | return r; |
106 | }; | 104 | }; |
107 | 105 | ||
108 | function convert(c){ | 106 | function convert(c){ |
109 | if(c.slice){ | 107 | if(c.slice){ |
110 | return c; | 108 | return c; |
111 | } | 109 | } |
112 | var r = []; | 110 | var r = []; |
113 | for(var i = 0, l = c.length; i < l; i++){ | 111 | for(var i = 0, l = c.length; i < l; i++){ |
114 | r[r.length] = c[i]; | 112 | r[r.length] = c[i]; |
115 | } | 113 | } |
116 | return r; | 114 | return r; |
117 | }; | 115 | }; |
118 | 116 | ||
119 | function attrValue(n, attr){ | 117 | function attrValue(n, attr){ |
120 | if(!n.tagName && typeof n.length != 'undefined'){ | 118 | if(!n.tagName && typeof n.length != 'undefined'){ |
121 | n = n[0]; | 119 | n = n[0]; |
122 | } | 120 | } |
123 | if(!n){ | 121 | if(!n){ |
124 | return null; | 122 | return null; |
125 | } | 123 | } |
126 | if(attr == 'for'){ | 124 | if(attr == 'for'){ |
127 | return n.htmlFor; | 125 | return n.htmlFor; |
128 | } | 126 | } |
129 | if(attr == 'class' || attr == 'className'){ | 127 | if(attr == 'class' || attr == 'className'){ |
130 | return n.className; | 128 | return n.className; |
131 | } | 129 | } |
132 | return n.getAttribute(attr) || n[attr]; | 130 | return n.getAttribute(attr) || n[attr]; |
133 | 131 | ||
134 | }; | 132 | }; |
135 | 133 | ||
136 | function getNodes(ns, mode, tagName){ | 134 | function getNodes(ns, mode, tagName){ |
137 | var result = [], cs; | 135 | var result = [], cs; |
138 | if(!ns){ | 136 | if(!ns){ |
139 | return result; | 137 | return result; |
140 | } | 138 | } |
141 | mode = mode ? mode.replace(trimRe, '$1') : ''; | 139 | mode = mode ? mode.replace(trimRe, '$1') : ''; |
142 | tagName = tagName || '*'; | 140 | tagName = tagName || '*'; |
143 | if(ns.tagName || ns == document){ | 141 | if(ns.tagName || ns == document){ |
144 | ns = [ns]; | 142 | ns = [ns]; |
145 | } | 143 | } |
146 | if(mode != '/' && mode != '>'){ | 144 | if(mode != '/' && mode != '>'){ |
147 | for(var i = 0, ni; ni = ns[i]; i++){ | 145 | for(var i = 0, ni; ni = ns[i]; i++){ |
148 | cs = ni.getElementsByTagName(tagName); | 146 | cs = ni.getElementsByTagName(tagName); |
149 | result = concat(result, cs); | 147 | result = concat(result, cs); |
150 | } | 148 | } |
151 | }else{ | 149 | }else{ |
152 | for(var i = 0, ni; ni = ns[i]; i++){ | 150 | for(var i = 0, ni; ni = ns[i]; i++){ |
153 | var cn = ni.getElementsByTagName(tagName); | 151 | var cn = ni.getElementsByTagName(tagName); |
154 | for(var j = 0, cj; cj = cn[j]; j++){ | 152 | for(var j = 0, cj; cj = cn[j]; j++){ |
155 | if(cj.parentNode == ni){ | 153 | if(cj.parentNode == ni){ |
156 | result[result.length] = cj; | 154 | result[result.length] = cj; |
157 | } | 155 | } |
158 | } | 156 | } |
159 | } | 157 | } |
160 | 158 | ||
161 | } | 159 | } |
162 | return result; | 160 | return result; |
163 | }; | 161 | }; |
164 | 162 | ||
165 | function concat(a, b){ | 163 | function concat(a, b){ |
166 | if(b.slice){ | 164 | if(b.slice){ |
167 | return a.concat(b); | 165 | return a.concat(b); |
168 | } | 166 | } |
169 | for(var i = 0, l = b.length; i < l; i++){ | 167 | for(var i = 0, l = b.length; i < l; i++){ |
170 | a[a.length] = b[i]; | 168 | a[a.length] = b[i]; |
171 | } | 169 | } |
172 | return a; | 170 | return a; |
173 | } | 171 | } |
174 | 172 | ||
175 | function byTag(cs, tagName){ | 173 | function byTag(cs, tagName){ |
176 | if(cs.tagName || cs == document){ | 174 | if(cs.tagName || cs == document){ |
177 | cs = [cs]; | 175 | cs = [cs]; |
178 | } | 176 | } |
179 | if(!tagName){ | 177 | if(!tagName){ |
180 | return cs; | 178 | return cs; |
181 | } | 179 | } |
182 | var r = []; tagName = tagName.toLowerCase(); | 180 | var r = []; tagName = tagName.toLowerCase(); |
183 | for(var i = 0, ci; ci = cs[i]; i++){ | 181 | for(var i = 0, ci; ci = cs[i]; i++){ |
184 | if(ci.nodeType == 1 && ci.tagName.toLowerCase()==tagName){ | 182 | if(ci.nodeType == 1 && ci.tagName.toLowerCase()==tagName){ |
185 | r[r.length] = ci; | 183 | r[r.length] = ci; |
186 | } | 184 | } |
187 | } | 185 | } |
188 | return r; | 186 | return r; |
189 | }; | 187 | }; |
190 | 188 | ||
191 | function byId(cs, attr, id){ | 189 | function byId(cs, attr, id){ |
192 | if(cs.tagName || cs == document){ | 190 | if(cs.tagName || cs == document){ |
193 | cs = [cs]; | 191 | cs = [cs]; |
194 | } | 192 | } |
195 | if(!id){ | 193 | if(!id){ |
196 | return cs; | 194 | return cs; |
197 | } | 195 | } |
198 | var r = []; | 196 | var r = []; |
199 | for(var i = 0, l = cs.length; i < l; i++){ | 197 | for(var i = 0, l = cs.length; i < l; i++){ |
200 | var ci = cs[i]; | 198 | var ci = cs[i]; |
201 | if(ci && ci.id == id){ | 199 | if(ci && ci.id == id){ |
202 | r[r.length] = ci; | 200 | r[r.length] = ci; |
203 | } | 201 | } |
204 | } | 202 | } |
205 | return r; | 203 | return r; |
206 | }; | 204 | }; |
207 | 205 | ||
208 | function byAttribute(cs, attr, value, op, custom){ | 206 | function byAttribute(cs, attr, value, op, custom){ |
209 | var r = [], st = custom=='{'; | 207 | var r = [], st = custom=='{'; |
210 | var f = Ext.DomQuery.operators[op]; | 208 | var f = Ext.DomQuery.operators[op]; |
211 | for(var i = 0, l = cs.length; i < l; i++){ | 209 | for(var i = 0, l = cs.length; i < l; i++){ |
212 | var a; | 210 | var a; |
213 | if(st){ | 211 | if(st){ |
214 | a = Ext.DomQuery.getStyle(cs[i], attr); | 212 | a = Ext.DomQuery.getStyle(cs[i], attr); |
215 | } | 213 | } |
216 | else if(attr == 'class' || attr == 'className'){ | 214 | else if(attr == 'class' || attr == 'className'){ |
217 | a = cs[i].className; | 215 | a = cs[i].className; |
218 | }else if(attr == 'for'){ | 216 | }else if(attr == 'for'){ |
219 | a = cs[i].htmlFor; | 217 | a = cs[i].htmlFor; |
220 | }else{ | 218 | }else{ |
221 | a = cs[i].getAttribute(attr); | 219 | a = cs[i].getAttribute(attr); |
222 | } | 220 | } |
223 | if((f && f(a, value)) || (!f && a)){ | 221 | if((f && f(a, value)) || (!f && a)){ |
224 | r[r.length] = cs[i]; | 222 | r[r.length] = cs[i]; |
225 | } | 223 | } |
226 | } | 224 | } |
227 | return r; | 225 | return r; |
228 | }; | 226 | }; |
229 | 227 | ||
230 | function byPseudo(cs, name, value){ | 228 | function byPseudo(cs, name, value){ |
231 | return Ext.DomQuery.pseudos[name](cs, value); | 229 | return Ext.DomQuery.pseudos[name](cs, value); |
232 | }; | 230 | }; |
233 | 231 | ||
234 | // This is for IE MSXML which does not support expandos. | 232 | // This is for IE MSXML which does not support expandos. |
235 | // IE runs the same speed using setAttribute, however FF slows way down | 233 | // IE runs the same speed using setAttribute, however FF slows way down |
236 | // and Safari completely fails so they need to continue to use expandos. | 234 | // and Safari completely fails so they need to continue to use expandos. |
237 | // Branched at load time for faster execution. | 235 | // Branched at load time for faster execution. |
238 | var isIE = window.ActiveXObject; | 236 | var isIE = window.ActiveXObject; |
239 | var addAttr = isIE ? | 237 | var addAttr = isIE ? |
240 | function(n, a, v){ | 238 | function(n, a, v){ |
241 | n.setAttribute(a, v); | 239 | n.setAttribute(a, v); |
242 | } : | 240 | } : |
243 | function(n, a, v){ | 241 | function(n, a, v){ |
244 | n[a] = v; | 242 | n[a] = v; |
245 | }; | 243 | }; |
246 | var getAttr = isIE ? | 244 | var getAttr = isIE ? |
247 | function(n, a){ | 245 | function(n, a){ |
248 | return n.getAttribute(a); | 246 | return n.getAttribute(a); |
249 | } : | 247 | } : |
250 | function(n, a){ | 248 | function(n, a){ |
251 | return n[a]; | 249 | return n[a]; |
252 | }; | 250 | }; |
253 | var clearAttr = isIE ? | 251 | var clearAttr = isIE ? |
254 | function(n, a){ | 252 | function(n, a){ |
255 | n.removeAttribute(a); | 253 | n.removeAttribute(a); |
256 | } : | 254 | } : |
257 | function(n, a, v){ | 255 | function(n, a, v){ |
258 | delete n[a]; | 256 | delete n[a]; |
259 | }; | 257 | }; |
260 | 258 | ||
261 | function nodup(cs){ | 259 | function nodup(cs){ |
262 | if(!cs.length){ | 260 | if(!cs.length){ |
263 | return cs; | 261 | return cs; |
264 | } | 262 | } |
265 | addAttr(cs[0], '_nodup', true); | 263 | addAttr(cs[0], '_nodup', true); |
266 | var r = [cs[0]]; | 264 | var r = [cs[0]]; |
267 | for(var i = 1, len = cs.length; i < len; i++){ | 265 | for(var i = 1, len = cs.length; i < len; i++){ |
268 | var c = cs[i]; | 266 | var c = cs[i]; |
269 | if(!getAttr(c, '_nodup')){ | 267 | if(!getAttr(c, '_nodup')){ |
270 | addAttr(c, '_nodup', true); | 268 | addAttr(c, '_nodup', true); |
271 | r[r.length] = c; | 269 | r[r.length] = c; |
272 | } | 270 | } |
273 | } | 271 | } |
274 | for(var i = 0, len = cs.length; i < len; i++){ | 272 | for(var i = 0, len = cs.length; i < len; i++){ |
275 | clearAttr(cs[i], '_nodup'); | 273 | clearAttr(cs[i], '_nodup'); |
276 | } | 274 | } |
277 | return r; | 275 | return r; |
278 | } | 276 | } |
279 | 277 | ||
280 | function quickDiff(c1, c2){ | 278 | function quickDiff(c1, c2){ |
281 | if(!c1.length){ | 279 | if(!c1.length){ |
282 | return c2; | 280 | return c2; |
283 | } | 281 | } |
284 | for(var i = 0, len = c1.length; i < len; i++){ | 282 | for(var i = 0, len = c1.length; i < len; i++){ |
285 | addAttr(c1[i], '_qdiff', true); | 283 | addAttr(c1[i], '_qdiff', true); |
286 | } | 284 | } |
287 | var r = []; | 285 | var r = []; |
288 | for(var i = 0, len = c2.length; i < len; i++){ | 286 | for(var i = 0, len = c2.length; i < len; i++){ |
289 | if(!getAttr(c2[i], '_qdiff')){ | 287 | if(!getAttr(c2[i], '_qdiff')){ |
290 | r[r.length] = c2[i]; | 288 | r[r.length] = c2[i]; |
291 | } | 289 | } |
292 | } | 290 | } |
293 | for(var i = 0, len = c1.length; i < len; i++){ | 291 | for(var i = 0, len = c1.length; i < len; i++){ |
294 | clearAttr(c1[i], '_qdiff'); | 292 | clearAttr(c1[i], '_qdiff'); |
295 | } | 293 | } |
296 | return r; | 294 | return r; |
297 | } | 295 | } |
298 | 296 | ||
299 | function quickId(ns, mode, root, id){ | 297 | function quickId(ns, mode, root, id){ |
300 | if(ns == root){ | 298 | if(ns == root){ |
301 | var d = root.ownerDocument || root; | 299 | var d = root.ownerDocument || root; |
302 | return d.getElementById(id); | 300 | return d.getElementById(id); |
303 | } | 301 | } |
304 | ns = getNodes(ns, mode, '*'); | 302 | ns = getNodes(ns, mode, '*'); |
305 | return byId(ns, null, id); | 303 | return byId(ns, null, id); |
306 | } | 304 | } |
307 | 305 | ||
308 | return { | 306 | return { |
309 | getStyle : function(el, name){ | 307 | getStyle : function(el, name){ |
310 | return YAHOO.util.Dom.getStyle(el, name); | 308 | return YAHOO.util.Dom.getStyle(el, name); |
311 | }, | 309 | }, |
312 | /** | 310 | /** |
313 | * Compiles a selector/xpath query into a reusable function. The returned function | 311 | * Compiles a selector/xpath query into a reusable function. The returned function |
314 | * takes one parameter "root" (optional), which is the context node from where the query should start. | 312 | * takes one parameter "root" (optional), which is the context node from where the query should start. |
315 | * @param {String} selector The selector/xpath query | 313 | * @param {String} selector The selector/xpath query |
316 | * @param {String} type (optional) Either 'select' (the default) or 'simple' for a simple selector match | 314 | * @param {String} type (optional) Either 'select' (the default) or 'simple' for a simple selector match |
317 | * @return {Function} | 315 | * @return {Function} |
318 | */ | 316 | */ |
319 | compile : function(path, type){ | 317 | compile : function(path, type){ |
320 | // strip leading slashes | 318 | // strip leading slashes |
321 | while(path.substr(0, 1)=='/'){ | 319 | while(path.substr(0, 1)=='/'){ |
322 | path = path.substr(1); | 320 | path = path.substr(1); |
323 | } | 321 | } |
324 | type = type || 'select'; | 322 | type = type || 'select'; |
325 | 323 | ||
326 | var fn = ['var f = function(root){\n var mode; var n = root || document;\n']; | 324 | var fn = ['var f = function(root){\n var mode; var n = root || document;\n']; |
327 | var q = path, mode, lq; | 325 | var q = path, mode, lq; |
328 | var tk = Ext.DomQuery.matchers; | 326 | var tk = Ext.DomQuery.matchers; |
329 | var tklen = tk.length; | 327 | var tklen = tk.length; |
330 | var mm; | 328 | var mm; |
331 | while(q && lq != q){ | 329 | while(q && lq != q){ |
332 | lq = q; | 330 | lq = q; |
333 | var tm = q.match(/^(#)?([\w-\*]+)/); | 331 | var tm = q.match(/^(#)?([\w-\*]+)/); |
334 | if(type == 'select'){ | 332 | if(type == 'select'){ |
335 | if(tm){ | 333 | if(tm){ |
336 | if(tm[1] == '#'){ | 334 | if(tm[1] == '#'){ |
337 | fn[fn.length] = 'n = quickId(n, mode, root, "'+tm[2]+'");'; | 335 | fn[fn.length] = 'n = quickId(n, mode, root, "'+tm[2]+'");'; |
338 | }else{ | 336 | }else{ |
339 | fn[fn.length] = 'n = getNodes(n, mode, "'+tm[2]+'");'; | 337 | fn[fn.length] = 'n = getNodes(n, mode, "'+tm[2]+'");'; |
340 | } | 338 | } |
341 | q = q.replace(tm[0], ''); | 339 | q = q.replace(tm[0], ''); |
342 | }else{ | 340 | }else{ |
343 | fn[fn.length] = 'n = getNodes(n, mode, "*");'; | 341 | fn[fn.length] = 'n = getNodes(n, mode, "*");'; |
344 | } | 342 | } |
345 | }else{ | 343 | }else{ |
346 | if(tm){ | 344 | if(tm){ |
347 | if(tm[1] == '#'){ | 345 | if(tm[1] == '#'){ |
348 | fn[fn.length] = 'n = byId(n, null, "'+tm[2]+'");'; | 346 | fn[fn.length] = 'n = byId(n, null, "'+tm[2]+'");'; |
349 | }else{ | 347 | }else{ |
350 | fn[fn.length] = 'n = byTag(n, "'+tm[2]+'");'; | 348 | fn[fn.length] = 'n = byTag(n, "'+tm[2]+'");'; |
351 | } | 349 | } |
352 | q = q.replace(tm[0], ''); | 350 | q = q.replace(tm[0], ''); |
353 | } | 351 | } |
354 | } | 352 | } |
355 | while(!(mm = q.match(modeRe))){ | 353 | while(!(mm = q.match(modeRe))){ |
356 | var matched = false; | 354 | var matched = false; |
357 | for(var j = 0; j < tklen; j++){ | 355 | for(var j = 0; j < tklen; j++){ |
358 | var t = tk[j]; | 356 | var t = tk[j]; |
359 | var m = q.match(t.re); | 357 | var m = q.match(t.re); |
360 | if(m){ | 358 | if(m){ |
361 | fn[fn.length] = t.select.replace(tplRe, function(x, i){ | 359 | fn[fn.length] = t.select.replace(tplRe, function(x, i){ |
362 | return m[i]; | 360 | return m[i]; |
363 | }); | 361 | }); |
364 | q = q.replace(m[0], ''); | 362 | q = q.replace(m[0], ''); |
365 | matched = true; | 363 | matched = true; |
366 | break; | 364 | break; |
367 | } | 365 | } |
368 | } | 366 | } |
369 | // prevent infinite loop on bad selector | 367 | // prevent infinite loop on bad selector |
370 | if(!matched){ | 368 | if(!matched){ |
371 | throw 'Error parsing selector, parsing failed at "' + q + '"'; | 369 | throw 'Error parsing selector, parsing failed at "' + q + '"'; |
372 | } | 370 | } |
373 | } | 371 | } |
374 | if(mm[1]){ | 372 | if(mm[1]){ |
375 | fn[fn.length] = 'mode="'+mm[1]+'";'; | 373 | fn[fn.length] = 'mode="'+mm[1]+'";'; |
376 | q = q.replace(mm[1], ''); | 374 | q = q.replace(mm[1], ''); |
377 | } | 375 | } |
378 | } | 376 | } |
379 | fn[fn.length] = 'return nodup(n);\n}'; | 377 | fn[fn.length] = 'return nodup(n);\n}'; |
380 | eval(fn.join('')); | 378 | eval(fn.join('')); |
381 | return f; | 379 | return f; |
382 | }, | 380 | }, |
383 | 381 | ||
384 | /** | 382 | /** |
385 | * Selects a group of elements. | 383 | * Selects a group of elements. |
386 | * @param {String} selector The selector/xpath query | 384 | * @param {String} selector The selector/xpath query |
387 | * @param {Node} root (optional) The start of the query (defaults to document). | 385 | * @param {Node} root (optional) The start of the query (defaults to document). |
388 | * @return {Array} | 386 | * @return {Array} |
389 | */ | 387 | */ |
390 | select : function(path, root, type){ | 388 | select : function(path, root, type){ |
391 | if(!root || root == document){ | 389 | if(!root || root == document){ |
392 | root = document; | 390 | root = document; |
393 | } | 391 | } |
394 | if(typeof root == 'string'){ | 392 | if(typeof root == 'string'){ |
395 | root = document.getElementById(root); | 393 | root = document.getElementById(root); |
396 | } | 394 | } |
397 | var paths = path.split(','); | 395 | var paths = path.split(','); |
398 | var results = []; | 396 | var results = []; |
399 | for(var i = 0, len = paths.length; i < len; i++){ | 397 | for(var i = 0, len = paths.length; i < len; i++){ |
400 | var p = paths[i].replace(trimRe, '$1'); | 398 | var p = paths[i].replace(trimRe, '$1'); |
401 | if(!cache[p]){ | 399 | if(!cache[p]){ |
402 | cache[p] = Ext.DomQuery.compile(p); | 400 | cache[p] = Ext.DomQuery.compile(p); |
403 | if(!cache[p]){ | 401 | if(!cache[p]){ |
404 | throw p + ' is not a valid selector'; | 402 | throw p + ' is not a valid selector'; |
405 | } | 403 | } |
406 | } | 404 | } |
diff --git a/frontend/beta/js/Clipperz/YUI/Drawer.js b/frontend/beta/js/Clipperz/YUI/Drawer.js index 508bfe5..2105363 100644 --- a/frontend/beta/js/Clipperz/YUI/Drawer.js +++ b/frontend/beta/js/Clipperz/YUI/Drawer.js | |||
@@ -1,235 +1,233 @@ | |||
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.YUI) == 'undefined') { Clipperz.YUI = {}; } | 25 | if (typeof(Clipperz.YUI) == 'undefined') { Clipperz.YUI = {}; } |
28 | 26 | ||
29 | 27 | ||
30 | Clipperz.YUI.Drawer = function(anElement, aRegion) { | 28 | Clipperz.YUI.Drawer = function(anElement, aRegion) { |
31 | this._status = 'slideIn'; | 29 | this._status = 'slideIn'; |
32 | 30 | ||
33 | this._element = YAHOO.ext.Element.get(anElement); | 31 | this._element = YAHOO.ext.Element.get(anElement); |
34 | this._region = aRegion || null; | 32 | this._region = aRegion || null; |
35 | 33 | ||
36 | this._collapsedElement = this.element().getChildrenByClassName("drawer-collapsed")[0]; | 34 | this._collapsedElement = this.element().getChildrenByClassName("drawer-collapsed")[0]; |
37 | this._contentElement = this.element().getChildrenByClassName("drawer-content")[0]; | 35 | this._contentElement = this.element().getChildrenByClassName("drawer-content")[0]; |
38 | 36 | ||
39 | 37 | ||
40 | this._wholeCollapedElement = this.enhanceCollapsedElement(); | 38 | this._wholeCollapedElement = this.enhanceCollapsedElement(); |
41 | this._wholeCollapedElement.setWidth(this.region().element().getWidth()); | 39 | this._wholeCollapedElement.setWidth(this.region().element().getWidth()); |
42 | this._wholeCollapedElement.setHeight(this.region().element().getHeight()); | 40 | this._wholeCollapedElement.setHeight(this.region().element().getHeight()); |
43 | 41 | ||
44 | this._contentWrapper = this.enhanceContentElement(); | 42 | this._contentWrapper = this.enhanceContentElement(); |
45 | this._contentElementActor = new YAHOO.ext.Actor(this.contentWrapper().dom); | 43 | this._contentElementActor = new YAHOO.ext.Actor(this.contentWrapper().dom); |
46 | this.contentElementActor().hide(); | 44 | this.contentElementActor().hide(); |
47 | 45 | ||
48 | this._contentWidth = 200; | 46 | this._contentWidth = 200; |
49 | }; | 47 | }; |
50 | 48 | ||
51 | YAHOO.extendX(Clipperz.YUI.Drawer, YAHOO.ext.util.Observable, { | 49 | YAHOO.extendX(Clipperz.YUI.Drawer, YAHOO.ext.util.Observable, { |
52 | 50 | ||
53 | 'element': function() { | 51 | 'element': function() { |
54 | return this._element; | 52 | return this._element; |
55 | }, | 53 | }, |
56 | 54 | ||
57 | //----------------------------------------------------- | 55 | //----------------------------------------------------- |
58 | 56 | ||
59 | 'status': function() { | 57 | 'status': function() { |
60 | return this._status; | 58 | return this._status; |
61 | }, | 59 | }, |
62 | 60 | ||
63 | 'setStatus': function(aValue) { | 61 | 'setStatus': function(aValue) { |
64 | this._status = aValue; | 62 | this._status = aValue; |
65 | }, | 63 | }, |
66 | 64 | ||
67 | //----------------------------------------------------- | 65 | //----------------------------------------------------- |
68 | 66 | ||
69 | 'collapsedElement': function() { | 67 | 'collapsedElement': function() { |
70 | return this._collapsedElement; | 68 | return this._collapsedElement; |
71 | }, | 69 | }, |
72 | 70 | ||
73 | //----------------------------------------------------- | 71 | //----------------------------------------------------- |
74 | 72 | ||
75 | 'contentElement': function() { | 73 | 'contentElement': function() { |
76 | return this._contentElement; | 74 | return this._contentElement; |
77 | }, | 75 | }, |
78 | 76 | ||
79 | //----------------------------------------------------- | 77 | //----------------------------------------------------- |
80 | 78 | ||
81 | 'contentElementActor': function() { | 79 | 'contentElementActor': function() { |
82 | return this._contentElementActor; | 80 | return this._contentElementActor; |
83 | }, | 81 | }, |
84 | 82 | ||
85 | //----------------------------------------------------- | 83 | //----------------------------------------------------- |
86 | 84 | ||
87 | 'contentWrapper': function() { | 85 | 'contentWrapper': function() { |
88 | return this._contentWrapper; | 86 | return this._contentWrapper; |
89 | }, | 87 | }, |
90 | 88 | ||
91 | //----------------------------------------------------- | 89 | //----------------------------------------------------- |
92 | 90 | ||
93 | 'contentWidth': function() { | 91 | 'contentWidth': function() { |
94 | return this._contentWidth; | 92 | return this._contentWidth; |
95 | }, | 93 | }, |
96 | 94 | ||
97 | //----------------------------------------------------- | 95 | //----------------------------------------------------- |
98 | 96 | ||
99 | 'region': function() { | 97 | 'region': function() { |
100 | return this._region; | 98 | return this._region; |
101 | }, | 99 | }, |
102 | 100 | ||
103 | //----------------------------------------------------- | 101 | //----------------------------------------------------- |
104 | 102 | ||
105 | 'enhanceCollapsedElement': function() { | 103 | 'enhanceCollapsedElement': function() { |
106 | varwrapper; | 104 | varwrapper; |
107 | var link; | 105 | var link; |
108 | 106 | ||
109 | wrapper = this.collapsedElement().wrap({tag:'div', cls:'drawer-collapsedElement-wrapper', children:[ | 107 | wrapper = this.collapsedElement().wrap({tag:'div', cls:'drawer-collapsedElement-wrapper', children:[ |
110 | {tag:'div', cls:'drawer-pin-button', children:[ | 108 | {tag:'div', cls:'drawer-pin-button', children:[ |
111 | {tag:'a', cls:'drawer-pin-button', href:"#", children:[ | 109 | {tag:'a', cls:'drawer-pin-button', href:"#", children:[ |
112 | {tag:'img', src:'./images/directLogins/drawer/mm-expand.gif'} | 110 | {tag:'img', src:'./images/directLogins/drawer/mm-expand.gif'} |
113 | ]} | 111 | ]} |
114 | ]} | 112 | ]} |
115 | ]}); | 113 | ]}); |
116 | 114 | ||
117 | link = wrapper.getChildrenByClassName('drawer-pin-button', 'a')[0]; | 115 | link = wrapper.getChildrenByClassName('drawer-pin-button', 'a')[0]; |
118 | MochiKit.Signal.connect(link.dom, 'onclick', this, 'pinDrawer'); | 116 | MochiKit.Signal.connect(link.dom, 'onclick', this, 'pinDrawer'); |
119 | 117 | ||
120 | this.collapsedElement().setHeight('100%'); | 118 | this.collapsedElement().setHeight('100%'); |
121 | this.collapsedElement().setStyle('cursor', 'pointer'); | 119 | this.collapsedElement().setStyle('cursor', 'pointer'); |
122 | MochiKit.Signal.connect(this.collapsedElement().dom, 'onclick', this, 'showDrawer'); | 120 | MochiKit.Signal.connect(this.collapsedElement().dom, 'onclick', this, 'showDrawer'); |
123 | 121 | ||
124 | return wrapper; | 122 | return wrapper; |
125 | }, | 123 | }, |
126 | 124 | ||
127 | //----------------------------------------------------- | 125 | //----------------------------------------------------- |
128 | 126 | ||
129 | 'enhanceContentElement': function() { | 127 | 'enhanceContentElement': function() { |
130 | var wrapper; | 128 | var wrapper; |
131 | 129 | ||
132 | wrapper = this.contentElement().wrap({tag:'div', cls:'drawer-content-wrapper', children:[ | 130 | wrapper = this.contentElement().wrap({tag:'div', cls:'drawer-content-wrapper', children:[ |
133 | {tag:'div', cls:'drawer-content-header', html:'direct login', style:'width:100%;'} | 131 | {tag:'div', cls:'drawer-content-header', html:'direct login', style:'width:100%;'} |
134 | ]}); | 132 | ]}); |
135 | 133 | ||
136 | MochiKit.Signal.connect(wrapper.dom, 'onclick', this, 'hideDrawer'); | 134 | MochiKit.Signal.connect(wrapper.dom, 'onclick', this, 'hideDrawer'); |
137 | return wrapper; | 135 | return wrapper; |
138 | }, | 136 | }, |
139 | 137 | ||
140 | //----------------------------------------------------- | 138 | //----------------------------------------------------- |
141 | 139 | ||
142 | 'pinDrawer': function() { | 140 | 'pinDrawer': function() { |
143 | alert("pin drawer"); | 141 | alert("pin drawer"); |
144 | }, | 142 | }, |
145 | 143 | ||
146 | //----------------------------------------------------- | 144 | //----------------------------------------------------- |
147 | 145 | ||
148 | 'showDrawer': function() { | 146 | 'showDrawer': function() { |
149 | if (this.status() == 'slideIn') { | 147 | if (this.status() == 'slideIn') { |
150 | var actor; | 148 | var actor; |
151 | 149 | ||
152 | this.setStatus('slidingOut'); | 150 | this.setStatus('slidingOut'); |
153 | actor = this.contentElementActor(); | 151 | actor = this.contentElementActor(); |
154 | actor.setHeight(this.region().element().getHeight()); | 152 | actor.setHeight(this.region().element().getHeight()); |
155 | 153 | ||
156 | actor.startCapture(true); | 154 | actor.startCapture(true); |
157 | actor.alignTo(this.element(), 'tr'); | 155 | actor.alignTo(this.element(), 'tr'); |
158 | actor.blindShow('left', this.contentWidth(), .35); | 156 | actor.blindShow('left', this.contentWidth(), .35); |
159 | actor.play(this.onSlideOut.createDelegate(this)); | 157 | actor.play(this.onSlideOut.createDelegate(this)); |
160 | } | 158 | } |
161 | }, | 159 | }, |
162 | 160 | ||
163 | //----------------------------------------------------- | 161 | //----------------------------------------------------- |
164 | 162 | ||
165 | 'onSlideOut': function() { | 163 | 'onSlideOut': function() { |
166 | this.setStatus('slideOut'); | 164 | this.setStatus('slideOut'); |
167 | MochiKit.Logging.logDebug(">>> onSlideOut"); | 165 | MochiKit.Logging.logDebug(">>> onSlideOut"); |
168 | // alert("done"); | 166 | // alert("done"); |
169 | }, | 167 | }, |
170 | 168 | ||
171 | //----------------------------------------------------- | 169 | //----------------------------------------------------- |
172 | /* | 170 | /* |
173 | 'showContentElement': function() { | 171 | 'showContentElement': function() { |
174 | var top, left, width, height; | 172 | var top, left, width, height; |
175 | 173 | ||
176 | MochiKit.Logging.logDebug(">>> showContentElement"); | 174 | MochiKit.Logging.logDebug(">>> showContentElement"); |
177 | 175 | ||
178 | 176 | ||
179 | top = this.element().getTop(true); | 177 | top = this.element().getTop(true); |
180 | left = this.element().getRight(); | 178 | left = this.element().getRight(); |
181 | width = this.contentWidth(); | 179 | width = this.contentWidth(); |
182 | height = this.element().getHeight(); | 180 | height = this.element().getHeight(); |
183 | 181 | ||
184 | this.contentWrapper().setStyle('position', 'absolute'); | 182 | this.contentWrapper().setStyle('position', 'absolute'); |
185 | this.contentWrapper().setStyle('overflow', 'none'); | 183 | this.contentWrapper().setStyle('overflow', 'none'); |
186 | this.contentWrapper().setStyle('visibility', 'visible'); | 184 | this.contentWrapper().setStyle('visibility', 'visible'); |
187 | this.contentWrapper().setStyle('z-index', '10'); | 185 | this.contentWrapper().setStyle('z-index', '10'); |
188 | 186 | ||
189 | this.contentWrapper().setLeft(left); | 187 | this.contentWrapper().setLeft(left); |
190 | this.contentWrapper().setTop(top); | 188 | this.contentWrapper().setTop(top); |
191 | this.contentWrapper().setHeight(height); | 189 | this.contentWrapper().setHeight(height); |
192 | this.contentWrapper().setWidth(width); | 190 | this.contentWrapper().setWidth(width); |
193 | 191 | ||
194 | this.contentWrapper().show(); | 192 | this.contentWrapper().show(); |
195 | }, | 193 | }, |
196 | */ | 194 | */ |
197 | //----------------------------------------------------- | 195 | //----------------------------------------------------- |
198 | 196 | ||
199 | 'hideDrawer': function() { | 197 | 'hideDrawer': function() { |
200 | if (this.status() == 'slideOut') { | 198 | if (this.status() == 'slideOut') { |
201 | var actor; | 199 | var actor; |
202 | 200 | ||
203 | this.setStatus('slidingIn'); | 201 | this.setStatus('slidingIn'); |
204 | 202 | ||
205 | actor = this.contentElementActor(); | 203 | actor = this.contentElementActor(); |
206 | actor.setHeight(this.region().element().getHeight()); | 204 | actor.setHeight(this.region().element().getHeight()); |
207 | 205 | ||
208 | actor.startCapture(true); | 206 | actor.startCapture(true); |
209 | actor.alignTo(this.element(), 'tr'); | 207 | actor.alignTo(this.element(), 'tr'); |
210 | actor.blindHide('left', .35); | 208 | actor.blindHide('left', .35); |
211 | actor.setVisible(false); | 209 | actor.setVisible(false); |
212 | actor.play(this.onSlideIn.createDelegate(this)); | 210 | actor.play(this.onSlideIn.createDelegate(this)); |
213 | } | 211 | } |
214 | }, | 212 | }, |
215 | 213 | ||
216 | //----------------------------------------------------- | 214 | //----------------------------------------------------- |
217 | 215 | ||
218 | 'onSlideIn': function() { | 216 | 'onSlideIn': function() { |
219 | this.setStatus('slideIn'); | 217 | this.setStatus('slideIn'); |
220 | MochiKit.Logging.logDebug(">>> onSlideIn"); | 218 | MochiKit.Logging.logDebug(">>> onSlideIn"); |
221 | // alert("done"); | 219 | // alert("done"); |
222 | }, | 220 | }, |
223 | 221 | ||
224 | //----------------------------------------------------- | 222 | //----------------------------------------------------- |
225 | 223 | ||
226 | 'hideContentElement': function() { | 224 | 'hideContentElement': function() { |
227 | this.contentWrapper().hide(); | 225 | this.contentWrapper().hide(); |
228 | }, | 226 | }, |
229 | 227 | ||
230 | //----------------------------------------------------- | 228 | //----------------------------------------------------- |
231 | //----------------------------------------------------- | 229 | //----------------------------------------------------- |
232 | 230 | ||
233 | //----------------------------------------------------- | 231 | //----------------------------------------------------- |
234 | __syntaxFix__: '__syntaxFix__' | 232 | __syntaxFix__: '__syntaxFix__' |
235 | }); \ No newline at end of file | 233 | }); \ No newline at end of file |
diff --git a/frontend/beta/js/Clipperz/YUI/IBLayoutManager.js b/frontend/beta/js/Clipperz/YUI/IBLayoutManager.js index 6e2138e..d6b5782 100644 --- a/frontend/beta/js/Clipperz/YUI/IBLayoutManager.js +++ b/frontend/beta/js/Clipperz/YUI/IBLayoutManager.js | |||
@@ -1,111 +1,109 @@ | |||
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.YUI) == 'undefined') { Clipperz.YUI = {}; } | 25 | if (typeof(Clipperz.YUI) == 'undefined') { Clipperz.YUI = {}; } |
28 | 26 | ||
29 | 27 | ||
30 | Clipperz.YUI.IBLayoutManager = function(container, config) { | 28 | Clipperz.YUI.IBLayoutManager = function(container, config) { |
31 | var regionName; | 29 | var regionName; |
32 | varelement; | 30 | varelement; |
33 | 31 | ||
34 | config = config || {}; | 32 | config = config || {}; |
35 | 33 | ||
36 | Clipperz.YUI.IBLayoutManager.superclass.constructor.call(this, container); | 34 | Clipperz.YUI.IBLayoutManager.superclass.constructor.call(this, container); |
37 | this.hideOnLayout = config.hideOnLayout || false; | 35 | this.hideOnLayout = config.hideOnLayout || false; |
38 | 36 | ||
39 | element = YAHOO.ext.Element.get(container); | 37 | element = YAHOO.ext.Element.get(container); |
40 | element.setStyle('position', 'absolute'); | 38 | element.setStyle('position', 'absolute'); |
41 | element.setStyle('overflow', 'hidden'); | 39 | element.setStyle('overflow', 'hidden'); |
42 | 40 | ||
43 | for (regionName in config.regions) { | 41 | for (regionName in config.regions) { |
44 | var newRegion; | 42 | var newRegion; |
45 | 43 | ||
46 | newRegion = new new Clipperz.YUI.IBLayoutRegion(this, regionName, config.regions[regionName]); | 44 | newRegion = new new Clipperz.YUI.IBLayoutRegion(this, regionName, config.regions[regionName]); |
47 | this.addRegion(regionName, newRegion); | 45 | this.addRegion(regionName, newRegion); |
48 | } | 46 | } |
49 | 47 | ||
50 | this.layout(); | 48 | this.layout(); |
51 | }; | 49 | }; |
52 | 50 | ||
53 | YAHOO.extendX(Clipperz.YUI.IBLayoutManager, YAHOO.ext.LayoutManager, { | 51 | YAHOO.extendX(Clipperz.YUI.IBLayoutManager, YAHOO.ext.LayoutManager, { |
54 | 52 | ||
55 | 'toString': function() { | 53 | 'toString': function() { |
56 | return "IBLayoutManager (" + this.el.id + ")"; | 54 | return "IBLayoutManager (" + this.el.id + ")"; |
57 | }, | 55 | }, |
58 | 56 | ||
59 | //----------------------------------------------------- | 57 | //----------------------------------------------------- |
60 | 58 | ||
61 | 'add': function(aName, aPanel) { | 59 | 'add': function(aName, aPanel) { |
62 | var regionName; | 60 | var regionName; |
63 | 61 | ||
64 | regionName = aName.toLowerCase(); | 62 | regionName = aName.toLowerCase(); |
65 | return this.regions[regionName].add(aPanel); | 63 | return this.regions[regionName].add(aPanel); |
66 | }, | 64 | }, |
67 | 65 | ||
68 | //----------------------------------------------------- | 66 | //----------------------------------------------------- |
69 | 67 | ||
70 | 'addRegion': function(aRegion) { | 68 | 'addRegion': function(aRegion) { |
71 | var regionName; | 69 | var regionName; |
72 | 70 | ||
73 | regionName = aRegion.name().toLowerCase(); | 71 | regionName = aRegion.name().toLowerCase(); |
74 | if (!this.regions[regionName]) { | 72 | if (!this.regions[regionName]) { |
75 | //MochiKit.Logging.logDebug("--- adding region with name: " + aRegion.name()); | 73 | //MochiKit.Logging.logDebug("--- adding region with name: " + aRegion.name()); |
76 | this.regions[regionName] = aRegion; | 74 | this.regions[regionName] = aRegion; |
77 | } else { | 75 | } else { |
78 | // ???? | 76 | // ???? |
79 | } | 77 | } |
80 | 78 | ||
81 | return aRegion; | 79 | return aRegion; |
82 | }, | 80 | }, |
83 | 81 | ||
84 | //----------------------------------------------------- | 82 | //----------------------------------------------------- |
85 | 83 | ||
86 | 'getRegion': function(target){ | 84 | 'getRegion': function(target){ |
87 | return this.regions[target.toLowerCase()]; | 85 | return this.regions[target.toLowerCase()]; |
88 | }, | 86 | }, |
89 | 87 | ||
90 | //----------------------------------------------------- | 88 | //----------------------------------------------------- |
91 | 89 | ||
92 | 'layout': function(){ | 90 | 'layout': function(){ |
93 | varregion; | 91 | varregion; |
94 | 92 | ||
95 | //MochiKit.Logging.logDebug(">>> IBLayoutManager.layout - regions: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(this.regions))); | 93 | //MochiKit.Logging.logDebug(">>> IBLayoutManager.layout - regions: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(this.regions))); |
96 | for (region in this.regions) { | 94 | for (region in this.regions) { |
97 | //MochiKit.Logging.logDebug("--- IBLayoutManager.layout - region: " + region); | 95 | //MochiKit.Logging.logDebug("--- IBLayoutManager.layout - region: " + region); |
98 | this.regions[region].layout(); | 96 | this.regions[region].layout(); |
99 | } | 97 | } |
100 | //MochiKit.Logging.logDebug("<<< IBLayoutManager.layout"); | 98 | //MochiKit.Logging.logDebug("<<< IBLayoutManager.layout"); |
101 | }, | 99 | }, |
102 | 100 | ||
103 | //----------------------------------------------------- | 101 | //----------------------------------------------------- |
104 | 102 | ||
105 | 'getSize': function() { | 103 | 'getSize': function() { |
106 | return this.el.getSize(); | 104 | return this.el.getSize(); |
107 | }, | 105 | }, |
108 | 106 | ||
109 | //----------------------------------------------------- | 107 | //----------------------------------------------------- |
110 | __syntaxFix__: '__syntaxFix__' | 108 | __syntaxFix__: '__syntaxFix__' |
111 | }); | 109 | }); |
diff --git a/frontend/beta/js/Clipperz/YUI/IBLayoutRegion.js b/frontend/beta/js/Clipperz/YUI/IBLayoutRegion.js index f8e0cb1..11b7a6c 100644 --- a/frontend/beta/js/Clipperz/YUI/IBLayoutRegion.js +++ b/frontend/beta/js/Clipperz/YUI/IBLayoutRegion.js | |||
@@ -1,246 +1,244 @@ | |||
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.YUI) == 'undefined') { Clipperz.YUI = {}; } | 25 | if (typeof(Clipperz.YUI) == 'undefined') { Clipperz.YUI = {}; } |
28 | 26 | ||
29 | 27 | ||
30 | Clipperz.YUI.IBLayoutRegion = function(aManager, aName, aConfig) { | 28 | Clipperz.YUI.IBLayoutRegion = function(aManager, aName, aConfig) { |
31 | this._configuration = aConfig; | 29 | this._configuration = aConfig; |
32 | 30 | ||
33 | //Clipperz.YUI.IBLayoutRegion.superclass.constructor.call(); | 31 | //Clipperz.YUI.IBLayoutRegion.superclass.constructor.call(); |
34 | Clipperz.YUI.IBLayoutRegion.superclass.constructor.call(this, aManager, aConfig, aName); | 32 | Clipperz.YUI.IBLayoutRegion.superclass.constructor.call(this, aManager, aConfig, aName); |
35 | }; | 33 | }; |
36 | 34 | ||
37 | YAHOO.extendX(Clipperz.YUI.IBLayoutRegion, YAHOO.ext.LayoutRegion, { | 35 | YAHOO.extendX(Clipperz.YUI.IBLayoutRegion, YAHOO.ext.LayoutRegion, { |
38 | 36 | ||
39 | 'toString': function() { | 37 | 'toString': function() { |
40 | return "IBLayoutRegion (" + this.name() + ")"; | 38 | return "IBLayoutRegion (" + this.name() + ")"; |
41 | }, | 39 | }, |
42 | 40 | ||
43 | //----------------------------------------------------- | 41 | //----------------------------------------------------- |
44 | 42 | ||
45 | 'name': function() { | 43 | 'name': function() { |
46 | return this.position; | 44 | return this.position; |
47 | }, | 45 | }, |
48 | 46 | ||
49 | //----------------------------------------------------- | 47 | //----------------------------------------------------- |
50 | 48 | ||
51 | 'manager': function() { | 49 | 'manager': function() { |
52 | return this.mgr; | 50 | return this.mgr; |
53 | }, | 51 | }, |
54 | 52 | ||
55 | 'configuration': function() { | 53 | 'configuration': function() { |
56 | return this._configuration; | 54 | return this._configuration; |
57 | }, | 55 | }, |
58 | 56 | ||
59 | //----------------------------------------------------- | 57 | //----------------------------------------------------- |
60 | 58 | ||
61 | 'getAttributeValue': function(anAttribute) { | 59 | 'getAttributeValue': function(anAttribute) { |
62 | var result; | 60 | var result; |
63 | 61 | ||
64 | switch(anAttribute) { | 62 | switch(anAttribute) { |
65 | case "top": | 63 | case "top": |
66 | result = this.element().getTop(); | 64 | result = this.element().getTop(); |
67 | break; | 65 | break; |
68 | case "left": | 66 | case "left": |
69 | result = this.element().getLeft(); | 67 | result = this.element().getLeft(); |
70 | break; | 68 | break; |
71 | case "bottom": | 69 | case "bottom": |
72 | result = this.element().getBottom(); | 70 | result = this.element().getBottom(); |
73 | break; | 71 | break; |
74 | case "right": | 72 | case "right": |
75 | result = this.element().getRight(); | 73 | result = this.element().getRight(); |
76 | break; | 74 | break; |
77 | case "height": | 75 | case "height": |
78 | result = this.element().getHeight(); | 76 | result = this.element().getHeight(); |
79 | break; | 77 | break; |
80 | case "width": | 78 | case "width": |
81 | result = this.element().getWidth(); | 79 | result = this.element().getWidth(); |
82 | break; | 80 | break; |
83 | } | 81 | } |
84 | //MochiKit.Logging.logDebug("--- " + this.name() + " [" + anAttribute + "] = " + result); | 82 | //MochiKit.Logging.logDebug("--- " + this.name() + " [" + anAttribute + "] = " + result); |
85 | 83 | ||
86 | return result; | 84 | return result; |
87 | }, | 85 | }, |
88 | 86 | ||
89 | //----------------------------------------------------- | 87 | //----------------------------------------------------- |
90 | 88 | ||
91 | 'normalizeConfigureValue': function(aConfigurationValue) { | 89 | 'normalizeConfigureValue': function(aConfigurationValue) { |
92 | var result; | 90 | var result; |
93 | 91 | ||
94 | //MochiKit.Logging.logDebug("--- normalizeConfigureValue - " + aConfigurationValue); | 92 | //MochiKit.Logging.logDebug("--- normalizeConfigureValue - " + aConfigurationValue); |
95 | if (typeof(aConfigurationValue) == 'number') { | 93 | if (typeof(aConfigurationValue) == 'number') { |
96 | result = aConfigurationValue; | 94 | result = aConfigurationValue; |
97 | } else if (aConfigurationValue == 'auto') { | 95 | } else if (aConfigurationValue == 'auto') { |
98 | result = aConfigurationValue; | 96 | result = aConfigurationValue; |
99 | } else { | 97 | } else { |
100 | var splitValues; | 98 | var splitValues; |
101 | var referenceValue; | 99 | var referenceValue; |
102 | var deltaValue; | 100 | var deltaValue; |
103 | var targetRegion; | 101 | var targetRegion; |
104 | var targetAttribute; | 102 | var targetAttribute; |
105 | 103 | ||
106 | splitValues = aConfigurationValue.split('+'); | 104 | splitValues = aConfigurationValue.split('+'); |
107 | referenceValue = Clipperz.Base.trim(splitValues[0]); | 105 | referenceValue = Clipperz.Base.trim(splitValues[0]); |
108 | deltaValue = Clipperz.Base.trim(splitValues[1] || ""); | 106 | deltaValue = Clipperz.Base.trim(splitValues[1] || ""); |
109 | 107 | ||
110 | splitValues = referenceValue.split('.'); | 108 | splitValues = referenceValue.split('.'); |
111 | targetRegion = splitValues[0]; | 109 | targetRegion = splitValues[0]; |
112 | targetAttribute = splitValues[1]; | 110 | targetAttribute = splitValues[1]; |
113 | 111 | ||
114 | //MochiKit.Logging.logDebug("> " + aConfigurationValue); | 112 | //MochiKit.Logging.logDebug("> " + aConfigurationValue); |
115 | //MochiKit.Logging.logDebug(">> manager: " + this.manager()); | 113 | //MochiKit.Logging.logDebug(">> manager: " + this.manager()); |
116 | //MochiKit.Logging.logDebug(">> targetRegion: " + targetRegion); | 114 | //MochiKit.Logging.logDebug(">> targetRegion: " + targetRegion); |
117 | //MochiKit.Logging.logDebug(">>> " + this.manager().getRegion(targetRegion)); | 115 | //MochiKit.Logging.logDebug(">>> " + this.manager().getRegion(targetRegion)); |
118 | targetValue = this.manager().getRegion(targetRegion).getAttributeValue(targetAttribute); | 116 | targetValue = this.manager().getRegion(targetRegion).getAttributeValue(targetAttribute); |
119 | //MochiKit.Logging.logDebug(">>>> " + targetRegion + "." + targetAttribute + " + " + deltaValue + " = " + targetValue); | 117 | //MochiKit.Logging.logDebug(">>>> " + targetRegion + "." + targetAttribute + " + " + deltaValue + " = " + targetValue); |
120 | 118 | ||
121 | result = targetValue + (deltaValue - 0); | 119 | result = targetValue + (deltaValue - 0); |
122 | 120 | ||
123 | //MochiKit.Logging.logDebug("<<< " + aConfigurationValue + " = " + result); | 121 | //MochiKit.Logging.logDebug("<<< " + aConfigurationValue + " = " + result); |
124 | } | 122 | } |
125 | 123 | ||
126 | return result; | 124 | return result; |
127 | }, | 125 | }, |
128 | 126 | ||
129 | 'normalizedConfiguration': function(aConfiguration) { | 127 | 'normalizedConfiguration': function(aConfiguration) { |
130 | varresult; | 128 | varresult; |
131 | varkey; | 129 | varkey; |
132 | 130 | ||
133 | result = {}; | 131 | result = {}; |
134 | 132 | ||
135 | //MochiKit.Logging.logDebug("--- normalizedConfiguration - keys: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(aConfiguration))); | 133 | //MochiKit.Logging.logDebug("--- normalizedConfiguration - keys: " + Clipperz.Base.serializeJSON(MochiKit.Base.keys(aConfiguration))); |
136 | for (key in aConfiguration) { | 134 | for (key in aConfiguration) { |
137 | if ((key == 'top') || (key == 'bottom') || (key == 'left') || (key == 'rigth') || (key == 'width') || (key == 'height')) { | 135 | if ((key == 'top') || (key == 'bottom') || (key == 'left') || (key == 'rigth') || (key == 'width') || (key == 'height')) { |
138 | result[key] = this.normalizeConfigureValue(aConfiguration[key]); | 136 | result[key] = this.normalizeConfigureValue(aConfiguration[key]); |
139 | } else { | 137 | } else { |
140 | result[key] = aConfiguration[key]; | 138 | result[key] = aConfiguration[key]; |
141 | } | 139 | } |
142 | } | 140 | } |
143 | 141 | ||
144 | return result; | 142 | return result; |
145 | }, | 143 | }, |
146 | 144 | ||
147 | //----------------------------------------------------- | 145 | //----------------------------------------------------- |
148 | 146 | ||
149 | 'element': function() { | 147 | 'element': function() { |
150 | return this.el; | 148 | return this.el; |
151 | }, | 149 | }, |
152 | 150 | ||
153 | //----------------------------------------------------- | 151 | //----------------------------------------------------- |
154 | /* | 152 | /* |
155 | 'hide': function() { | 153 | 'hide': function() { |
156 | MochiKit.Logging.logDebug(">>> IBLayoutManager.hide()") | 154 | MochiKit.Logging.logDebug(">>> IBLayoutManager.hide()") |
157 | Clipperz.YUI.IBLayoutRegion.superclass.hide.call(this); | 155 | Clipperz.YUI.IBLayoutRegion.superclass.hide.call(this); |
158 | }, | 156 | }, |
159 | */ | 157 | */ |
160 | //----------------------------------------------------- | 158 | //----------------------------------------------------- |
161 | /* | 159 | /* |
162 | 'add': function(aPanel) { | 160 | 'add': function(aPanel) { |
163 | Clipperz.YUI.IBLayoutRegion.superclass.add.call(this, aPanel); | 161 | Clipperz.YUI.IBLayoutRegion.superclass.add.call(this, aPanel); |
164 | aPanel.el.fitToParent(true); | 162 | aPanel.el.fitToParent(true); |
165 | }, | 163 | }, |
166 | */ | 164 | */ |
167 | //----------------------------------------------------- | 165 | //----------------------------------------------------- |
168 | 166 | ||
169 | 'updateBox': function(aBox) { | 167 | 'updateBox': function(aBox) { |
170 | //MochiKit.Logging.logDebug(">>> IBLayoutRegion.updateBox - " + aBox); | 168 | //MochiKit.Logging.logDebug(">>> IBLayoutRegion.updateBox - " + aBox); |
171 | Clipperz.YUI.IBLayoutRegion.superclass.updateBox.call(this, aBox); | 169 | Clipperz.YUI.IBLayoutRegion.superclass.updateBox.call(this, aBox); |
172 | }, | 170 | }, |
173 | 171 | ||
174 | //----------------------------------------------------- | 172 | //----------------------------------------------------- |
175 | 173 | ||
176 | 'layout': function() { | 174 | 'layout': function() { |
177 | vartop, left, bottom, right, width, height; | 175 | vartop, left, bottom, right, width, height; |
178 | varelement; | 176 | varelement; |
179 | var config; | 177 | var config; |
180 | var windowSize; | 178 | var windowSize; |
181 | var containerSize; | 179 | var containerSize; |
182 | 180 | ||
183 | //MochiKit.Logging.logDebug(">>> IBLayoutRegion.layout - " + this); | 181 | //MochiKit.Logging.logDebug(">>> IBLayoutRegion.layout - " + this); |
184 | config = this.normalizedConfiguration(this.configuration()); | 182 | config = this.normalizedConfiguration(this.configuration()); |
185 | element = this.element(); | 183 | element = this.element(); |
186 | // containerSize = this.manager().getSize(true); | 184 | // containerSize = this.manager().getSize(true); |
187 | containerSize = this.manager().getSize(false); | 185 | containerSize = this.manager().getSize(false); |
188 | windowSize = {width: YAHOO.util.Dom.getViewportWidth(), height: YAHOO.util.Dom.getViewportHeight()}; | 186 | windowSize = {width: YAHOO.util.Dom.getViewportWidth(), height: YAHOO.util.Dom.getViewportHeight()}; |
189 | 187 | ||
190 | // element.setStyle("position", "absolute"); | 188 | // element.setStyle("position", "absolute"); |
191 | // element.setStyle("overflow", "none"); | 189 | // element.setStyle("overflow", "none"); |
192 | 190 | ||
193 | if (typeof(config.top) == 'number') { | 191 | if (typeof(config.top) == 'number') { |
194 | top = config.top; | 192 | top = config.top; |
195 | 193 | ||
196 | if (typeof(config.bottom) == 'number') { | 194 | if (typeof(config.bottom) == 'number') { |
197 | height = containerSize.height - top - config.bottom; | 195 | height = containerSize.height - top - config.bottom; |
198 | } else if (typeof(config.height) == 'number') { | 196 | } else if (typeof(config.height) == 'number') { |
199 | height = config.height; | 197 | height = config.height; |
200 | } else { | 198 | } else { |
201 | //??? | 199 | //??? |
202 | } | 200 | } |
203 | } else { | 201 | } else { |
204 | if ((typeof(config.bottom) == 'number') && (typeof(config.height) == 'number')) { | 202 | if ((typeof(config.bottom) == 'number') && (typeof(config.height) == 'number')) { |
205 | top = containerSize.height - (config.height + config.bottom); | 203 | top = containerSize.height - (config.height + config.bottom); |
206 | height = config.height; | 204 | height = config.height; |
207 | } else if ((config.bottom == 'auto') && (typeof(config.height) == 'number')) { | 205 | } else if ((config.bottom == 'auto') && (typeof(config.height) == 'number')) { |
208 | top = ((containerSize.height - config.height) / 2); | 206 | top = ((containerSize.height - config.height) / 2); |
209 | height = config.height; | 207 | height = config.height; |
210 | } | 208 | } |
211 | } | 209 | } |
212 | 210 | ||
213 | if (typeof(config.left) == 'number') { | 211 | if (typeof(config.left) == 'number') { |
214 | left = config.left; | 212 | left = config.left; |
215 | 213 | ||
216 | if (typeof(config.right) == 'number') { | 214 | if (typeof(config.right) == 'number') { |
217 | width = (containerSize.width - left - config.right); | 215 | width = (containerSize.width - left - config.right); |
218 | } else if (typeof(config.width) == 'number') { | 216 | } else if (typeof(config.width) == 'number') { |
219 | width = config.width; | 217 | width = config.width; |
220 | } else { | 218 | } else { |
221 | //??? | 219 | //??? |
222 | } | 220 | } |
223 | } else { | 221 | } else { |
224 | if ((typeof(config.right) == 'number') && (typeof(config.width) == 'number')) { | 222 | if ((typeof(config.right) == 'number') && (typeof(config.width) == 'number')) { |
225 | left = containerSize.width - (config.width + config.right); | 223 | left = containerSize.width - (config.width + config.right); |
226 | width = config.width; | 224 | width = config.width; |
227 | } else if ((config.right == 'auto') && (typeof(config.width) == 'number')) { | 225 | } else if ((config.right == 'auto') && (typeof(config.width) == 'number')) { |
228 | left = ((containerSize.width - config.width) / 2); | 226 | left = ((containerSize.width - config.width) / 2); |
229 | width = config.width; | 227 | width = config.width; |
230 | } | 228 | } |
231 | } | 229 | } |
232 | //MochiKit.Logging.logDebug("--- setting position (top: " + top + ", left: " + left + ", width: " + width + ", height: " + height + ")"); | 230 | //MochiKit.Logging.logDebug("--- setting position (top: " + top + ", left: " + left + ", width: " + width + ", height: " + height + ")"); |
233 | element.setTop(top); | 231 | element.setTop(top); |
234 | element.setLeft(left); | 232 | element.setLeft(left); |
235 | element.setWidth(width); | 233 | element.setWidth(width); |
236 | element.setHeight(height); | 234 | element.setHeight(height); |
237 | 235 | ||
238 | if (this.activePanel != null) { | 236 | if (this.activePanel != null) { |
239 | this.activePanel.setSize(width, height); | 237 | this.activePanel.setSize(width, height); |
240 | } | 238 | } |
241 | //MochiKit.Logging.logDebug("<<< IBLayoutRegion.layout"); | 239 | //MochiKit.Logging.logDebug("<<< IBLayoutRegion.layout"); |
242 | }, | 240 | }, |
243 | 241 | ||
244 | //----------------------------------------------------- | 242 | //----------------------------------------------------- |
245 | __syntaxFix__: '__syntaxFix__' | 243 | __syntaxFix__: '__syntaxFix__' |
246 | }); | 244 | }); |
diff --git a/frontend/beta/js/Clipperz/YUI/MessageBox.js b/frontend/beta/js/Clipperz/YUI/MessageBox.js index c7b4702..8b8ca7f 100644 --- a/frontend/beta/js/Clipperz/YUI/MessageBox.js +++ b/frontend/beta/js/Clipperz/YUI/MessageBox.js | |||
@@ -1,262 +1,260 @@ | |||
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 | Clipperz.YUI.MessageBox = function(){ | 24 | Clipperz.YUI.MessageBox = function(){ |
27 | var dlg, opt, mask; | 25 | var dlg, opt, mask; |
28 | var bodyEl, msgEl, textboxEl, textareaEl, progressEl, pp; | 26 | var bodyEl, msgEl, textboxEl, textareaEl, progressEl, pp; |
29 | var buttons, activeTextEl, bwidth; | 27 | var buttons, activeTextEl, bwidth; |
30 | 28 | ||
31 | var handleButton = function(button){ | 29 | var handleButton = function(button){ |
32 | if(typeof opt.fn == 'function'){ | 30 | if(typeof opt.fn == 'function'){ |
33 | if(opt.fn.call(opt.scope||window, button, activeTextEl.dom.value) !== false){ | 31 | if(opt.fn.call(opt.scope||window, button, activeTextEl.dom.value) !== false){ |
34 | dlg.hide(); | 32 | dlg.hide(); |
35 | } | 33 | } |
36 | }else{ | 34 | }else{ |
37 | dlg.hide(); | 35 | dlg.hide(); |
38 | } | 36 | } |
39 | }; | 37 | }; |
40 | 38 | ||
41 | return { | 39 | return { |
42 | updateButtons: function(b){ | 40 | updateButtons: function(b){ |
43 | var width = 0; | 41 | var width = 0; |
44 | if(!b){ | 42 | if(!b){ |
45 | buttons['ok'].hide(); | 43 | buttons['ok'].hide(); |
46 | buttons['cancel'].hide(); | 44 | buttons['cancel'].hide(); |
47 | buttons['yes'].hide(); | 45 | buttons['yes'].hide(); |
48 | buttons['no'].hide(); | 46 | buttons['no'].hide(); |
49 | return width; | 47 | return width; |
50 | } | 48 | } |
51 | for(var k in buttons){ | 49 | for(var k in buttons){ |
52 | if(typeof buttons[k] != 'function'){ | 50 | if(typeof buttons[k] != 'function'){ |
53 | if(b[k]){ | 51 | if(b[k]){ |
54 | buttons[k].show(); | 52 | buttons[k].show(); |
55 | buttons[k].setText(typeof b[k] == 'string' ? b[k] : YAHOO.ext.MessageBox.buttonText[k]); | 53 | buttons[k].setText(typeof b[k] == 'string' ? b[k] : YAHOO.ext.MessageBox.buttonText[k]); |
56 | width += buttons[k].el.getWidth()+15; | 54 | width += buttons[k].el.getWidth()+15; |
57 | }else{ | 55 | }else{ |
58 | buttons[k].hide(); | 56 | buttons[k].hide(); |
59 | } | 57 | } |
60 | } | 58 | } |
61 | } | 59 | } |
62 | return width; | 60 | return width; |
63 | }, | 61 | }, |
64 | 62 | ||
65 | getDialog : function(){ | 63 | getDialog : function(){ |
66 | if(!dlg){ | 64 | if(!dlg){ |
67 | dlg = new YAHOO.ext.BasicDialog('mb-dlg', { | 65 | dlg = new YAHOO.ext.BasicDialog('mb-dlg', { |
68 | autoCreate:true, | 66 | autoCreate:true, |
69 | shadow:true, | 67 | shadow:true, |
70 | draggable:true, | 68 | draggable:true, |
71 | resizable:false, | 69 | resizable:false, |
72 | constraintoviewport:true, | 70 | constraintoviewport:true, |
73 | fixedcenter:true, | 71 | fixedcenter:true, |
74 | shim:true, | 72 | shim:true, |
75 | modal:true, | 73 | modal:true, |
76 | width:400, height:100, | 74 | width:400, height:100, |
77 | buttonAlign:'center', | 75 | buttonAlign:'center', |
78 | closeClick : function(){ | 76 | closeClick : function(){ |
79 | if(opt && opt.buttons && opt.buttons.no && !opt.buttons.cancel){ | 77 | if(opt && opt.buttons && opt.buttons.no && !opt.buttons.cancel){ |
80 | handleButton('no'); | 78 | handleButton('no'); |
81 | }else{ | 79 | }else{ |
82 | handleButton('cancel'); | 80 | handleButton('cancel'); |
83 | } | 81 | } |
84 | } | 82 | } |
85 | }); | 83 | }); |
86 | dlg.closeClick = function(){ | 84 | dlg.closeClick = function(){ |
87 | alert('wtf'); | 85 | alert('wtf'); |
88 | }; | 86 | }; |
89 | mask = dlg.mask; | 87 | mask = dlg.mask; |
90 | dlg.addKeyListener(27, dlg.hide, dlg); | 88 | dlg.addKeyListener(27, dlg.hide, dlg); |
91 | buttons = {}; | 89 | buttons = {}; |
92 | buttons['ok'] = dlg.addButton(this.buttonText['ok'], handleButton.createCallback('ok')); | 90 | buttons['ok'] = dlg.addButton(this.buttonText['ok'], handleButton.createCallback('ok')); |
93 | buttons['yes'] = dlg.addButton(this.buttonText['yes'], handleButton.createCallback('yes')); | 91 | buttons['yes'] = dlg.addButton(this.buttonText['yes'], handleButton.createCallback('yes')); |
94 | buttons['no'] = dlg.addButton(this.buttonText['no'], handleButton.createCallback('no')); | 92 | buttons['no'] = dlg.addButton(this.buttonText['no'], handleButton.createCallback('no')); |
95 | buttons['cancel'] = dlg.addButton(this.buttonText['cancel'], handleButton.createCallback('cancel')); | 93 | buttons['cancel'] = dlg.addButton(this.buttonText['cancel'], handleButton.createCallback('cancel')); |
96 | bodyEl = dlg.body.createChild({ | 94 | bodyEl = dlg.body.createChild({ |
97 | tag:'div', | 95 | tag:'div', |
98 | html:'<span class="ext-mb-text"></span><br /><input type="text" class="ext-mb-input"><textarea class="ext-mb-textarea"></textarea><div class="ext-mb-progress-wrap"><div class="ext-mb-progress"><div class="ext-mb-progress-bar"> </div></div></div>' | 96 | html:'<span class="ext-mb-text"></span><br /><input type="text" class="ext-mb-input"><textarea class="ext-mb-textarea"></textarea><div class="ext-mb-progress-wrap"><div class="ext-mb-progress"><div class="ext-mb-progress-bar"> </div></div></div>' |
99 | }); | 97 | }); |
100 | msgEl = bodyEl.dom.firstChild; | 98 | msgEl = bodyEl.dom.firstChild; |
101 | textboxEl = getEl(bodyEl.dom.childNodes[2]); | 99 | textboxEl = getEl(bodyEl.dom.childNodes[2]); |
102 | textboxEl.enableDisplayMode(); | 100 | textboxEl.enableDisplayMode(); |
103 | textboxEl.addKeyListener([10,13], function(){ | 101 | textboxEl.addKeyListener([10,13], function(){ |
104 | if(dlg.isVisible() && opt && opt.buttons){ | 102 | if(dlg.isVisible() && opt && opt.buttons){ |
105 | if(opt.buttons.ok){ | 103 | if(opt.buttons.ok){ |
106 | handleButton('ok'); | 104 | handleButton('ok'); |
107 | }else if(opt.buttons.yes){ | 105 | }else if(opt.buttons.yes){ |
108 | handleButton('yes'); | 106 | handleButton('yes'); |
109 | } | 107 | } |
110 | } | 108 | } |
111 | }); | 109 | }); |
112 | textareaEl = getEl(bodyEl.dom.childNodes[3]); | 110 | textareaEl = getEl(bodyEl.dom.childNodes[3]); |
113 | textareaEl.enableDisplayMode(); | 111 | textareaEl.enableDisplayMode(); |
114 | progressEl = getEl(bodyEl.dom.childNodes[4]); | 112 | progressEl = getEl(bodyEl.dom.childNodes[4]); |
115 | progressEl.enableDisplayMode(); | 113 | progressEl.enableDisplayMode(); |
116 | pp = getEl(progressEl.dom.firstChild.firstChild); | 114 | pp = getEl(progressEl.dom.firstChild.firstChild); |
117 | } | 115 | } |
118 | return dlg; | 116 | return dlg; |
119 | }, | 117 | }, |
120 | 118 | ||
121 | updateText : function(text){ | 119 | updateText : function(text){ |
122 | if(!dlg.isVisible() && !opt.width){ | 120 | if(!dlg.isVisible() && !opt.width){ |
123 | dlg.resizeTo(this.maxWidth, 100); // resize first so content is never clipped from previous shows | 121 | dlg.resizeTo(this.maxWidth, 100); // resize first so content is never clipped from previous shows |
124 | } | 122 | } |
125 | msgEl.innerHTML = text; | 123 | msgEl.innerHTML = text; |
126 | var w = Math.max(Math.min(opt.width || msgEl.offsetWidth, this.maxWidth), | 124 | var w = Math.max(Math.min(opt.width || msgEl.offsetWidth, this.maxWidth), |
127 | Math.max(opt.minWidth || this.minWidth, bwidth)); | 125 | Math.max(opt.minWidth || this.minWidth, bwidth)); |
128 | if(opt.prompt){ | 126 | if(opt.prompt){ |
129 | activeTextEl.setWidth(w); | 127 | activeTextEl.setWidth(w); |
130 | } | 128 | } |
131 | dlg.setContentSize(w, bodyEl.getHeight()); | 129 | dlg.setContentSize(w, bodyEl.getHeight()); |
132 | }, | 130 | }, |
133 | 131 | ||
134 | updateProgress : function(value, text){ | 132 | updateProgress : function(value, text){ |
135 | if(text){ | 133 | if(text){ |
136 | this.updateText(text); | 134 | this.updateText(text); |
137 | } | 135 | } |
138 | pp.setWidth(value*progressEl.dom.firstChild.offsetWidth); | 136 | pp.setWidth(value*progressEl.dom.firstChild.offsetWidth); |
139 | }, | 137 | }, |
140 | 138 | ||
141 | isVisible : function(){ | 139 | isVisible : function(){ |
142 | return dlg && dlg.isVisible(); | 140 | return dlg && dlg.isVisible(); |
143 | }, | 141 | }, |
144 | 142 | ||
145 | hide : function(){ | 143 | hide : function(){ |
146 | if(this.isVisible()){ | 144 | if(this.isVisible()){ |
147 | dlg.hide(); | 145 | dlg.hide(); |
148 | } | 146 | } |
149 | }, | 147 | }, |
150 | 148 | ||
151 | show : function(options){ | 149 | show : function(options){ |
152 | var d = this.getDialog(); | 150 | var d = this.getDialog(); |
153 | opt = options; | 151 | opt = options; |
154 | d.setTitle(opt.title || ' '); | 152 | d.setTitle(opt.title || ' '); |
155 | d.close.setDisplayed(opt.closable !== false); | 153 | d.close.setDisplayed(opt.closable !== false); |
156 | activeTextEl = textboxEl; | 154 | activeTextEl = textboxEl; |
157 | opt.prompt = opt.prompt || (opt.multiline ? true : false) | 155 | opt.prompt = opt.prompt || (opt.multiline ? true : false) |
158 | if(opt.prompt){ | 156 | if(opt.prompt){ |
159 | if(opt.multiline){ | 157 | if(opt.multiline){ |
160 | textboxEl.hide(); | 158 | textboxEl.hide(); |
161 | textareaEl.show(); | 159 | textareaEl.show(); |
162 | textareaEl.setHeight(typeof opt.multiline == 'number' ? | 160 | textareaEl.setHeight(typeof opt.multiline == 'number' ? |
163 | opt.multiline : this.defaultTextHeight); | 161 | opt.multiline : this.defaultTextHeight); |
164 | activeTextEl = textareaEl; | 162 | activeTextEl = textareaEl; |
165 | }else{ | 163 | }else{ |
166 | textboxEl.show(); | 164 | textboxEl.show(); |
167 | textareaEl.hide(); | 165 | textareaEl.hide(); |
168 | } | 166 | } |
169 | }else{ | 167 | }else{ |
170 | textboxEl.hide(); | 168 | textboxEl.hide(); |
171 | textareaEl.hide(); | 169 | textareaEl.hide(); |
172 | } | 170 | } |
173 | progressEl.setDisplayed(opt.progress === true); | 171 | progressEl.setDisplayed(opt.progress === true); |
174 | this.updateProgress(0); | 172 | this.updateProgress(0); |
175 | activeTextEl.dom.value = opt.value || ''; | 173 | activeTextEl.dom.value = opt.value || ''; |
176 | if(opt.prompt){ | 174 | if(opt.prompt){ |
177 | dlg.setDefaultButton(activeTextEl); | 175 | dlg.setDefaultButton(activeTextEl); |
178 | }else{ | 176 | }else{ |
179 | var bs = opt.buttons; | 177 | var bs = opt.buttons; |
180 | var db = null; | 178 | var db = null; |
181 | if(bs && bs.ok){ | 179 | if(bs && bs.ok){ |
182 | db = buttons['ok']; | 180 | db = buttons['ok']; |
183 | }else if(bs && bs.yes){ | 181 | }else if(bs && bs.yes){ |
184 | db = buttons['yes']; | 182 | db = buttons['yes']; |
185 | } | 183 | } |
186 | dlg.setDefaultButton(db); | 184 | dlg.setDefaultButton(db); |
187 | } | 185 | } |
188 | bwidth = this.updateButtons(opt.buttons); | 186 | bwidth = this.updateButtons(opt.buttons); |
189 | this.updateText(opt.msg); | 187 | this.updateText(opt.msg); |
190 | d.modal = opt.modal !== false; | 188 | d.modal = opt.modal !== false; |
191 | d.mask = opt.modal !== false ? mask : false; | 189 | d.mask = opt.modal !== false ? mask : false; |
192 | d.animateTarget = null; | 190 | d.animateTarget = null; |
193 | d.show(options.animEl); | 191 | d.show(options.animEl); |
194 | }, | 192 | }, |
195 | 193 | ||
196 | progress : function(title, msg){ | 194 | progress : function(title, msg){ |
197 | this.show({ | 195 | this.show({ |
198 | title : title, | 196 | title : title, |
199 | msg : msg, | 197 | msg : msg, |
200 | buttons: false, | 198 | buttons: false, |
201 | progress:true, | 199 | progress:true, |
202 | closable:false | 200 | closable:false |
203 | }); | 201 | }); |
204 | }, | 202 | }, |
205 | 203 | ||
206 | progressElement : function() { | 204 | progressElement : function() { |
207 | return progressEl; | 205 | return progressEl; |
208 | }, | 206 | }, |
209 | 207 | ||
210 | opt: function() { | 208 | opt: function() { |
211 | return opt; | 209 | return opt; |
212 | }, | 210 | }, |
213 | 211 | ||
214 | alert : function(title, msg, fn, scope){ | 212 | alert : function(title, msg, fn, scope){ |
215 | this.show({ | 213 | this.show({ |
216 | title : title, | 214 | title : title, |
217 | msg : msg, | 215 | msg : msg, |
218 | buttons: this.OK, | 216 | buttons: this.OK, |
219 | fn: fn, | 217 | fn: fn, |
220 | scope : scope | 218 | scope : scope |
221 | }); | 219 | }); |
222 | }, | 220 | }, |
223 | 221 | ||
224 | confirm : function(title, msg, fn, scope){ | 222 | confirm : function(title, msg, fn, scope){ |
225 | this.show({ | 223 | this.show({ |
226 | title : title, | 224 | title : title, |
227 | msg : msg, | 225 | msg : msg, |
228 | buttons: this.YESNO, | 226 | buttons: this.YESNO, |
229 | fn: fn, | 227 | fn: fn, |
230 | scope : scope | 228 | scope : scope |
231 | }); | 229 | }); |
232 | }, | 230 | }, |
233 | 231 | ||
234 | prompt : function(title, msg, fn, scope, multiline){ | 232 | prompt : function(title, msg, fn, scope, multiline){ |
235 | this.show({ | 233 | this.show({ |
236 | title : title, | 234 | title : title, |
237 | msg : msg, | 235 | msg : msg, |
238 | buttons: this.OKCANCEL, | 236 | buttons: this.OKCANCEL, |
239 | fn: fn, | 237 | fn: fn, |
240 | minWidth:250, | 238 | minWidth:250, |
241 | scope : scope, | 239 | scope : scope, |
242 | prompt:true, | 240 | prompt:true, |
243 | multiline: multiline | 241 | multiline: multiline |
244 | }); | 242 | }); |
245 | }, | 243 | }, |
246 | 244 | ||
247 | OK : {ok:true}, | 245 | OK : {ok:true}, |
248 | YESNO : {yes:true, no:true}, | 246 | YESNO : {yes:true, no:true}, |
249 | OKCANCEL : {ok:true, cancel:true}, | 247 | OKCANCEL : {ok:true, cancel:true}, |
250 | YESNOCANCEL : {yes:true, no:true, cancel:true}, | 248 | YESNOCANCEL : {yes:true, no:true, cancel:true}, |
251 | 249 | ||
252 | defaultTextHeight:75, | 250 | defaultTextHeight:75, |
253 | maxWidth : 500, | 251 | maxWidth : 500, |
254 | minWidth : 100, | 252 | minWidth : 100, |
255 | buttonText : { | 253 | buttonText : { |
256 | ok : 'OK', | 254 | ok : 'OK', |
257 | cancel : 'Cancel', | 255 | cancel : 'Cancel', |
258 | yes : 'Yes', | 256 | yes : 'Yes', |
259 | no : 'No' | 257 | no : 'No' |
260 | } | 258 | } |
261 | }; | 259 | }; |
262 | }(); | 260 | }(); |