summaryrefslogtreecommitdiff
path: root/frontend/delta/js/MochiKit/MochiKit.js
Unidiff
Diffstat (limited to 'frontend/delta/js/MochiKit/MochiKit.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/delta/js/MochiKit/MochiKit.js156
1 files changed, 156 insertions, 0 deletions
diff --git a/frontend/delta/js/MochiKit/MochiKit.js b/frontend/delta/js/MochiKit/MochiKit.js
new file mode 100644
index 0000000..5fac077
--- a/dev/null
+++ b/frontend/delta/js/MochiKit/MochiKit.js
@@ -0,0 +1,156 @@
1/*
2
3Copyright 2008-2013 Clipperz Srl
4
5This file is part of Clipperz, the online password manager.
6For further information about its features and functionalities please
7refer to http://www.clipperz.com.
8
9* Clipperz is free software: you can redistribute it and/or modify it
10 under the terms of the GNU Affero General Public License as published
11 by the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14* Clipperz is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 See the GNU Affero General Public License for more details.
18
19* You should have received a copy of the GNU Affero General Public
20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
21
22*/
23
24/***
25
26MochiKit.MochiKit 1.5
27
28See <http://mochikit.com/> for documentation, downloads, license, etc.
29
30(c) 2005 Bob Ippolito. All rights Reserved.
31
32***/
33
34var MochiKit = MochiKit || {};
35
36/** @id MochiKit.MochiKit */
37MochiKit.MochiKit = MochiKit.MochiKit || {};
38
39MochiKit.MochiKit.NAME = "MochiKit.MochiKit";
40MochiKit.MochiKit.VERSION = "1.5";
41MochiKit.MochiKit.__export__ = false;
42MochiKit.MochiKit.__repr__ = function () {
43 return "[" + this.NAME + " " + this.VERSION + "]";
44};
45
46/** @id MochiKit.MochiKit.toString */
47MochiKit.MochiKit.toString = function () {
48 return this.__repr__();
49};
50
51/** @id MochiKit.MochiKit.SUBMODULES */
52MochiKit.MochiKit.SUBMODULES = [
53 "Base",
54 "Iter",
55 "Logging",
56 "DateTime",
57 "Format",
58 "Text",
59 "Async",
60 "DOM",
61 "Selector",
62 "Style",
63 "LoggingPane",
64 "Color",
65 "Signal",
66 "Position",
67 "Visual",
68 "DragAndDrop",
69 "Sortable"
70];
71
72(function () {
73 if (typeof(document) == "undefined") {
74 return;
75 }
76 var scripts = document.getElementsByTagName("script");
77 var kXHTMLNSURI = "http://www.w3.org/1999/xhtml";
78 var kSVGNSURI = "http://www.w3.org/2000/svg";
79 var kXLINKNSURI = "http://www.w3.org/1999/xlink";
80 var kXULNSURI = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
81 var base = null;
82 var baseElem = null;
83 var allScripts = {};
84 var i;
85 var src;
86 for (i = 0; i < scripts.length; i++) {
87 src = null;
88 switch (scripts[i].namespaceURI) {
89 case kSVGNSURI:
90 src = scripts[i].getAttributeNS(kXLINKNSURI, "href");
91 break;
92 /*
93 case null: // HTML
94 case '': // HTML
95 case kXHTMLNSURI:
96 case kXULNSURI:
97 */
98 default:
99 src = scripts[i].getAttribute("src");
100 break;
101 }
102 if (!src) {
103 continue;
104 }
105 allScripts[src] = true;
106 if (src.match(/MochiKit.js(\?.*)?$/)) {
107 base = src.substring(0, src.lastIndexOf('MochiKit.js'));
108 baseElem = scripts[i];
109 }
110 }
111 if (base === null) {
112 return;
113 }
114 var modules = MochiKit.MochiKit.SUBMODULES;
115 for (var i = 0; i < modules.length; i++) {
116 if (MochiKit[modules[i]]) {
117 continue;
118 }
119 var uri = base + modules[i] + '.js';
120 if (uri in allScripts) {
121 continue;
122 }
123 if (baseElem.namespaceURI == kSVGNSURI ||
124 baseElem.namespaceURI == kXULNSURI) {
125 // SVG, XUL
126 /*
127 SVG does not support document.write, so if Safari wants to
128 support SVG tests it should fix its deferred loading bug
129 (see following below).
130 */
131 var s = document.createElementNS(baseElem.namespaceURI, 'script');
132 s.setAttribute("id", "MochiKit_" + base + modules[i]);
133 if (baseElem.namespaceURI == kSVGNSURI) {
134 s.setAttributeNS(kXLINKNSURI, 'href', uri);
135 } else {
136 s.setAttribute('src', uri);
137 }
138 s.setAttribute("type", "application/x-javascript");
139 baseElem.parentNode.appendChild(s);
140 } else {
141 // HTML, XHTML
142 /*
143 DOM can not be used here because Safari does
144 deferred loading of scripts unless they are
145 in the document or inserted with document.write
146
147 This is not XHTML compliant. If you want XHTML
148 compliance then you must use the packed version of MochiKit
149 or include each script individually (basically unroll
150 these document.write calls into your XHTML source)
151 */
152 document.write('<' + baseElem.nodeName + ' src="' + uri +
153 '" type="text/javascript"></script>');
154 }
155 };
156})();