summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/YUI/Utils.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Clipperz/YUI/Utils.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/YUI/Utils.js98
1 files changed, 98 insertions, 0 deletions
diff --git a/frontend/gamma/js/Clipperz/YUI/Utils.js b/frontend/gamma/js/Clipperz/YUI/Utils.js
new file mode 100644
index 0000000..4d4a5f9
--- a/dev/null
+++ b/frontend/gamma/js/Clipperz/YUI/Utils.js
@@ -0,0 +1,98 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz's Javascript Crypto Library.
6Javascript Crypto Library provides web developers with an extensive
7and efficient set of cryptographic functions. The library aims to
8obtain maximum execution speed while preserving modularity and
9reusability.
10For further information about its features and functionalities please
11refer to http://www.clipperz.com
12
13* Javascript Crypto Library is free software: you can redistribute
14 it and/or modify it under the terms of the GNU Affero General Public
15 License as published by the Free Software Foundation, either version
16 3 of the License, or (at your option) any later version.
17
18* Javascript Crypto Library is distributed in the hope that it will
19 be useful, but WITHOUT ANY WARRANTY; without even the implied
20 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 See the GNU Affero General Public License for more details.
22
23* You should have received a copy of the GNU Affero General Public
24 License along with Javascript Crypto Library. If not, see
25 <http://www.gnu.org/licenses/>.
26
27*/
28
29if (typeof YAHOO == 'undefined') { YAHOO = {}; };
30if (typeof YAHOO.util == 'undefined') { YAHOO.util = {}; };
31if (typeof YAHOO.util.Dom == 'undefined') { YAHOO.util.Dom = {}; };
32
33YAHOO.extend = function(subc, superc, overrides) {
34 var F = function() {};
35 F.prototype=superc.prototype;
36 subc.prototype=new F();
37 subc.prototype.constructor=subc;
38 subc.superclass=superc.prototype;
39 if (superc.prototype.constructor == Object.prototype.constructor) {
40 superc.prototype.constructor=superc;
41 }
42
43 if (overrides) {
44 for (var i in overrides) {
45 subc.prototype[i]=overrides[i];
46 }
47 }
48};
49
50YAHOO.override = function(origclass, overrides){
51 if(overrides){
52 var p = origclass.prototype;
53 for(var method in overrides){
54 p[method] = overrides[method];
55 }
56 }
57};
58
59YAHOO.extendX = function(subclass, superclass, overrides){
60 YAHOO.extend(subclass, superclass);
61 subclass.override = function(o){
62 YAHOO.override(subclass, o);
63 };
64 if(!subclass.prototype.override){
65 subclass.prototype.override = function(o){
66 for(var method in o){
67 this[method] = o[method];
68 }
69 };
70 }
71 if(overrides){
72 subclass.override(overrides);
73 };
74
75};
76
77YAHOO.util.Dom.get = function(el) {
78 if (!el) { return null; } // nothing to work with
79
80 if (typeof el != 'string' && !(el instanceof Array) ) { // assuming HTMLElement or HTMLCollection, so pass back as is
81 return el;
82 }
83
84 if (typeof el == 'string') { // ID
85 return document.getElementById(el);
86 }
87 else { // array of ID's and/or elements
88 var collection = [];
89 for (var i = 0, len = el.length; i < len; ++i) {
90 collection[collection.length] = YAHOO.util.Dom.get(el[i]);
91 }
92
93 return collection;
94 }
95
96 return null; // safety, should never happen
97};
98