Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /*** |
michael@0 | 2 | |
michael@0 | 3 | MochiKit.MochiKit 1.4 |
michael@0 | 4 | |
michael@0 | 5 | See <http://mochikit.com/> for documentation, downloads, license, etc. |
michael@0 | 6 | |
michael@0 | 7 | (c) 2005 Bob Ippolito. All rights Reserved. |
michael@0 | 8 | |
michael@0 | 9 | ***/ |
michael@0 | 10 | |
michael@0 | 11 | if (typeof(MochiKit) == 'undefined') { |
michael@0 | 12 | MochiKit = {}; |
michael@0 | 13 | } |
michael@0 | 14 | |
michael@0 | 15 | if (typeof(MochiKit.MochiKit) == 'undefined') { |
michael@0 | 16 | /** @id MochiKit.MochiKit */ |
michael@0 | 17 | MochiKit.MochiKit = {}; |
michael@0 | 18 | } |
michael@0 | 19 | |
michael@0 | 20 | MochiKit.MochiKit.NAME = "MochiKit.MochiKit"; |
michael@0 | 21 | MochiKit.MochiKit.VERSION = "1.4"; |
michael@0 | 22 | MochiKit.MochiKit.__repr__ = function () { |
michael@0 | 23 | return "[" + this.NAME + " " + this.VERSION + "]"; |
michael@0 | 24 | }; |
michael@0 | 25 | |
michael@0 | 26 | /** @id MochiKit.MochiKit.toString */ |
michael@0 | 27 | MochiKit.MochiKit.toString = function () { |
michael@0 | 28 | return this.__repr__(); |
michael@0 | 29 | }; |
michael@0 | 30 | |
michael@0 | 31 | /** @id MochiKit.MochiKit.SUBMODULES */ |
michael@0 | 32 | MochiKit.MochiKit.SUBMODULES = [ |
michael@0 | 33 | "Base", |
michael@0 | 34 | "Iter", |
michael@0 | 35 | "Logging", |
michael@0 | 36 | "DateTime", |
michael@0 | 37 | "Format", |
michael@0 | 38 | "Async", |
michael@0 | 39 | "DOM", |
michael@0 | 40 | "Style", |
michael@0 | 41 | "LoggingPane", |
michael@0 | 42 | "Color", |
michael@0 | 43 | "Signal", |
michael@0 | 44 | "Visual" |
michael@0 | 45 | ]; |
michael@0 | 46 | |
michael@0 | 47 | if (typeof(JSAN) != 'undefined' || typeof(dojo) != 'undefined') { |
michael@0 | 48 | if (typeof(dojo) != 'undefined') { |
michael@0 | 49 | dojo.provide('MochiKit.MochiKit'); |
michael@0 | 50 | dojo.require("MochiKit.*"); |
michael@0 | 51 | } |
michael@0 | 52 | if (typeof(JSAN) != 'undefined') { |
michael@0 | 53 | (function (lst) { |
michael@0 | 54 | for (var i = 0; i < lst.length; i++) { |
michael@0 | 55 | JSAN.use("MochiKit." + lst[i], []); |
michael@0 | 56 | } |
michael@0 | 57 | })(MochiKit.MochiKit.SUBMODULES); |
michael@0 | 58 | } |
michael@0 | 59 | (function () { |
michael@0 | 60 | var extend = MochiKit.Base.extend; |
michael@0 | 61 | var self = MochiKit.MochiKit; |
michael@0 | 62 | var modules = self.SUBMODULES; |
michael@0 | 63 | var EXPORT = []; |
michael@0 | 64 | var EXPORT_OK = []; |
michael@0 | 65 | var EXPORT_TAGS = {}; |
michael@0 | 66 | var i, k, m, all; |
michael@0 | 67 | for (i = 0; i < modules.length; i++) { |
michael@0 | 68 | m = MochiKit[modules[i]]; |
michael@0 | 69 | extend(EXPORT, m.EXPORT); |
michael@0 | 70 | extend(EXPORT_OK, m.EXPORT_OK); |
michael@0 | 71 | for (k in m.EXPORT_TAGS) { |
michael@0 | 72 | EXPORT_TAGS[k] = extend(EXPORT_TAGS[k], m.EXPORT_TAGS[k]); |
michael@0 | 73 | } |
michael@0 | 74 | all = m.EXPORT_TAGS[":all"]; |
michael@0 | 75 | if (!all) { |
michael@0 | 76 | all = extend(null, m.EXPORT, m.EXPORT_OK); |
michael@0 | 77 | } |
michael@0 | 78 | var j; |
michael@0 | 79 | for (j = 0; j < all.length; j++) { |
michael@0 | 80 | k = all[j]; |
michael@0 | 81 | self[k] = m[k]; |
michael@0 | 82 | } |
michael@0 | 83 | } |
michael@0 | 84 | self.EXPORT = EXPORT; |
michael@0 | 85 | self.EXPORT_OK = EXPORT_OK; |
michael@0 | 86 | self.EXPORT_TAGS = EXPORT_TAGS; |
michael@0 | 87 | }()); |
michael@0 | 88 | |
michael@0 | 89 | } else { |
michael@0 | 90 | if (typeof(MochiKit.__compat__) == 'undefined') { |
michael@0 | 91 | MochiKit.__compat__ = true; |
michael@0 | 92 | } |
michael@0 | 93 | (function () { |
michael@0 | 94 | if (typeof(document) == "undefined") { |
michael@0 | 95 | return; |
michael@0 | 96 | } |
michael@0 | 97 | var scripts = document.getElementsByTagName("script"); |
michael@0 | 98 | var kXULNSURI = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; |
michael@0 | 99 | var base = null; |
michael@0 | 100 | var baseElem = null; |
michael@0 | 101 | var allScripts = {}; |
michael@0 | 102 | var i; |
michael@0 | 103 | for (i = 0; i < scripts.length; i++) { |
michael@0 | 104 | var src = scripts[i].getAttribute("src"); |
michael@0 | 105 | if (!src) { |
michael@0 | 106 | continue; |
michael@0 | 107 | } |
michael@0 | 108 | allScripts[src] = true; |
michael@0 | 109 | if (src.match(/MochiKit.js$/)) { |
michael@0 | 110 | base = src.substring(0, src.lastIndexOf('MochiKit.js')); |
michael@0 | 111 | baseElem = scripts[i]; |
michael@0 | 112 | } |
michael@0 | 113 | } |
michael@0 | 114 | if (base === null) { |
michael@0 | 115 | return; |
michael@0 | 116 | } |
michael@0 | 117 | var modules = MochiKit.MochiKit.SUBMODULES; |
michael@0 | 118 | for (var i = 0; i < modules.length; i++) { |
michael@0 | 119 | if (MochiKit[modules[i]]) { |
michael@0 | 120 | continue; |
michael@0 | 121 | } |
michael@0 | 122 | var uri = base + modules[i] + '.js'; |
michael@0 | 123 | if (uri in allScripts) { |
michael@0 | 124 | continue; |
michael@0 | 125 | } |
michael@0 | 126 | if (document.documentElement && |
michael@0 | 127 | document.documentElement.namespaceURI == kXULNSURI) { |
michael@0 | 128 | // XUL |
michael@0 | 129 | var s = document.createElementNS(kXULNSURI, 'script'); |
michael@0 | 130 | s.setAttribute("id", "MochiKit_" + base + modules[i]); |
michael@0 | 131 | s.setAttribute("src", uri); |
michael@0 | 132 | s.setAttribute("type", "application/x-javascript"); |
michael@0 | 133 | baseElem.parentNode.appendChild(s); |
michael@0 | 134 | } else { |
michael@0 | 135 | // HTML |
michael@0 | 136 | /* |
michael@0 | 137 | DOM can not be used here because Safari does |
michael@0 | 138 | deferred loading of scripts unless they are |
michael@0 | 139 | in the document or inserted with document.write |
michael@0 | 140 | |
michael@0 | 141 | This is not XHTML compliant. If you want XHTML |
michael@0 | 142 | compliance then you must use the packed version of MochiKit |
michael@0 | 143 | or include each script individually (basically unroll |
michael@0 | 144 | these document.write calls into your XHTML source) |
michael@0 | 145 | |
michael@0 | 146 | */ |
michael@0 | 147 | document.write('<script src="' + uri + |
michael@0 | 148 | '" type="text/javascript"></script>'); |
michael@0 | 149 | } |
michael@0 | 150 | }; |
michael@0 | 151 | })(); |
michael@0 | 152 | } |