author | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2011-10-02 23:56:18 (UTC) |
---|---|---|
committer | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2011-10-02 23:56:18 (UTC) |
commit | ef68436ac04da078ffdcacd7e1f785473a303d45 (patch) (unidiff) | |
tree | c403752d66a2c4775f00affd4fa8431b29c5b68c /frontend/gamma/js/Clipperz/YUI/Utils.js | |
parent | 597ecfbc0249d83e1b856cbd558340c01237a360 (diff) | |
download | clipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.zip clipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.tar.gz clipperz-ef68436ac04da078ffdcacd7e1f785473a303d45.tar.bz2 |
First version of the newly restructured repository
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.js | 98 |
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 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz's Javascript Crypto Library. | ||
6 | Javascript Crypto Library provides web developers with an extensive | ||
7 | and efficient set of cryptographic functions. The library aims to | ||
8 | obtain maximum execution speed while preserving modularity and | ||
9 | reusability. | ||
10 | For further information about its features and functionalities please | ||
11 | refer 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 | |||
29 | if (typeof YAHOO == 'undefined') { YAHOO = {}; }; | ||
30 | if (typeof YAHOO.util == 'undefined') { YAHOO.util = {}; }; | ||
31 | if (typeof YAHOO.util.Dom == 'undefined') { YAHOO.util.Dom = {}; }; | ||
32 | |||
33 | YAHOO.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 | |||
50 | YAHOO.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 | |||
59 | YAHOO.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 | |||
77 | YAHOO.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 | |||