Diffstat (limited to 'frontend/gamma/js/Clipperz/YUI') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/YUI/DomHelper.js | 29 | ||||
-rw-r--r-- | frontend/gamma/js/Clipperz/YUI/DomQuery.js | 22 | ||||
-rw-r--r-- | frontend/gamma/js/Clipperz/YUI/Utils.js | 22 |
3 files changed, 31 insertions, 42 deletions
diff --git a/frontend/gamma/js/Clipperz/YUI/DomHelper.js b/frontend/gamma/js/Clipperz/YUI/DomHelper.js index 87c74f5..0a1f9fe 100644 --- a/frontend/gamma/js/Clipperz/YUI/DomHelper.js +++ b/frontend/gamma/js/Clipperz/YUI/DomHelper.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 | 27 | ||
30 | /** | 28 | /** |
31 | * @class Clipperz.ext.DomHelper | 29 | * @class Clipperz.ext.DomHelper |
32 | * Utility class for working with DOM and/or Templates. It transparently supports using HTML fragments or DOM. | 30 | * Utility class for working with DOM and/or Templates. It transparently supports using HTML fragments or DOM. |
33 | * 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>. | 31 | * 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>. |
34 | * @singleton | 32 | * @singleton |
35 | */ | 33 | */ |
36 | Clipperz.YUI.DomHelper = new function(){ | 34 | Clipperz.YUI.DomHelper = new function(){ |
37 | /**@private*/ | 35 | /**@private*/ |
38 | var d = document; | 36 | var d = document; |
39 | var tempTableEl = null; | 37 | var tempTableEl = null; |
40 | /** True to force the use of DOM instead of html fragments @type Boolean */ | 38 | /** True to force the use of DOM instead of html fragments @type Boolean */ |
41 | this.useDom = false; | 39 | this.useDom = false; |
42 | 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; | 40 | 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; |
43 | /** | 41 | /** |
44 | * Applies a style specification to an element | 42 | * Applies a style specification to an element |
45 | * @param {String/HTMLElement} el The element to apply styles to | 43 | * @param {String/HTMLElement} el The element to apply styles to |
46 | * @param {String/Object/Function} styles A style specification string eg "width:100px", or object in the form {width:"100px"}, or | 44 | * @param {String/Object/Function} styles A style specification string eg "width:100px", or object in the form {width:"100px"}, or |
47 | * a function which returns such a specification. | 45 | * a function which returns such a specification. |
48 | */ | 46 | */ |
49 | this.applyStyles = function(el, styles){ | 47 | this.applyStyles = function(el, styles){ |
50 | if(styles){ | 48 | if(styles){ |
51 | var D = YAHOO.util.Dom; | 49 | var D = YAHOO.util.Dom; |
52 | if (typeof styles == "string"){ | 50 | if (typeof styles == "string"){ |
53 | var re = /\s?([a-z\-]*)\:([^;]*);?/gi; | 51 | var re = /\s?([a-z\-]*)\:([^;]*);?/gi; |
54 | var matches; | 52 | var matches; |
55 | while ((matches = re.exec(styles)) != null){ | 53 | while ((matches = re.exec(styles)) != null){ |
56 | D.setStyle(el, matches[1], matches[2]); | 54 | D.setStyle(el, matches[1], matches[2]); |
57 | } | 55 | } |
58 | }else if (typeof styles == "object"){ | 56 | }else if (typeof styles == "object"){ |
59 | for (var style in styles){ | 57 | for (var style in styles){ |
60 | D.setStyle(el, style, styles[style]); | 58 | D.setStyle(el, style, styles[style]); |
61 | } | 59 | } |
62 | }else if (typeof styles == "function"){ | 60 | }else if (typeof styles == "function"){ |
63 | Clipperz.YUI.DomHelper.applyStyles(el, styles.call()); | 61 | Clipperz.YUI.DomHelper.applyStyles(el, styles.call()); |
64 | } | 62 | } |
65 | } | 63 | } |
66 | }; | 64 | }; |
67 | 65 | ||
68 | // build as innerHTML where available | 66 | // build as innerHTML where available |
69 | /** @ignore */ | 67 | /** @ignore */ |
70 | var createHtml = function(o){ | 68 | var createHtml = function(o){ |
@@ -395,84 +393,79 @@ Clipperz.YUI.DomHelper.Template.prototype = { | |||
395 | /** | 393 | /** |
396 | * Compiles the template into an internal function, eliminating the RegEx overhead | 394 | * Compiles the template into an internal function, eliminating the RegEx overhead |
397 | */ | 395 | */ |
398 | compile : function(){ | 396 | compile : function(){ |
399 | var body = ["this.compiled = function(values){ return ['"]; | 397 | var body = ["this.compiled = function(values){ return ['"]; |
400 | body.push(this.html.replace(this.re, "', values['$1'], '")); | 398 | body.push(this.html.replace(this.re, "', values['$1'], '")); |
401 | body.push("'].join('');};"); | 399 | body.push("'].join('');};"); |
402 | eval(body.join('')); | 400 | eval(body.join('')); |
403 | return this; | 401 | return this; |
404 | }, | 402 | }, |
405 | 403 | ||
406 | /** | 404 | /** |
407 | * Applies the supplied values to the template and inserts the new node(s) before el | 405 | * Applies the supplied values to the template and inserts the new node(s) before el |
408 | * @param {String/HTMLElement/Element} el The context element | 406 | * @param {String/HTMLElement/Element} el The context element |
409 | * @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'}) | 407 | * @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'}) |
410 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.Element | 408 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.Element |
411 | * @return {HTMLElement} The new node | 409 | * @return {HTMLElement} The new node |
412 | */ | 410 | */ |
413 | insertBefore: function(el, values, returnElement){ | 411 | insertBefore: function(el, values, returnElement){ |
414 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); | 412 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); |
415 | var newNode = Clipperz.YUI.DomHelper.insertHtml('beforeBegin', el, this.applyTemplate(values)); | 413 | var newNode = Clipperz.YUI.DomHelper.insertHtml('beforeBegin', el, this.applyTemplate(values)); |
416 | return returnElement ? YAHOO.Element.get(newNode, true) : newNode; | 414 | return returnElement ? YAHOO.Element.get(newNode, true) : newNode; |
417 | }, | 415 | }, |
418 | 416 | ||
419 | /** | 417 | /** |
420 | * Applies the supplied values to the template and inserts the new node(s) after el | 418 | * Applies the supplied values to the template and inserts the new node(s) after el |
421 | * @param {String/HTMLElement/Element} el The context element | 419 | * @param {String/HTMLElement/Element} el The context element |
422 | * @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'}) | 420 | * @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'}) |
423 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.Element | 421 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.Element |
424 | * @return {HTMLElement} The new node | 422 | * @return {HTMLElement} The new node |
425 | */ | 423 | */ |
426 | insertAfter : function(el, values, returnElement){ | 424 | insertAfter : function(el, values, returnElement){ |
427 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); | 425 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); |
428 | var newNode = Clipperz.YUI.DomHelper.insertHtml('afterEnd', el, this.applyTemplate(values)); | 426 | var newNode = Clipperz.YUI.DomHelper.insertHtml('afterEnd', el, this.applyTemplate(values)); |
429 | return returnElement ? YAHOO.Element.get(newNode, true) : newNode; | 427 | return returnElement ? YAHOO.Element.get(newNode, true) : newNode; |
430 | }, | 428 | }, |
431 | 429 | ||
432 | /** | 430 | /** |
433 | * Applies the supplied values to the template and append the new node(s) to el | 431 | * Applies the supplied values to the template and append the new node(s) to el |
434 | * @param {String/HTMLElement/Element} el The context element | 432 | * @param {String/HTMLElement/Element} el The context element |
435 | * @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'}) | 433 | * @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'}) |
436 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.Element | 434 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.Element |
437 | * @return {HTMLElement} The new node | 435 | * @return {HTMLElement} The new node |
438 | */ | 436 | */ |
439 | append : function(el, values, returnElement){ | 437 | append : function(el, values, returnElement){ |
440 | var sanitizedValues; | 438 | var sanitizedValues; |
441 | var key; | 439 | var key; |
442 | 440 | ||
443 | // sanitizedValues = MochiKit.Base.map(sanitizedValues) | ||
444 | //console.log("values", values); | ||
445 | sanitizedValues = {}; | 441 | sanitizedValues = {}; |
446 | for (key in values) { | 442 | for (key in values) { |
447 | sanitizedValues[key] = Clipperz.Base.sanitizeString(values[key]); | 443 | sanitizedValues[key] = Clipperz.Base.sanitizeString(values[key]); |
448 | } | 444 | } |
449 | //console.log("sanitizedValues", sanitizedValues); | ||
450 | // el = el.dom ? el.dom : YAHOO.util.Dom.get(el); | ||
451 | el = (typeof el == 'string') ? YAHOO.util.Dom.get(el) : el; | 445 | el = (typeof el == 'string') ? YAHOO.util.Dom.get(el) : el; |
452 | //Clipperz.log(this.applyTemplate(sanitizedValues)); | ||
453 | var newNode = Clipperz.YUI.DomHelper.insertHtml('beforeEnd', el, this.applyTemplate(sanitizedValues)); | 446 | var newNode = Clipperz.YUI.DomHelper.insertHtml('beforeEnd', el, this.applyTemplate(sanitizedValues)); |
454 | // return returnElement ? YAHOO.Element.get(newNode, true) : newNode; | 447 | |
455 | return newNode; | 448 | return newNode; |
456 | }, | 449 | }, |
457 | 450 | ||
458 | /** | 451 | /** |
459 | * Applies the supplied values to the template and overwrites the content of el with the new node(s) | 452 | * Applies the supplied values to the template and overwrites the content of el with the new node(s) |
460 | * @param {String/HTMLElement/Element} el The context element | 453 | * @param {String/HTMLElement/Element} el The context element |
461 | * @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'}) | 454 | * @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'}) |
462 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.Element | 455 | * @param {<i>Boolean</i>} returnElement (optional) true to return a YAHOO.Element |
463 | * @return {HTMLElement} The new node | 456 | * @return {HTMLElement} The new node |
464 | */ | 457 | */ |
465 | overwrite : function(el, values, returnElement){ | 458 | overwrite : function(el, values, returnElement){ |
466 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); | 459 | el = el.dom ? el.dom : YAHOO.util.Dom.get(el); |
467 | el.innerHTML = ''; | 460 | el.innerHTML = ''; |
468 | var newNode = Clipperz.YUI.DomHelper.insertHtml('beforeEnd', el, this.applyTemplate(values)); | 461 | var newNode = Clipperz.YUI.DomHelper.insertHtml('beforeEnd', el, this.applyTemplate(values)); |
469 | return returnElement ? YAHOO.Element.get(newNode, true) : newNode; | 462 | return returnElement ? YAHOO.Element.get(newNode, true) : newNode; |
470 | } | 463 | } |
471 | }; | 464 | }; |
472 | /** | 465 | /** |
473 | * Alias for applyTemplate | 466 | * Alias for applyTemplate |
474 | * @method | 467 | * @method |
475 | */ | 468 | */ |
476 | Clipperz.YUI.DomHelper.Template.prototype.apply = Clipperz.YUI.DomHelper.Template.prototype.applyTemplate; | 469 | Clipperz.YUI.DomHelper.Template.prototype.apply = Clipperz.YUI.DomHelper.Template.prototype.applyTemplate; |
477 | 470 | ||
478 | Clipperz.YUI.Template = Clipperz.YUI.DomHelper.Template; | 471 | Clipperz.YUI.Template = Clipperz.YUI.DomHelper.Template; |
diff --git a/frontend/gamma/js/Clipperz/YUI/DomQuery.js b/frontend/gamma/js/Clipperz/YUI/DomQuery.js index 76d0fae..c1af0ca 100644 --- a/frontend/gamma/js/Clipperz/YUI/DomQuery.js +++ b/frontend/gamma/js/Clipperz/YUI/DomQuery.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 | 27 | ||
30 | /* | 28 | /* |
31 | * yui-ext 0.40 | 29 | * yui-ext 0.40 |
32 | * Copyright(c) 2006, Jack Slocum. | 30 | * Copyright(c) 2006, Jack Slocum. |
33 | */ | 31 | */ |
34 | 32 | ||
35 | /** | 33 | /** |
36 | * @class Clipperz.YUI.DomQuery | 34 | * @class Clipperz.YUI.DomQuery |
37 | * Provides high performance selector/xpath processing by compiling queries into reusable functions. | 35 | * Provides high performance selector/xpath processing by compiling queries into reusable functions. |
38 | * New pseudo classes and matchers can be plugged. It works on HTML and XML documents (if a content node is passed in). | 36 | * New pseudo classes and matchers can be plugged. It works on HTML and XML documents (if a content node is passed in). |
39 | * @singleton | 37 | * @singleton |
40 | */ | 38 | */ |
41 | Clipperz.YUI.DomQuery = function(){ | 39 | Clipperz.YUI.DomQuery = function(){ |
42 | var cache = {}, simpleCache = {}, valueCache = {}; | 40 | var cache = {}, simpleCache = {}, valueCache = {}; |
43 | var nonSpace = /\S/; | 41 | var nonSpace = /\S/; |
44 | var trimRe = /^\s*(.*?)\s*$/; | 42 | var trimRe = /^\s*(.*?)\s*$/; |
45 | var tplRe = /\{(\d+)\}/g; | 43 | var tplRe = /\{(\d+)\}/g; |
46 | var modeRe = /^(\s?[\/>]\s?|\s|$)/; | 44 | var modeRe = /^(\s?[\/>]\s?|\s|$)/; |
47 | var clsRes = {}; | 45 | var clsRes = {}; |
48 | 46 | ||
49 | function child(p, index){ | 47 | function child(p, index){ |
50 | var i = 0; | 48 | var i = 0; |
51 | var n = p.firstChild; | 49 | var n = p.firstChild; |
52 | while(n){ | 50 | while(n){ |
53 | if(n.nodeType == 1){ | 51 | if(n.nodeType == 1){ |
54 | i++; | 52 | i++; |
55 | if(i == index){ | 53 | if(i == index){ |
56 | return n; | 54 | return n; |
57 | } | 55 | } |
58 | } | 56 | } |
59 | n = n.nextSibling; | 57 | n = n.nextSibling; |
60 | } | 58 | } |
61 | return null; | 59 | return null; |
62 | }; | 60 | }; |
63 | 61 | ||
64 | function next(d){ | 62 | function next(d){ |
65 | var n = d.nextSibling; | 63 | var n = d.nextSibling; |
66 | while(n && n.nodeType != 1){ | 64 | while(n && n.nodeType != 1){ |
67 | n = n.nextSibling; | 65 | n = n.nextSibling; |
68 | } | 66 | } |
69 | return n; | 67 | return n; |
70 | }; | 68 | }; |
diff --git a/frontend/gamma/js/Clipperz/YUI/Utils.js b/frontend/gamma/js/Clipperz/YUI/Utils.js index e9929fc..4def842 100644 --- a/frontend/gamma/js/Clipperz/YUI/Utils.js +++ b/frontend/gamma/js/Clipperz/YUI/Utils.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 YAHOO == 'undefined') { YAHOO = {}; }; | 24 | if (typeof YAHOO == 'undefined') { YAHOO = {}; }; |
27 | if (typeof YAHOO.util == 'undefined') { YAHOO.util = {}; }; | 25 | if (typeof YAHOO.util == 'undefined') { YAHOO.util = {}; }; |
28 | if (typeof YAHOO.util.Dom == 'undefined') { YAHOO.util.Dom = {}; }; | 26 | if (typeof YAHOO.util.Dom == 'undefined') { YAHOO.util.Dom = {}; }; |
29 | 27 | ||
30 | YAHOO.extend = function(subc, superc, overrides) { | 28 | YAHOO.extend = function(subc, superc, overrides) { |
31 | var F = function() {}; | 29 | var F = function() {}; |
32 | F.prototype=superc.prototype; | 30 | F.prototype=superc.prototype; |
33 | subc.prototype=new F(); | 31 | subc.prototype=new F(); |
34 | subc.prototype.constructor=subc; | 32 | subc.prototype.constructor=subc; |
35 | subc.superclass=superc.prototype; | 33 | subc.superclass=superc.prototype; |
36 | if (superc.prototype.constructor == Object.prototype.constructor) { | 34 | if (superc.prototype.constructor == Object.prototype.constructor) { |
37 | superc.prototype.constructor=superc; | 35 | superc.prototype.constructor=superc; |
38 | } | 36 | } |
39 | 37 | ||
40 | if (overrides) { | 38 | if (overrides) { |
41 | for (var i in overrides) { | 39 | for (var i in overrides) { |
42 | subc.prototype[i]=overrides[i]; | 40 | subc.prototype[i]=overrides[i]; |
43 | } | 41 | } |
44 | } | 42 | } |
45 | }; | 43 | }; |
46 | 44 | ||
47 | YAHOO.override = function(origclass, overrides){ | 45 | YAHOO.override = function(origclass, overrides){ |
48 | if(overrides){ | 46 | if(overrides){ |
49 | var p = origclass.prototype; | 47 | var p = origclass.prototype; |
50 | for(var method in overrides){ | 48 | for(var method in overrides){ |
51 | p[method] = overrides[method]; | 49 | p[method] = overrides[method]; |
52 | } | 50 | } |
53 | } | 51 | } |
54 | }; | 52 | }; |
55 | 53 | ||
56 | YAHOO.extendX = function(subclass, superclass, overrides){ | 54 | YAHOO.extendX = function(subclass, superclass, overrides){ |
57 | YAHOO.extend(subclass, superclass); | 55 | YAHOO.extend(subclass, superclass); |
58 | subclass.override = function(o){ | 56 | subclass.override = function(o){ |
59 | YAHOO.override(subclass, o); | 57 | YAHOO.override(subclass, o); |
60 | }; | 58 | }; |
61 | if(!subclass.prototype.override){ | 59 | if(!subclass.prototype.override){ |
62 | subclass.prototype.override = function(o){ | 60 | subclass.prototype.override = function(o){ |
63 | for(var method in o){ | 61 | for(var method in o){ |
64 | this[method] = o[method]; | 62 | this[method] = o[method]; |
65 | } | 63 | } |
66 | }; | 64 | }; |
67 | } | 65 | } |
68 | if(overrides){ | 66 | if(overrides){ |
69 | subclass.override(overrides); | 67 | subclass.override(overrides); |
70 | }; | 68 | }; |