Changeset 550
- Timestamp:
- 01/22/06 07:05:43 (3 years ago)
- Files:
-
- mochikit/branches/scriptaculous/MochiKit/Async.js (modified) (2 diffs)
- mochikit/branches/scriptaculous/MochiKit/Base.js (modified) (1 diff)
- mochikit/branches/scriptaculous/MochiKit/Color.js (modified) (1 diff)
- mochikit/branches/scriptaculous/MochiKit/DOM.js (modified) (2 diffs)
- mochikit/branches/scriptaculous/MochiKit/DateTime.js (modified) (1 diff)
- mochikit/branches/scriptaculous/MochiKit/Effects.js (modified) (3 diffs)
- mochikit/branches/scriptaculous/MochiKit/Format.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
mochikit/branches/scriptaculous/MochiKit/Async.js
r548 r550 355 355 } 356 356 }; 357 358 MochiKit.Async.DeferredList = function (list, /* optional */fireOnOneCallback, fireOnOneErrback, consumeErrors, canceller) {359 this.list = list;360 this.resultList = new Array(this.list.length);361 362 // Deferred init363 this.chain = [];364 this.id = this._nextId();365 this.fired = -1;366 this.paused = 0;367 this.results = [null, null];368 this.canceller = canceller;369 this.silentlyCancelled = false;370 371 if (this.list.length == 0 && !fireOnOneCallback) {372 this.callback(this.resultList);373 }374 375 this.finishedCount = 0376 this.fireOnOneCallback = fireOnOneCallback;377 this.fireOnOneErrback = fireOnOneErrback;378 this.consumeErrors = consumeErrors;379 380 var index = 0;381 MochiKit.Base.map(MochiKit.Base.bind(function (d) {382 d.addCallback(MochiKit.Base.bind(this._cbDeferred, this), index, true);383 d.addErrback(MochiKit.Base.bind(this._cbDeferred, this), index, false);384 index += 1;385 }, this), this.list);386 };387 388 MochiKit.Base.update(MochiKit.Async.DeferredList.prototype,389 MochiKit.Async.Deferred.prototype);390 391 MochiKit.Base.update(MochiKit.Async.DeferredList.prototype, {392 _cbDeferred: function (index, succeeded, result) {393 this.resultList[index] = [succeeded, result];394 this.finishedCount += 1;395 if (this.fired != 0) {396 if (succeeded && this.fireOnOneCallback) {397 this.callback([index, result]);398 } else if (!succeeded && this.fireOnOneErrback) {399 this.errback(result);400 } else if (this.finishedCount == this.list.length) {401 this.callback(this.resultList);402 }403 }404 if (!succeeded && this.consumeErrors) {405 result = null;406 }407 return result;408 }409 });410 357 411 358 MochiKit.Base.update(MochiKit.Async, { … … 674 621 "XMLHttpRequestError", 675 622 "Deferred", 676 "DeferredList",677 623 "succeed", 678 624 "fail", mochikit/branches/scriptaculous/MochiKit/Base.js
r491 r550 1330 1330 1331 1331 MochiKit.Base._exportSymbols = function (globals, module) { 1332 if ((typeof(JSAN) == 'undefined' && typeof(dojo) == 'undefined') 1333 || (typeof(MochiKit.__compat__) == 'boolean' && MochiKit.__compat__)) { 1334 var all = module.EXPORT_TAGS[":all"]; 1335 for (var i = 0; i < all.length; i++) { 1336 globals[all[i]] = module[all[i]]; 1337 } 1332 if (typeof(MochiKit.__export__) == "undefined") { 1333 MochiKit.__export__ = (MochiKit.__compat__ || 1334 (typeof(JSAN) == 'undefined' && typeof(dojo) == 'undefined') 1335 ); 1336 } 1337 if (!MochiKit.__export__) { 1338 return; 1339 } 1340 var all = module.EXPORT_TAGS[":all"]; 1341 for (var i = 0; i < all.length; i++) { 1342 globals[all[i]] = module[all[i]]; 1338 1343 } 1339 1344 }; mochikit/branches/scriptaculous/MochiKit/Color.js
r464 r550 102 102 lighterColorWithLevel: function (level) { 103 103 var hsl = this.asHSL(); 104 Math.min(hsl.l + level, 1);104 hsl.l = Math.min(hsl.l + level, 1); 105 105 var m = MochiKit.Color; 106 106 return m.Color.fromHSL(hsl); mochikit/branches/scriptaculous/MochiKit/DOM.js
r485 r550 146 146 return undefined; 147 147 } 148 return new self.Dimensions( 149 parseInt(self.computedStyle(elem, 'width').replace(/px/, '')), 150 parseInt(self.computedStyle(elem, 'height').replace(/px/, '')) 151 ); 148 if (self.computedStyle(elem, 'display') != 'none') { 149 return new self.Dimensions(elem.w || 0, elem.h || 0); 150 } 151 var s = elem.style; 152 var originalVisibility = s.visibility; 153 var originalPosition = s.position; 154 s.visibility = 'hidden'; 155 s.position = 'absolute'; 156 s.display = ''; 157 var originalWidth = elem.clientWidth; 158 var originalHeight = elem.clientHeight; 159 s.display = 'none'; 160 s.position = originalPosition; 161 s.visibility = originalVisibility; 162 return new self.Dimensions(originalWidth, originalHeight); 152 163 }; 153 164 … … 1042 1053 MochiKit.DOM.__new__(this); 1043 1054 1055 // 1056 // XXX: Internet Explorer blows 1057 // 1058 withWindow = MochiKit.DOM.withWindow; 1059 withDocument = MochiKit.DOM.withDocument; 1060 1044 1061 MochiKit.Base._exportSymbols(this, MochiKit.DOM); mochikit/branches/scriptaculous/MochiKit/DateTime.js
r438 r550 251 251 MochiKit.DateTime.__new__(); 252 252 253 //MochiKit.Base._exportSymbols(this, MochiKit.DateTime); 254 (function (globals, module) { 255 if ((typeof(JSAN) == 'undefined' && typeof(dojo) == 'undefined') 256 || (typeof(MochiKit.__compat__) == 'boolean' && MochiKit.__compat__)) { 257 var all = module.EXPORT_TAGS[":all"]; 258 for (var i = 0; i < all.length; i++) { 259 globals[all[i]] = module[all[i]]; 260 } 261 } 262 })(this, MochiKit.DateTime); 253 if (typeof(MochiKit.Base) != "undefined") { 254 MochiKit.Base._exportSymbols(this, MochiKit.DateTime); 255 } else { 256 (function (globals, module) { 257 if ((typeof(JSAN) == 'undefined' && typeof(dojo) == 'undefined') 258 || (typeof(MochiKit.__compat__) == 'boolean' && MochiKit.__compat__)) { 259 var all = module.EXPORT_TAGS[":all"]; 260 for (var i = 0; i < all.length; i++) { 261 globals[all[i]] = module[all[i]]; 262 } 263 } 264 })(this, MochiKit.DateTime); 265 } mochikit/branches/scriptaculous/MochiKit/Effects.js
r534 r550 135 135 'slide': ['SlideDown','SlideUp'], 136 136 'blind': ['BlindDown','BlindUp'], 137 'appear': ['Appear','Fade'] 137 'appear': ['Appear','Fade'], 138 'size': ['Grow','Fade'] 138 139 }; 139 140 … … 1100 1101 height: element.style.height, 1101 1102 width: element.style.width, 1102 opacity: MochiKit.DOM.getInlineOpacity(element) }; 1103 opacity: MochiKit.DOM.getInlineOpacity(element) 1104 }; 1103 1105 1104 1106 var dims = MochiKit.DOM.elementDimensions(element); … … 1197 1199 height: element.style.height, 1198 1200 width: element.style.width, 1199 opacity: MochiKit.DOM.getInlineOpacity(element) }; 1201 opacity: MochiKit.DOM.getInlineOpacity(element) 1202 }; 1200 1203 1201 1204 var dims = MochiKit.DOM.elementDimensions(element); mochikit/branches/scriptaculous/MochiKit/Format.js
r456 r550 298 298 MochiKit.Format.__new__(); 299 299 300 //MochiKit.Base._exportSymbols(this, MochiKit.Format); 301 (function (globals, module) { 302 if ((typeof(JSAN) == 'undefined' && typeof(dojo) == 'undefined') 303 || (typeof(MochiKit.__compat__) == 'boolean' && MochiKit.__compat__)) { 304 var all = module.EXPORT_TAGS[":all"]; 305 for (var i = 0; i < all.length; i++) { 306 globals[all[i]] = module[all[i]]; 307 } 308 } 309 })(this, MochiKit.Format); 300 if (typeof(MochiKit.Base) != "undefined") { 301 MochiKit.Base._exportSymbols(this, MochiKit.Format); 302 } else { 303 (function (globals, module) { 304 if ((typeof(JSAN) == 'undefined' && typeof(dojo) == 'undefined') 305 || (typeof(MochiKit.__compat__) == 'boolean' && MochiKit.__compat__)) { 306 var all = module.EXPORT_TAGS[":all"]; 307 for (var i = 0; i < all.length; i++) { 308 globals[all[i]] = module[all[i]]; 309 } 310 } 311 })(this, MochiKit.Format); 312 }
