Commit 5ffb2b61d0d659c4e2f8b35a00492d3118ac36ce
1 parent
9655e78a
Added packed mochikit
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@6086 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
6795 additions
and
1 deletions
lib/templating/kt3template.inc.php
| ... | ... | @@ -94,10 +94,16 @@ class KTPage { |
| 94 | 94 | $this->requireCSSResource("resources/css/kt-ie-icons.css", true); |
| 95 | 95 | /* default js files initialisation */ |
| 96 | 96 | $aJS = Array(); |
| 97 | - $aJS[] = 'thirdpartyjs/MochiKit/MochiKit.js'; | |
| 97 | + | |
| 98 | + /* | |
| 99 | + $aJS[] = 'thirdpartyjs/MochiKit/MochiKit.js'; | |
| 98 | 100 | $aJS[] = 'thirdpartyjs/MochiKit/New.js'; |
| 99 | 101 | $aJS[] = 'thirdpartyjs/MochiKit/DragAndDrop.js'; |
| 100 | 102 | $aJS[] = 'thirdpartyjs/MochiKit/Sortable.js'; |
| 103 | + $aJS[] = 'thirdpartyjs/MochiKit/Style.js'; | |
| 104 | + $aJS[] = 'thirdpartyjs/MochiKit/Signal.js'; | |
| 105 | + */ | |
| 106 | + $aJS[] = 'thirdpartyjs/MochiKit/MochiKitPacked.js'; | |
| 101 | 107 | $aJS[] = 'resources/js/kt-utility.js'; |
| 102 | 108 | $aJS[] = 'presentation/i18nJavascript.php'; |
| 103 | 109 | ... | ... |
thirdpartyjs/MochiKit/MochiKitPacked.js
0 → 100644
Changes suppressed. Click to show
| 1 | +/*** | |
| 2 | + | |
| 3 | + MochiKit.MochiKit 1.4 : PACKED VERSION | |
| 4 | + | |
| 5 | + THIS FILE IS AUTOMATICALLY GENERATED. If creating patches, please | |
| 6 | + diff against the source tree, not this file. | |
| 7 | + | |
| 8 | + See <http://mochikit.com/> for documentation, downloads, license, etc. | |
| 9 | + | |
| 10 | + (c) 2005 Bob Ippolito. All rights Reserved. | |
| 11 | + | |
| 12 | +***/ | |
| 13 | + | |
| 14 | +if(typeof (dojo)!="undefined"){ | |
| 15 | +dojo.provide("MochiKit.Base"); | |
| 16 | +} | |
| 17 | +if(typeof (MochiKit)=="undefined"){ | |
| 18 | +MochiKit={}; | |
| 19 | +} | |
| 20 | +if(typeof (MochiKit.Base)=="undefined"){ | |
| 21 | +MochiKit.Base={}; | |
| 22 | +} | |
| 23 | +if(typeof (MochiKit.__export__)=="undefined"){ | |
| 24 | +MochiKit.__export__=(MochiKit.__compat__||(typeof (JSAN)=="undefined"&&typeof (dojo)=="undefined")); | |
| 25 | +} | |
| 26 | +MochiKit.Base.VERSION="1.4"; | |
| 27 | +MochiKit.Base.NAME="MochiKit.Base"; | |
| 28 | +MochiKit.Base.update=function(_1,_2){ | |
| 29 | +if(_1===null){ | |
| 30 | +_1={}; | |
| 31 | +} | |
| 32 | +for(var i=1;i<arguments.length;i++){ | |
| 33 | +var o=arguments[i]; | |
| 34 | +if(typeof (o)!="undefined"&&o!==null){ | |
| 35 | +for(var k in o){ | |
| 36 | +_1[k]=o[k]; | |
| 37 | +} | |
| 38 | +} | |
| 39 | +} | |
| 40 | +return _1; | |
| 41 | +}; | |
| 42 | +MochiKit.Base.update(MochiKit.Base,{__repr__:function(){ | |
| 43 | +return "["+this.NAME+" "+this.VERSION+"]"; | |
| 44 | +},toString:function(){ | |
| 45 | +return this.__repr__(); | |
| 46 | +},camelize:function(_6){ | |
| 47 | +var _7=_6.split("-"); | |
| 48 | +var cc=_7[0]; | |
| 49 | +for(var i=1;i<_7.length;i++){ | |
| 50 | +cc+=_7[i].charAt(0).toUpperCase()+_7[i].substring(1); | |
| 51 | +} | |
| 52 | +return cc; | |
| 53 | +},counter:function(n){ | |
| 54 | +if(arguments.length===0){ | |
| 55 | +n=1; | |
| 56 | +} | |
| 57 | +return function(){ | |
| 58 | +return n++; | |
| 59 | +}; | |
| 60 | +},clone:function(obj){ | |
| 61 | +var me=arguments.callee; | |
| 62 | +if(arguments.length==1){ | |
| 63 | +me.prototype=obj; | |
| 64 | +return new me(); | |
| 65 | +} | |
| 66 | +},_flattenArray:function(res,lst){ | |
| 67 | +for(var i=0;i<lst.length;i++){ | |
| 68 | +var o=lst[i]; | |
| 69 | +if(o instanceof Array){ | |
| 70 | +arguments.callee(res,o); | |
| 71 | +}else{ | |
| 72 | +res.push(o); | |
| 73 | +} | |
| 74 | +} | |
| 75 | +return res; | |
| 76 | +},flattenArray:function(lst){ | |
| 77 | +return MochiKit.Base._flattenArray([],lst); | |
| 78 | +},flattenArguments:function(lst){ | |
| 79 | +var res=[]; | |
| 80 | +var m=MochiKit.Base; | |
| 81 | +var _15=m.extend(null,arguments); | |
| 82 | +while(_15.length){ | |
| 83 | +var o=_15.shift(); | |
| 84 | +if(o&&typeof (o)=="object"&&typeof (o.length)=="number"){ | |
| 85 | +for(var i=o.length-1;i>=0;i--){ | |
| 86 | +_15.unshift(o[i]); | |
| 87 | +} | |
| 88 | +}else{ | |
| 89 | +res.push(o); | |
| 90 | +} | |
| 91 | +} | |
| 92 | +return res; | |
| 93 | +},extend:function(_16,obj,_17){ | |
| 94 | +if(!_17){ | |
| 95 | +_17=0; | |
| 96 | +} | |
| 97 | +if(obj){ | |
| 98 | +var l=obj.length; | |
| 99 | +if(typeof (l)!="number"){ | |
| 100 | +if(typeof (MochiKit.Iter)!="undefined"){ | |
| 101 | +obj=MochiKit.Iter.list(obj); | |
| 102 | +l=obj.length; | |
| 103 | +}else{ | |
| 104 | +throw new TypeError("Argument not an array-like and MochiKit.Iter not present"); | |
| 105 | +} | |
| 106 | +} | |
| 107 | +if(!_16){ | |
| 108 | +_16=[]; | |
| 109 | +} | |
| 110 | +for(var i=_17;i<l;i++){ | |
| 111 | +_16.push(obj[i]); | |
| 112 | +} | |
| 113 | +} | |
| 114 | +return _16; | |
| 115 | +},updatetree:function(_19,obj){ | |
| 116 | +if(_19===null){ | |
| 117 | +_19={}; | |
| 118 | +} | |
| 119 | +for(var i=1;i<arguments.length;i++){ | |
| 120 | +var o=arguments[i]; | |
| 121 | +if(typeof (o)!="undefined"&&o!==null){ | |
| 122 | +for(var k in o){ | |
| 123 | +var v=o[k]; | |
| 124 | +if(typeof (_19[k])=="object"&&typeof (v)=="object"){ | |
| 125 | +arguments.callee(_19[k],v); | |
| 126 | +}else{ | |
| 127 | +_19[k]=v; | |
| 128 | +} | |
| 129 | +} | |
| 130 | +} | |
| 131 | +} | |
| 132 | +return _19; | |
| 133 | +},setdefault:function(_21,obj){ | |
| 134 | +if(_21===null){ | |
| 135 | +_21={}; | |
| 136 | +} | |
| 137 | +for(var i=1;i<arguments.length;i++){ | |
| 138 | +var o=arguments[i]; | |
| 139 | +for(var k in o){ | |
| 140 | +if(!(k in _21)){ | |
| 141 | +_21[k]=o[k]; | |
| 142 | +} | |
| 143 | +} | |
| 144 | +} | |
| 145 | +return _21; | |
| 146 | +},keys:function(obj){ | |
| 147 | +var _22=[]; | |
| 148 | +for(var _23 in obj){ | |
| 149 | +_22.push(_23); | |
| 150 | +} | |
| 151 | +return _22; | |
| 152 | +},values:function(obj){ | |
| 153 | +var _24=[]; | |
| 154 | +for(var _25 in obj){ | |
| 155 | +_24.push(obj[_25]); | |
| 156 | +} | |
| 157 | +return _24; | |
| 158 | +},items:function(obj){ | |
| 159 | +var _26=[]; | |
| 160 | +var e; | |
| 161 | +for(var _28 in obj){ | |
| 162 | +var v; | |
| 163 | +try{ | |
| 164 | +v=obj[_28]; | |
| 165 | +} | |
| 166 | +catch(e){ | |
| 167 | +continue; | |
| 168 | +} | |
| 169 | +_26.push([_28,v]); | |
| 170 | +} | |
| 171 | +return _26; | |
| 172 | +},_newNamedError:function(_29,_30,_31){ | |
| 173 | +_31.prototype=new MochiKit.Base.NamedError(_29.NAME+"."+_30); | |
| 174 | +_29[_30]=_31; | |
| 175 | +},operator:{truth:function(a){ | |
| 176 | +return !!a; | |
| 177 | +},lognot:function(a){ | |
| 178 | +return !a; | |
| 179 | +},identity:function(a){ | |
| 180 | +return a; | |
| 181 | +},not:function(a){ | |
| 182 | +return ~a; | |
| 183 | +},neg:function(a){ | |
| 184 | +return -a; | |
| 185 | +},add:function(a,b){ | |
| 186 | +return a+b; | |
| 187 | +},sub:function(a,b){ | |
| 188 | +return a-b; | |
| 189 | +},div:function(a,b){ | |
| 190 | +return a/b; | |
| 191 | +},mod:function(a,b){ | |
| 192 | +return a%b; | |
| 193 | +},mul:function(a,b){ | |
| 194 | +return a*b; | |
| 195 | +},and:function(a,b){ | |
| 196 | +return a&b; | |
| 197 | +},or:function(a,b){ | |
| 198 | +return a|b; | |
| 199 | +},xor:function(a,b){ | |
| 200 | +return a^b; | |
| 201 | +},lshift:function(a,b){ | |
| 202 | +return a<<b; | |
| 203 | +},rshift:function(a,b){ | |
| 204 | +return a>>b; | |
| 205 | +},zrshift:function(a,b){ | |
| 206 | +return a>>>b; | |
| 207 | +},eq:function(a,b){ | |
| 208 | +return a==b; | |
| 209 | +},ne:function(a,b){ | |
| 210 | +return a!=b; | |
| 211 | +},gt:function(a,b){ | |
| 212 | +return a>b; | |
| 213 | +},ge:function(a,b){ | |
| 214 | +return a>=b; | |
| 215 | +},lt:function(a,b){ | |
| 216 | +return a<b; | |
| 217 | +},le:function(a,b){ | |
| 218 | +return a<=b; | |
| 219 | +},seq:function(a,b){ | |
| 220 | +return a===b; | |
| 221 | +},sne:function(a,b){ | |
| 222 | +return a!==b; | |
| 223 | +},ceq:function(a,b){ | |
| 224 | +return MochiKit.Base.compare(a,b)===0; | |
| 225 | +},cne:function(a,b){ | |
| 226 | +return MochiKit.Base.compare(a,b)!==0; | |
| 227 | +},cgt:function(a,b){ | |
| 228 | +return MochiKit.Base.compare(a,b)==1; | |
| 229 | +},cge:function(a,b){ | |
| 230 | +return MochiKit.Base.compare(a,b)!=-1; | |
| 231 | +},clt:function(a,b){ | |
| 232 | +return MochiKit.Base.compare(a,b)==-1; | |
| 233 | +},cle:function(a,b){ | |
| 234 | +return MochiKit.Base.compare(a,b)!=1; | |
| 235 | +},logand:function(a,b){ | |
| 236 | +return a&&b; | |
| 237 | +},logor:function(a,b){ | |
| 238 | +return a||b; | |
| 239 | +},contains:function(a,b){ | |
| 240 | +return b in a; | |
| 241 | +}},forwardCall:function(_34){ | |
| 242 | +return function(){ | |
| 243 | +return this[_34].apply(this,arguments); | |
| 244 | +}; | |
| 245 | +},itemgetter:function(_35){ | |
| 246 | +return function(arg){ | |
| 247 | +return arg[_35]; | |
| 248 | +}; | |
| 249 | +},typeMatcher:function(){ | |
| 250 | +var _37={}; | |
| 251 | +for(var i=0;i<arguments.length;i++){ | |
| 252 | +var typ=arguments[i]; | |
| 253 | +_37[typ]=typ; | |
| 254 | +} | |
| 255 | +return function(){ | |
| 256 | +for(var i=0;i<arguments.length;i++){ | |
| 257 | +if(!(typeof (arguments[i]) in _37)){ | |
| 258 | +return false; | |
| 259 | +} | |
| 260 | +} | |
| 261 | +return true; | |
| 262 | +}; | |
| 263 | +},isNull:function(){ | |
| 264 | +for(var i=0;i<arguments.length;i++){ | |
| 265 | +if(arguments[i]!==null){ | |
| 266 | +return false; | |
| 267 | +} | |
| 268 | +} | |
| 269 | +return true; | |
| 270 | +},isUndefinedOrNull:function(){ | |
| 271 | +for(var i=0;i<arguments.length;i++){ | |
| 272 | +var o=arguments[i]; | |
| 273 | +if(!(typeof (o)=="undefined"||o===null)){ | |
| 274 | +return false; | |
| 275 | +} | |
| 276 | +} | |
| 277 | +return true; | |
| 278 | +},isEmpty:function(obj){ | |
| 279 | +return !MochiKit.Base.isNotEmpty.apply(this,arguments); | |
| 280 | +},isNotEmpty:function(obj){ | |
| 281 | +for(var i=0;i<arguments.length;i++){ | |
| 282 | +var o=arguments[i]; | |
| 283 | +if(!(o&&o.length)){ | |
| 284 | +return false; | |
| 285 | +} | |
| 286 | +} | |
| 287 | +return true; | |
| 288 | +},isArrayLike:function(){ | |
| 289 | +for(var i=0;i<arguments.length;i++){ | |
| 290 | +var o=arguments[i]; | |
| 291 | +var typ=typeof (o); | |
| 292 | +if((typ!="object"&&!(typ=="function"&&typeof (o.item)=="function"))||o===null||typeof (o.length)!="number"||o.nodeType===3){ | |
| 293 | +return false; | |
| 294 | +} | |
| 295 | +} | |
| 296 | +return true; | |
| 297 | +},isDateLike:function(){ | |
| 298 | +for(var i=0;i<arguments.length;i++){ | |
| 299 | +var o=arguments[i]; | |
| 300 | +if(typeof (o)!="object"||o===null||typeof (o.getTime)!="function"){ | |
| 301 | +return false; | |
| 302 | +} | |
| 303 | +} | |
| 304 | +return true; | |
| 305 | +},xmap:function(fn){ | |
| 306 | +if(fn===null){ | |
| 307 | +return MochiKit.Base.extend(null,arguments,1); | |
| 308 | +} | |
| 309 | +var _40=[]; | |
| 310 | +for(var i=1;i<arguments.length;i++){ | |
| 311 | +_40.push(fn(arguments[i])); | |
| 312 | +} | |
| 313 | +return _40; | |
| 314 | +},map:function(fn,lst){ | |
| 315 | +var m=MochiKit.Base; | |
| 316 | +var itr=MochiKit.Iter; | |
| 317 | +var _42=m.isArrayLike; | |
| 318 | +if(arguments.length<=2){ | |
| 319 | +if(!_42(lst)){ | |
| 320 | +if(itr){ | |
| 321 | +lst=itr.list(lst); | |
| 322 | +if(fn===null){ | |
| 323 | +return lst; | |
| 324 | +} | |
| 325 | +}else{ | |
| 326 | +throw new TypeError("Argument not an array-like and MochiKit.Iter not present"); | |
| 327 | +} | |
| 328 | +} | |
| 329 | +if(fn===null){ | |
| 330 | +return m.extend(null,lst); | |
| 331 | +} | |
| 332 | +var _43=[]; | |
| 333 | +for(var i=0;i<lst.length;i++){ | |
| 334 | +_43.push(fn(lst[i])); | |
| 335 | +} | |
| 336 | +return _43; | |
| 337 | +}else{ | |
| 338 | +if(fn===null){ | |
| 339 | +fn=Array; | |
| 340 | +} | |
| 341 | +var _44=null; | |
| 342 | +for(i=1;i<arguments.length;i++){ | |
| 343 | +if(!_42(arguments[i])){ | |
| 344 | +if(itr){ | |
| 345 | +return itr.list(itr.imap.apply(null,arguments)); | |
| 346 | +}else{ | |
| 347 | +throw new TypeError("Argument not an array-like and MochiKit.Iter not present"); | |
| 348 | +} | |
| 349 | +} | |
| 350 | +var l=arguments[i].length; | |
| 351 | +if(_44===null||_44>l){ | |
| 352 | +_44=l; | |
| 353 | +} | |
| 354 | +} | |
| 355 | +_43=[]; | |
| 356 | +for(i=0;i<_44;i++){ | |
| 357 | +var _45=[]; | |
| 358 | +for(var j=1;j<arguments.length;j++){ | |
| 359 | +_45.push(arguments[j][i]); | |
| 360 | +} | |
| 361 | +_43.push(fn.apply(this,_45)); | |
| 362 | +} | |
| 363 | +return _43; | |
| 364 | +} | |
| 365 | +},xfilter:function(fn){ | |
| 366 | +var _47=[]; | |
| 367 | +if(fn===null){ | |
| 368 | +fn=MochiKit.Base.operator.truth; | |
| 369 | +} | |
| 370 | +for(var i=1;i<arguments.length;i++){ | |
| 371 | +var o=arguments[i]; | |
| 372 | +if(fn(o)){ | |
| 373 | +_47.push(o); | |
| 374 | +} | |
| 375 | +} | |
| 376 | +return _47; | |
| 377 | +},filter:function(fn,lst,_48){ | |
| 378 | +var _49=[]; | |
| 379 | +var m=MochiKit.Base; | |
| 380 | +if(!m.isArrayLike(lst)){ | |
| 381 | +if(MochiKit.Iter){ | |
| 382 | +lst=MochiKit.Iter.list(lst); | |
| 383 | +}else{ | |
| 384 | +throw new TypeError("Argument not an array-like and MochiKit.Iter not present"); | |
| 385 | +} | |
| 386 | +} | |
| 387 | +if(fn===null){ | |
| 388 | +fn=m.operator.truth; | |
| 389 | +} | |
| 390 | +if(typeof (Array.prototype.filter)=="function"){ | |
| 391 | +return Array.prototype.filter.call(lst,fn,_48); | |
| 392 | +}else{ | |
| 393 | +if(typeof (_48)=="undefined"||_48===null){ | |
| 394 | +for(var i=0;i<lst.length;i++){ | |
| 395 | +var o=lst[i]; | |
| 396 | +if(fn(o)){ | |
| 397 | +_49.push(o); | |
| 398 | +} | |
| 399 | +} | |
| 400 | +}else{ | |
| 401 | +for(i=0;i<lst.length;i++){ | |
| 402 | +o=lst[i]; | |
| 403 | +if(fn.call(_48,o)){ | |
| 404 | +_49.push(o); | |
| 405 | +} | |
| 406 | +} | |
| 407 | +} | |
| 408 | +} | |
| 409 | +return _49; | |
| 410 | +},_wrapDumbFunction:function(_50){ | |
| 411 | +return function(){ | |
| 412 | +switch(arguments.length){ | |
| 413 | +case 0: | |
| 414 | +return _50(); | |
| 415 | +case 1: | |
| 416 | +return _50(arguments[0]); | |
| 417 | +case 2: | |
| 418 | +return _50(arguments[0],arguments[1]); | |
| 419 | +case 3: | |
| 420 | +return _50(arguments[0],arguments[1],arguments[2]); | |
| 421 | +} | |
| 422 | +var _51=[]; | |
| 423 | +for(var i=0;i<arguments.length;i++){ | |
| 424 | +_51.push("arguments["+i+"]"); | |
| 425 | +} | |
| 426 | +return eval("(func("+_51.join(",")+"))"); | |
| 427 | +}; | |
| 428 | +},methodcaller:function(_52){ | |
| 429 | +var _53=MochiKit.Base.extend(null,arguments,1); | |
| 430 | +if(typeof (_52)=="function"){ | |
| 431 | +return function(obj){ | |
| 432 | +return _52.apply(obj,_53); | |
| 433 | +}; | |
| 434 | +}else{ | |
| 435 | +return function(obj){ | |
| 436 | +return obj[_52].apply(obj,_53); | |
| 437 | +}; | |
| 438 | +} | |
| 439 | +},method:function(_54,_55){ | |
| 440 | +var m=MochiKit.Base; | |
| 441 | +return m.bind.apply(this,m.extend([_55,_54],arguments,2)); | |
| 442 | +},compose:function(f1,f2){ | |
| 443 | +var _58=[]; | |
| 444 | +var m=MochiKit.Base; | |
| 445 | +if(arguments.length===0){ | |
| 446 | +throw new TypeError("compose() requires at least one argument"); | |
| 447 | +} | |
| 448 | +for(var i=0;i<arguments.length;i++){ | |
| 449 | +var fn=arguments[i]; | |
| 450 | +if(typeof (fn)!="function"){ | |
| 451 | +throw new TypeError(m.repr(fn)+" is not a function"); | |
| 452 | +} | |
| 453 | +_58.push(fn); | |
| 454 | +} | |
| 455 | +return function(){ | |
| 456 | +var _59=arguments; | |
| 457 | +for(var i=_58.length-1;i>=0;i--){ | |
| 458 | +_59=[_58[i].apply(this,_59)]; | |
| 459 | +} | |
| 460 | +return _59[0]; | |
| 461 | +}; | |
| 462 | +},bind:function(_60,_61){ | |
| 463 | +if(typeof (_60)=="string"){ | |
| 464 | +_60=_61[_60]; | |
| 465 | +} | |
| 466 | +var _62=_60.im_func; | |
| 467 | +var _63=_60.im_preargs; | |
| 468 | +var _64=_60.im_self; | |
| 469 | +var m=MochiKit.Base; | |
| 470 | +if(typeof (_60)=="function"&&typeof (_60.apply)=="undefined"){ | |
| 471 | +_60=m._wrapDumbFunction(_60); | |
| 472 | +} | |
| 473 | +if(typeof (_62)!="function"){ | |
| 474 | +_62=_60; | |
| 475 | +} | |
| 476 | +if(typeof (_61)!="undefined"){ | |
| 477 | +_64=_61; | |
| 478 | +} | |
| 479 | +if(typeof (_63)=="undefined"){ | |
| 480 | +_63=[]; | |
| 481 | +}else{ | |
| 482 | +_63=_63.slice(); | |
| 483 | +} | |
| 484 | +m.extend(_63,arguments,2); | |
| 485 | +var _65=function(){ | |
| 486 | +var _66=arguments; | |
| 487 | +var me=arguments.callee; | |
| 488 | +if(me.im_preargs.length>0){ | |
| 489 | +_66=m.concat(me.im_preargs,_66); | |
| 490 | +} | |
| 491 | +var _61=me.im_self; | |
| 492 | +if(!_61){ | |
| 493 | +_61=this; | |
| 494 | +} | |
| 495 | +return me.im_func.apply(_61,_66); | |
| 496 | +}; | |
| 497 | +_65.im_self=_64; | |
| 498 | +_65.im_func=_62; | |
| 499 | +_65.im_preargs=_63; | |
| 500 | +return _65; | |
| 501 | +},bindMethods:function(_67){ | |
| 502 | +var _68=MochiKit.Base.bind; | |
| 503 | +for(var k in _67){ | |
| 504 | +var _69=_67[k]; | |
| 505 | +if(typeof (_69)=="function"){ | |
| 506 | +_67[k]=_68(_69,_67); | |
| 507 | +} | |
| 508 | +} | |
| 509 | +},registerComparator:function(_70,_71,_72,_73){ | |
| 510 | +MochiKit.Base.comparatorRegistry.register(_70,_71,_72,_73); | |
| 511 | +},_primitives:{"boolean":true,"string":true,"number":true},compare:function(a,b){ | |
| 512 | +if(a==b){ | |
| 513 | +return 0; | |
| 514 | +} | |
| 515 | +var _74=(typeof (a)=="undefined"||a===null); | |
| 516 | +var _75=(typeof (b)=="undefined"||b===null); | |
| 517 | +if(_74&&_75){ | |
| 518 | +return 0; | |
| 519 | +}else{ | |
| 520 | +if(_74){ | |
| 521 | +return -1; | |
| 522 | +}else{ | |
| 523 | +if(_75){ | |
| 524 | +return 1; | |
| 525 | +} | |
| 526 | +} | |
| 527 | +} | |
| 528 | +var m=MochiKit.Base; | |
| 529 | +var _76=m._primitives; | |
| 530 | +if(!(typeof (a) in _76&&typeof (b) in _76)){ | |
| 531 | +try{ | |
| 532 | +return m.comparatorRegistry.match(a,b); | |
| 533 | +} | |
| 534 | +catch(e){ | |
| 535 | +if(e!=m.NotFound){ | |
| 536 | +throw e; | |
| 537 | +} | |
| 538 | +} | |
| 539 | +} | |
| 540 | +if(a<b){ | |
| 541 | +return -1; | |
| 542 | +}else{ | |
| 543 | +if(a>b){ | |
| 544 | +return 1; | |
| 545 | +} | |
| 546 | +} | |
| 547 | +var _77=m.repr; | |
| 548 | +throw new TypeError(_77(a)+" and "+_77(b)+" can not be compared"); | |
| 549 | +},compareDateLike:function(a,b){ | |
| 550 | +return MochiKit.Base.compare(a.getTime(),b.getTime()); | |
| 551 | +},compareArrayLike:function(a,b){ | |
| 552 | +var _78=MochiKit.Base.compare; | |
| 553 | +var _79=a.length; | |
| 554 | +var _80=0; | |
| 555 | +if(_79>b.length){ | |
| 556 | +_80=1; | |
| 557 | +_79=b.length; | |
| 558 | +}else{ | |
| 559 | +if(_79<b.length){ | |
| 560 | +_80=-1; | |
| 561 | +} | |
| 562 | +} | |
| 563 | +for(var i=0;i<_79;i++){ | |
| 564 | +var cmp=_78(a[i],b[i]); | |
| 565 | +if(cmp){ | |
| 566 | +return cmp; | |
| 567 | +} | |
| 568 | +} | |
| 569 | +return _80; | |
| 570 | +},registerRepr:function(_82,_83,_84,_85){ | |
| 571 | +MochiKit.Base.reprRegistry.register(_82,_83,_84,_85); | |
| 572 | +},repr:function(o){ | |
| 573 | +if(typeof (o)=="undefined"){ | |
| 574 | +return "undefined"; | |
| 575 | +}else{ | |
| 576 | +if(o===null){ | |
| 577 | +return "null"; | |
| 578 | +} | |
| 579 | +} | |
| 580 | +try{ | |
| 581 | +if(typeof (o.__repr__)=="function"){ | |
| 582 | +return o.__repr__(); | |
| 583 | +}else{ | |
| 584 | +if(typeof (o.repr)=="function"&&o.repr!=arguments.callee){ | |
| 585 | +return o.repr(); | |
| 586 | +} | |
| 587 | +} | |
| 588 | +return MochiKit.Base.reprRegistry.match(o); | |
| 589 | +} | |
| 590 | +catch(e){ | |
| 591 | +if(typeof (o.NAME)=="string"&&(o.toString==Function.prototype.toString||o.toString==Object.prototype.toString)){ | |
| 592 | +return o.NAME; | |
| 593 | +} | |
| 594 | +} | |
| 595 | +try{ | |
| 596 | +var _86=(o+""); | |
| 597 | +} | |
| 598 | +catch(e){ | |
| 599 | +return "["+typeof (o)+"]"; | |
| 600 | +} | |
| 601 | +if(typeof (o)=="function"){ | |
| 602 | +o=_86.replace(/^\s+/,""); | |
| 603 | +var idx=o.indexOf("{"); | |
| 604 | +if(idx!=-1){ | |
| 605 | +o=o.substr(0,idx)+"{...}"; | |
| 606 | +} | |
| 607 | +} | |
| 608 | +return _86; | |
| 609 | +},reprArrayLike:function(o){ | |
| 610 | +var m=MochiKit.Base; | |
| 611 | +return "["+m.map(m.repr,o).join(", ")+"]"; | |
| 612 | +},reprString:function(o){ | |
| 613 | +return ("\""+o.replace(/(["\\])/g,"\\$1")+"\"").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r"); | |
| 614 | +},reprNumber:function(o){ | |
| 615 | +return o+""; | |
| 616 | +},registerJSON:function(_88,_89,_90,_91){ | |
| 617 | +MochiKit.Base.jsonRegistry.register(_88,_89,_90,_91); | |
| 618 | +},evalJSON:function(){ | |
| 619 | +return eval("("+arguments[0]+")"); | |
| 620 | +},serializeJSON:function(o){ | |
| 621 | +var _92=typeof (o); | |
| 622 | +if(_92=="number"||_92=="boolean"){ | |
| 623 | +return o+""; | |
| 624 | +}else{ | |
| 625 | +if(o===null){ | |
| 626 | +return "null"; | |
| 627 | +} | |
| 628 | +} | |
| 629 | +var m=MochiKit.Base; | |
| 630 | +var _93=m.reprString; | |
| 631 | +if(_92=="string"){ | |
| 632 | +return _93(o); | |
| 633 | +} | |
| 634 | +var me=arguments.callee; | |
| 635 | +var _94; | |
| 636 | +if(typeof (o.__json__)=="function"){ | |
| 637 | +_94=o.__json__(); | |
| 638 | +if(o!==_94){ | |
| 639 | +return me(_94); | |
| 640 | +} | |
| 641 | +} | |
| 642 | +if(typeof (o.json)=="function"){ | |
| 643 | +_94=o.json(); | |
| 644 | +if(o!==_94){ | |
| 645 | +return me(_94); | |
| 646 | +} | |
| 647 | +} | |
| 648 | +if(_92!="function"&&typeof (o.length)=="number"){ | |
| 649 | +var res=[]; | |
| 650 | +for(var i=0;i<o.length;i++){ | |
| 651 | +var val=me(o[i]); | |
| 652 | +if(typeof (val)!="string"){ | |
| 653 | +val="undefined"; | |
| 654 | +} | |
| 655 | +res.push(val); | |
| 656 | +} | |
| 657 | +return "["+res.join(", ")+"]"; | |
| 658 | +} | |
| 659 | +try{ | |
| 660 | +_94=m.jsonRegistry.match(o); | |
| 661 | +if(o!==_94){ | |
| 662 | +return me(_94); | |
| 663 | +} | |
| 664 | +} | |
| 665 | +catch(e){ | |
| 666 | +if(e!=m.NotFound){ | |
| 667 | +throw e; | |
| 668 | +} | |
| 669 | +} | |
| 670 | +if(_92=="undefined"){ | |
| 671 | +throw new TypeError("undefined can not be serialized as JSON"); | |
| 672 | +} | |
| 673 | +if(_92=="function"){ | |
| 674 | +return null; | |
| 675 | +} | |
| 676 | +res=[]; | |
| 677 | +for(var k in o){ | |
| 678 | +var _96; | |
| 679 | +if(typeof (k)=="number"){ | |
| 680 | +_96="\""+k+"\""; | |
| 681 | +}else{ | |
| 682 | +if(typeof (k)=="string"){ | |
| 683 | +_96=_93(k); | |
| 684 | +}else{ | |
| 685 | +continue; | |
| 686 | +} | |
| 687 | +} | |
| 688 | +val=me(o[k]); | |
| 689 | +if(typeof (val)!="string"){ | |
| 690 | +continue; | |
| 691 | +} | |
| 692 | +res.push(_96+":"+val); | |
| 693 | +} | |
| 694 | +return "{"+res.join(", ")+"}"; | |
| 695 | +},objEqual:function(a,b){ | |
| 696 | +return (MochiKit.Base.compare(a,b)===0); | |
| 697 | +},arrayEqual:function(_97,arr){ | |
| 698 | +if(_97.length!=arr.length){ | |
| 699 | +return false; | |
| 700 | +} | |
| 701 | +return (MochiKit.Base.compare(_97,arr)===0); | |
| 702 | +},concat:function(){ | |
| 703 | +var _99=[]; | |
| 704 | +var _100=MochiKit.Base.extend; | |
| 705 | +for(var i=0;i<arguments.length;i++){ | |
| 706 | +_100(_99,arguments[i]); | |
| 707 | +} | |
| 708 | +return _99; | |
| 709 | +},keyComparator:function(key){ | |
| 710 | +var m=MochiKit.Base; | |
| 711 | +var _102=m.compare; | |
| 712 | +if(arguments.length==1){ | |
| 713 | +return function(a,b){ | |
| 714 | +return _102(a[key],b[key]); | |
| 715 | +}; | |
| 716 | +} | |
| 717 | +var _103=m.extend(null,arguments); | |
| 718 | +return function(a,b){ | |
| 719 | +var rval=0; | |
| 720 | +for(var i=0;(rval===0)&&(i<_103.length);i++){ | |
| 721 | +var key=_103[i]; | |
| 722 | +rval=_102(a[key],b[key]); | |
| 723 | +} | |
| 724 | +return rval; | |
| 725 | +}; | |
| 726 | +},reverseKeyComparator:function(key){ | |
| 727 | +var _105=MochiKit.Base.keyComparator.apply(this,arguments); | |
| 728 | +return function(a,b){ | |
| 729 | +return _105(b,a); | |
| 730 | +}; | |
| 731 | +},partial:function(func){ | |
| 732 | +var m=MochiKit.Base; | |
| 733 | +return m.bind.apply(this,m.extend([func,undefined],arguments,1)); | |
| 734 | +},listMinMax:function(_107,lst){ | |
| 735 | +if(lst.length===0){ | |
| 736 | +return null; | |
| 737 | +} | |
| 738 | +var cur=lst[0]; | |
| 739 | +var _109=MochiKit.Base.compare; | |
| 740 | +for(var i=1;i<lst.length;i++){ | |
| 741 | +var o=lst[i]; | |
| 742 | +if(_109(o,cur)==_107){ | |
| 743 | +cur=o; | |
| 744 | +} | |
| 745 | +} | |
| 746 | +return cur; | |
| 747 | +},objMax:function(){ | |
| 748 | +return MochiKit.Base.listMinMax(1,arguments); | |
| 749 | +},objMin:function(){ | |
| 750 | +return MochiKit.Base.listMinMax(-1,arguments); | |
| 751 | +},findIdentical:function(lst,_110,_111,end){ | |
| 752 | +if(typeof (end)=="undefined"||end===null){ | |
| 753 | +end=lst.length; | |
| 754 | +} | |
| 755 | +if(typeof (_111)=="undefined"||_111===null){ | |
| 756 | +_111=0; | |
| 757 | +} | |
| 758 | +for(var i=_111;i<end;i++){ | |
| 759 | +if(lst[i]===_110){ | |
| 760 | +return i; | |
| 761 | +} | |
| 762 | +} | |
| 763 | +return -1; | |
| 764 | +},mean:function(){ | |
| 765 | +var sum=0; | |
| 766 | +var m=MochiKit.Base; | |
| 767 | +var args=m.extend(null,arguments); | |
| 768 | +var _115=args.length; | |
| 769 | +while(args.length){ | |
| 770 | +var o=args.shift(); | |
| 771 | +if(o&&typeof (o)=="object"&&typeof (o.length)=="number"){ | |
| 772 | +_115+=o.length-1; | |
| 773 | +for(var i=o.length-1;i>=0;i--){ | |
| 774 | +sum+=o[i]; | |
| 775 | +} | |
| 776 | +}else{ | |
| 777 | +sum+=o; | |
| 778 | +} | |
| 779 | +} | |
| 780 | +if(_115<=0){ | |
| 781 | +throw new TypeError("mean() requires at least one argument"); | |
| 782 | +} | |
| 783 | +return sum/_115; | |
| 784 | +},median:function(){ | |
| 785 | +var data=MochiKit.Base.flattenArguments(arguments); | |
| 786 | +if(data.length===0){ | |
| 787 | +throw new TypeError("median() requires at least one argument"); | |
| 788 | +} | |
| 789 | +data.sort(compare); | |
| 790 | +if(data.length%2==0){ | |
| 791 | +var _117=data.length/2; | |
| 792 | +return (data[_117]+data[_117-1])/2; | |
| 793 | +}else{ | |
| 794 | +return data[(data.length-1)/2]; | |
| 795 | +} | |
| 796 | +},findValue:function(lst,_118,_119,end){ | |
| 797 | +if(typeof (end)=="undefined"||end===null){ | |
| 798 | +end=lst.length; | |
| 799 | +} | |
| 800 | +if(typeof (_119)=="undefined"||_119===null){ | |
| 801 | +_119=0; | |
| 802 | +} | |
| 803 | +var cmp=MochiKit.Base.compare; | |
| 804 | +for(var i=_119;i<end;i++){ | |
| 805 | +if(cmp(lst[i],_118)===0){ | |
| 806 | +return i; | |
| 807 | +} | |
| 808 | +} | |
| 809 | +return -1; | |
| 810 | +},nodeWalk:function(node,_121){ | |
| 811 | +var _122=[node]; | |
| 812 | +var _123=MochiKit.Base.extend; | |
| 813 | +while(_122.length){ | |
| 814 | +var res=_121(_122.shift()); | |
| 815 | +if(res){ | |
| 816 | +_123(_122,res); | |
| 817 | +} | |
| 818 | +} | |
| 819 | +},nameFunctions:function(_124){ | |
| 820 | +var base=_124.NAME; | |
| 821 | +if(typeof (base)=="undefined"){ | |
| 822 | +base=""; | |
| 823 | +}else{ | |
| 824 | +base=base+"."; | |
| 825 | +} | |
| 826 | +for(var name in _124){ | |
| 827 | +var o=_124[name]; | |
| 828 | +if(typeof (o)=="function"&&typeof (o.NAME)=="undefined"){ | |
| 829 | +try{ | |
| 830 | +o.NAME=base+name; | |
| 831 | +} | |
| 832 | +catch(e){ | |
| 833 | +} | |
| 834 | +} | |
| 835 | +} | |
| 836 | +},queryString:function(_127,_128){ | |
| 837 | +if(typeof (MochiKit.DOM)!="undefined"&&arguments.length==1&&(typeof (_127)=="string"||(typeof (_127.nodeType)!="undefined"&&_127.nodeType>0))){ | |
| 838 | +var kv=MochiKit.DOM.formContents(_127); | |
| 839 | +_127=kv[0]; | |
| 840 | +_128=kv[1]; | |
| 841 | +}else{ | |
| 842 | +if(arguments.length==1){ | |
| 843 | +if(typeof (_127.length)=="number"&&_127.length==2){ | |
| 844 | +return arguments.callee(_127[0],_127[1]); | |
| 845 | +} | |
| 846 | +var o=_127; | |
| 847 | +_127=[]; | |
| 848 | +_128=[]; | |
| 849 | +for(var k in o){ | |
| 850 | +var v=o[k]; | |
| 851 | +if(typeof (v)=="function"){ | |
| 852 | +continue; | |
| 853 | +}else{ | |
| 854 | +if(typeof (v)!="string"&&typeof (v.length)=="number"){ | |
| 855 | +for(var i=0;i<v.length;i++){ | |
| 856 | +_127.push(k); | |
| 857 | +_128.push(v[i]); | |
| 858 | +} | |
| 859 | +}else{ | |
| 860 | +_127.push(k); | |
| 861 | +_128.push(v); | |
| 862 | +} | |
| 863 | +} | |
| 864 | +} | |
| 865 | +} | |
| 866 | +} | |
| 867 | +var rval=[]; | |
| 868 | +var len=Math.min(_127.length,_128.length); | |
| 869 | +var _131=MochiKit.Base.urlEncode; | |
| 870 | +for(var i=0;i<len;i++){ | |
| 871 | +v=_128[i]; | |
| 872 | +if(typeof (v)!="undefined"&&v!==null){ | |
| 873 | +rval.push(_131(_127[i])+"="+_131(v)); | |
| 874 | +} | |
| 875 | +} | |
| 876 | +return rval.join("&"); | |
| 877 | +},parseQueryString:function(_132,_133){ | |
| 878 | +var qstr=(_132.charAt(0)=="?")?_132.substring(1):_132; | |
| 879 | +var _135=qstr.replace(/\+/g,"%20").split(/(\&\;|\&\#38\;|\&|\&)/); | |
| 880 | +var o={}; | |
| 881 | +var _136; | |
| 882 | +if(typeof (decodeURIComponent)!="undefined"){ | |
| 883 | +_136=decodeURIComponent; | |
| 884 | +}else{ | |
| 885 | +_136=unescape; | |
| 886 | +} | |
| 887 | +if(_133){ | |
| 888 | +for(var i=0;i<_135.length;i++){ | |
| 889 | +var pair=_135[i].split("="); | |
| 890 | +if(pair.length!==2){ | |
| 891 | +continue; | |
| 892 | +} | |
| 893 | +var name=_136(pair[0]); | |
| 894 | +var arr=o[name]; | |
| 895 | +if(!(arr instanceof Array)){ | |
| 896 | +arr=[]; | |
| 897 | +o[name]=arr; | |
| 898 | +} | |
| 899 | +arr.push(_136(pair[1])); | |
| 900 | +} | |
| 901 | +}else{ | |
| 902 | +for(i=0;i<_135.length;i++){ | |
| 903 | +pair=_135[i].split("="); | |
| 904 | +if(pair.length!==2){ | |
| 905 | +continue; | |
| 906 | +} | |
| 907 | +o[_136(pair[0])]=_136(pair[1]); | |
| 908 | +} | |
| 909 | +} | |
| 910 | +return o; | |
| 911 | +}}); | |
| 912 | +MochiKit.Base.AdapterRegistry=function(){ | |
| 913 | +this.pairs=[]; | |
| 914 | +}; | |
| 915 | +MochiKit.Base.AdapterRegistry.prototype={register:function(name,_138,wrap,_140){ | |
| 916 | +if(_140){ | |
| 917 | +this.pairs.unshift([name,_138,wrap]); | |
| 918 | +}else{ | |
| 919 | +this.pairs.push([name,_138,wrap]); | |
| 920 | +} | |
| 921 | +},match:function(){ | |
| 922 | +for(var i=0;i<this.pairs.length;i++){ | |
| 923 | +var pair=this.pairs[i]; | |
| 924 | +if(pair[1].apply(this,arguments)){ | |
| 925 | +return pair[2].apply(this,arguments); | |
| 926 | +} | |
| 927 | +} | |
| 928 | +throw MochiKit.Base.NotFound; | |
| 929 | +},unregister:function(name){ | |
| 930 | +for(var i=0;i<this.pairs.length;i++){ | |
| 931 | +var pair=this.pairs[i]; | |
| 932 | +if(pair[0]==name){ | |
| 933 | +this.pairs.splice(i,1); | |
| 934 | +return true; | |
| 935 | +} | |
| 936 | +} | |
| 937 | +return false; | |
| 938 | +}}; | |
| 939 | +MochiKit.Base.EXPORT=["flattenArray","noop","camelize","counter","clone","extend","update","updatetree","setdefault","keys","values","items","NamedError","operator","forwardCall","itemgetter","typeMatcher","isCallable","isUndefined","isUndefinedOrNull","isNull","isEmpty","isNotEmpty","isArrayLike","isDateLike","xmap","map","xfilter","filter","methodcaller","compose","bind","bindMethods","NotFound","AdapterRegistry","registerComparator","compare","registerRepr","repr","objEqual","arrayEqual","concat","keyComparator","reverseKeyComparator","partial","merge","listMinMax","listMax","listMin","objMax","objMin","nodeWalk","zip","urlEncode","queryString","serializeJSON","registerJSON","evalJSON","parseQueryString","findValue","findIdentical","flattenArguments","method","average","mean","median"]; | |
| 940 | +MochiKit.Base.EXPORT_OK=["nameFunctions","comparatorRegistry","reprRegistry","jsonRegistry","compareDateLike","compareArrayLike","reprArrayLike","reprString","reprNumber"]; | |
| 941 | +MochiKit.Base._exportSymbols=function(_141,_142){ | |
| 942 | +if(!MochiKit.__export__){ | |
| 943 | +return; | |
| 944 | +} | |
| 945 | +var all=_142.EXPORT_TAGS[":all"]; | |
| 946 | +for(var i=0;i<all.length;i++){ | |
| 947 | +_141[all[i]]=_142[all[i]]; | |
| 948 | +} | |
| 949 | +}; | |
| 950 | +MochiKit.Base.__new__=function(){ | |
| 951 | +var m=this; | |
| 952 | +m.noop=m.operator.identity; | |
| 953 | +m.forward=m.forwardCall; | |
| 954 | +m.find=m.findValue; | |
| 955 | +if(typeof (encodeURIComponent)!="undefined"){ | |
| 956 | +m.urlEncode=function(_144){ | |
| 957 | +return encodeURIComponent(_144).replace(/\'/g,"%27"); | |
| 958 | +}; | |
| 959 | +}else{ | |
| 960 | +m.urlEncode=function(_145){ | |
| 961 | +return escape(_145).replace(/\+/g,"%2B").replace(/\"/g,"%22").rval.replace(/\'/g,"%27"); | |
| 962 | +}; | |
| 963 | +} | |
| 964 | +m.NamedError=function(name){ | |
| 965 | +this.message=name; | |
| 966 | +this.name=name; | |
| 967 | +}; | |
| 968 | +m.NamedError.prototype=new Error(); | |
| 969 | +m.update(m.NamedError.prototype,{repr:function(){ | |
| 970 | +if(this.message&&this.message!=this.name){ | |
| 971 | +return this.name+"("+m.repr(this.message)+")"; | |
| 972 | +}else{ | |
| 973 | +return this.name+"()"; | |
| 974 | +} | |
| 975 | +},toString:m.forwardCall("repr")}); | |
| 976 | +m.NotFound=new m.NamedError("MochiKit.Base.NotFound"); | |
| 977 | +m.listMax=m.partial(m.listMinMax,1); | |
| 978 | +m.listMin=m.partial(m.listMinMax,-1); | |
| 979 | +m.isCallable=m.typeMatcher("function"); | |
| 980 | +m.isUndefined=m.typeMatcher("undefined"); | |
| 981 | +m.merge=m.partial(m.update,null); | |
| 982 | +m.zip=m.partial(m.map,null); | |
| 983 | +m.average=m.mean; | |
| 984 | +m.comparatorRegistry=new m.AdapterRegistry(); | |
| 985 | +m.registerComparator("dateLike",m.isDateLike,m.compareDateLike); | |
| 986 | +m.registerComparator("arrayLike",m.isArrayLike,m.compareArrayLike); | |
| 987 | +m.reprRegistry=new m.AdapterRegistry(); | |
| 988 | +m.registerRepr("arrayLike",m.isArrayLike,m.reprArrayLike); | |
| 989 | +m.registerRepr("string",m.typeMatcher("string"),m.reprString); | |
| 990 | +m.registerRepr("numbers",m.typeMatcher("number","boolean"),m.reprNumber); | |
| 991 | +m.jsonRegistry=new m.AdapterRegistry(); | |
| 992 | +var all=m.concat(m.EXPORT,m.EXPORT_OK); | |
| 993 | +m.EXPORT_TAGS={":common":m.concat(m.EXPORT_OK),":all":all}; | |
| 994 | +m.nameFunctions(this); | |
| 995 | +}; | |
| 996 | +MochiKit.Base.__new__(); | |
| 997 | +if(MochiKit.__export__){ | |
| 998 | +compare=MochiKit.Base.compare; | |
| 999 | +compose=MochiKit.Base.compose; | |
| 1000 | +serializeJSON=MochiKit.Base.serializeJSON; | |
| 1001 | +} | |
| 1002 | +MochiKit.Base._exportSymbols(this,MochiKit.Base); | |
| 1003 | +if(typeof (dojo)!="undefined"){ | |
| 1004 | +dojo.provide("MochiKit.Iter"); | |
| 1005 | +dojo.require("MochiKit.Base"); | |
| 1006 | +} | |
| 1007 | +if(typeof (JSAN)!="undefined"){ | |
| 1008 | +JSAN.use("MochiKit.Base",[]); | |
| 1009 | +} | |
| 1010 | +try{ | |
| 1011 | +if(typeof (MochiKit.Base)=="undefined"){ | |
| 1012 | +throw ""; | |
| 1013 | +} | |
| 1014 | +} | |
| 1015 | +catch(e){ | |
| 1016 | +throw "MochiKit.Iter depends on MochiKit.Base!"; | |
| 1017 | +} | |
| 1018 | +if(typeof (MochiKit.Iter)=="undefined"){ | |
| 1019 | +MochiKit.Iter={}; | |
| 1020 | +} | |
| 1021 | +MochiKit.Iter.NAME="MochiKit.Iter"; | |
| 1022 | +MochiKit.Iter.VERSION="1.4"; | |
| 1023 | +MochiKit.Base.update(MochiKit.Iter,{__repr__:function(){ | |
| 1024 | +return "["+this.NAME+" "+this.VERSION+"]"; | |
| 1025 | +},toString:function(){ | |
| 1026 | +return this.__repr__(); | |
| 1027 | +},registerIteratorFactory:function(name,_146,_147,_148){ | |
| 1028 | +MochiKit.Iter.iteratorRegistry.register(name,_146,_147,_148); | |
| 1029 | +},iter:function(_149,_150){ | |
| 1030 | +var self=MochiKit.Iter; | |
| 1031 | +if(arguments.length==2){ | |
| 1032 | +return self.takewhile(function(a){ | |
| 1033 | +return a!=_150; | |
| 1034 | +},_149); | |
| 1035 | +} | |
| 1036 | +if(typeof (_149.next)=="function"){ | |
| 1037 | +return _149; | |
| 1038 | +}else{ | |
| 1039 | +if(typeof (_149.iter)=="function"){ | |
| 1040 | +return _149.iter(); | |
| 1041 | +} | |
| 1042 | +} | |
| 1043 | +try{ | |
| 1044 | +return self.iteratorRegistry.match(_149); | |
| 1045 | +} | |
| 1046 | +catch(e){ | |
| 1047 | +var m=MochiKit.Base; | |
| 1048 | +if(e==m.NotFound){ | |
| 1049 | +e=new TypeError(typeof (_149)+": "+m.repr(_149)+" is not iterable"); | |
| 1050 | +} | |
| 1051 | +throw e; | |
| 1052 | +} | |
| 1053 | +},count:function(n){ | |
| 1054 | +if(!n){ | |
| 1055 | +n=0; | |
| 1056 | +} | |
| 1057 | +var m=MochiKit.Base; | |
| 1058 | +return {repr:function(){ | |
| 1059 | +return "count("+n+")"; | |
| 1060 | +},toString:m.forwardCall("repr"),next:m.counter(n)}; | |
| 1061 | +},cycle:function(p){ | |
| 1062 | +var self=MochiKit.Iter; | |
| 1063 | +var m=MochiKit.Base; | |
| 1064 | +var lst=[]; | |
| 1065 | +var _153=self.iter(p); | |
| 1066 | +return {repr:function(){ | |
| 1067 | +return "cycle(...)"; | |
| 1068 | +},toString:m.forwardCall("repr"),next:function(){ | |
| 1069 | +try{ | |
| 1070 | +var rval=_153.next(); | |
| 1071 | +lst.push(rval); | |
| 1072 | +return rval; | |
| 1073 | +} | |
| 1074 | +catch(e){ | |
| 1075 | +if(e!=self.StopIteration){ | |
| 1076 | +throw e; | |
| 1077 | +} | |
| 1078 | +if(lst.length===0){ | |
| 1079 | +this.next=function(){ | |
| 1080 | +throw self.StopIteration; | |
| 1081 | +}; | |
| 1082 | +}else{ | |
| 1083 | +var i=-1; | |
| 1084 | +this.next=function(){ | |
| 1085 | +i=(i+1)%lst.length; | |
| 1086 | +return lst[i]; | |
| 1087 | +}; | |
| 1088 | +} | |
| 1089 | +return this.next(); | |
| 1090 | +} | |
| 1091 | +}}; | |
| 1092 | +},repeat:function(elem,n){ | |
| 1093 | +var m=MochiKit.Base; | |
| 1094 | +if(typeof (n)=="undefined"){ | |
| 1095 | +return {repr:function(){ | |
| 1096 | +return "repeat("+m.repr(elem)+")"; | |
| 1097 | +},toString:m.forwardCall("repr"),next:function(){ | |
| 1098 | +return elem; | |
| 1099 | +}}; | |
| 1100 | +} | |
| 1101 | +return {repr:function(){ | |
| 1102 | +return "repeat("+m.repr(elem)+", "+n+")"; | |
| 1103 | +},toString:m.forwardCall("repr"),next:function(){ | |
| 1104 | +if(n<=0){ | |
| 1105 | +throw MochiKit.Iter.StopIteration; | |
| 1106 | +} | |
| 1107 | +n-=1; | |
| 1108 | +return elem; | |
| 1109 | +}}; | |
| 1110 | +},next:function(_155){ | |
| 1111 | +return _155.next(); | |
| 1112 | +},izip:function(p,q){ | |
| 1113 | +var m=MochiKit.Base; | |
| 1114 | +var self=MochiKit.Iter; | |
| 1115 | +var next=self.next; | |
| 1116 | +var _158=m.map(self.iter,arguments); | |
| 1117 | +return {repr:function(){ | |
| 1118 | +return "izip(...)"; | |
| 1119 | +},toString:m.forwardCall("repr"),next:function(){ | |
| 1120 | +return m.map(next,_158); | |
| 1121 | +}}; | |
| 1122 | +},ifilter:function(pred,seq){ | |
| 1123 | +var m=MochiKit.Base; | |
| 1124 | +seq=MochiKit.Iter.iter(seq); | |
| 1125 | +if(pred===null){ | |
| 1126 | +pred=m.operator.truth; | |
| 1127 | +} | |
| 1128 | +return {repr:function(){ | |
| 1129 | +return "ifilter(...)"; | |
| 1130 | +},toString:m.forwardCall("repr"),next:function(){ | |
| 1131 | +while(true){ | |
| 1132 | +var rval=seq.next(); | |
| 1133 | +if(pred(rval)){ | |
| 1134 | +return rval; | |
| 1135 | +} | |
| 1136 | +} | |
| 1137 | +return undefined; | |
| 1138 | +}}; | |
| 1139 | +},ifilterfalse:function(pred,seq){ | |
| 1140 | +var m=MochiKit.Base; | |
| 1141 | +seq=MochiKit.Iter.iter(seq); | |
| 1142 | +if(pred===null){ | |
| 1143 | +pred=m.operator.truth; | |
| 1144 | +} | |
| 1145 | +return {repr:function(){ | |
| 1146 | +return "ifilterfalse(...)"; | |
| 1147 | +},toString:m.forwardCall("repr"),next:function(){ | |
| 1148 | +while(true){ | |
| 1149 | +var rval=seq.next(); | |
| 1150 | +if(!pred(rval)){ | |
| 1151 | +return rval; | |
| 1152 | +} | |
| 1153 | +} | |
| 1154 | +return undefined; | |
| 1155 | +}}; | |
| 1156 | +},islice:function(seq){ | |
| 1157 | +var self=MochiKit.Iter; | |
| 1158 | +var m=MochiKit.Base; | |
| 1159 | +seq=self.iter(seq); | |
| 1160 | +var _161=0; | |
| 1161 | +var stop=0; | |
| 1162 | +var step=1; | |
| 1163 | +var i=-1; | |
| 1164 | +if(arguments.length==2){ | |
| 1165 | +stop=arguments[1]; | |
| 1166 | +}else{ | |
| 1167 | +if(arguments.length==3){ | |
| 1168 | +_161=arguments[1]; | |
| 1169 | +stop=arguments[2]; | |
| 1170 | +}else{ | |
| 1171 | +_161=arguments[1]; | |
| 1172 | +stop=arguments[2]; | |
| 1173 | +step=arguments[3]; | |
| 1174 | +} | |
| 1175 | +} | |
| 1176 | +return {repr:function(){ | |
| 1177 | +return "islice("+["...",_161,stop,step].join(", ")+")"; | |
| 1178 | +},toString:m.forwardCall("repr"),next:function(){ | |
| 1179 | +var rval; | |
| 1180 | +while(i<_161){ | |
| 1181 | +rval=seq.next(); | |
| 1182 | +i++; | |
| 1183 | +} | |
| 1184 | +if(_161>=stop){ | |
| 1185 | +throw self.StopIteration; | |
| 1186 | +} | |
| 1187 | +_161+=step; | |
| 1188 | +return rval; | |
| 1189 | +}}; | |
| 1190 | +},imap:function(fun,p,q){ | |
| 1191 | +var m=MochiKit.Base; | |
| 1192 | +var self=MochiKit.Iter; | |
| 1193 | +var _165=m.map(self.iter,m.extend(null,arguments,1)); | |
| 1194 | +var map=m.map; | |
| 1195 | +var next=self.next; | |
| 1196 | +return {repr:function(){ | |
| 1197 | +return "imap(...)"; | |
| 1198 | +},toString:m.forwardCall("repr"),next:function(){ | |
| 1199 | +return fun.apply(this,map(next,_165)); | |
| 1200 | +}}; | |
| 1201 | +},applymap:function(fun,seq,self){ | |
| 1202 | +seq=MochiKit.Iter.iter(seq); | |
| 1203 | +var m=MochiKit.Base; | |
| 1204 | +return {repr:function(){ | |
| 1205 | +return "applymap(...)"; | |
| 1206 | +},toString:m.forwardCall("repr"),next:function(){ | |
| 1207 | +return fun.apply(self,seq.next()); | |
| 1208 | +}}; | |
| 1209 | +},chain:function(p,q){ | |
| 1210 | +var self=MochiKit.Iter; | |
| 1211 | +var m=MochiKit.Base; | |
| 1212 | +if(arguments.length==1){ | |
| 1213 | +return self.iter(arguments[0]); | |
| 1214 | +} | |
| 1215 | +var _167=m.map(self.iter,arguments); | |
| 1216 | +return {repr:function(){ | |
| 1217 | +return "chain(...)"; | |
| 1218 | +},toString:m.forwardCall("repr"),next:function(){ | |
| 1219 | +while(_167.length>1){ | |
| 1220 | +try{ | |
| 1221 | +return _167[0].next(); | |
| 1222 | +} | |
| 1223 | +catch(e){ | |
| 1224 | +if(e!=self.StopIteration){ | |
| 1225 | +throw e; | |
| 1226 | +} | |
| 1227 | +_167.shift(); | |
| 1228 | +} | |
| 1229 | +} | |
| 1230 | +if(_167.length==1){ | |
| 1231 | +var arg=_167.shift(); | |
| 1232 | +this.next=m.bind("next",arg); | |
| 1233 | +return this.next(); | |
| 1234 | +} | |
| 1235 | +throw self.StopIteration; | |
| 1236 | +}}; | |
| 1237 | +},takewhile:function(pred,seq){ | |
| 1238 | +var self=MochiKit.Iter; | |
| 1239 | +seq=self.iter(seq); | |
| 1240 | +return {repr:function(){ | |
| 1241 | +return "takewhile(...)"; | |
| 1242 | +},toString:MochiKit.Base.forwardCall("repr"),next:function(){ | |
| 1243 | +var rval=seq.next(); | |
| 1244 | +if(!pred(rval)){ | |
| 1245 | +this.next=function(){ | |
| 1246 | +throw self.StopIteration; | |
| 1247 | +}; | |
| 1248 | +this.next(); | |
| 1249 | +} | |
| 1250 | +return rval; | |
| 1251 | +}}; | |
| 1252 | +},dropwhile:function(pred,seq){ | |
| 1253 | +seq=MochiKit.Iter.iter(seq); | |
| 1254 | +var m=MochiKit.Base; | |
| 1255 | +var bind=m.bind; | |
| 1256 | +return {"repr":function(){ | |
| 1257 | +return "dropwhile(...)"; | |
| 1258 | +},"toString":m.forwardCall("repr"),"next":function(){ | |
| 1259 | +while(true){ | |
| 1260 | +var rval=seq.next(); | |
| 1261 | +if(!pred(rval)){ | |
| 1262 | +break; | |
| 1263 | +} | |
| 1264 | +} | |
| 1265 | +this.next=bind("next",seq); | |
| 1266 | +return rval; | |
| 1267 | +}}; | |
| 1268 | +},_tee:function(_169,sync,_171){ | |
| 1269 | +sync.pos[_169]=-1; | |
| 1270 | +var m=MochiKit.Base; | |
| 1271 | +var _172=m.listMin; | |
| 1272 | +return {repr:function(){ | |
| 1273 | +return "tee("+_169+", ...)"; | |
| 1274 | +},toString:m.forwardCall("repr"),next:function(){ | |
| 1275 | +var rval; | |
| 1276 | +var i=sync.pos[_169]; | |
| 1277 | +if(i==sync.max){ | |
| 1278 | +rval=_171.next(); | |
| 1279 | +sync.deque.push(rval); | |
| 1280 | +sync.max+=1; | |
| 1281 | +sync.pos[_169]+=1; | |
| 1282 | +}else{ | |
| 1283 | +rval=sync.deque[i-sync.min]; | |
| 1284 | +sync.pos[_169]+=1; | |
| 1285 | +if(i==sync.min&&_172(sync.pos)!=sync.min){ | |
| 1286 | +sync.min+=1; | |
| 1287 | +sync.deque.shift(); | |
| 1288 | +} | |
| 1289 | +} | |
| 1290 | +return rval; | |
| 1291 | +}}; | |
| 1292 | +},tee:function(_173,n){ | |
| 1293 | +var rval=[]; | |
| 1294 | +var sync={"pos":[],"deque":[],"max":-1,"min":-1}; | |
| 1295 | +if(arguments.length==1||typeof (n)=="undefined"||n===null){ | |
| 1296 | +n=2; | |
| 1297 | +} | |
| 1298 | +var self=MochiKit.Iter; | |
| 1299 | +_173=self.iter(_173); | |
| 1300 | +var _tee=self._tee; | |
| 1301 | +for(var i=0;i<n;i++){ | |
| 1302 | +rval.push(_tee(i,sync,_173)); | |
| 1303 | +} | |
| 1304 | +return rval; | |
| 1305 | +},list:function(_175){ | |
| 1306 | +var m=MochiKit.Base; | |
| 1307 | +if(typeof (_175.slice)=="function"){ | |
| 1308 | +return _175.slice(); | |
| 1309 | +}else{ | |
| 1310 | +if(m.isArrayLike(_175)){ | |
| 1311 | +return m.concat(_175); | |
| 1312 | +} | |
| 1313 | +} | |
| 1314 | +var self=MochiKit.Iter; | |
| 1315 | +_175=self.iter(_175); | |
| 1316 | +var rval=[]; | |
| 1317 | +try{ | |
| 1318 | +while(true){ | |
| 1319 | +rval.push(_175.next()); | |
| 1320 | +} | |
| 1321 | +} | |
| 1322 | +catch(e){ | |
| 1323 | +if(e!=self.StopIteration){ | |
| 1324 | +throw e; | |
| 1325 | +} | |
| 1326 | +return rval; | |
| 1327 | +} | |
| 1328 | +return undefined; | |
| 1329 | +},reduce:function(fn,_176,_177){ | |
| 1330 | +var i=0; | |
| 1331 | +var x=_177; | |
| 1332 | +var self=MochiKit.Iter; | |
| 1333 | +_176=self.iter(_176); | |
| 1334 | +if(arguments.length<3){ | |
| 1335 | +try{ | |
| 1336 | +x=_176.next(); | |
| 1337 | +} | |
| 1338 | +catch(e){ | |
| 1339 | +if(e==self.StopIteration){ | |
| 1340 | +e=new TypeError("reduce() of empty sequence with no initial value"); | |
| 1341 | +} | |
| 1342 | +throw e; | |
| 1343 | +} | |
| 1344 | +i++; | |
| 1345 | +} | |
| 1346 | +try{ | |
| 1347 | +while(true){ | |
| 1348 | +x=fn(x,_176.next()); | |
| 1349 | +} | |
| 1350 | +} | |
| 1351 | +catch(e){ | |
| 1352 | +if(e!=self.StopIteration){ | |
| 1353 | +throw e; | |
| 1354 | +} | |
| 1355 | +} | |
| 1356 | +return x; | |
| 1357 | +},range:function(){ | |
| 1358 | +var _179=0; | |
| 1359 | +var stop=0; | |
| 1360 | +var step=1; | |
| 1361 | +if(arguments.length==1){ | |
| 1362 | +stop=arguments[0]; | |
| 1363 | +}else{ | |
| 1364 | +if(arguments.length==2){ | |
| 1365 | +_179=arguments[0]; | |
| 1366 | +stop=arguments[1]; | |
| 1367 | +}else{ | |
| 1368 | +if(arguments.length==3){ | |
| 1369 | +_179=arguments[0]; | |
| 1370 | +stop=arguments[1]; | |
| 1371 | +step=arguments[2]; | |
| 1372 | +}else{ | |
| 1373 | +throw new TypeError("range() takes 1, 2, or 3 arguments!"); | |
| 1374 | +} | |
| 1375 | +} | |
| 1376 | +} | |
| 1377 | +if(step===0){ | |
| 1378 | +throw new TypeError("range() step must not be 0"); | |
| 1379 | +} | |
| 1380 | +return {next:function(){ | |
| 1381 | +if((step>0&&_179>=stop)||(step<0&&_179<=stop)){ | |
| 1382 | +throw MochiKit.Iter.StopIteration; | |
| 1383 | +} | |
| 1384 | +var rval=_179; | |
| 1385 | +_179+=step; | |
| 1386 | +return rval; | |
| 1387 | +},repr:function(){ | |
| 1388 | +return "range("+[_179,stop,step].join(", ")+")"; | |
| 1389 | +},toString:MochiKit.Base.forwardCall("repr")}; | |
| 1390 | +},sum:function(_180,_181){ | |
| 1391 | +if(typeof (_181)=="undefined"||_181===null){ | |
| 1392 | +_181=0; | |
| 1393 | +} | |
| 1394 | +var x=_181; | |
| 1395 | +var self=MochiKit.Iter; | |
| 1396 | +_180=self.iter(_180); | |
| 1397 | +try{ | |
| 1398 | +while(true){ | |
| 1399 | +x+=_180.next(); | |
| 1400 | +} | |
| 1401 | +} | |
| 1402 | +catch(e){ | |
| 1403 | +if(e!=self.StopIteration){ | |
| 1404 | +throw e; | |
| 1405 | +} | |
| 1406 | +} | |
| 1407 | +return x; | |
| 1408 | +},exhaust:function(_182){ | |
| 1409 | +var self=MochiKit.Iter; | |
| 1410 | +_182=self.iter(_182); | |
| 1411 | +try{ | |
| 1412 | +while(true){ | |
| 1413 | +_182.next(); | |
| 1414 | +} | |
| 1415 | +} | |
| 1416 | +catch(e){ | |
| 1417 | +if(e!=self.StopIteration){ | |
| 1418 | +throw e; | |
| 1419 | +} | |
| 1420 | +} | |
| 1421 | +},forEach:function(_183,func,self){ | |
| 1422 | +var m=MochiKit.Base; | |
| 1423 | +if(arguments.length>2){ | |
| 1424 | +func=m.bind(func,self); | |
| 1425 | +} | |
| 1426 | +if(m.isArrayLike(_183)){ | |
| 1427 | +try{ | |
| 1428 | +for(var i=0;i<_183.length;i++){ | |
| 1429 | +func(_183[i]); | |
| 1430 | +} | |
| 1431 | +} | |
| 1432 | +catch(e){ | |
| 1433 | +if(e!=MochiKit.Iter.StopIteration){ | |
| 1434 | +throw e; | |
| 1435 | +} | |
| 1436 | +} | |
| 1437 | +}else{ | |
| 1438 | +self=MochiKit.Iter; | |
| 1439 | +self.exhaust(self.imap(func,_183)); | |
| 1440 | +} | |
| 1441 | +},every:function(_184,func){ | |
| 1442 | +var self=MochiKit.Iter; | |
| 1443 | +try{ | |
| 1444 | +self.ifilterfalse(func,_184).next(); | |
| 1445 | +return false; | |
| 1446 | +} | |
| 1447 | +catch(e){ | |
| 1448 | +if(e!=self.StopIteration){ | |
| 1449 | +throw e; | |
| 1450 | +} | |
| 1451 | +return true; | |
| 1452 | +} | |
| 1453 | +},sorted:function(_185,cmp){ | |
| 1454 | +var rval=MochiKit.Iter.list(_185); | |
| 1455 | +if(arguments.length==1){ | |
| 1456 | +cmp=MochiKit.Base.compare; | |
| 1457 | +} | |
| 1458 | +rval.sort(cmp); | |
| 1459 | +return rval; | |
| 1460 | +},reversed:function(_186){ | |
| 1461 | +var rval=MochiKit.Iter.list(_186); | |
| 1462 | +rval.reverse(); | |
| 1463 | +return rval; | |
| 1464 | +},some:function(_187,func){ | |
| 1465 | +var self=MochiKit.Iter; | |
| 1466 | +try{ | |
| 1467 | +self.ifilter(func,_187).next(); | |
| 1468 | +return true; | |
| 1469 | +} | |
| 1470 | +catch(e){ | |
| 1471 | +if(e!=self.StopIteration){ | |
| 1472 | +throw e; | |
| 1473 | +} | |
| 1474 | +return false; | |
| 1475 | +} | |
| 1476 | +},iextend:function(lst,_188){ | |
| 1477 | +if(MochiKit.Base.isArrayLike(_188)){ | |
| 1478 | +for(var i=0;i<_188.length;i++){ | |
| 1479 | +lst.push(_188[i]); | |
| 1480 | +} | |
| 1481 | +}else{ | |
| 1482 | +var self=MochiKit.Iter; | |
| 1483 | +_188=self.iter(_188); | |
| 1484 | +try{ | |
| 1485 | +while(true){ | |
| 1486 | +lst.push(_188.next()); | |
| 1487 | +} | |
| 1488 | +} | |
| 1489 | +catch(e){ | |
| 1490 | +if(e!=self.StopIteration){ | |
| 1491 | +throw e; | |
| 1492 | +} | |
| 1493 | +} | |
| 1494 | +} | |
| 1495 | +return lst; | |
| 1496 | +},groupby:function(_189,_190){ | |
| 1497 | +var m=MochiKit.Base; | |
| 1498 | +var self=MochiKit.Iter; | |
| 1499 | +if(arguments.length<2){ | |
| 1500 | +_190=m.operator.identity; | |
| 1501 | +} | |
| 1502 | +_189=self.iter(_189); | |
| 1503 | +var pk=undefined; | |
| 1504 | +var k=undefined; | |
| 1505 | +var v; | |
| 1506 | +function fetch(){ | |
| 1507 | +v=_189.next(); | |
| 1508 | +k=_190(v); | |
| 1509 | +} | |
| 1510 | +function eat(){ | |
| 1511 | +var ret=v; | |
| 1512 | +v=undefined; | |
| 1513 | +return ret; | |
| 1514 | +} | |
| 1515 | +var _193=true; | |
| 1516 | +var _194=m.compare; | |
| 1517 | +return {repr:function(){ | |
| 1518 | +return "groupby(...)"; | |
| 1519 | +},next:function(){ | |
| 1520 | +while(_194(k,pk)===0){ | |
| 1521 | +fetch(); | |
| 1522 | +if(_193){ | |
| 1523 | +_193=false; | |
| 1524 | +break; | |
| 1525 | +} | |
| 1526 | +} | |
| 1527 | +pk=k; | |
| 1528 | +return [k,{next:function(){ | |
| 1529 | +if(v==undefined){ | |
| 1530 | +fetch(); | |
| 1531 | +} | |
| 1532 | +if(_194(k,pk)!==0){ | |
| 1533 | +throw self.StopIteration; | |
| 1534 | +} | |
| 1535 | +return eat(); | |
| 1536 | +}}]; | |
| 1537 | +}}; | |
| 1538 | +},groupby_as_array:function(_195,_196){ | |
| 1539 | +var m=MochiKit.Base; | |
| 1540 | +var self=MochiKit.Iter; | |
| 1541 | +if(arguments.length<2){ | |
| 1542 | +_196=m.operator.identity; | |
| 1543 | +} | |
| 1544 | +_195=self.iter(_195); | |
| 1545 | +var _197=[]; | |
| 1546 | +var _198=true; | |
| 1547 | +var _199; | |
| 1548 | +var _200=m.compare; | |
| 1549 | +while(true){ | |
| 1550 | +try{ | |
| 1551 | +var _201=_195.next(); | |
| 1552 | +var key=_196(_201); | |
| 1553 | +} | |
| 1554 | +catch(e){ | |
| 1555 | +if(e==self.StopIteration){ | |
| 1556 | +break; | |
| 1557 | +} | |
| 1558 | +throw e; | |
| 1559 | +} | |
| 1560 | +if(_198||_200(key,_199)!==0){ | |
| 1561 | +var _202=[]; | |
| 1562 | +_197.push([key,_202]); | |
| 1563 | +} | |
| 1564 | +_202.push(_201); | |
| 1565 | +_198=false; | |
| 1566 | +_199=key; | |
| 1567 | +} | |
| 1568 | +return _197; | |
| 1569 | +},arrayLikeIter:function(_203){ | |
| 1570 | +var i=0; | |
| 1571 | +return {repr:function(){ | |
| 1572 | +return "arrayLikeIter(...)"; | |
| 1573 | +},toString:MochiKit.Base.forwardCall("repr"),next:function(){ | |
| 1574 | +if(i>=_203.length){ | |
| 1575 | +throw MochiKit.Iter.StopIteration; | |
| 1576 | +} | |
| 1577 | +return _203[i++]; | |
| 1578 | +}}; | |
| 1579 | +},hasIterateNext:function(_204){ | |
| 1580 | +return (_204&&typeof (_204.iterateNext)=="function"); | |
| 1581 | +},iterateNextIter:function(_205){ | |
| 1582 | +return {repr:function(){ | |
| 1583 | +return "iterateNextIter(...)"; | |
| 1584 | +},toString:MochiKit.Base.forwardCall("repr"),next:function(){ | |
| 1585 | +var rval=_205.iterateNext(); | |
| 1586 | +if(rval===null||rval===undefined){ | |
| 1587 | +throw MochiKit.Iter.StopIteration; | |
| 1588 | +} | |
| 1589 | +return rval; | |
| 1590 | +}}; | |
| 1591 | +}}); | |
| 1592 | +MochiKit.Iter.EXPORT_OK=["iteratorRegistry","arrayLikeIter","hasIterateNext","iterateNextIter",]; | |
| 1593 | +MochiKit.Iter.EXPORT=["StopIteration","registerIteratorFactory","iter","count","cycle","repeat","next","izip","ifilter","ifilterfalse","islice","imap","applymap","chain","takewhile","dropwhile","tee","list","reduce","range","sum","exhaust","forEach","every","sorted","reversed","some","iextend","groupby","groupby_as_array"]; | |
| 1594 | +MochiKit.Iter.__new__=function(){ | |
| 1595 | +var m=MochiKit.Base; | |
| 1596 | +if(typeof (StopIteration)!="undefined"){ | |
| 1597 | +this.StopIteration=StopIteration; | |
| 1598 | +}else{ | |
| 1599 | +this.StopIteration=new m.NamedError("StopIteration"); | |
| 1600 | +} | |
| 1601 | +this.iteratorRegistry=new m.AdapterRegistry(); | |
| 1602 | +this.registerIteratorFactory("arrayLike",m.isArrayLike,this.arrayLikeIter); | |
| 1603 | +this.registerIteratorFactory("iterateNext",this.hasIterateNext,this.iterateNextIter); | |
| 1604 | +this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; | |
| 1605 | +m.nameFunctions(this); | |
| 1606 | +}; | |
| 1607 | +MochiKit.Iter.__new__(); | |
| 1608 | +if(MochiKit.__export__){ | |
| 1609 | +reduce=MochiKit.Iter.reduce; | |
| 1610 | +} | |
| 1611 | +MochiKit.Base._exportSymbols(this,MochiKit.Iter); | |
| 1612 | +if(typeof (dojo)!="undefined"){ | |
| 1613 | +dojo.provide("MochiKit.Logging"); | |
| 1614 | +dojo.require("MochiKit.Base"); | |
| 1615 | +} | |
| 1616 | +if(typeof (JSAN)!="undefined"){ | |
| 1617 | +JSAN.use("MochiKit.Base",[]); | |
| 1618 | +} | |
| 1619 | +try{ | |
| 1620 | +if(typeof (MochiKit.Base)=="undefined"){ | |
| 1621 | +throw ""; | |
| 1622 | +} | |
| 1623 | +} | |
| 1624 | +catch(e){ | |
| 1625 | +throw "MochiKit.Logging depends on MochiKit.Base!"; | |
| 1626 | +} | |
| 1627 | +if(typeof (MochiKit.Logging)=="undefined"){ | |
| 1628 | +MochiKit.Logging={}; | |
| 1629 | +} | |
| 1630 | +MochiKit.Logging.NAME="MochiKit.Logging"; | |
| 1631 | +MochiKit.Logging.VERSION="1.4"; | |
| 1632 | +MochiKit.Logging.__repr__=function(){ | |
| 1633 | +return "["+this.NAME+" "+this.VERSION+"]"; | |
| 1634 | +}; | |
| 1635 | +MochiKit.Logging.toString=function(){ | |
| 1636 | +return this.__repr__(); | |
| 1637 | +}; | |
| 1638 | +MochiKit.Logging.EXPORT=["LogLevel","LogMessage","Logger","alertListener","logger","log","logError","logDebug","logFatal","logWarning"]; | |
| 1639 | +MochiKit.Logging.EXPORT_OK=["logLevelAtLeast","isLogMessage","compareLogMessage"]; | |
| 1640 | +MochiKit.Logging.LogMessage=function(num,_207,info){ | |
| 1641 | +this.num=num; | |
| 1642 | +this.level=_207; | |
| 1643 | +this.info=info; | |
| 1644 | +this.timestamp=new Date(); | |
| 1645 | +}; | |
| 1646 | +MochiKit.Logging.LogMessage.prototype={repr:function(){ | |
| 1647 | +var m=MochiKit.Base; | |
| 1648 | +return "LogMessage("+m.map(m.repr,[this.num,this.level,this.info]).join(", ")+")"; | |
| 1649 | +},toString:MochiKit.Base.forwardCall("repr")}; | |
| 1650 | +MochiKit.Base.update(MochiKit.Logging,{logLevelAtLeast:function(_209){ | |
| 1651 | +var self=MochiKit.Logging; | |
| 1652 | +if(typeof (_209)=="string"){ | |
| 1653 | +_209=self.LogLevel[_209]; | |
| 1654 | +} | |
| 1655 | +return function(msg){ | |
| 1656 | +var _211=msg.level; | |
| 1657 | +if(typeof (_211)=="string"){ | |
| 1658 | +_211=self.LogLevel[_211]; | |
| 1659 | +} | |
| 1660 | +return _211>=_209; | |
| 1661 | +}; | |
| 1662 | +},isLogMessage:function(){ | |
| 1663 | +var _212=MochiKit.Logging.LogMessage; | |
| 1664 | +for(var i=0;i<arguments.length;i++){ | |
| 1665 | +if(!(arguments[i] instanceof _212)){ | |
| 1666 | +return false; | |
| 1667 | +} | |
| 1668 | +} | |
| 1669 | +return true; | |
| 1670 | +},compareLogMessage:function(a,b){ | |
| 1671 | +return MochiKit.Base.compare([a.level,a.info],[b.level,b.info]); | |
| 1672 | +},alertListener:function(msg){ | |
| 1673 | +alert("num: "+msg.num+"\nlevel: "+msg.level+"\ninfo: "+msg.info.join(" ")); | |
| 1674 | +}}); | |
| 1675 | +MochiKit.Logging.Logger=function(_213){ | |
| 1676 | +this.counter=0; | |
| 1677 | +if(typeof (_213)=="undefined"||_213===null){ | |
| 1678 | +_213=-1; | |
| 1679 | +} | |
| 1680 | +this.maxSize=_213; | |
| 1681 | +this._messages=[]; | |
| 1682 | +this.listeners={}; | |
| 1683 | +this.useNativeConsole=false; | |
| 1684 | +}; | |
| 1685 | +MochiKit.Logging.Logger.prototype={clear:function(){ | |
| 1686 | +this._messages.splice(0,this._messages.length); | |
| 1687 | +},logToConsole:function(msg){ | |
| 1688 | +if(typeof (window)!="undefined"&&window.console&&window.console.log){ | |
| 1689 | +window.console.log(msg.replace(/%/g,"\uff05")); | |
| 1690 | +}else{ | |
| 1691 | +if(typeof (opera)!="undefined"&&opera.postError){ | |
| 1692 | +opera.postError(msg); | |
| 1693 | +}else{ | |
| 1694 | +if(typeof (printfire)=="function"){ | |
| 1695 | +printfire(msg); | |
| 1696 | +}else{ | |
| 1697 | +if(typeof (Debug)!="undefined"&&Debug.writeln){ | |
| 1698 | +Debug.writeln(msg); | |
| 1699 | +}else{ | |
| 1700 | +if(typeof (debug)!="undefined"&&debug.trace){ | |
| 1701 | +debug.trace(msg); | |
| 1702 | +} | |
| 1703 | +} | |
| 1704 | +} | |
| 1705 | +} | |
| 1706 | +} | |
| 1707 | +},dispatchListeners:function(msg){ | |
| 1708 | +for(var k in this.listeners){ | |
| 1709 | +var pair=this.listeners[k]; | |
| 1710 | +if(pair.ident!=k||(pair[0]&&!pair[0](msg))){ | |
| 1711 | +continue; | |
| 1712 | +} | |
| 1713 | +pair[1](msg); | |
| 1714 | +} | |
| 1715 | +},addListener:function(_214,_215,_216){ | |
| 1716 | +if(typeof (_215)=="string"){ | |
| 1717 | +_215=MochiKit.Logging.logLevelAtLeast(_215); | |
| 1718 | +} | |
| 1719 | +var _217=[_215,_216]; | |
| 1720 | +_217.ident=_214; | |
| 1721 | +this.listeners[_214]=_217; | |
| 1722 | +},removeListener:function(_218){ | |
| 1723 | +delete this.listeners[_218]; | |
| 1724 | +},baseLog:function(_219,_220){ | |
| 1725 | +var msg=new MochiKit.Logging.LogMessage(this.counter,_219,MochiKit.Base.extend(null,arguments,1)); | |
| 1726 | +this._messages.push(msg); | |
| 1727 | +this.dispatchListeners(msg); | |
| 1728 | +if(this.useNativeConsole){ | |
| 1729 | +this.logToConsole(msg.level+": "+msg.info.join(" ")); | |
| 1730 | +} | |
| 1731 | +this.counter+=1; | |
| 1732 | +while(this.maxSize>=0&&this._messages.length>this.maxSize){ | |
| 1733 | +this._messages.shift(); | |
| 1734 | +} | |
| 1735 | +},getMessages:function(_221){ | |
| 1736 | +var _222=0; | |
| 1737 | +if(!(typeof (_221)=="undefined"||_221===null)){ | |
| 1738 | +_222=Math.max(0,this._messages.length-_221); | |
| 1739 | +} | |
| 1740 | +return this._messages.slice(_222); | |
| 1741 | +},getMessageText:function(_223){ | |
| 1742 | +if(typeof (_223)=="undefined"||_223===null){ | |
| 1743 | +_223=30; | |
| 1744 | +} | |
| 1745 | +var _224=this.getMessages(_223); | |
| 1746 | +if(_224.length){ | |
| 1747 | +var lst=map(function(m){ | |
| 1748 | +return "\n ["+m.num+"] "+m.level+": "+m.info.join(" "); | |
| 1749 | +},_224); | |
| 1750 | +lst.unshift("LAST "+_224.length+" MESSAGES:"); | |
| 1751 | +return lst.join(""); | |
| 1752 | +} | |
| 1753 | +return ""; | |
| 1754 | +},debuggingBookmarklet:function(_225){ | |
| 1755 | +if(typeof (MochiKit.LoggingPane)=="undefined"){ | |
| 1756 | +alert(this.getMessageText()); | |
| 1757 | +}else{ | |
| 1758 | +MochiKit.LoggingPane.createLoggingPane(_225||false); | |
| 1759 | +} | |
| 1760 | +}}; | |
| 1761 | +MochiKit.Logging.__new__=function(){ | |
| 1762 | +this.LogLevel={ERROR:40,FATAL:50,WARNING:30,INFO:20,DEBUG:10}; | |
| 1763 | +var m=MochiKit.Base; | |
| 1764 | +m.registerComparator("LogMessage",this.isLogMessage,this.compareLogMessage); | |
| 1765 | +var _226=m.partial; | |
| 1766 | +var _227=this.Logger; | |
| 1767 | +var _228=_227.prototype.baseLog; | |
| 1768 | +m.update(this.Logger.prototype,{debug:_226(_228,"DEBUG"),log:_226(_228,"INFO"),error:_226(_228,"ERROR"),fatal:_226(_228,"FATAL"),warning:_226(_228,"WARNING")}); | |
| 1769 | +var self=this; | |
| 1770 | +var _229=function(name){ | |
| 1771 | +return function(){ | |
| 1772 | +self.logger[name].apply(self.logger,arguments); | |
| 1773 | +}; | |
| 1774 | +}; | |
| 1775 | +this.log=_229("log"); | |
| 1776 | +this.logError=_229("error"); | |
| 1777 | +this.logDebug=_229("debug"); | |
| 1778 | +this.logFatal=_229("fatal"); | |
| 1779 | +this.logWarning=_229("warning"); | |
| 1780 | +this.logger=new _227(); | |
| 1781 | +this.logger.useNativeConsole=true; | |
| 1782 | +this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; | |
| 1783 | +m.nameFunctions(this); | |
| 1784 | +}; | |
| 1785 | +if(typeof (printfire)=="undefined"&&typeof (document)!="undefined"&&document.createEvent&&typeof (dispatchEvent)!="undefined"){ | |
| 1786 | +printfire=function(){ | |
| 1787 | +printfire.args=arguments; | |
| 1788 | +var ev=document.createEvent("Events"); | |
| 1789 | +ev.initEvent("printfire",false,true); | |
| 1790 | +dispatchEvent(ev); | |
| 1791 | +}; | |
| 1792 | +} | |
| 1793 | +MochiKit.Logging.__new__(); | |
| 1794 | +MochiKit.Base._exportSymbols(this,MochiKit.Logging); | |
| 1795 | +if(typeof (dojo)!="undefined"){ | |
| 1796 | +dojo.provide("MochiKit.DateTime"); | |
| 1797 | +} | |
| 1798 | +if(typeof (MochiKit)=="undefined"){ | |
| 1799 | +MochiKit={}; | |
| 1800 | +} | |
| 1801 | +if(typeof (MochiKit.DateTime)=="undefined"){ | |
| 1802 | +MochiKit.DateTime={}; | |
| 1803 | +} | |
| 1804 | +MochiKit.DateTime.NAME="MochiKit.DateTime"; | |
| 1805 | +MochiKit.DateTime.VERSION="1.4"; | |
| 1806 | +MochiKit.DateTime.__repr__=function(){ | |
| 1807 | +return "["+this.NAME+" "+this.VERSION+"]"; | |
| 1808 | +}; | |
| 1809 | +MochiKit.DateTime.toString=function(){ | |
| 1810 | +return this.__repr__(); | |
| 1811 | +}; | |
| 1812 | +MochiKit.DateTime.isoDate=function(str){ | |
| 1813 | +str=str+""; | |
| 1814 | +if(typeof (str)!="string"||str.length===0){ | |
| 1815 | +return null; | |
| 1816 | +} | |
| 1817 | +var iso=str.split("-"); | |
| 1818 | +if(iso.length===0){ | |
| 1819 | +return null; | |
| 1820 | +} | |
| 1821 | +return new Date(iso[0],iso[1]-1,iso[2]); | |
| 1822 | +}; | |
| 1823 | +MochiKit.DateTime._isoRegexp=/(\d{4,})(?:-(\d{1,2})(?:-(\d{1,2})(?:[T ](\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d+))?)?(?:(Z)|([+-])(\d{1,2})(?::(\d{1,2}))?)?)?)?)?/; | |
| 1824 | +MochiKit.DateTime.isoTimestamp=function(str){ | |
| 1825 | +str=str+""; | |
| 1826 | +if(typeof (str)!="string"||str.length===0){ | |
| 1827 | +return null; | |
| 1828 | +} | |
| 1829 | +var res=str.match(MochiKit.DateTime._isoRegexp); | |
| 1830 | +if(typeof (res)=="undefined"||res===null){ | |
| 1831 | +return null; | |
| 1832 | +} | |
| 1833 | +var year,month,day,hour,min,sec,msec; | |
| 1834 | +year=parseInt(res[1],10); | |
| 1835 | +if(typeof (res[2])=="undefined"||res[2]===""){ | |
| 1836 | +return new Date(year); | |
| 1837 | +} | |
| 1838 | +month=parseInt(res[2],10)-1; | |
| 1839 | +day=parseInt(res[3],10); | |
| 1840 | +if(typeof (res[4])=="undefined"||res[4]===""){ | |
| 1841 | +return new Date(year,month,day); | |
| 1842 | +} | |
| 1843 | +hour=parseInt(res[4],10); | |
| 1844 | +min=parseInt(res[5],10); | |
| 1845 | +sec=(typeof (res[6])!="undefined"&&res[6]!=="")?parseInt(res[6],10):0; | |
| 1846 | +if(typeof (res[7])!="undefined"&&res[7]!==""){ | |
| 1847 | +msec=Math.round(1000*parseFloat("0."+res[7])); | |
| 1848 | +}else{ | |
| 1849 | +msec=0; | |
| 1850 | +} | |
| 1851 | +if((typeof (res[8])=="undefined"||res[8]==="")&&(typeof (res[9])=="undefined"||res[9]==="")){ | |
| 1852 | +return new Date(year,month,day,hour,min,sec,msec); | |
| 1853 | +} | |
| 1854 | +var ofs; | |
| 1855 | +if(typeof (res[9])!="undefined"&&res[9]!==""){ | |
| 1856 | +ofs=parseInt(res[10],10)*3600000; | |
| 1857 | +if(typeof (res[11])!="undefined"&&res[11]!==""){ | |
| 1858 | +ofs+=parseInt(res[11],10)*60000; | |
| 1859 | +} | |
| 1860 | +if(res[9]=="-"){ | |
| 1861 | +ofs=-ofs; | |
| 1862 | +} | |
| 1863 | +}else{ | |
| 1864 | +ofs=0; | |
| 1865 | +} | |
| 1866 | +return new Date(Date.UTC(year,month,day,hour,min,sec,msec)-ofs); | |
| 1867 | +}; | |
| 1868 | +MochiKit.DateTime.toISOTime=function(date,_236){ | |
| 1869 | +if(typeof (date)=="undefined"||date===null){ | |
| 1870 | +return null; | |
| 1871 | +} | |
| 1872 | +var hh=date.getHours(); | |
| 1873 | +var mm=date.getMinutes(); | |
| 1874 | +var ss=date.getSeconds(); | |
| 1875 | +var lst=[((_236&&(hh<10))?"0"+hh:hh),((mm<10)?"0"+mm:mm),((ss<10)?"0"+ss:ss)]; | |
| 1876 | +return lst.join(":"); | |
| 1877 | +}; | |
| 1878 | +MochiKit.DateTime.toISOTimestamp=function(date,_240){ | |
| 1879 | +if(typeof (date)=="undefined"||date===null){ | |
| 1880 | +return null; | |
| 1881 | +} | |
| 1882 | +var sep=_240?"T":" "; | |
| 1883 | +var foot=_240?"Z":""; | |
| 1884 | +if(_240){ | |
| 1885 | +date=new Date(date.getTime()+(date.getTimezoneOffset()*60000)); | |
| 1886 | +} | |
| 1887 | +return MochiKit.DateTime.toISODate(date)+sep+MochiKit.DateTime.toISOTime(date,_240)+foot; | |
| 1888 | +}; | |
| 1889 | +MochiKit.DateTime.toISODate=function(date){ | |
| 1890 | +if(typeof (date)=="undefined"||date===null){ | |
| 1891 | +return null; | |
| 1892 | +} | |
| 1893 | +var _243=MochiKit.DateTime._padTwo; | |
| 1894 | +return [date.getFullYear(),_243(date.getMonth()+1),_243(date.getDate())].join("-"); | |
| 1895 | +}; | |
| 1896 | +MochiKit.DateTime.americanDate=function(d){ | |
| 1897 | +d=d+""; | |
| 1898 | +if(typeof (d)!="string"||d.length===0){ | |
| 1899 | +return null; | |
| 1900 | +} | |
| 1901 | +var a=d.split("/"); | |
| 1902 | +return new Date(a[2],a[0]-1,a[1]); | |
| 1903 | +}; | |
| 1904 | +MochiKit.DateTime._padTwo=function(n){ | |
| 1905 | +return (n>9)?n:"0"+n; | |
| 1906 | +}; | |
| 1907 | +MochiKit.DateTime.toPaddedAmericanDate=function(d){ | |
| 1908 | +if(typeof (d)=="undefined"||d===null){ | |
| 1909 | +return null; | |
| 1910 | +} | |
| 1911 | +var _245=MochiKit.DateTime._padTwo; | |
| 1912 | +return [_245(d.getMonth()+1),_245(d.getDate()),d.getFullYear()].join("/"); | |
| 1913 | +}; | |
| 1914 | +MochiKit.DateTime.toAmericanDate=function(d){ | |
| 1915 | +if(typeof (d)=="undefined"||d===null){ | |
| 1916 | +return null; | |
| 1917 | +} | |
| 1918 | +return [d.getMonth()+1,d.getDate(),d.getFullYear()].join("/"); | |
| 1919 | +}; | |
| 1920 | +MochiKit.DateTime.EXPORT=["isoDate","isoTimestamp","toISOTime","toISOTimestamp","toISODate","americanDate","toPaddedAmericanDate","toAmericanDate"]; | |
| 1921 | +MochiKit.DateTime.EXPORT_OK=[]; | |
| 1922 | +MochiKit.DateTime.EXPORT_TAGS={":common":MochiKit.DateTime.EXPORT,":all":MochiKit.DateTime.EXPORT}; | |
| 1923 | +MochiKit.DateTime.__new__=function(){ | |
| 1924 | +var base=this.NAME+"."; | |
| 1925 | +for(var k in this){ | |
| 1926 | +var o=this[k]; | |
| 1927 | +if(typeof (o)=="function"&&typeof (o.NAME)=="undefined"){ | |
| 1928 | +try{ | |
| 1929 | +o.NAME=base+k; | |
| 1930 | +} | |
| 1931 | +catch(e){ | |
| 1932 | +} | |
| 1933 | +} | |
| 1934 | +} | |
| 1935 | +}; | |
| 1936 | +MochiKit.DateTime.__new__(); | |
| 1937 | +if(typeof (MochiKit.Base)!="undefined"){ | |
| 1938 | +MochiKit.Base._exportSymbols(this,MochiKit.DateTime); | |
| 1939 | +}else{ | |
| 1940 | +(function(_246,_247){ | |
| 1941 | +if((typeof (JSAN)=="undefined"&&typeof (dojo)=="undefined")||(MochiKit.__export__===false)){ | |
| 1942 | +var all=_247.EXPORT_TAGS[":all"]; | |
| 1943 | +for(var i=0;i<all.length;i++){ | |
| 1944 | +_246[all[i]]=_247[all[i]]; | |
| 1945 | +} | |
| 1946 | +} | |
| 1947 | +})(this,MochiKit.DateTime); | |
| 1948 | +} | |
| 1949 | +if(typeof (dojo)!="undefined"){ | |
| 1950 | +dojo.provide("MochiKit.Format"); | |
| 1951 | +} | |
| 1952 | +if(typeof (MochiKit)=="undefined"){ | |
| 1953 | +MochiKit={}; | |
| 1954 | +} | |
| 1955 | +if(typeof (MochiKit.Format)=="undefined"){ | |
| 1956 | +MochiKit.Format={}; | |
| 1957 | +} | |
| 1958 | +MochiKit.Format.NAME="MochiKit.Format"; | |
| 1959 | +MochiKit.Format.VERSION="1.4"; | |
| 1960 | +MochiKit.Format.__repr__=function(){ | |
| 1961 | +return "["+this.NAME+" "+this.VERSION+"]"; | |
| 1962 | +}; | |
| 1963 | +MochiKit.Format.toString=function(){ | |
| 1964 | +return this.__repr__(); | |
| 1965 | +}; | |
| 1966 | +MochiKit.Format._numberFormatter=function(_248,_249,_250,_251,_252,_253,_254,_255,_256){ | |
| 1967 | +return function(num){ | |
| 1968 | +num=parseFloat(num); | |
| 1969 | +if(typeof (num)=="undefined"||num===null||isNaN(num)){ | |
| 1970 | +return _248; | |
| 1971 | +} | |
| 1972 | +var _257=_249; | |
| 1973 | +var _258=_250; | |
| 1974 | +if(num<0){ | |
| 1975 | +num=-num; | |
| 1976 | +}else{ | |
| 1977 | +_257=_257.replace(/-/,""); | |
| 1978 | +} | |
| 1979 | +var me=arguments.callee; | |
| 1980 | +var fmt=MochiKit.Format.formatLocale(_251); | |
| 1981 | +if(_252){ | |
| 1982 | +num=num*100; | |
| 1983 | +_258=fmt.percent+_258; | |
| 1984 | +} | |
| 1985 | +num=MochiKit.Format.roundToFixed(num,_253); | |
| 1986 | +var _260=num.split(/\./); | |
| 1987 | +var _261=_260[0]; | |
| 1988 | +var frac=(_260.length==1)?"":_260[1]; | |
| 1989 | +var res=""; | |
| 1990 | +while(_261.length<_254){ | |
| 1991 | +_261="0"+_261; | |
| 1992 | +} | |
| 1993 | +if(_255){ | |
| 1994 | +while(_261.length>_255){ | |
| 1995 | +var i=_261.length-_255; | |
| 1996 | +res=fmt.separator+_261.substring(i,_261.length)+res; | |
| 1997 | +_261=_261.substring(0,i); | |
| 1998 | +} | |
| 1999 | +} | |
| 2000 | +res=_261+res; | |
| 2001 | +if(_253>0){ | |
| 2002 | +while(frac.length<_256){ | |
| 2003 | +frac=frac+"0"; | |
| 2004 | +} | |
| 2005 | +res=res+fmt.decimal+frac; | |
| 2006 | +} | |
| 2007 | +return _257+res+_258; | |
| 2008 | +}; | |
| 2009 | +}; | |
| 2010 | +MochiKit.Format.numberFormatter=function(_263,_264,_265){ | |
| 2011 | +if(typeof (_264)=="undefined"){ | |
| 2012 | +_264=""; | |
| 2013 | +} | |
| 2014 | +var _266=_263.match(/((?:[0#]+,)?[0#]+)(?:\.([0#]+))?(%)?/); | |
| 2015 | +if(!_266){ | |
| 2016 | +throw TypeError("Invalid pattern"); | |
| 2017 | +} | |
| 2018 | +var _267=_263.substr(0,_266.index); | |
| 2019 | +var _268=_263.substr(_266.index+_266[0].length); | |
| 2020 | +if(_267.search(/-/)==-1){ | |
| 2021 | +_267=_267+"-"; | |
| 2022 | +} | |
| 2023 | +var _269=_266[1]; | |
| 2024 | +var frac=(typeof (_266[2])=="string"&&_266[2]!="")?_266[2]:""; | |
| 2025 | +var _270=(typeof (_266[3])=="string"&&_266[3]!=""); | |
| 2026 | +var tmp=_269.split(/,/); | |
| 2027 | +var _272; | |
| 2028 | +if(typeof (_265)=="undefined"){ | |
| 2029 | +_265="default"; | |
| 2030 | +} | |
| 2031 | +if(tmp.length==1){ | |
| 2032 | +_272=null; | |
| 2033 | +}else{ | |
| 2034 | +_272=tmp[1].length; | |
| 2035 | +} | |
| 2036 | +var _273=_269.length-_269.replace(/0/g,"").length; | |
| 2037 | +var _274=frac.length-frac.replace(/0/g,"").length; | |
| 2038 | +var _275=frac.length; | |
| 2039 | +var rval=MochiKit.Format._numberFormatter(_264,_267,_268,_265,_270,_275,_273,_272,_274); | |
| 2040 | +var m=MochiKit.Base; | |
| 2041 | +if(m){ | |
| 2042 | +var fn=arguments.callee; | |
| 2043 | +var args=m.concat(arguments); | |
| 2044 | +rval.repr=function(){ | |
| 2045 | +return [self.NAME,"(",map(m.repr,args).join(", "),")"].join(""); | |
| 2046 | +}; | |
| 2047 | +} | |
| 2048 | +return rval; | |
| 2049 | +}; | |
| 2050 | +MochiKit.Format.formatLocale=function(_276){ | |
| 2051 | +if(typeof (_276)=="undefined"||_276===null){ | |
| 2052 | +_276="default"; | |
| 2053 | +} | |
| 2054 | +if(typeof (_276)=="string"){ | |
| 2055 | +var rval=MochiKit.Format.LOCALE[_276]; | |
| 2056 | +if(typeof (rval)=="string"){ | |
| 2057 | +rval=arguments.callee(rval); | |
| 2058 | +MochiKit.Format.LOCALE[_276]=rval; | |
| 2059 | +} | |
| 2060 | +return rval; | |
| 2061 | +}else{ | |
| 2062 | +return _276; | |
| 2063 | +} | |
| 2064 | +}; | |
| 2065 | +MochiKit.Format.twoDigitAverage=function(_277,_278){ | |
| 2066 | +if(_278){ | |
| 2067 | +var res=_277/_278; | |
| 2068 | +if(!isNaN(res)){ | |
| 2069 | +return MochiKit.Format.twoDigitFloat(_277/_278); | |
| 2070 | +} | |
| 2071 | +} | |
| 2072 | +return "0"; | |
| 2073 | +}; | |
| 2074 | +MochiKit.Format.twoDigitFloat=function(_279){ | |
| 2075 | +var sign=(_279<0?"-":""); | |
| 2076 | +var s=Math.floor(Math.abs(_279)*100).toString(); | |
| 2077 | +if(s=="0"){ | |
| 2078 | +return s; | |
| 2079 | +} | |
| 2080 | +if(s.length<3){ | |
| 2081 | +while(s.charAt(s.length-1)=="0"){ | |
| 2082 | +s=s.substring(0,s.length-1); | |
| 2083 | +} | |
| 2084 | +return sign+"0."+s; | |
| 2085 | +} | |
| 2086 | +var head=sign+s.substring(0,s.length-2); | |
| 2087 | +var tail=s.substring(s.length-2,s.length); | |
| 2088 | +if(tail=="00"){ | |
| 2089 | +return head; | |
| 2090 | +}else{ | |
| 2091 | +if(tail.charAt(1)=="0"){ | |
| 2092 | +return head+"."+tail.charAt(0); | |
| 2093 | +}else{ | |
| 2094 | +return head+"."+tail; | |
| 2095 | +} | |
| 2096 | +} | |
| 2097 | +}; | |
| 2098 | +MochiKit.Format.lstrip=function(str,_284){ | |
| 2099 | +str=str+""; | |
| 2100 | +if(typeof (str)!="string"){ | |
| 2101 | +return null; | |
| 2102 | +} | |
| 2103 | +if(!_284){ | |
| 2104 | +return str.replace(/^\s+/,""); | |
| 2105 | +}else{ | |
| 2106 | +return str.replace(new RegExp("^["+_284+"]+"),""); | |
| 2107 | +} | |
| 2108 | +}; | |
| 2109 | +MochiKit.Format.rstrip=function(str,_285){ | |
| 2110 | +str=str+""; | |
| 2111 | +if(typeof (str)!="string"){ | |
| 2112 | +return null; | |
| 2113 | +} | |
| 2114 | +if(!_285){ | |
| 2115 | +return str.replace(/\s+$/,""); | |
| 2116 | +}else{ | |
| 2117 | +return str.replace(new RegExp("["+_285+"]+$"),""); | |
| 2118 | +} | |
| 2119 | +}; | |
| 2120 | +MochiKit.Format.strip=function(str,_286){ | |
| 2121 | +var self=MochiKit.Format; | |
| 2122 | +return self.rstrip(self.lstrip(str,_286),_286); | |
| 2123 | +}; | |
| 2124 | +MochiKit.Format.truncToFixed=function(_287,_288){ | |
| 2125 | +_287=Math.floor(_287*Math.pow(10,_288)); | |
| 2126 | +var res=(_287*Math.pow(10,-_288)).toFixed(_288); | |
| 2127 | +if(res.charAt(0)=="."){ | |
| 2128 | +res="0"+res; | |
| 2129 | +} | |
| 2130 | +return res; | |
| 2131 | +}; | |
| 2132 | +MochiKit.Format.roundToFixed=function(_289,_290){ | |
| 2133 | +return MochiKit.Format.truncToFixed(_289+0.5*Math.pow(10,-_290),_290); | |
| 2134 | +}; | |
| 2135 | +MochiKit.Format.percentFormat=function(_291){ | |
| 2136 | +return MochiKit.Format.twoDigitFloat(100*_291)+"%"; | |
| 2137 | +}; | |
| 2138 | +MochiKit.Format.EXPORT=["truncToFixed","roundToFixed","numberFormatter","formatLocale","twoDigitAverage","twoDigitFloat","percentFormat","lstrip","rstrip","strip"]; | |
| 2139 | +MochiKit.Format.LOCALE={en_US:{separator:",",decimal:".",percent:"%"},de_DE:{separator:".",decimal:",",percent:"%"},fr_FR:{separator:" ",decimal:",",percent:"%"},"default":"en_US"}; | |
| 2140 | +MochiKit.Format.EXPORT_OK=[]; | |
| 2141 | +MochiKit.Format.EXPORT_TAGS={":all":MochiKit.Format.EXPORT,":common":MochiKit.Format.EXPORT}; | |
| 2142 | +MochiKit.Format.__new__=function(){ | |
| 2143 | +var base=this.NAME+"."; | |
| 2144 | +var k,v,o; | |
| 2145 | +for(k in this.LOCALE){ | |
| 2146 | +o=this.LOCALE[k]; | |
| 2147 | +if(typeof (o)=="object"){ | |
| 2148 | +o.repr=function(){ | |
| 2149 | +return this.NAME; | |
| 2150 | +}; | |
| 2151 | +o.NAME=base+"LOCALE."+k; | |
| 2152 | +} | |
| 2153 | +} | |
| 2154 | +for(k in this){ | |
| 2155 | +o=this[k]; | |
| 2156 | +if(typeof (o)=="function"&&typeof (o.NAME)=="undefined"){ | |
| 2157 | +try{ | |
| 2158 | +o.NAME=base+k; | |
| 2159 | +} | |
| 2160 | +catch(e){ | |
| 2161 | +} | |
| 2162 | +} | |
| 2163 | +} | |
| 2164 | +}; | |
| 2165 | +MochiKit.Format.__new__(); | |
| 2166 | +if(typeof (MochiKit.Base)!="undefined"){ | |
| 2167 | +MochiKit.Base._exportSymbols(this,MochiKit.Format); | |
| 2168 | +}else{ | |
| 2169 | +(function(_292,_293){ | |
| 2170 | +if((typeof (JSAN)=="undefined"&&typeof (dojo)=="undefined")||(MochiKit.__export__===false)){ | |
| 2171 | +var all=_293.EXPORT_TAGS[":all"]; | |
| 2172 | +for(var i=0;i<all.length;i++){ | |
| 2173 | +_292[all[i]]=_293[all[i]]; | |
| 2174 | +} | |
| 2175 | +} | |
| 2176 | +})(this,MochiKit.Format); | |
| 2177 | +} | |
| 2178 | +if(typeof (dojo)!="undefined"){ | |
| 2179 | +dojo.provide("MochiKit.Async"); | |
| 2180 | +dojo.require("MochiKit.Base"); | |
| 2181 | +} | |
| 2182 | +if(typeof (JSAN)!="undefined"){ | |
| 2183 | +JSAN.use("MochiKit.Base",[]); | |
| 2184 | +} | |
| 2185 | +try{ | |
| 2186 | +if(typeof (MochiKit.Base)=="undefined"){ | |
| 2187 | +throw ""; | |
| 2188 | +} | |
| 2189 | +} | |
| 2190 | +catch(e){ | |
| 2191 | +throw "MochiKit.Async depends on MochiKit.Base!"; | |
| 2192 | +} | |
| 2193 | +if(typeof (MochiKit.Async)=="undefined"){ | |
| 2194 | +MochiKit.Async={}; | |
| 2195 | +} | |
| 2196 | +MochiKit.Async.NAME="MochiKit.Async"; | |
| 2197 | +MochiKit.Async.VERSION="1.4"; | |
| 2198 | +MochiKit.Async.__repr__=function(){ | |
| 2199 | +return "["+this.NAME+" "+this.VERSION+"]"; | |
| 2200 | +}; | |
| 2201 | +MochiKit.Async.toString=function(){ | |
| 2202 | +return this.__repr__(); | |
| 2203 | +}; | |
| 2204 | +MochiKit.Async.Deferred=function(_294){ | |
| 2205 | +this.chain=[]; | |
| 2206 | +this.id=this._nextId(); | |
| 2207 | +this.fired=-1; | |
| 2208 | +this.paused=0; | |
| 2209 | +this.results=[null,null]; | |
| 2210 | +this.canceller=_294; | |
| 2211 | +this.silentlyCancelled=false; | |
| 2212 | +this.chained=false; | |
| 2213 | +}; | |
| 2214 | +MochiKit.Async.Deferred.prototype={repr:function(){ | |
| 2215 | +var _295; | |
| 2216 | +if(this.fired==-1){ | |
| 2217 | +_295="unfired"; | |
| 2218 | +}else{ | |
| 2219 | +if(this.fired===0){ | |
| 2220 | +_295="success"; | |
| 2221 | +}else{ | |
| 2222 | +_295="error"; | |
| 2223 | +} | |
| 2224 | +} | |
| 2225 | +return "Deferred("+this.id+", "+_295+")"; | |
| 2226 | +},toString:MochiKit.Base.forwardCall("repr"),_nextId:MochiKit.Base.counter(),cancel:function(){ | |
| 2227 | +var self=MochiKit.Async; | |
| 2228 | +if(this.fired==-1){ | |
| 2229 | +if(this.canceller){ | |
| 2230 | +this.canceller(this); | |
| 2231 | +}else{ | |
| 2232 | +this.silentlyCancelled=true; | |
| 2233 | +} | |
| 2234 | +if(this.fired==-1){ | |
| 2235 | +this.errback(new self.CancelledError(this)); | |
| 2236 | +} | |
| 2237 | +}else{ | |
| 2238 | +if((this.fired===0)&&(this.results[0] instanceof self.Deferred)){ | |
| 2239 | +this.results[0].cancel(); | |
| 2240 | +} | |
| 2241 | +} | |
| 2242 | +},_resback:function(res){ | |
| 2243 | +this.fired=((res instanceof Error)?1:0); | |
| 2244 | +this.results[this.fired]=res; | |
| 2245 | +this._fire(); | |
| 2246 | +},_check:function(){ | |
| 2247 | +if(this.fired!=-1){ | |
| 2248 | +if(!this.silentlyCancelled){ | |
| 2249 | +throw new MochiKit.Async.AlreadyCalledError(this); | |
| 2250 | +} | |
| 2251 | +this.silentlyCancelled=false; | |
| 2252 | +return; | |
| 2253 | +} | |
| 2254 | +},callback:function(res){ | |
| 2255 | +this._check(); | |
| 2256 | +if(res instanceof MochiKit.Async.Deferred){ | |
| 2257 | +throw new Error("Deferred instances can only be chained if they are the result of a callback"); | |
| 2258 | +} | |
| 2259 | +this._resback(res); | |
| 2260 | +},errback:function(res){ | |
| 2261 | +this._check(); | |
| 2262 | +var self=MochiKit.Async; | |
| 2263 | +if(res instanceof self.Deferred){ | |
| 2264 | +throw new Error("Deferred instances can only be chained if they are the result of a callback"); | |
| 2265 | +} | |
| 2266 | +if(!(res instanceof Error)){ | |
| 2267 | +res=new self.GenericError(res); | |
| 2268 | +} | |
| 2269 | +this._resback(res); | |
| 2270 | +},addBoth:function(fn){ | |
| 2271 | +if(arguments.length>1){ | |
| 2272 | +fn=MochiKit.Base.partial.apply(null,arguments); | |
| 2273 | +} | |
| 2274 | +return this.addCallbacks(fn,fn); | |
| 2275 | +},addCallback:function(fn){ | |
| 2276 | +if(arguments.length>1){ | |
| 2277 | +fn=MochiKit.Base.partial.apply(null,arguments); | |
| 2278 | +} | |
| 2279 | +return this.addCallbacks(fn,null); | |
| 2280 | +},addErrback:function(fn){ | |
| 2281 | +if(arguments.length>1){ | |
| 2282 | +fn=MochiKit.Base.partial.apply(null,arguments); | |
| 2283 | +} | |
| 2284 | +return this.addCallbacks(null,fn); | |
| 2285 | +},addCallbacks:function(cb,eb){ | |
| 2286 | +if(this.chained){ | |
| 2287 | +throw new Error("Chained Deferreds can not be re-used"); | |
| 2288 | +} | |
| 2289 | +this.chain.push([cb,eb]); | |
| 2290 | +if(this.fired>=0){ | |
| 2291 | +this._fire(); | |
| 2292 | +} | |
| 2293 | +return this; | |
| 2294 | +},_fire:function(){ | |
| 2295 | +var _298=this.chain; | |
| 2296 | +var _299=this.fired; | |
| 2297 | +var res=this.results[_299]; | |
| 2298 | +var self=this; | |
| 2299 | +var cb=null; | |
| 2300 | +while(_298.length>0&&this.paused===0){ | |
| 2301 | +var pair=_298.shift(); | |
| 2302 | +var f=pair[_299]; | |
| 2303 | +if(f===null){ | |
| 2304 | +continue; | |
| 2305 | +} | |
| 2306 | +try{ | |
| 2307 | +res=f(res); | |
| 2308 | +_299=((res instanceof Error)?1:0); | |
| 2309 | +if(res instanceof MochiKit.Async.Deferred){ | |
| 2310 | +cb=function(res){ | |
| 2311 | +self._resback(res); | |
| 2312 | +self.paused--; | |
| 2313 | +if((self.paused===0)&&(self.fired>=0)){ | |
| 2314 | +self._fire(); | |
| 2315 | +} | |
| 2316 | +}; | |
| 2317 | +this.paused++; | |
| 2318 | +} | |
| 2319 | +} | |
| 2320 | +catch(err){ | |
| 2321 | +_299=1; | |
| 2322 | +if(!(err instanceof Error)){ | |
| 2323 | +err=new MochiKit.Async.GenericError(err); | |
| 2324 | +} | |
| 2325 | +res=err; | |
| 2326 | +} | |
| 2327 | +} | |
| 2328 | +this.fired=_299; | |
| 2329 | +this.results[_299]=res; | |
| 2330 | +if(cb&&this.paused){ | |
| 2331 | +res.addBoth(cb); | |
| 2332 | +res.chained=true; | |
| 2333 | +} | |
| 2334 | +}}; | |
| 2335 | +MochiKit.Base.update(MochiKit.Async,{evalJSONRequest:function(){ | |
| 2336 | +return eval("("+arguments[0].responseText+")"); | |
| 2337 | +},succeed:function(_301){ | |
| 2338 | +var d=new MochiKit.Async.Deferred(); | |
| 2339 | +d.callback.apply(d,arguments); | |
| 2340 | +return d; | |
| 2341 | +},fail:function(_302){ | |
| 2342 | +var d=new MochiKit.Async.Deferred(); | |
| 2343 | +d.errback.apply(d,arguments); | |
| 2344 | +return d; | |
| 2345 | +},getXMLHttpRequest:function(){ | |
| 2346 | +var self=arguments.callee; | |
| 2347 | +if(!self.XMLHttpRequest){ | |
| 2348 | +var _303=[function(){ | |
| 2349 | +return new XMLHttpRequest(); | |
| 2350 | +},function(){ | |
| 2351 | +return new ActiveXObject("Msxml2.XMLHTTP"); | |
| 2352 | +},function(){ | |
| 2353 | +return new ActiveXObject("Microsoft.XMLHTTP"); | |
| 2354 | +},function(){ | |
| 2355 | +return new ActiveXObject("Msxml2.XMLHTTP.4.0"); | |
| 2356 | +},function(){ | |
| 2357 | +throw new MochiKit.Async.BrowserComplianceError("Browser does not support XMLHttpRequest"); | |
| 2358 | +}]; | |
| 2359 | +for(var i=0;i<_303.length;i++){ | |
| 2360 | +var func=_303[i]; | |
| 2361 | +try{ | |
| 2362 | +self.XMLHttpRequest=func; | |
| 2363 | +return func(); | |
| 2364 | +} | |
| 2365 | +catch(e){ | |
| 2366 | +} | |
| 2367 | +} | |
| 2368 | +} | |
| 2369 | +return self.XMLHttpRequest(); | |
| 2370 | +},_xhr_onreadystatechange:function(d){ | |
| 2371 | +var m=MochiKit.Base; | |
| 2372 | +if(this.readyState==4){ | |
| 2373 | +try{ | |
| 2374 | +this.onreadystatechange=null; | |
| 2375 | +} | |
| 2376 | +catch(e){ | |
| 2377 | +try{ | |
| 2378 | +this.onreadystatechange=m.noop; | |
| 2379 | +} | |
| 2380 | +catch(e){ | |
| 2381 | +} | |
| 2382 | +} | |
| 2383 | +var _304=null; | |
| 2384 | +try{ | |
| 2385 | +_304=this.status; | |
| 2386 | +if(!_304&&m.isNotEmpty(this.responseText)){ | |
| 2387 | +_304=304; | |
| 2388 | +} | |
| 2389 | +} | |
| 2390 | +catch(e){ | |
| 2391 | +} | |
| 2392 | +if(_304==200||_304==201||_304==204||_304==304||_304==1223){ | |
| 2393 | +d.callback(this); | |
| 2394 | +}else{ | |
| 2395 | +var err=new MochiKit.Async.XMLHttpRequestError(this,"Request failed"); | |
| 2396 | +if(err.number){ | |
| 2397 | +d.errback(err); | |
| 2398 | +}else{ | |
| 2399 | +d.errback(err); | |
| 2400 | +} | |
| 2401 | +} | |
| 2402 | +} | |
| 2403 | +},_xhr_canceller:function(req){ | |
| 2404 | +try{ | |
| 2405 | +req.onreadystatechange=null; | |
| 2406 | +} | |
| 2407 | +catch(e){ | |
| 2408 | +try{ | |
| 2409 | +req.onreadystatechange=MochiKit.Base.noop; | |
| 2410 | +} | |
| 2411 | +catch(e){ | |
| 2412 | +} | |
| 2413 | +} | |
| 2414 | +req.abort(); | |
| 2415 | +},sendXMLHttpRequest:function(req,_307){ | |
| 2416 | +if(typeof (_307)=="undefined"||_307===null){ | |
| 2417 | +_307=""; | |
| 2418 | +} | |
| 2419 | +var m=MochiKit.Base; | |
| 2420 | +var self=MochiKit.Async; | |
| 2421 | +var d=new self.Deferred(m.partial(self._xhr_canceller,req)); | |
| 2422 | +try{ | |
| 2423 | +req.onreadystatechange=m.bind(self._xhr_onreadystatechange,req,d); | |
| 2424 | +req.send(_307); | |
| 2425 | +} | |
| 2426 | +catch(e){ | |
| 2427 | +try{ | |
| 2428 | +req.onreadystatechange=null; | |
| 2429 | +} | |
| 2430 | +catch(ignore){ | |
| 2431 | +} | |
| 2432 | +d.errback(e); | |
| 2433 | +} | |
| 2434 | +return d; | |
| 2435 | +},doXHR:function(url,opts){ | |
| 2436 | +var m=MochiKit.Base; | |
| 2437 | +opts=m.update({method:"GET",sendContent:""},opts); | |
| 2438 | +var self=MochiKit.Async; | |
| 2439 | +var req=self.getXMLHttpRequest(); | |
| 2440 | +if(opts.queryString){ | |
| 2441 | +var qs=m.queryString(opts.queryString); | |
| 2442 | +if(qs){ | |
| 2443 | +url+="?"+qs; | |
| 2444 | +} | |
| 2445 | +} | |
| 2446 | +req.open(opts.method,url,true,opts.username,opts.password); | |
| 2447 | +if(req.overrideMimeType&&opts.mimeType){ | |
| 2448 | +req.overrideMimeType(opts.mimeType); | |
| 2449 | +} | |
| 2450 | +if(opts.headers){ | |
| 2451 | +var _311=opts.headers; | |
| 2452 | +if(!m.isArrayLike(_311)){ | |
| 2453 | +_311=m.items(_311); | |
| 2454 | +} | |
| 2455 | +for(var i=0;i<_311.length;i++){ | |
| 2456 | +var _312=_311[i]; | |
| 2457 | +var name=_312[0]; | |
| 2458 | +var _313=_312[1]; | |
| 2459 | +req.setRequestHeader(name,_313); | |
| 2460 | +} | |
| 2461 | +} | |
| 2462 | +return self.sendXMLHttpRequest(req,opts.sendContent); | |
| 2463 | +},_buildURL:function(url){ | |
| 2464 | +if(arguments.length>1){ | |
| 2465 | +var m=MochiKit.Base; | |
| 2466 | +var qs=m.queryString.apply(null,m.extend(null,arguments,1)); | |
| 2467 | +if(qs){ | |
| 2468 | +return url+"?"+qs; | |
| 2469 | +} | |
| 2470 | +} | |
| 2471 | +return url; | |
| 2472 | +},doSimpleXMLHttpRequest:function(url){ | |
| 2473 | +var self=MochiKit.Async; | |
| 2474 | +url=self._buildURL.apply(self,arguments); | |
| 2475 | +return self.doXHR(url); | |
| 2476 | +},loadJSONDoc:function(url){ | |
| 2477 | +var self=MochiKit.Async; | |
| 2478 | +url=self._buildURL.apply(self,arguments); | |
| 2479 | +var d=self.doXHR(url,{"mimeType":"text/plain","headers":[["Accept","application/json"]]}); | |
| 2480 | +d=d.addCallback(self.evalJSONRequest); | |
| 2481 | +return d; | |
| 2482 | +},wait:function(_314,_315){ | |
| 2483 | +var d=new MochiKit.Async.Deferred(); | |
| 2484 | +var m=MochiKit.Base; | |
| 2485 | +if(typeof (_315)!="undefined"){ | |
| 2486 | +d.addCallback(function(){ | |
| 2487 | +return _315; | |
| 2488 | +}); | |
| 2489 | +} | |
| 2490 | +var _316=setTimeout(m.bind("callback",d),Math.floor(_314*1000)); | |
| 2491 | +d.canceller=function(){ | |
| 2492 | +try{ | |
| 2493 | +clearTimeout(_316); | |
| 2494 | +} | |
| 2495 | +catch(e){ | |
| 2496 | +} | |
| 2497 | +}; | |
| 2498 | +return d; | |
| 2499 | +},callLater:function(_317,func){ | |
| 2500 | +var m=MochiKit.Base; | |
| 2501 | +var _318=m.partial.apply(m,m.extend(null,arguments,1)); | |
| 2502 | +return MochiKit.Async.wait(_317).addCallback(function(res){ | |
| 2503 | +return _318(); | |
| 2504 | +}); | |
| 2505 | +}}); | |
| 2506 | +MochiKit.Async.DeferredLock=function(){ | |
| 2507 | +this.waiting=[]; | |
| 2508 | +this.locked=false; | |
| 2509 | +this.id=this._nextId(); | |
| 2510 | +}; | |
| 2511 | +MochiKit.Async.DeferredLock.prototype={__class__:MochiKit.Async.DeferredLock,acquire:function(){ | |
| 2512 | +var d=new MochiKit.Async.Deferred(); | |
| 2513 | +if(this.locked){ | |
| 2514 | +this.waiting.push(d); | |
| 2515 | +}else{ | |
| 2516 | +this.locked=true; | |
| 2517 | +d.callback(this); | |
| 2518 | +} | |
| 2519 | +return d; | |
| 2520 | +},release:function(){ | |
| 2521 | +if(!this.locked){ | |
| 2522 | +throw TypeError("Tried to release an unlocked DeferredLock"); | |
| 2523 | +} | |
| 2524 | +this.locked=false; | |
| 2525 | +if(this.waiting.length>0){ | |
| 2526 | +this.locked=true; | |
| 2527 | +this.waiting.shift().callback(this); | |
| 2528 | +} | |
| 2529 | +},_nextId:MochiKit.Base.counter(),repr:function(){ | |
| 2530 | +var _319; | |
| 2531 | +if(this.locked){ | |
| 2532 | +_319="locked, "+this.waiting.length+" waiting"; | |
| 2533 | +}else{ | |
| 2534 | +_319="unlocked"; | |
| 2535 | +} | |
| 2536 | +return "DeferredLock("+this.id+", "+_319+")"; | |
| 2537 | +},toString:MochiKit.Base.forwardCall("repr")}; | |
| 2538 | +MochiKit.Async.DeferredList=function(list,_321,_322,_323,_324){ | |
| 2539 | +MochiKit.Async.Deferred.apply(this,[_324]); | |
| 2540 | +this.list=list; | |
| 2541 | +var _325=[]; | |
| 2542 | +this.resultList=_325; | |
| 2543 | +this.finishedCount=0; | |
| 2544 | +this.fireOnOneCallback=_321; | |
| 2545 | +this.fireOnOneErrback=_322; | |
| 2546 | +this.consumeErrors=_323; | |
| 2547 | +var cb=MochiKit.Base.bind(this._cbDeferred,this); | |
| 2548 | +for(var i=0;i<list.length;i++){ | |
| 2549 | +var d=list[i]; | |
| 2550 | +_325.push(undefined); | |
| 2551 | +d.addCallback(cb,i,true); | |
| 2552 | +d.addErrback(cb,i,false); | |
| 2553 | +} | |
| 2554 | +if(list.length===0&&!_321){ | |
| 2555 | +this.callback(this.resultList); | |
| 2556 | +} | |
| 2557 | +}; | |
| 2558 | +MochiKit.Async.DeferredList.prototype=new MochiKit.Async.Deferred(); | |
| 2559 | +MochiKit.Async.DeferredList.prototype._cbDeferred=function(_326,_327,_328){ | |
| 2560 | +this.resultList[_326]=[_327,_328]; | |
| 2561 | +this.finishedCount+=1; | |
| 2562 | +if(this.fired==-1){ | |
| 2563 | +if(_327&&this.fireOnOneCallback){ | |
| 2564 | +this.callback([_326,_328]); | |
| 2565 | +}else{ | |
| 2566 | +if(!_327&&this.fireOnOneErrback){ | |
| 2567 | +this.errback(_328); | |
| 2568 | +}else{ | |
| 2569 | +if(this.finishedCount==this.list.length){ | |
| 2570 | +this.callback(this.resultList); | |
| 2571 | +} | |
| 2572 | +} | |
| 2573 | +} | |
| 2574 | +} | |
| 2575 | +if(!_327&&this.consumeErrors){ | |
| 2576 | +_328=null; | |
| 2577 | +} | |
| 2578 | +return _328; | |
| 2579 | +}; | |
| 2580 | +MochiKit.Async.gatherResults=function(_329){ | |
| 2581 | +var d=new MochiKit.Async.DeferredList(_329,false,true,false); | |
| 2582 | +d.addCallback(function(_330){ | |
| 2583 | +var ret=[]; | |
| 2584 | +for(var i=0;i<_330.length;i++){ | |
| 2585 | +ret.push(_330[i][1]); | |
| 2586 | +} | |
| 2587 | +return ret; | |
| 2588 | +}); | |
| 2589 | +return d; | |
| 2590 | +}; | |
| 2591 | +MochiKit.Async.maybeDeferred=function(func){ | |
| 2592 | +var self=MochiKit.Async; | |
| 2593 | +var _331; | |
| 2594 | +try{ | |
| 2595 | +var r=func.apply(null,MochiKit.Base.extend([],arguments,1)); | |
| 2596 | +if(r instanceof self.Deferred){ | |
| 2597 | +_331=r; | |
| 2598 | +}else{ | |
| 2599 | +if(r instanceof Error){ | |
| 2600 | +_331=self.fail(r); | |
| 2601 | +}else{ | |
| 2602 | +_331=self.succeed(r); | |
| 2603 | +} | |
| 2604 | +} | |
| 2605 | +} | |
| 2606 | +catch(e){ | |
| 2607 | +_331=self.fail(e); | |
| 2608 | +} | |
| 2609 | +return _331; | |
| 2610 | +}; | |
| 2611 | +MochiKit.Async.EXPORT=["AlreadyCalledError","CancelledError","BrowserComplianceError","GenericError","XMLHttpRequestError","Deferred","succeed","fail","getXMLHttpRequest","doSimpleXMLHttpRequest","loadJSONDoc","wait","callLater","sendXMLHttpRequest","DeferredLock","DeferredList","gatherResults","maybeDeferred","doXHR"]; | |
| 2612 | +MochiKit.Async.EXPORT_OK=["evalJSONRequest"]; | |
| 2613 | +MochiKit.Async.__new__=function(){ | |
| 2614 | +var m=MochiKit.Base; | |
| 2615 | +var ne=m.partial(m._newNamedError,this); | |
| 2616 | +ne("AlreadyCalledError",function(_334){ | |
| 2617 | +this.deferred=_334; | |
| 2618 | +}); | |
| 2619 | +ne("CancelledError",function(_335){ | |
| 2620 | +this.deferred=_335; | |
| 2621 | +}); | |
| 2622 | +ne("BrowserComplianceError",function(msg){ | |
| 2623 | +this.message=msg; | |
| 2624 | +}); | |
| 2625 | +ne("GenericError",function(msg){ | |
| 2626 | +this.message=msg; | |
| 2627 | +}); | |
| 2628 | +ne("XMLHttpRequestError",function(req,msg){ | |
| 2629 | +this.req=req; | |
| 2630 | +this.message=msg; | |
| 2631 | +try{ | |
| 2632 | +this.number=req.status; | |
| 2633 | +} | |
| 2634 | +catch(e){ | |
| 2635 | +} | |
| 2636 | +}); | |
| 2637 | +this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; | |
| 2638 | +m.nameFunctions(this); | |
| 2639 | +}; | |
| 2640 | +MochiKit.Async.__new__(); | |
| 2641 | +MochiKit.Base._exportSymbols(this,MochiKit.Async); | |
| 2642 | +if(typeof (dojo)!="undefined"){ | |
| 2643 | +dojo.provide("MochiKit.DOM"); | |
| 2644 | +dojo.require("MochiKit.Base"); | |
| 2645 | +} | |
| 2646 | +if(typeof (JSAN)!="undefined"){ | |
| 2647 | +JSAN.use("MochiKit.Base",[]); | |
| 2648 | +} | |
| 2649 | +try{ | |
| 2650 | +if(typeof (MochiKit.Base)=="undefined"){ | |
| 2651 | +throw ""; | |
| 2652 | +} | |
| 2653 | +} | |
| 2654 | +catch(e){ | |
| 2655 | +throw "MochiKit.DOM depends on MochiKit.Base!"; | |
| 2656 | +} | |
| 2657 | +if(typeof (MochiKit.DOM)=="undefined"){ | |
| 2658 | +MochiKit.DOM={}; | |
| 2659 | +} | |
| 2660 | +MochiKit.DOM.NAME="MochiKit.DOM"; | |
| 2661 | +MochiKit.DOM.VERSION="1.4"; | |
| 2662 | +MochiKit.DOM.__repr__=function(){ | |
| 2663 | +return "["+this.NAME+" "+this.VERSION+"]"; | |
| 2664 | +}; | |
| 2665 | +MochiKit.DOM.toString=function(){ | |
| 2666 | +return this.__repr__(); | |
| 2667 | +}; | |
| 2668 | +MochiKit.DOM.EXPORT=["removeEmptyTextNodes","formContents","currentWindow","currentDocument","withWindow","withDocument","registerDOMConverter","coerceToDOM","createDOM","createDOMFunc","isChildNode","getNodeAttribute","removeNodeAttribute","setNodeAttribute","updateNodeAttributes","appendChildNodes","insertSiblingNodesAfter","insertSiblingNodesBefore","replaceChildNodes","removeElement","swapDOM","BUTTON","TT","PRE","H1","H2","H3","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG","getElement","$","getElementsByTagAndClassName","addToCallStack","addLoadEvent","focusOnLoad","setElementClass","toggleElementClass","addElementClass","removeElementClass","swapElementClass","hasElementClass","escapeHTML","toHTML","emitHTML","scrapeText","isParent","getFirstParentByTagAndClassName","makeClipping","undoClipping","makePositioned","undoPositioned","getFirstElementByTagAndClassName"]; | |
| 2669 | +MochiKit.DOM.EXPORT_OK=["domConverters"]; | |
| 2670 | +MochiKit.DOM.DEPRECATED=[["computedStyle","MochiKit.Style.getStyle","1.4"],["elementDimensions","MochiKit.Style.getElementDimensions","1.4"],["elementPosition","MochiKit.Style.getElementPosition","1.4"],["hideElement","MochiKit.Style.hideElement","1.4"],["setElementDimensions","MochiKit.Style.setElementDimensions","1.4"],["setElementPosition","MochiKit.Style.setElementPosition","1.4"],["setDisplayForElement","MochiKit.Style.setDisplayForElement","1.4"],["setOpacity","MochiKit.Style.setOpacity","1.4"],["showElement","MochiKit.Style.showElement","1.4"],["Coordinates","MochiKit.Style.Coordinates","1.4"],["Dimensions","MochiKit.Style.Dimensions","1.4"]]; | |
| 2671 | +MochiKit.DOM.getViewportDimensions=new Function(""+"if (!MochiKit[\"Style\"]) {"+" throw new Error(\"This function has been deprecated and depends on MochiKit.Style.\");"+"}"+"return MochiKit.Style.getViewportDimensions.apply(this, arguments);"); | |
| 2672 | +MochiKit.Base.update(MochiKit.DOM,{currentWindow:function(){ | |
| 2673 | +return MochiKit.DOM._window; | |
| 2674 | +},currentDocument:function(){ | |
| 2675 | +return MochiKit.DOM._document; | |
| 2676 | +},withWindow:function(win,func){ | |
| 2677 | +var self=MochiKit.DOM; | |
| 2678 | +var _337=self._document; | |
| 2679 | +var _338=self._win; | |
| 2680 | +var rval; | |
| 2681 | +try{ | |
| 2682 | +self._window=win; | |
| 2683 | +self._document=win.document; | |
| 2684 | +rval=func(); | |
| 2685 | +} | |
| 2686 | +catch(e){ | |
| 2687 | +self._window=_338; | |
| 2688 | +self._document=_337; | |
| 2689 | +throw e; | |
| 2690 | +} | |
| 2691 | +self._window=_338; | |
| 2692 | +self._document=_337; | |
| 2693 | +return rval; | |
| 2694 | +},formContents:function(elem){ | |
| 2695 | +var _339=[]; | |
| 2696 | +var _340=[]; | |
| 2697 | +var m=MochiKit.Base; | |
| 2698 | +var self=MochiKit.DOM; | |
| 2699 | +if(typeof (elem)=="undefined"||elem===null){ | |
| 2700 | +elem=self._document.body; | |
| 2701 | +}else{ | |
| 2702 | +elem=self.getElement(elem); | |
| 2703 | +} | |
| 2704 | +m.nodeWalk(elem,function(elem){ | |
| 2705 | +var name=elem.name; | |
| 2706 | +if(m.isNotEmpty(name)){ | |
| 2707 | +var _341=elem.tagName.toUpperCase(); | |
| 2708 | +if(_341==="INPUT"&&(elem.type=="radio"||elem.type=="checkbox")&&!elem.checked){ | |
| 2709 | +return null; | |
| 2710 | +} | |
| 2711 | +if(_341==="SELECT"){ | |
| 2712 | +if(elem.type=="select-one"){ | |
| 2713 | +if(elem.selectedIndex>=0){ | |
| 2714 | +var opt=elem.options[elem.selectedIndex]; | |
| 2715 | +var v=opt.value; | |
| 2716 | +if(!v){ | |
| 2717 | +var h=opt.outerHTML; | |
| 2718 | +if(h&&!h.match(/^[^>]+\svalue\s*=/i)){ | |
| 2719 | +v=opt.text; | |
| 2720 | +} | |
| 2721 | +} | |
| 2722 | +_339.push(name); | |
| 2723 | +_340.push(v); | |
| 2724 | +return null; | |
| 2725 | +} | |
| 2726 | +_339.push(name); | |
| 2727 | +_340.push(""); | |
| 2728 | +return null; | |
| 2729 | +}else{ | |
| 2730 | +var opts=elem.options; | |
| 2731 | +if(!opts.length){ | |
| 2732 | +_339.push(name); | |
| 2733 | +_340.push(""); | |
| 2734 | +return null; | |
| 2735 | +} | |
| 2736 | +for(var i=0;i<opts.length;i++){ | |
| 2737 | +var opt=opts[i]; | |
| 2738 | +if(!opt.selected){ | |
| 2739 | +continue; | |
| 2740 | +} | |
| 2741 | +var v=opt.value; | |
| 2742 | +if(!v){ | |
| 2743 | +var h=opt.outerHTML; | |
| 2744 | +if(h&&!h.match(/^[^>]+\svalue\s*=/i)){ | |
| 2745 | +v=opt.text; | |
| 2746 | +} | |
| 2747 | +} | |
| 2748 | +_339.push(name); | |
| 2749 | +_340.push(v); | |
| 2750 | +} | |
| 2751 | +return null; | |
| 2752 | +} | |
| 2753 | +} | |
| 2754 | +if(_341==="FORM"||_341==="P"||_341==="SPAN"||_341==="DIV"){ | |
| 2755 | +return elem.childNodes; | |
| 2756 | +} | |
| 2757 | +_339.push(name); | |
| 2758 | +_340.push(elem.value||""); | |
| 2759 | +return null; | |
| 2760 | +} | |
| 2761 | +return elem.childNodes; | |
| 2762 | +}); | |
| 2763 | +return [_339,_340]; | |
| 2764 | +},withDocument:function(doc,func){ | |
| 2765 | +var self=MochiKit.DOM; | |
| 2766 | +var _345=self._document; | |
| 2767 | +var rval; | |
| 2768 | +try{ | |
| 2769 | +self._document=doc; | |
| 2770 | +rval=func(); | |
| 2771 | +} | |
| 2772 | +catch(e){ | |
| 2773 | +self._document=_345; | |
| 2774 | +throw e; | |
| 2775 | +} | |
| 2776 | +self._document=_345; | |
| 2777 | +return rval; | |
| 2778 | +},registerDOMConverter:function(name,_346,wrap,_347){ | |
| 2779 | +MochiKit.DOM.domConverters.register(name,_346,wrap,_347); | |
| 2780 | +},coerceToDOM:function(node,ctx){ | |
| 2781 | +var m=MochiKit.Base; | |
| 2782 | +var im=MochiKit.Iter; | |
| 2783 | +var self=MochiKit.DOM; | |
| 2784 | +if(im){ | |
| 2785 | +var iter=im.iter; | |
| 2786 | +var _351=im.repeat; | |
| 2787 | +var map=m.map; | |
| 2788 | +} | |
| 2789 | +var _352=self.domConverters; | |
| 2790 | +var _353=arguments.callee; | |
| 2791 | +var _354=m.NotFound; | |
| 2792 | +while(true){ | |
| 2793 | +if(typeof (node)=="undefined"||node===null){ | |
| 2794 | +return null; | |
| 2795 | +} | |
| 2796 | +if(typeof (node.nodeType)!="undefined"&&node.nodeType>0){ | |
| 2797 | +return node; | |
| 2798 | +} | |
| 2799 | +if(typeof (node)=="number"||typeof (node)=="boolean"){ | |
| 2800 | +node=node.toString(); | |
| 2801 | +} | |
| 2802 | +if(typeof (node)=="string"){ | |
| 2803 | +return self._document.createTextNode(node); | |
| 2804 | +} | |
| 2805 | +if(typeof (node.__dom__)=="function"){ | |
| 2806 | +node=node.__dom__(ctx); | |
| 2807 | +continue; | |
| 2808 | +} | |
| 2809 | +if(typeof (node.dom)=="function"){ | |
| 2810 | +node=node.dom(ctx); | |
| 2811 | +continue; | |
| 2812 | +} | |
| 2813 | +if(typeof (node)=="function"){ | |
| 2814 | +node=node.apply(ctx,[ctx]); | |
| 2815 | +continue; | |
| 2816 | +} | |
| 2817 | +if(im){ | |
| 2818 | +var _355=null; | |
| 2819 | +try{ | |
| 2820 | +_355=iter(node); | |
| 2821 | +} | |
| 2822 | +catch(e){ | |
| 2823 | +} | |
| 2824 | +if(_355){ | |
| 2825 | +return map(_353,_355,_351(ctx)); | |
| 2826 | +} | |
| 2827 | +} | |
| 2828 | +try{ | |
| 2829 | +node=_352.match(node,ctx); | |
| 2830 | +continue; | |
| 2831 | +} | |
| 2832 | +catch(e){ | |
| 2833 | +if(e!=_354){ | |
| 2834 | +throw e; | |
| 2835 | +} | |
| 2836 | +} | |
| 2837 | +return self._document.createTextNode(node.toString()); | |
| 2838 | +} | |
| 2839 | +return undefined; | |
| 2840 | +},isChildNode:function(node,_356){ | |
| 2841 | +var self=MochiKit.DOM; | |
| 2842 | +if(typeof (node)=="string"){ | |
| 2843 | +node=self.getElement(node); | |
| 2844 | +} | |
| 2845 | +if(typeof (_356)=="string"){ | |
| 2846 | +_356=self.getElement(_356); | |
| 2847 | +} | |
| 2848 | +if(node===_356){ | |
| 2849 | +return true; | |
| 2850 | +} | |
| 2851 | +while(node&&node.tagName.toUpperCase()!="BODY"){ | |
| 2852 | +node=node.parentNode; | |
| 2853 | +if(node===_356){ | |
| 2854 | +return true; | |
| 2855 | +} | |
| 2856 | +} | |
| 2857 | +return false; | |
| 2858 | +},setNodeAttribute:function(node,attr,_358){ | |
| 2859 | +var o={}; | |
| 2860 | +o[attr]=_358; | |
| 2861 | +try{ | |
| 2862 | +return MochiKit.DOM.updateNodeAttributes(node,o); | |
| 2863 | +} | |
| 2864 | +catch(e){ | |
| 2865 | +} | |
| 2866 | +return null; | |
| 2867 | +},getNodeAttribute:function(node,attr){ | |
| 2868 | +var self=MochiKit.DOM; | |
| 2869 | +var _359=self.attributeArray.renames[attr]; | |
| 2870 | +node=self.getElement(node); | |
| 2871 | +try{ | |
| 2872 | +if(_359){ | |
| 2873 | +return node[_359]; | |
| 2874 | +} | |
| 2875 | +return node.getAttribute(attr); | |
| 2876 | +} | |
| 2877 | +catch(e){ | |
| 2878 | +} | |
| 2879 | +return null; | |
| 2880 | +},removeNodeAttribute:function(node,attr){ | |
| 2881 | +var self=MochiKit.DOM; | |
| 2882 | +var _360=self.attributeArray.renames[attr]; | |
| 2883 | +node=self.getElement(node); | |
| 2884 | +try{ | |
| 2885 | +if(_360){ | |
| 2886 | +return node[_360]; | |
| 2887 | +} | |
| 2888 | +return node.removeAttribute(attr); | |
| 2889 | +} | |
| 2890 | +catch(e){ | |
| 2891 | +} | |
| 2892 | +return null; | |
| 2893 | +},updateNodeAttributes:function(node,_361){ | |
| 2894 | +var elem=node; | |
| 2895 | +var self=MochiKit.DOM; | |
| 2896 | +if(typeof (node)=="string"){ | |
| 2897 | +elem=self.getElement(node); | |
| 2898 | +} | |
| 2899 | +if(_361){ | |
| 2900 | +var _362=MochiKit.Base.updatetree; | |
| 2901 | +if(self.attributeArray.compliant){ | |
| 2902 | +for(var k in _361){ | |
| 2903 | +var v=_361[k]; | |
| 2904 | +if(typeof (v)=="object"&&typeof (elem[k])=="object"){ | |
| 2905 | +if(k=="style"&&MochiKit.Style){ | |
| 2906 | +MochiKit.Style.setStyle(elem,v); | |
| 2907 | +}else{ | |
| 2908 | +_362(elem[k],v); | |
| 2909 | +} | |
| 2910 | +}else{ | |
| 2911 | +if(k.substring(0,2)=="on"){ | |
| 2912 | +if(typeof (v)=="string"){ | |
| 2913 | +v=new Function(v); | |
| 2914 | +} | |
| 2915 | +elem[k]=v; | |
| 2916 | +}else{ | |
| 2917 | +elem.setAttribute(k,v); | |
| 2918 | +} | |
| 2919 | +} | |
| 2920 | +} | |
| 2921 | +}else{ | |
| 2922 | +var _363=self.attributeArray.renames; | |
| 2923 | +for(k in _361){ | |
| 2924 | +v=_361[k]; | |
| 2925 | +var _364=_363[k]; | |
| 2926 | +if(k=="style"&&typeof (v)=="string"){ | |
| 2927 | +elem.style.cssText=v; | |
| 2928 | +}else{ | |
| 2929 | +if(typeof (_364)=="string"){ | |
| 2930 | +elem[_364]=v; | |
| 2931 | +}else{ | |
| 2932 | +if(typeof (elem[k])=="object"&&typeof (v)=="object"){ | |
| 2933 | +if(k=="style"&&MochiKit.Style){ | |
| 2934 | +MochiKit.Style.setStyle(elem,v); | |
| 2935 | +}else{ | |
| 2936 | +_362(elem[k],v); | |
| 2937 | +} | |
| 2938 | +}else{ | |
| 2939 | +if(k.substring(0,2)=="on"){ | |
| 2940 | +if(typeof (v)=="string"){ | |
| 2941 | +v=new Function(v); | |
| 2942 | +} | |
| 2943 | +elem[k]=v; | |
| 2944 | +}else{ | |
| 2945 | +elem.setAttribute(k,v); | |
| 2946 | +} | |
| 2947 | +} | |
| 2948 | +} | |
| 2949 | +} | |
| 2950 | +} | |
| 2951 | +} | |
| 2952 | +} | |
| 2953 | +return elem; | |
| 2954 | +},appendChildNodes:function(node){ | |
| 2955 | +var elem=node; | |
| 2956 | +var self=MochiKit.DOM; | |
| 2957 | +if(typeof (node)=="string"){ | |
| 2958 | +elem=self.getElement(node); | |
| 2959 | +} | |
| 2960 | +var _365=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; | |
| 2961 | +var _366=MochiKit.Base.concat; | |
| 2962 | +while(_365.length){ | |
| 2963 | +var n=_365.shift(); | |
| 2964 | +if(typeof (n)=="undefined"||n===null){ | |
| 2965 | +}else{ | |
| 2966 | +if(typeof (n.nodeType)=="number"){ | |
| 2967 | +elem.appendChild(n); | |
| 2968 | +}else{ | |
| 2969 | +_365=_366(n,_365); | |
| 2970 | +} | |
| 2971 | +} | |
| 2972 | +} | |
| 2973 | +return elem; | |
| 2974 | +},insertSiblingNodesBefore:function(node){ | |
| 2975 | +var elem=node; | |
| 2976 | +var self=MochiKit.DOM; | |
| 2977 | +if(typeof (node)=="string"){ | |
| 2978 | +elem=self.getElement(node); | |
| 2979 | +} | |
| 2980 | +var _367=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; | |
| 2981 | +var _368=elem.parentNode; | |
| 2982 | +var _369=MochiKit.Base.concat; | |
| 2983 | +while(_367.length){ | |
| 2984 | +var n=_367.shift(); | |
| 2985 | +if(typeof (n)=="undefined"||n===null){ | |
| 2986 | +}else{ | |
| 2987 | +if(typeof (n.nodeType)=="number"){ | |
| 2988 | +_368.insertBefore(n,elem); | |
| 2989 | +}else{ | |
| 2990 | +_367=_369(n,_367); | |
| 2991 | +} | |
| 2992 | +} | |
| 2993 | +} | |
| 2994 | +return _368; | |
| 2995 | +},insertSiblingNodesAfter:function(node){ | |
| 2996 | +var elem=node; | |
| 2997 | +var self=MochiKit.DOM; | |
| 2998 | +if(typeof (node)=="string"){ | |
| 2999 | +elem=self.getElement(node); | |
| 3000 | +} | |
| 3001 | +var _370=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; | |
| 3002 | +if(elem.nextSibling){ | |
| 3003 | +return self.insertSiblingNodesBefore(elem.nextSibling,_370); | |
| 3004 | +}else{ | |
| 3005 | +return self.appendChildNodes(elem.parentNode,_370); | |
| 3006 | +} | |
| 3007 | +},replaceChildNodes:function(node){ | |
| 3008 | +var elem=node; | |
| 3009 | +var self=MochiKit.DOM; | |
| 3010 | +if(typeof (node)=="string"){ | |
| 3011 | +elem=self.getElement(node); | |
| 3012 | +arguments[0]=elem; | |
| 3013 | +} | |
| 3014 | +var _371; | |
| 3015 | +while((_371=elem.firstChild)){ | |
| 3016 | +elem.removeChild(_371); | |
| 3017 | +} | |
| 3018 | +if(arguments.length<2){ | |
| 3019 | +return elem; | |
| 3020 | +}else{ | |
| 3021 | +return self.appendChildNodes.apply(this,arguments); | |
| 3022 | +} | |
| 3023 | +},createDOM:function(name,_372){ | |
| 3024 | +var elem; | |
| 3025 | +var self=MochiKit.DOM; | |
| 3026 | +var m=MochiKit.Base; | |
| 3027 | +if(typeof (_372)=="string"||typeof (_372)=="number"){ | |
| 3028 | +var args=m.extend([name,null],arguments,1); | |
| 3029 | +return arguments.callee.apply(this,args); | |
| 3030 | +} | |
| 3031 | +if(typeof (name)=="string"){ | |
| 3032 | +var _373=self._xhtml; | |
| 3033 | +if(_372&&!self.attributeArray.compliant){ | |
| 3034 | +var _374=""; | |
| 3035 | +if("name" in _372){ | |
| 3036 | +_374+=" name=\""+self.escapeHTML(_372.name)+"\""; | |
| 3037 | +} | |
| 3038 | +if(name=="input"&&"type" in _372){ | |
| 3039 | +_374+=" type=\""+self.escapeHTML(_372.type)+"\""; | |
| 3040 | +} | |
| 3041 | +if(_374){ | |
| 3042 | +name="<"+name+_374+">"; | |
| 3043 | +_373=false; | |
| 3044 | +} | |
| 3045 | +} | |
| 3046 | +var d=self._document; | |
| 3047 | +if(_373&&d===document){ | |
| 3048 | +elem=d.createElementNS("http://www.w3.org/1999/xhtml",name); | |
| 3049 | +}else{ | |
| 3050 | +elem=d.createElement(name); | |
| 3051 | +} | |
| 3052 | +}else{ | |
| 3053 | +elem=name; | |
| 3054 | +} | |
| 3055 | +if(_372){ | |
| 3056 | +self.updateNodeAttributes(elem,_372); | |
| 3057 | +} | |
| 3058 | +if(arguments.length<=2){ | |
| 3059 | +return elem; | |
| 3060 | +}else{ | |
| 3061 | +var args=m.extend([elem],arguments,2); | |
| 3062 | +return self.appendChildNodes.apply(this,args); | |
| 3063 | +} | |
| 3064 | +},createDOMFunc:function(){ | |
| 3065 | +var m=MochiKit.Base; | |
| 3066 | +return m.partial.apply(this,m.extend([MochiKit.DOM.createDOM],arguments)); | |
| 3067 | +},removeElement:function(elem){ | |
| 3068 | +var e=MochiKit.DOM.getElement(elem); | |
| 3069 | +e.parentNode.removeChild(e); | |
| 3070 | +return e; | |
| 3071 | +},swapDOM:function(dest,src){ | |
| 3072 | +var self=MochiKit.DOM; | |
| 3073 | +dest=self.getElement(dest); | |
| 3074 | +var _377=dest.parentNode; | |
| 3075 | +if(src){ | |
| 3076 | +src=self.getElement(src); | |
| 3077 | +_377.replaceChild(src,dest); | |
| 3078 | +}else{ | |
| 3079 | +_377.removeChild(dest); | |
| 3080 | +} | |
| 3081 | +return src; | |
| 3082 | +},getElement:function(id){ | |
| 3083 | +var self=MochiKit.DOM; | |
| 3084 | +if(arguments.length==1){ | |
| 3085 | +return ((typeof (id)=="string")?self._document.getElementById(id):id); | |
| 3086 | +}else{ | |
| 3087 | +return MochiKit.Base.map(self.getElement,arguments); | |
| 3088 | +} | |
| 3089 | +},getElementsByTagAndClassName:function(_379,_380,_381){ | |
| 3090 | +var self=MochiKit.DOM; | |
| 3091 | +if(typeof (_379)=="undefined"||_379===null){ | |
| 3092 | +_379="*"; | |
| 3093 | +} | |
| 3094 | +if(typeof (_381)=="undefined"||_381===null){ | |
| 3095 | +_381=self._document; | |
| 3096 | +} | |
| 3097 | +_381=self.getElement(_381); | |
| 3098 | +var _382=(_381.getElementsByTagName(_379)||self._document.all); | |
| 3099 | +if(typeof (_380)=="undefined"||_380===null){ | |
| 3100 | +return MochiKit.Base.extend(null,_382); | |
| 3101 | +} | |
| 3102 | +var _383=[]; | |
| 3103 | +for(var i=0;i<_382.length;i++){ | |
| 3104 | +var _384=_382[i]; | |
| 3105 | +var cls=_384.className; | |
| 3106 | +if(!cls){ | |
| 3107 | +continue; | |
| 3108 | +} | |
| 3109 | +var _386=cls.split(" "); | |
| 3110 | +for(var j=0;j<_386.length;j++){ | |
| 3111 | +if(_386[j]==_380){ | |
| 3112 | +_383.push(_384); | |
| 3113 | +break; | |
| 3114 | +} | |
| 3115 | +} | |
| 3116 | +} | |
| 3117 | +return _383; | |
| 3118 | +},_newCallStack:function(path,once){ | |
| 3119 | +var rval=function(){ | |
| 3120 | +var _389=arguments.callee.callStack; | |
| 3121 | +for(var i=0;i<_389.length;i++){ | |
| 3122 | +if(_389[i].apply(this,arguments)===false){ | |
| 3123 | +break; | |
| 3124 | +} | |
| 3125 | +} | |
| 3126 | +if(once){ | |
| 3127 | +try{ | |
| 3128 | +this[path]=null; | |
| 3129 | +} | |
| 3130 | +catch(e){ | |
| 3131 | +} | |
| 3132 | +} | |
| 3133 | +}; | |
| 3134 | +rval.callStack=[]; | |
| 3135 | +return rval; | |
| 3136 | +},addToCallStack:function(_390,path,func,once){ | |
| 3137 | +var self=MochiKit.DOM; | |
| 3138 | +var _391=_390[path]; | |
| 3139 | +var _392=_391; | |
| 3140 | +if(!(typeof (_391)=="function"&&typeof (_391.callStack)=="object"&&_391.callStack!==null)){ | |
| 3141 | +_392=self._newCallStack(path,once); | |
| 3142 | +if(typeof (_391)=="function"){ | |
| 3143 | +_392.callStack.push(_391); | |
| 3144 | +} | |
| 3145 | +_390[path]=_392; | |
| 3146 | +} | |
| 3147 | +_392.callStack.push(func); | |
| 3148 | +},addLoadEvent:function(func){ | |
| 3149 | +var self=MochiKit.DOM; | |
| 3150 | +self.addToCallStack(self._window,"onload",func,true); | |
| 3151 | +},focusOnLoad:function(_393){ | |
| 3152 | +var self=MochiKit.DOM; | |
| 3153 | +self.addLoadEvent(function(){ | |
| 3154 | +_393=self.getElement(_393); | |
| 3155 | +if(_393){ | |
| 3156 | +_393.focus(); | |
| 3157 | +} | |
| 3158 | +}); | |
| 3159 | +},setElementClass:function(_394,_395){ | |
| 3160 | +var self=MochiKit.DOM; | |
| 3161 | +var obj=self.getElement(_394); | |
| 3162 | +if(self.attributeArray.compliant){ | |
| 3163 | +obj.setAttribute("class",_395); | |
| 3164 | +}else{ | |
| 3165 | +obj.setAttribute("className",_395); | |
| 3166 | +} | |
| 3167 | +},toggleElementClass:function(_396){ | |
| 3168 | +var self=MochiKit.DOM; | |
| 3169 | +for(var i=1;i<arguments.length;i++){ | |
| 3170 | +var obj=self.getElement(arguments[i]); | |
| 3171 | +if(!self.addElementClass(obj,_396)){ | |
| 3172 | +self.removeElementClass(obj,_396); | |
| 3173 | +} | |
| 3174 | +} | |
| 3175 | +},addElementClass:function(_397,_398){ | |
| 3176 | +var self=MochiKit.DOM; | |
| 3177 | +var obj=self.getElement(_397); | |
| 3178 | +var cls=obj.className; | |
| 3179 | +if(cls==undefined||cls.length===0){ | |
| 3180 | +self.setElementClass(obj,_398); | |
| 3181 | +return true; | |
| 3182 | +} | |
| 3183 | +if(cls==_398){ | |
| 3184 | +return false; | |
| 3185 | +} | |
| 3186 | +var _399=cls.split(" "); | |
| 3187 | +for(var i=0;i<_399.length;i++){ | |
| 3188 | +if(_399[i]==_398){ | |
| 3189 | +return false; | |
| 3190 | +} | |
| 3191 | +} | |
| 3192 | +self.setElementClass(obj,cls+" "+_398); | |
| 3193 | +return true; | |
| 3194 | +},removeElementClass:function(_400,_401){ | |
| 3195 | +var self=MochiKit.DOM; | |
| 3196 | +var obj=self.getElement(_400); | |
| 3197 | +var cls=obj.className; | |
| 3198 | +if(cls==undefined||cls.length===0){ | |
| 3199 | +return false; | |
| 3200 | +} | |
| 3201 | +if(cls==_401){ | |
| 3202 | +self.setElementClass(obj,""); | |
| 3203 | +return true; | |
| 3204 | +} | |
| 3205 | +var _402=cls.split(" "); | |
| 3206 | +for(var i=0;i<_402.length;i++){ | |
| 3207 | +if(_402[i]==_401){ | |
| 3208 | +_402.splice(i,1); | |
| 3209 | +self.setElementClass(obj,_402.join(" ")); | |
| 3210 | +return true; | |
| 3211 | +} | |
| 3212 | +} | |
| 3213 | +return false; | |
| 3214 | +},swapElementClass:function(_403,_404,_405){ | |
| 3215 | +var obj=MochiKit.DOM.getElement(_403); | |
| 3216 | +var res=MochiKit.DOM.removeElementClass(obj,_404); | |
| 3217 | +if(res){ | |
| 3218 | +MochiKit.DOM.addElementClass(obj,_405); | |
| 3219 | +} | |
| 3220 | +return res; | |
| 3221 | +},hasElementClass:function(_406,_407){ | |
| 3222 | +var obj=MochiKit.DOM.getElement(_406); | |
| 3223 | +var cls=obj.className; | |
| 3224 | +if(!cls){ | |
| 3225 | +return false; | |
| 3226 | +} | |
| 3227 | +var _408=cls.split(" "); | |
| 3228 | +for(var i=1;i<arguments.length;i++){ | |
| 3229 | +var good=false; | |
| 3230 | +for(var j=0;j<_408.length;j++){ | |
| 3231 | +if(_408[j]==arguments[i]){ | |
| 3232 | +good=true; | |
| 3233 | +break; | |
| 3234 | +} | |
| 3235 | +} | |
| 3236 | +if(!good){ | |
| 3237 | +return false; | |
| 3238 | +} | |
| 3239 | +} | |
| 3240 | +return true; | |
| 3241 | +},escapeHTML:function(s){ | |
| 3242 | +return s.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">"); | |
| 3243 | +},toHTML:function(dom){ | |
| 3244 | +return MochiKit.DOM.emitHTML(dom).join(""); | |
| 3245 | +},emitHTML:function(dom,lst){ | |
| 3246 | +if(typeof (lst)=="undefined"||lst===null){ | |
| 3247 | +lst=[]; | |
| 3248 | +} | |
| 3249 | +var _411=[dom]; | |
| 3250 | +var self=MochiKit.DOM; | |
| 3251 | +var _412=self.escapeHTML; | |
| 3252 | +var _413=self.attributeArray; | |
| 3253 | +while(_411.length){ | |
| 3254 | +dom=_411.pop(); | |
| 3255 | +if(typeof (dom)=="string"){ | |
| 3256 | +lst.push(dom); | |
| 3257 | +}else{ | |
| 3258 | +if(dom.nodeType==1){ | |
| 3259 | +lst.push("<"+dom.tagName.toLowerCase()); | |
| 3260 | +var _414=[]; | |
| 3261 | +var _415=_413(dom); | |
| 3262 | +for(var i=0;i<_415.length;i++){ | |
| 3263 | +var a=_415[i]; | |
| 3264 | +_414.push([" ",a.name,"=\"",_412(a.value),"\""]); | |
| 3265 | +} | |
| 3266 | +_414.sort(); | |
| 3267 | +for(i=0;i<_414.length;i++){ | |
| 3268 | +var _416=_414[i]; | |
| 3269 | +for(var j=0;j<_416.length;j++){ | |
| 3270 | +lst.push(_416[j]); | |
| 3271 | +} | |
| 3272 | +} | |
| 3273 | +if(dom.hasChildNodes()){ | |
| 3274 | +lst.push(">"); | |
| 3275 | +_411.push("</"+dom.tagName.toLowerCase()+">"); | |
| 3276 | +var _417=dom.childNodes; | |
| 3277 | +for(i=_417.length-1;i>=0;i--){ | |
| 3278 | +_411.push(_417[i]); | |
| 3279 | +} | |
| 3280 | +}else{ | |
| 3281 | +lst.push("/>"); | |
| 3282 | +} | |
| 3283 | +}else{ | |
| 3284 | +if(dom.nodeType==3){ | |
| 3285 | +lst.push(_412(dom.nodeValue)); | |
| 3286 | +} | |
| 3287 | +} | |
| 3288 | +} | |
| 3289 | +} | |
| 3290 | +return lst; | |
| 3291 | +},scrapeText:function(node,_418){ | |
| 3292 | +var rval=[]; | |
| 3293 | +(function(node){ | |
| 3294 | +var cn=node.childNodes; | |
| 3295 | +if(cn){ | |
| 3296 | +for(var i=0;i<cn.length;i++){ | |
| 3297 | +arguments.callee.call(this,cn[i]); | |
| 3298 | +} | |
| 3299 | +} | |
| 3300 | +var _420=node.nodeValue; | |
| 3301 | +if(typeof (_420)=="string"){ | |
| 3302 | +rval.push(_420); | |
| 3303 | +} | |
| 3304 | +})(MochiKit.DOM.getElement(node)); | |
| 3305 | +if(_418){ | |
| 3306 | +return rval; | |
| 3307 | +}else{ | |
| 3308 | +return rval.join(""); | |
| 3309 | +} | |
| 3310 | +},removeEmptyTextNodes:function(_421){ | |
| 3311 | +_421=MochiKit.DOM.getElement(_421); | |
| 3312 | +for(var i=0;i<_421.childNodes.length;i++){ | |
| 3313 | +var node=_421.childNodes[i]; | |
| 3314 | +if(node.nodeType==3&&!/\S/.test(node.nodeValue)){ | |
| 3315 | +node.parentNode.removeChild(node); | |
| 3316 | +} | |
| 3317 | +} | |
| 3318 | +},makeClipping:function(_422){ | |
| 3319 | +_422=MochiKit.DOM.getElement(_422); | |
| 3320 | +var _423=_422.style.overflow; | |
| 3321 | +if((MochiKit.Style.getStyle(_422,"overflow")||"visible")!="hidden"){ | |
| 3322 | +_422.style.overflow="hidden"; | |
| 3323 | +} | |
| 3324 | +return _423; | |
| 3325 | +},undoClipping:function(_424,_425){ | |
| 3326 | +_424=MochiKit.DOM.getElement(_424); | |
| 3327 | +if(!_425){ | |
| 3328 | +return; | |
| 3329 | +} | |
| 3330 | +_424.style.overflow=_425; | |
| 3331 | +},makePositioned:function(_426){ | |
| 3332 | +_426=MochiKit.DOM.getElement(_426); | |
| 3333 | +var pos=MochiKit.Style.getStyle(_426,"position"); | |
| 3334 | +if(pos=="static"||!pos){ | |
| 3335 | +_426.style.position="relative"; | |
| 3336 | +if(/Opera/.test(navigator.userAgent)){ | |
| 3337 | +_426.style.top=0; | |
| 3338 | +_426.style.left=0; | |
| 3339 | +} | |
| 3340 | +} | |
| 3341 | +},undoPositioned:function(_428){ | |
| 3342 | +_428=MochiKit.DOM.getElement(_428); | |
| 3343 | +if(_428.style.position=="relative"){ | |
| 3344 | +_428.style.position=_428.style.top=_428.style.left=_428.style.bottom=_428.style.right=""; | |
| 3345 | +} | |
| 3346 | +},getFirstElementByTagAndClassName:function(_429,_430,_431){ | |
| 3347 | +var self=MochiKit.DOM; | |
| 3348 | +if(typeof (_429)=="undefined"||_429===null){ | |
| 3349 | +_429="*"; | |
| 3350 | +} | |
| 3351 | +if(typeof (_431)=="undefined"||_431===null){ | |
| 3352 | +_431=self._document; | |
| 3353 | +} | |
| 3354 | +_431=self.getElement(_431); | |
| 3355 | +var _432=(_431.getElementsByTagName(_429)||self._document.all); | |
| 3356 | +if(typeof (_430)=="undefined"||_430===null){ | |
| 3357 | +return _432[0]; | |
| 3358 | +} | |
| 3359 | +for(var i=0;i<_432.length;i++){ | |
| 3360 | +var _433=_432[i]; | |
| 3361 | +var _434=_433.className.split(" "); | |
| 3362 | +for(var j=0;j<_434.length;j++){ | |
| 3363 | +if(_434[j]==_430){ | |
| 3364 | +return _433; | |
| 3365 | +} | |
| 3366 | +} | |
| 3367 | +} | |
| 3368 | +},getFirstParentByTagAndClassName:function(elem,_435,_436){ | |
| 3369 | +var self=MochiKit.DOM; | |
| 3370 | +elem=self.getElement(elem); | |
| 3371 | +if(typeof (_435)=="undefined"||_435===null){ | |
| 3372 | +_435="*"; | |
| 3373 | +}else{ | |
| 3374 | +_435=_435.toUpperCase(); | |
| 3375 | +} | |
| 3376 | +if(typeof (_436)=="undefined"||_436===null){ | |
| 3377 | +_436=null; | |
| 3378 | +} | |
| 3379 | +var _437=""; | |
| 3380 | +var _438=""; | |
| 3381 | +while(elem&&elem.tagName){ | |
| 3382 | +elem=elem.parentNode; | |
| 3383 | +if(_435=="*"&&_436===null){ | |
| 3384 | +return elem; | |
| 3385 | +} | |
| 3386 | +_437=elem.className.split(" "); | |
| 3387 | +_438=elem.tagName.toUpperCase(); | |
| 3388 | +if(_436===null&&_435==_438){ | |
| 3389 | +return elem; | |
| 3390 | +}else{ | |
| 3391 | +if(_436!==null){ | |
| 3392 | +for(var i=0;i<_437.length;i++){ | |
| 3393 | +if(_435=="*"&&_437[i]==_436){ | |
| 3394 | +return elem; | |
| 3395 | +}else{ | |
| 3396 | +if(_435==_438&&_437[i]==_436){ | |
| 3397 | +return elem; | |
| 3398 | +} | |
| 3399 | +} | |
| 3400 | +} | |
| 3401 | +} | |
| 3402 | +} | |
| 3403 | +} | |
| 3404 | +return elem; | |
| 3405 | +},isParent:function(_439,_440){ | |
| 3406 | +if(!_439.parentNode||_439==_440){ | |
| 3407 | +return false; | |
| 3408 | +} | |
| 3409 | +if(_439.parentNode==_440){ | |
| 3410 | +return true; | |
| 3411 | +} | |
| 3412 | +return MochiKit.DOM.isParent(_439.parentNode,_440); | |
| 3413 | +},__new__:function(win){ | |
| 3414 | +var m=MochiKit.Base; | |
| 3415 | +if(typeof (document)!="undefined"){ | |
| 3416 | +this._document=document; | |
| 3417 | +var _441="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; | |
| 3418 | +this._xhtml=(document.documentElement&&document.createElementNS&&document.documentElement.namespaceURI===_441); | |
| 3419 | +}else{ | |
| 3420 | +if(MochiKit.MockDOM){ | |
| 3421 | +this._document=MochiKit.MockDOM.document; | |
| 3422 | +} | |
| 3423 | +} | |
| 3424 | +this._window=win; | |
| 3425 | +this.domConverters=new m.AdapterRegistry(); | |
| 3426 | +var _442=this._document.createElement("span"); | |
| 3427 | +var _443; | |
| 3428 | +if(_442&&_442.attributes&&_442.attributes.length>0){ | |
| 3429 | +var _444=m.filter; | |
| 3430 | +_443=function(node){ | |
| 3431 | +return _444(_443.ignoreAttrFilter,node.attributes); | |
| 3432 | +}; | |
| 3433 | +_443.ignoreAttr={}; | |
| 3434 | +var _445=_442.attributes; | |
| 3435 | +var _446=_443.ignoreAttr; | |
| 3436 | +for(var i=0;i<_445.length;i++){ | |
| 3437 | +var a=_445[i]; | |
| 3438 | +_446[a.name]=a.value; | |
| 3439 | +} | |
| 3440 | +_443.ignoreAttrFilter=function(a){ | |
| 3441 | +return (_443.ignoreAttr[a.name]!=a.value); | |
| 3442 | +}; | |
| 3443 | +_443.compliant=false; | |
| 3444 | +_443.renames={"class":"className","checked":"defaultChecked","usemap":"useMap","for":"htmlFor","readonly":"readOnly","colspan":"colSpan","bgcolor":"bgColor"}; | |
| 3445 | +}else{ | |
| 3446 | +_443=function(node){ | |
| 3447 | +return node.attributes; | |
| 3448 | +}; | |
| 3449 | +_443.compliant=true; | |
| 3450 | +_443.renames={}; | |
| 3451 | +} | |
| 3452 | +this.attributeArray=_443; | |
| 3453 | +var _447=function(_448,arr){ | |
| 3454 | +var _449=arr[1].split("."); | |
| 3455 | +var str=""; | |
| 3456 | +var obj={}; | |
| 3457 | +str+="if (!MochiKit."+_449[1]+") { throw new Error(\""; | |
| 3458 | +str+="This function has been deprecated and depends on MochiKit."; | |
| 3459 | +str+=_449[1]+".\");}"; | |
| 3460 | +str+="return MochiKit."+_449[1]+"."+arr[0]; | |
| 3461 | +str+=".apply(this, arguments);"; | |
| 3462 | +obj[_449[2]]=new Function(str); | |
| 3463 | +MochiKit.Base.update(MochiKit[_448],obj); | |
| 3464 | +}; | |
| 3465 | +for(var i;i<MochiKit.DOM.DEPRECATED.length;i++){ | |
| 3466 | +_447("DOM",MochiKit.DOM.DEPRECATED[i]); | |
| 3467 | +} | |
| 3468 | +var _450=this.createDOMFunc; | |
| 3469 | +this.UL=_450("ul"); | |
| 3470 | +this.OL=_450("ol"); | |
| 3471 | +this.LI=_450("li"); | |
| 3472 | +this.TD=_450("td"); | |
| 3473 | +this.TR=_450("tr"); | |
| 3474 | +this.TBODY=_450("tbody"); | |
| 3475 | +this.THEAD=_450("thead"); | |
| 3476 | +this.TFOOT=_450("tfoot"); | |
| 3477 | +this.TABLE=_450("table"); | |
| 3478 | +this.TH=_450("th"); | |
| 3479 | +this.INPUT=_450("input"); | |
| 3480 | +this.SPAN=_450("span"); | |
| 3481 | +this.A=_450("a"); | |
| 3482 | +this.DIV=_450("div"); | |
| 3483 | +this.IMG=_450("img"); | |
| 3484 | +this.BUTTON=_450("button"); | |
| 3485 | +this.TT=_450("tt"); | |
| 3486 | +this.PRE=_450("pre"); | |
| 3487 | +this.H1=_450("h1"); | |
| 3488 | +this.H2=_450("h2"); | |
| 3489 | +this.H3=_450("h3"); | |
| 3490 | +this.BR=_450("br"); | |
| 3491 | +this.HR=_450("hr"); | |
| 3492 | +this.LABEL=_450("label"); | |
| 3493 | +this.TEXTAREA=_450("textarea"); | |
| 3494 | +this.FORM=_450("form"); | |
| 3495 | +this.P=_450("p"); | |
| 3496 | +this.SELECT=_450("select"); | |
| 3497 | +this.OPTION=_450("option"); | |
| 3498 | +this.OPTGROUP=_450("optgroup"); | |
| 3499 | +this.LEGEND=_450("legend"); | |
| 3500 | +this.FIELDSET=_450("fieldset"); | |
| 3501 | +this.STRONG=_450("strong"); | |
| 3502 | +this.CANVAS=_450("canvas"); | |
| 3503 | +this.$=this.getElement; | |
| 3504 | +this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; | |
| 3505 | +m.nameFunctions(this); | |
| 3506 | +}}); | |
| 3507 | +MochiKit.DOM.__new__(((typeof (window)=="undefined")?this:window)); | |
| 3508 | +if(MochiKit.__export__){ | |
| 3509 | +withWindow=MochiKit.DOM.withWindow; | |
| 3510 | +withDocument=MochiKit.DOM.withDocument; | |
| 3511 | +} | |
| 3512 | +MochiKit.Base._exportSymbols(this,MochiKit.DOM); | |
| 3513 | +if(typeof (dojo)!="undefined"){ | |
| 3514 | +dojo.provide("MochiKit.Selector"); | |
| 3515 | +dojo.require("MochiKit.Base"); | |
| 3516 | +dojo.require("MochiKit.DOM"); | |
| 3517 | +dojo.require("MochiKit.Iter"); | |
| 3518 | +} | |
| 3519 | +if(typeof (JSAN)!="undefined"){ | |
| 3520 | +JSAN.use("MochiKit.Base",[]); | |
| 3521 | +JSAN.use("MochiKit.DOM",[]); | |
| 3522 | +JSAN.use("MochiKit.Iter",[]); | |
| 3523 | +} | |
| 3524 | +try{ | |
| 3525 | +if(typeof (MochiKit.Base)==="undefined"||typeof (MochiKit.DOM)==="undefined"||typeof (MochiKit.Iter)==="undefined"){ | |
| 3526 | +throw ""; | |
| 3527 | +} | |
| 3528 | +} | |
| 3529 | +catch(e){ | |
| 3530 | +throw "MochiKit.Selector depends on MochiKit.Base, MochiKit.DOM and MochiKit.Iter!"; | |
| 3531 | +} | |
| 3532 | +if(typeof (MochiKit.Selector)=="undefined"){ | |
| 3533 | +MochiKit.Selector={}; | |
| 3534 | +} | |
| 3535 | +MochiKit.Selector.NAME="MochiKit.Selector"; | |
| 3536 | +MochiKit.Selector.VERSION="1.4"; | |
| 3537 | +MochiKit.Selector.__repr__=function(){ | |
| 3538 | +return "["+this.NAME+" "+this.VERSION+"]"; | |
| 3539 | +}; | |
| 3540 | +MochiKit.Selector.toString=function(){ | |
| 3541 | +return this.__repr__(); | |
| 3542 | +}; | |
| 3543 | +MochiKit.Selector.Selector=function(_451){ | |
| 3544 | +this.params={classNames:[],pseudoClassNames:[]}; | |
| 3545 | +this.expression=_451.toString().replace(/(^\s+|\s+$)/g,""); | |
| 3546 | +this.parseExpression(); | |
| 3547 | +this.compileMatcher(); | |
| 3548 | +}; | |
| 3549 | +MochiKit.Selector.Selector.prototype={__class__:MochiKit.Selector.Selector,parseExpression:function(){ | |
| 3550 | +function abort(_452){ | |
| 3551 | +throw "Parse error in selector: "+_452; | |
| 3552 | +} | |
| 3553 | +if(this.expression==""){ | |
| 3554 | +abort("empty expression"); | |
| 3555 | +} | |
| 3556 | +var repr=MochiKit.Base.repr; | |
| 3557 | +var _454=this.params; | |
| 3558 | +var expr=this.expression; | |
| 3559 | +var _456,modifier,clause,rest; | |
| 3560 | +while(_456=expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!^$*]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)){ | |
| 3561 | +_454.attributes=_454.attributes||[]; | |
| 3562 | +_454.attributes.push({name:_456[2],operator:_456[3],value:_456[4]||_456[5]||""}); | |
| 3563 | +expr=_456[1]; | |
| 3564 | +} | |
| 3565 | +if(expr=="*"){ | |
| 3566 | +return this.params.wildcard=true; | |
| 3567 | +} | |
| 3568 | +while(_456=expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+(?:\([^)]*\))?)(.*)/i)){ | |
| 3569 | +modifier=_456[1]; | |
| 3570 | +clause=_456[2]; | |
| 3571 | +rest=_456[3]; | |
| 3572 | +switch(modifier){ | |
| 3573 | +case "#": | |
| 3574 | +_454.id=clause; | |
| 3575 | +break; | |
| 3576 | +case ".": | |
| 3577 | +_454.classNames.push(clause); | |
| 3578 | +break; | |
| 3579 | +case ":": | |
| 3580 | +_454.pseudoClassNames.push(clause); | |
| 3581 | +break; | |
| 3582 | +case "": | |
| 3583 | +case undefined: | |
| 3584 | +_454.tagName=clause.toUpperCase(); | |
| 3585 | +break; | |
| 3586 | +default: | |
| 3587 | +abort(repr(expr)); | |
| 3588 | +} | |
| 3589 | +expr=rest; | |
| 3590 | +} | |
| 3591 | +if(expr.length>0){ | |
| 3592 | +abort(repr(expr)); | |
| 3593 | +} | |
| 3594 | +},buildMatchExpression:function(){ | |
| 3595 | +var repr=MochiKit.Base.repr; | |
| 3596 | +var _457=this.params; | |
| 3597 | +var _458=[]; | |
| 3598 | +var _459,i; | |
| 3599 | +function childElements(_460){ | |
| 3600 | +return "MochiKit.Base.filter(function (node) { return node.nodeType == 1; }, "+_460+".childNodes)"; | |
| 3601 | +} | |
| 3602 | +if(_457.wildcard){ | |
| 3603 | +_458.push("true"); | |
| 3604 | +} | |
| 3605 | +if(_459=_457.id){ | |
| 3606 | +_458.push("element.id == "+repr(_459)); | |
| 3607 | +} | |
| 3608 | +if(_459=_457.tagName){ | |
| 3609 | +_458.push("element.tagName.toUpperCase() == "+repr(_459)); | |
| 3610 | +} | |
| 3611 | +if((_459=_457.classNames).length>0){ | |
| 3612 | +for(i=0;i<_459.length;i++){ | |
| 3613 | +_458.push("MochiKit.DOM.hasElementClass(element, "+repr(_459[i])+")"); | |
| 3614 | +} | |
| 3615 | +} | |
| 3616 | +if((_459=_457.pseudoClassNames).length>0){ | |
| 3617 | +for(i=0;i<_459.length;i++){ | |
| 3618 | +var _461=_459[i].match(/^([^(]+)(?:\((.*)\))?$/); | |
| 3619 | +var _462=_461[1]; | |
| 3620 | +var _463=_461[2]; | |
| 3621 | +switch(_462){ | |
| 3622 | +case "root": | |
| 3623 | +_458.push("element.nodeType == 9 || element === element.ownerDocument.documentElement"); | |
| 3624 | +break; | |
| 3625 | +case "nth-child": | |
| 3626 | +case "nth-last-child": | |
| 3627 | +case "nth-of-type": | |
| 3628 | +case "nth-last-of-type": | |
| 3629 | +_461=_463.match(/^((?:(\d+)n\+)?(\d+)|odd|even)$/); | |
| 3630 | +if(!_461){ | |
| 3631 | +throw "Invalid argument to pseudo element nth-child: "+_463; | |
| 3632 | +} | |
| 3633 | +var a,b; | |
| 3634 | +if(_461[0]=="odd"){ | |
| 3635 | +a=2; | |
| 3636 | +b=1; | |
| 3637 | +}else{ | |
| 3638 | +if(_461[0]=="even"){ | |
| 3639 | +a=2; | |
| 3640 | +b=0; | |
| 3641 | +}else{ | |
| 3642 | +a=_461[2]&&parseInt(_461)||null; | |
| 3643 | +b=parseInt(_461[3]); | |
| 3644 | +} | |
| 3645 | +} | |
| 3646 | +_458.push("this.nthChild(element,"+a+","+b+","+!!_462.match("^nth-last")+","+!!_462.match("of-type$")+")"); | |
| 3647 | +break; | |
| 3648 | +case "first-child": | |
| 3649 | +_458.push("this.nthChild(element, null, 1)"); | |
| 3650 | +break; | |
| 3651 | +case "last-child": | |
| 3652 | +_458.push("this.nthChild(element, null, 1, true)"); | |
| 3653 | +break; | |
| 3654 | +case "first-of-type": | |
| 3655 | +_458.push("this.nthChild(element, null, 1, false, true)"); | |
| 3656 | +break; | |
| 3657 | +case "last-of-type": | |
| 3658 | +_458.push("this.nthChild(element, null, 1, true, true)"); | |
| 3659 | +break; | |
| 3660 | +case "only-child": | |
| 3661 | +_458.push(childElements("element.parentNode")+".length == 1"); | |
| 3662 | +break; | |
| 3663 | +case "only-of-type": | |
| 3664 | +_458.push("MochiKit.Base.filter(function (node) { return node.tagName == element.tagName; }, "+childElements("element.parentNode")+").length == 1"); | |
| 3665 | +break; | |
| 3666 | +case "empty": | |
| 3667 | +_458.push("element.childNodes.length == 0"); | |
| 3668 | +break; | |
| 3669 | +case "enabled": | |
| 3670 | +_458.push("(this.isUIElement(element) && element.disabled === false)"); | |
| 3671 | +break; | |
| 3672 | +case "disabled": | |
| 3673 | +_458.push("(this.isUIElement(element) && element.disabled === true)"); | |
| 3674 | +break; | |
| 3675 | +case "checked": | |
| 3676 | +_458.push("(this.isUIElement(element) && element.checked === true)"); | |
| 3677 | +break; | |
| 3678 | +case "not": | |
| 3679 | +var _464=new MochiKit.Selector.Selector(_463); | |
| 3680 | +_458.push("!( "+_464.buildMatchExpression()+")"); | |
| 3681 | +break; | |
| 3682 | +} | |
| 3683 | +} | |
| 3684 | +} | |
| 3685 | +if(_459=_457.attributes){ | |
| 3686 | +MochiKit.Base.map(function(_465){ | |
| 3687 | +var _466="MochiKit.DOM.getNodeAttribute(element, "+repr(_465.name)+")"; | |
| 3688 | +var _467=function(_468){ | |
| 3689 | +return _466+" && "+_466+".split("+repr(_468)+")"; | |
| 3690 | +}; | |
| 3691 | +switch(_465.operator){ | |
| 3692 | +case "=": | |
| 3693 | +_458.push(_466+" == "+repr(_465.value)); | |
| 3694 | +break; | |
| 3695 | +case "~=": | |
| 3696 | +_458.push("MochiKit.Base.findValue("+_467(" ")+", "+repr(_465.value)+") > -1"); | |
| 3697 | +break; | |
| 3698 | +case "^=": | |
| 3699 | +_458.push(_466+".substring(0, "+_465.value.length+") == "+repr(_465.value)); | |
| 3700 | +break; | |
| 3701 | +case "$=": | |
| 3702 | +_458.push(_466+".substring("+_466+".length - "+_465.value.length+") == "+repr(_465.value)); | |
| 3703 | +break; | |
| 3704 | +case "*=": | |
| 3705 | +_458.push(_466+".match("+repr(_465.value)+")"); | |
| 3706 | +break; | |
| 3707 | +case "|=": | |
| 3708 | +_458.push(_467("-")+"[0].toUpperCase() == "+repr(_465.value.toUpperCase())); | |
| 3709 | +break; | |
| 3710 | +case "!=": | |
| 3711 | +_458.push(_466+" != "+repr(_465.value)); | |
| 3712 | +break; | |
| 3713 | +case "": | |
| 3714 | +case undefined: | |
| 3715 | +_458.push(_466+" != null"); | |
| 3716 | +break; | |
| 3717 | +default: | |
| 3718 | +throw "Unknown operator "+_465.operator+" in selector"; | |
| 3719 | +} | |
| 3720 | +},_459); | |
| 3721 | +} | |
| 3722 | +return _458.join(" && "); | |
| 3723 | +},compileMatcher:function(){ | |
| 3724 | +this.match=new Function("element","if (!element.tagName) return false; return "+this.buildMatchExpression()); | |
| 3725 | +},nthChild:function(_469,a,b,_470,_471){ | |
| 3726 | +var _472=MochiKit.Base.filter(function(node){ | |
| 3727 | +return node.nodeType==1; | |
| 3728 | +},_469.parentNode.childNodes); | |
| 3729 | +if(_471){ | |
| 3730 | +_472=MochiKit.Base.filter(function(node){ | |
| 3731 | +return node.tagName==_469.tagName; | |
| 3732 | +},_472); | |
| 3733 | +} | |
| 3734 | +if(_470){ | |
| 3735 | +_472=MochiKit.Iter.reversed(_472); | |
| 3736 | +} | |
| 3737 | +if(a){ | |
| 3738 | +var _473=MochiKit.Base.findIdentical(_472,_469); | |
| 3739 | +return ((_473+1-b)/a)%1==0; | |
| 3740 | +}else{ | |
| 3741 | +return b==MochiKit.Base.findIdentical(_472,_469)+1; | |
| 3742 | +} | |
| 3743 | +},isUIElement:function(_474){ | |
| 3744 | +return findValue(["input","button","select","option","textarea","object"],_474.tagName.toLowerCase())>-1; | |
| 3745 | +},findElements:function(_475,axis){ | |
| 3746 | +var _477; | |
| 3747 | +if(axis==undefined){ | |
| 3748 | +axis=""; | |
| 3749 | +} | |
| 3750 | +function inScope(_477,_475){ | |
| 3751 | +if(axis==""){ | |
| 3752 | +return MochiKit.DOM.isChildNode(_477,_475); | |
| 3753 | +}else{ | |
| 3754 | +if(axis==">"){ | |
| 3755 | +return _477.parentNode==_475; | |
| 3756 | +}else{ | |
| 3757 | +if(axis=="+"){ | |
| 3758 | +return _477==nextSiblingElement(_475); | |
| 3759 | +}else{ | |
| 3760 | +if(axis=="~"){ | |
| 3761 | +var _478=_475; | |
| 3762 | +while(_478=nextSiblingElement(_478)){ | |
| 3763 | +if(_477==_478){ | |
| 3764 | +return true; | |
| 3765 | +} | |
| 3766 | +} | |
| 3767 | +return false; | |
| 3768 | +}else{ | |
| 3769 | +throw "Invalid axis: "+axis; | |
| 3770 | +} | |
| 3771 | +} | |
| 3772 | +} | |
| 3773 | +} | |
| 3774 | +} | |
| 3775 | +if(element=MochiKit.DOM.getElement(this.params.id)){ | |
| 3776 | +if(this.match(element)){ | |
| 3777 | +if(!scope||inScope(element,scope)){ | |
| 3778 | +return [element]; | |
| 3779 | +} | |
| 3780 | +} | |
| 3781 | +} | |
| 3782 | +function nextSiblingElement(node){ | |
| 3783 | +node=node.nextSibling; | |
| 3784 | +while(node&&node.nodeType!=1){ | |
| 3785 | +node=node.nextSibling; | |
| 3786 | +} | |
| 3787 | +return node; | |
| 3788 | +} | |
| 3789 | +if(axis==""){ | |
| 3790 | +scope=(scope||currentDocument()).getElementsByTagName(this.params.tagName||"*"); | |
| 3791 | +}else{ | |
| 3792 | +if(axis==">"){ | |
| 3793 | +if(!scope){ | |
| 3794 | +throw "> combinator not allowed without preceeding expression"; | |
| 3795 | +} | |
| 3796 | +scope=MochiKit.Base.filter(function(node){ | |
| 3797 | +return node.nodeType==1; | |
| 3798 | +},scope.childNodes); | |
| 3799 | +}else{ | |
| 3800 | +if(axis=="+"){ | |
| 3801 | +if(!scope){ | |
| 3802 | +throw "+ combinator not allowed without preceeding expression"; | |
| 3803 | +} | |
| 3804 | +scope=nextSiblingElement(scope)&&[nextSiblingElement(scope)]; | |
| 3805 | +}else{ | |
| 3806 | +if(axis=="~"){ | |
| 3807 | +if(!scope){ | |
| 3808 | +throw "~ combinator not allowed without preceeding expression"; | |
| 3809 | +} | |
| 3810 | +var _479=[]; | |
| 3811 | +while(nextSiblingElement(scope)){ | |
| 3812 | +scope=nextSiblingElement(scope); | |
| 3813 | +_479.push(scope); | |
| 3814 | +} | |
| 3815 | +scope=_479; | |
| 3816 | +} | |
| 3817 | +} | |
| 3818 | +} | |
| 3819 | +} | |
| 3820 | +if(!scope){ | |
| 3821 | +return []; | |
| 3822 | +} | |
| 3823 | +var _480=MochiKit.Base.filter(MochiKit.Base.bind(function(_481){ | |
| 3824 | +return this.match(_481); | |
| 3825 | +},this),scope); | |
| 3826 | +return _480; | |
| 3827 | +},repr:function(){ | |
| 3828 | +return "Selector("+this.expression+")"; | |
| 3829 | +},toString:MochiKit.Base.forwardCall("repr")}; | |
| 3830 | +MochiKit.Base.update(MochiKit.Selector,{findChildElements:function(_482,_483){ | |
| 3831 | +return MochiKit.Base.flattenArray(MochiKit.Base.map(function(_484){ | |
| 3832 | +var _485=""; | |
| 3833 | +return MochiKit.Iter.reduce(function(_486,expr){ | |
| 3834 | +if(match=expr.match(/^[>+~]$/)){ | |
| 3835 | +_485=match[0]; | |
| 3836 | +return _486; | |
| 3837 | +}else{ | |
| 3838 | +var _487=new MochiKit.Selector.Selector(expr); | |
| 3839 | +var _488=MochiKit.Iter.reduce(function(_488,_489){ | |
| 3840 | +return MochiKit.Base.extend(_488,_487.findElements(_489||_482,_485)); | |
| 3841 | +},_486,[]); | |
| 3842 | +_485=""; | |
| 3843 | +return elements; | |
| 3844 | +} | |
| 3845 | +},_484.replace(/(^\s+|\s+$)/g,"").split(/\s+/),[null]); | |
| 3846 | +},_483)); | |
| 3847 | +}}); | |
| 3848 | +function $$(){ | |
| 3849 | +return MochiKit.Selector.findChildElements(MochiKit.DOM.currentDocument(),arguments); | |
| 3850 | +} | |
| 3851 | +if(typeof (dojo)!="undefined"){ | |
| 3852 | +dojo.provide("MochiKit.Style"); | |
| 3853 | +dojo.require("MochiKit.Base"); | |
| 3854 | +dojo.require("MochiKit.DOM"); | |
| 3855 | +} | |
| 3856 | +if(typeof (JSAN)!="undefined"){ | |
| 3857 | +JSAN.use("MochiKit.Base",[]); | |
| 3858 | +} | |
| 3859 | +try{ | |
| 3860 | +if(typeof (MochiKit.Base)=="undefined"){ | |
| 3861 | +throw ""; | |
| 3862 | +} | |
| 3863 | +} | |
| 3864 | +catch(e){ | |
| 3865 | +throw "MochiKit.Style depends on MochiKit.Base!"; | |
| 3866 | +} | |
| 3867 | +try{ | |
| 3868 | +if(typeof (MochiKit.DOM)=="undefined"){ | |
| 3869 | +throw ""; | |
| 3870 | +} | |
| 3871 | +} | |
| 3872 | +catch(e){ | |
| 3873 | +throw "MochiKit.Style depends on MochiKit.DOM!"; | |
| 3874 | +} | |
| 3875 | +if(typeof (MochiKit.Style)=="undefined"){ | |
| 3876 | +MochiKit.Style={}; | |
| 3877 | +} | |
| 3878 | +MochiKit.Style.NAME="MochiKit.Style"; | |
| 3879 | +MochiKit.Style.VERSION="1.4"; | |
| 3880 | +MochiKit.Style.__repr__=function(){ | |
| 3881 | +return "["+this.NAME+" "+this.VERSION+"]"; | |
| 3882 | +}; | |
| 3883 | +MochiKit.Style.toString=function(){ | |
| 3884 | +return this.__repr__(); | |
| 3885 | +}; | |
| 3886 | +MochiKit.Style.EXPORT_OK=[]; | |
| 3887 | +MochiKit.Style.EXPORT=["setStyle","setOpacity","getStyle","getElementDimensions","elementDimensions","setElementDimensions","getElementPosition","elementPosition","setElementPosition","setDisplayForElement","hideElement","showElement","getViewportDimensions","getViewportPosition","Dimensions","Coordinates"]; | |
| 3888 | +MochiKit.Style.Dimensions=function(w,h){ | |
| 3889 | +this.w=w; | |
| 3890 | +this.h=h; | |
| 3891 | +}; | |
| 3892 | +MochiKit.Style.Dimensions.prototype.__repr__=function(){ | |
| 3893 | +var repr=MochiKit.Base.repr; | |
| 3894 | +return "{w: "+repr(this.w)+", h: "+repr(this.h)+"}"; | |
| 3895 | +}; | |
| 3896 | +MochiKit.Style.Dimensions.prototype.toString=function(){ | |
| 3897 | +return this.__repr__(); | |
| 3898 | +}; | |
| 3899 | +MochiKit.Style.Coordinates=function(x,y){ | |
| 3900 | +this.x=x; | |
| 3901 | +this.y=y; | |
| 3902 | +}; | |
| 3903 | +MochiKit.Style.Coordinates.prototype.__repr__=function(){ | |
| 3904 | +var repr=MochiKit.Base.repr; | |
| 3905 | +return "{x: "+repr(this.x)+", y: "+repr(this.y)+"}"; | |
| 3906 | +}; | |
| 3907 | +MochiKit.Style.Coordinates.prototype.toString=function(){ | |
| 3908 | +return this.__repr__(); | |
| 3909 | +}; | |
| 3910 | +MochiKit.Base.update(MochiKit.Style,{getStyle:function(elem,_492){ | |
| 3911 | +var dom=MochiKit.DOM; | |
| 3912 | +var d=dom._document; | |
| 3913 | +elem=dom.getElement(elem); | |
| 3914 | +_492=MochiKit.Base.camelize(_492); | |
| 3915 | +if(!elem||elem==d){ | |
| 3916 | +return undefined; | |
| 3917 | +} | |
| 3918 | +if(_492=="opacity"&&elem.filters){ | |
| 3919 | +var _493; | |
| 3920 | +if(_493=(MochiKit.Style.getStyle(elem,"filter")||"").match(/alpha\(opacity=(.*)\)/)){ | |
| 3921 | +if(_493[1]){ | |
| 3922 | +return parseFloat(_493[1])/100; | |
| 3923 | +} | |
| 3924 | +} | |
| 3925 | +return 1; | |
| 3926 | +} | |
| 3927 | +var _494=elem.style?elem.style[_492]:null; | |
| 3928 | +if(!_494){ | |
| 3929 | +if(d.defaultView&&d.defaultView.getComputedStyle){ | |
| 3930 | +var css=d.defaultView.getComputedStyle(elem,null); | |
| 3931 | +_492=_492.replace(/([A-Z])/g,"-$1").toLowerCase(); | |
| 3932 | +_494=css?css.getPropertyValue(_492):null; | |
| 3933 | +}else{ | |
| 3934 | +if(elem.currentStyle){ | |
| 3935 | +_494=elem.currentStyle[_492]; | |
| 3936 | +} | |
| 3937 | +} | |
| 3938 | +} | |
| 3939 | +if(_492=="opacity"){ | |
| 3940 | +_494=parseFloat(_494); | |
| 3941 | +} | |
| 3942 | +if(/Opera/.test(navigator.userAgent)&&(MochiKit.Base.find(["left","top","right","bottom"],_492)!=-1)){ | |
| 3943 | +if(MochiKit.Style.getStyle(elem,"position")=="static"){ | |
| 3944 | +_494="auto"; | |
| 3945 | +} | |
| 3946 | +} | |
| 3947 | +return _494=="auto"?null:_494; | |
| 3948 | +},setStyle:function(elem,_496){ | |
| 3949 | +elem=MochiKit.DOM.getElement(elem); | |
| 3950 | +for(name in _496){ | |
| 3951 | +if(name=="opacity"){ | |
| 3952 | +MochiKit.Style.setOpacity(elem,_496[name]); | |
| 3953 | +}else{ | |
| 3954 | +elem.style[MochiKit.Base.camelize(name)]=_496[name]; | |
| 3955 | +} | |
| 3956 | +} | |
| 3957 | +},setOpacity:function(elem,o){ | |
| 3958 | +elem=MochiKit.DOM.getElement(elem); | |
| 3959 | +var self=MochiKit.Style; | |
| 3960 | +if(o==1){ | |
| 3961 | +var _497=/Gecko/.test(navigator.userAgent)&&!(/Konqueror|Safari|KHTML/.test(navigator.userAgent)); | |
| 3962 | +elem.style[name]=_497?0.999999:1; | |
| 3963 | +if(/MSIE/.test(navigator.userAgent)){ | |
| 3964 | +elem.style["filter"]=self.getStyle(elem,"filter").replace(/alpha\([^\)]*\)/gi,""); | |
| 3965 | +} | |
| 3966 | +}else{ | |
| 3967 | +if(o<0.00001){ | |
| 3968 | +o=0; | |
| 3969 | +} | |
| 3970 | +elem.style[name]=o; | |
| 3971 | +if(/MSIE/.test(navigator.userAgent)){ | |
| 3972 | +elem.style["filter"]=self.getStyle(elem,"filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+o*100+")"; | |
| 3973 | +} | |
| 3974 | +} | |
| 3975 | +},getElementPosition:function(elem,_498){ | |
| 3976 | +var self=MochiKit.Style; | |
| 3977 | +var dom=MochiKit.DOM; | |
| 3978 | +elem=dom.getElement(elem); | |
| 3979 | +if(!elem||(!(elem.x&&elem.y)&&(!elem.parentNode==null||self.getStyle(elem,"display")=="none"))){ | |
| 3980 | +return undefined; | |
| 3981 | +} | |
| 3982 | +var c=new self.Coordinates(0,0); | |
| 3983 | +var box=null; | |
| 3984 | +var _501=null; | |
| 3985 | +var d=MochiKit.DOM._document; | |
| 3986 | +var de=d.documentElement; | |
| 3987 | +var b=d.body; | |
| 3988 | +if(!elem.parentNode&&elem.x&&elem.y){ | |
| 3989 | +c.x+=elem.x||0; | |
| 3990 | +c.y+=elem.y||0; | |
| 3991 | +}else{ | |
| 3992 | +if(elem.getBoundingClientRect){ | |
| 3993 | +box=elem.getBoundingClientRect(); | |
| 3994 | +c.x+=box.left+(de.scrollLeft||b.scrollLeft)-(de.clientLeft||0); | |
| 3995 | +c.y+=box.top+(de.scrollTop||b.scrollTop)-(de.clientTop||0); | |
| 3996 | +}else{ | |
| 3997 | +if(elem.offsetParent){ | |
| 3998 | +c.x+=elem.offsetLeft; | |
| 3999 | +c.y+=elem.offsetTop; | |
| 4000 | +_501=elem.offsetParent; | |
| 4001 | +if(_501!=elem){ | |
| 4002 | +while(_501){ | |
| 4003 | +c.x+=_501.offsetLeft; | |
| 4004 | +c.y+=_501.offsetTop; | |
| 4005 | +_501=_501.offsetParent; | |
| 4006 | +} | |
| 4007 | +} | |
| 4008 | +var ua=navigator.userAgent.toLowerCase(); | |
| 4009 | +if((typeof (opera)!="undefined"&&parseFloat(opera.version())<9)||(ua.indexOf("safari")!=-1&&self.getStyle(elem,"position")=="absolute")){ | |
| 4010 | +c.x-=b.offsetLeft; | |
| 4011 | +c.y-=b.offsetTop; | |
| 4012 | +} | |
| 4013 | +} | |
| 4014 | +} | |
| 4015 | +} | |
| 4016 | +if(typeof (_498)!="undefined"){ | |
| 4017 | +_498=arguments.callee(_498); | |
| 4018 | +if(_498){ | |
| 4019 | +c.x-=(_498.x||0); | |
| 4020 | +c.y-=(_498.y||0); | |
| 4021 | +} | |
| 4022 | +} | |
| 4023 | +if(elem.parentNode){ | |
| 4024 | +_501=elem.parentNode; | |
| 4025 | +}else{ | |
| 4026 | +_501=null; | |
| 4027 | +} | |
| 4028 | +while(_501){ | |
| 4029 | +var _504=_501.tagName.toUpperCase(); | |
| 4030 | +if(_504==="BODY"||_504==="HTML"){ | |
| 4031 | +break; | |
| 4032 | +} | |
| 4033 | +c.x-=_501.scrollLeft; | |
| 4034 | +c.y-=_501.scrollTop; | |
| 4035 | +if(_501.parentNode){ | |
| 4036 | +_501=_501.parentNode; | |
| 4037 | +}else{ | |
| 4038 | +_501=null; | |
| 4039 | +} | |
| 4040 | +} | |
| 4041 | +return c; | |
| 4042 | +},setElementPosition:function(elem,_505,_506){ | |
| 4043 | +elem=MochiKit.DOM.getElement(elem); | |
| 4044 | +if(typeof (_506)=="undefined"){ | |
| 4045 | +_506="px"; | |
| 4046 | +} | |
| 4047 | +var _507={}; | |
| 4048 | +var _508=MochiKit.Base.isUndefinedOrNull; | |
| 4049 | +if(!_508(_505.x)){ | |
| 4050 | +_507["left"]=_505.x+_506; | |
| 4051 | +} | |
| 4052 | +if(!_508(_505.y)){ | |
| 4053 | +_507["top"]=_505.y+_506; | |
| 4054 | +} | |
| 4055 | +MochiKit.DOM.updateNodeAttributes(elem,{"style":_507}); | |
| 4056 | +},getElementDimensions:function(elem){ | |
| 4057 | +var self=MochiKit.Style; | |
| 4058 | +var dom=MochiKit.DOM; | |
| 4059 | +if(typeof (elem.w)=="number"||typeof (elem.h)=="number"){ | |
| 4060 | +return new self.Dimensions(elem.w||0,elem.h||0); | |
| 4061 | +} | |
| 4062 | +elem=dom.getElement(elem); | |
| 4063 | +if(!elem){ | |
| 4064 | +return undefined; | |
| 4065 | +} | |
| 4066 | +var disp=self.getStyle(elem,"display"); | |
| 4067 | +if(disp!="none"&&disp!=""&&typeof (disp)!="undefined"){ | |
| 4068 | +return new self.Dimensions(elem.offsetWidth||0,elem.offsetHeight||0); | |
| 4069 | +} | |
| 4070 | +var s=elem.style; | |
| 4071 | +var _510=s.visibility; | |
| 4072 | +var _511=s.position; | |
| 4073 | +s.visibility="hidden"; | |
| 4074 | +s.position="absolute"; | |
| 4075 | +s.display=""; | |
| 4076 | +var _512=elem.offsetWidth; | |
| 4077 | +var _513=elem.offsetHeight; | |
| 4078 | +s.display="none"; | |
| 4079 | +s.position=_511; | |
| 4080 | +s.visibility=_510; | |
| 4081 | +return new self.Dimensions(_512,_513); | |
| 4082 | +},setElementDimensions:function(elem,_514,_515){ | |
| 4083 | +elem=MochiKit.DOM.getElement(elem); | |
| 4084 | +if(typeof (_515)=="undefined"){ | |
| 4085 | +_515="px"; | |
| 4086 | +} | |
| 4087 | +var _516={}; | |
| 4088 | +var _517=MochiKit.Base.isUndefinedOrNull; | |
| 4089 | +if(!_517(_514.w)){ | |
| 4090 | +_516["width"]=_514.w+_515; | |
| 4091 | +} | |
| 4092 | +if(!_517(_514.h)){ | |
| 4093 | +_516["height"]=_514.h+_515; | |
| 4094 | +} | |
| 4095 | +MochiKit.DOM.updateNodeAttributes(elem,{"style":_516}); | |
| 4096 | +},setDisplayForElement:function(_518,_519){ | |
| 4097 | +var _520=MochiKit.Base.extend(null,arguments,1); | |
| 4098 | +var _521=MochiKit.DOM.getElement; | |
| 4099 | +for(var i=0;i<_520.length;i++){ | |
| 4100 | +var _519=_521(_520[i]); | |
| 4101 | +if(_519){ | |
| 4102 | +_519.style.display=_518; | |
| 4103 | +} | |
| 4104 | +} | |
| 4105 | +},getViewportDimensions:function(){ | |
| 4106 | +var d=new MochiKit.Style.Dimensions(); | |
| 4107 | +var w=MochiKit.DOM._window; | |
| 4108 | +var b=MochiKit.DOM._document.body; | |
| 4109 | +if(w.innerWidth){ | |
| 4110 | +d.w=w.innerWidth; | |
| 4111 | +d.h=w.innerHeight; | |
| 4112 | +}else{ | |
| 4113 | +if(b.parentElement.clientWidth){ | |
| 4114 | +d.w=b.parentElement.clientWidth; | |
| 4115 | +d.h=b.parentElement.clientHeight; | |
| 4116 | +}else{ | |
| 4117 | +if(b&&b.clientWidth){ | |
| 4118 | +d.w=b.clientWidth; | |
| 4119 | +d.h=b.clientHeight; | |
| 4120 | +} | |
| 4121 | +} | |
| 4122 | +} | |
| 4123 | +return d; | |
| 4124 | +},getViewportPosition:function(){ | |
| 4125 | +var c=new MochiKit.Style.Coordinates(0,0); | |
| 4126 | +var d=MochiKit.DOM._document; | |
| 4127 | +var de=d.documentElement; | |
| 4128 | +var db=d.body; | |
| 4129 | +if(de&&(de.scrollTop||de.scrollLeft)){ | |
| 4130 | +c.x=de.scrollLeft; | |
| 4131 | +c.y=de.scrollTop; | |
| 4132 | +}else{ | |
| 4133 | +if(db){ | |
| 4134 | +c.x=db.scrollLeft; | |
| 4135 | +c.y=db.scrollTop; | |
| 4136 | +} | |
| 4137 | +} | |
| 4138 | +return c; | |
| 4139 | +},__new__:function(){ | |
| 4140 | +var m=MochiKit.Base; | |
| 4141 | +this.elementPosition=this.getElementPosition; | |
| 4142 | +this.elementDimensions=this.getElementDimensions; | |
| 4143 | +this.hideElement=m.partial(this.setDisplayForElement,"none"); | |
| 4144 | +this.showElement=m.partial(this.setDisplayForElement,"block"); | |
| 4145 | +this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; | |
| 4146 | +m.nameFunctions(this); | |
| 4147 | +}}); | |
| 4148 | +MochiKit.Style.__new__(); | |
| 4149 | +MochiKit.Base._exportSymbols(this,MochiKit.Style); | |
| 4150 | +if(typeof (dojo)!="undefined"){ | |
| 4151 | +dojo.provide("MochiKit.LoggingPane"); | |
| 4152 | +dojo.require("MochiKit.Logging"); | |
| 4153 | +dojo.require("MochiKit.Base"); | |
| 4154 | +} | |
| 4155 | +if(typeof (JSAN)!="undefined"){ | |
| 4156 | +JSAN.use("MochiKit.Logging",[]); | |
| 4157 | +JSAN.use("MochiKit.Base",[]); | |
| 4158 | +} | |
| 4159 | +try{ | |
| 4160 | +if(typeof (MochiKit.Base)=="undefined"||typeof (MochiKit.Logging)=="undefined"){ | |
| 4161 | +throw ""; | |
| 4162 | +} | |
| 4163 | +} | |
| 4164 | +catch(e){ | |
| 4165 | +throw "MochiKit.LoggingPane depends on MochiKit.Base and MochiKit.Logging!"; | |
| 4166 | +} | |
| 4167 | +if(typeof (MochiKit.LoggingPane)=="undefined"){ | |
| 4168 | +MochiKit.LoggingPane={}; | |
| 4169 | +} | |
| 4170 | +MochiKit.LoggingPane.NAME="MochiKit.LoggingPane"; | |
| 4171 | +MochiKit.LoggingPane.VERSION="1.4"; | |
| 4172 | +MochiKit.LoggingPane.__repr__=function(){ | |
| 4173 | +return "["+this.NAME+" "+this.VERSION+"]"; | |
| 4174 | +}; | |
| 4175 | +MochiKit.LoggingPane.toString=function(){ | |
| 4176 | +return this.__repr__(); | |
| 4177 | +}; | |
| 4178 | +MochiKit.LoggingPane.createLoggingPane=function(_523){ | |
| 4179 | +var m=MochiKit.LoggingPane; | |
| 4180 | +_523=!(!_523); | |
| 4181 | +if(m._loggingPane&&m._loggingPane.inline!=_523){ | |
| 4182 | +m._loggingPane.closePane(); | |
| 4183 | +m._loggingPane=null; | |
| 4184 | +} | |
| 4185 | +if(!m._loggingPane||m._loggingPane.closed){ | |
| 4186 | +m._loggingPane=new m.LoggingPane(_523,MochiKit.Logging.logger); | |
| 4187 | +} | |
| 4188 | +return m._loggingPane; | |
| 4189 | +}; | |
| 4190 | +MochiKit.LoggingPane.LoggingPane=function(_524,_525){ | |
| 4191 | +if(typeof (_525)=="undefined"||_525===null){ | |
| 4192 | +_525=MochiKit.Logging.logger; | |
| 4193 | +} | |
| 4194 | +this.logger=_525; | |
| 4195 | +var _526=MochiKit.Base.update; | |
| 4196 | +var _527=MochiKit.Base.updatetree; | |
| 4197 | +var bind=MochiKit.Base.bind; | |
| 4198 | +var _528=MochiKit.Base.clone; | |
| 4199 | +var win=window; | |
| 4200 | +var uid="_MochiKit_LoggingPane"; | |
| 4201 | +if(typeof (MochiKit.DOM)!="undefined"){ | |
| 4202 | +win=MochiKit.DOM.currentWindow(); | |
| 4203 | +} | |
| 4204 | +if(!_524){ | |
| 4205 | +var url=win.location.href.split("?")[0].replace(/[#:\/.><&-]/g,"_"); | |
| 4206 | +var name=uid+"_"+url; | |
| 4207 | +var nwin=win.open("",name,"dependent,resizable,height=200"); | |
| 4208 | +if(!nwin){ | |
| 4209 | +alert("Not able to open debugging window due to pop-up blocking."); | |
| 4210 | +return undefined; | |
| 4211 | +} | |
| 4212 | +nwin.document.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" "+"\"http://www.w3.org/TR/html4/loose.dtd\">"+"<html><head><title>[MochiKit.LoggingPane]</title></head>"+"<body></body></html>"); | |
| 4213 | +nwin.document.close(); | |
| 4214 | +nwin.document.title+=" "+win.document.title; | |
| 4215 | +win=nwin; | |
| 4216 | +} | |
| 4217 | +var doc=win.document; | |
| 4218 | +this.doc=doc; | |
| 4219 | +var _531=doc.getElementById(uid); | |
| 4220 | +var _532=!!_531; | |
| 4221 | +if(_531&&typeof (_531.loggingPane)!="undefined"){ | |
| 4222 | +_531.loggingPane.logger=this.logger; | |
| 4223 | +_531.loggingPane.buildAndApplyFilter(); | |
| 4224 | +return _531.loggingPane; | |
| 4225 | +} | |
| 4226 | +if(_532){ | |
| 4227 | +var _533; | |
| 4228 | +while((_533=_531.firstChild)){ | |
| 4229 | +_531.removeChild(_533); | |
| 4230 | +} | |
| 4231 | +}else{ | |
| 4232 | +_531=doc.createElement("div"); | |
| 4233 | +_531.id=uid; | |
| 4234 | +} | |
| 4235 | +_531.loggingPane=this; | |
| 4236 | +var _534=doc.createElement("input"); | |
| 4237 | +var _535=doc.createElement("input"); | |
| 4238 | +var _536=doc.createElement("button"); | |
| 4239 | +var _537=doc.createElement("button"); | |
| 4240 | +var _538=doc.createElement("button"); | |
| 4241 | +var _539=doc.createElement("button"); | |
| 4242 | +var _540=doc.createElement("div"); | |
| 4243 | +var _541=doc.createElement("div"); | |
| 4244 | +var _542=uid+"_Listener"; | |
| 4245 | +this.colorTable=_528(this.colorTable); | |
| 4246 | +var _543=[]; | |
| 4247 | +var _544=null; | |
| 4248 | +var _545=function(msg){ | |
| 4249 | +var _546=msg.level; | |
| 4250 | +if(typeof (_546)=="number"){ | |
| 4251 | +_546=MochiKit.Logging.LogLevel[_546]; | |
| 4252 | +} | |
| 4253 | +return _546; | |
| 4254 | +}; | |
| 4255 | +var _547=function(msg){ | |
| 4256 | +return msg.info.join(" "); | |
| 4257 | +}; | |
| 4258 | +var _548=bind(function(msg){ | |
| 4259 | +var _549=_545(msg); | |
| 4260 | +var text=_547(msg); | |
| 4261 | +var c=this.colorTable[_549]; | |
| 4262 | +var p=doc.createElement("span"); | |
| 4263 | +p.className="MochiKit-LogMessage MochiKit-LogLevel-"+_549; | |
| 4264 | +p.style.cssText="margin: 0px; white-space: -moz-pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; white-space: pre-line; word-wrap: break-word; wrap-option: emergency; color: "+c; | |
| 4265 | +p.appendChild(doc.createTextNode(_549+": "+text)); | |
| 4266 | +_541.appendChild(p); | |
| 4267 | +_541.appendChild(doc.createElement("br")); | |
| 4268 | +if(_540.offsetHeight>_540.scrollHeight){ | |
| 4269 | +_540.scrollTop=0; | |
| 4270 | +}else{ | |
| 4271 | +_540.scrollTop=_540.scrollHeight; | |
| 4272 | +} | |
| 4273 | +},this); | |
| 4274 | +var _551=function(msg){ | |
| 4275 | +_543[_543.length]=msg; | |
| 4276 | +_548(msg); | |
| 4277 | +}; | |
| 4278 | +var _552=function(){ | |
| 4279 | +var _553,infore; | |
| 4280 | +try{ | |
| 4281 | +_553=new RegExp(_534.value); | |
| 4282 | +infore=new RegExp(_535.value); | |
| 4283 | +} | |
| 4284 | +catch(e){ | |
| 4285 | +logDebug("Error in filter regex: "+e.message); | |
| 4286 | +return null; | |
| 4287 | +} | |
| 4288 | +return function(msg){ | |
| 4289 | +return (_553.test(_545(msg))&&infore.test(_547(msg))); | |
| 4290 | +}; | |
| 4291 | +}; | |
| 4292 | +var _554=function(){ | |
| 4293 | +while(_541.firstChild){ | |
| 4294 | +_541.removeChild(_541.firstChild); | |
| 4295 | +} | |
| 4296 | +}; | |
| 4297 | +var _555=function(){ | |
| 4298 | +_543=[]; | |
| 4299 | +_554(); | |
| 4300 | +}; | |
| 4301 | +var _556=bind(function(){ | |
| 4302 | +if(this.closed){ | |
| 4303 | +return; | |
| 4304 | +} | |
| 4305 | +this.closed=true; | |
| 4306 | +if(MochiKit.LoggingPane._loggingPane==this){ | |
| 4307 | +MochiKit.LoggingPane._loggingPane=null; | |
| 4308 | +} | |
| 4309 | +this.logger.removeListener(_542); | |
| 4310 | +try{ | |
| 4311 | +try{ | |
| 4312 | +_531.loggingPane=null; | |
| 4313 | +} | |
| 4314 | +catch(e){ | |
| 4315 | +logFatal("Bookmarklet was closed incorrectly."); | |
| 4316 | +} | |
| 4317 | +if(_524){ | |
| 4318 | +_531.parentNode.removeChild(_531); | |
| 4319 | +}else{ | |
| 4320 | +this.win.close(); | |
| 4321 | +} | |
| 4322 | +} | |
| 4323 | +catch(e){ | |
| 4324 | +} | |
| 4325 | +},this); | |
| 4326 | +var _557=function(){ | |
| 4327 | +_554(); | |
| 4328 | +for(var i=0;i<_543.length;i++){ | |
| 4329 | +var msg=_543[i]; | |
| 4330 | +if(_544===null||_544(msg)){ | |
| 4331 | +_548(msg); | |
| 4332 | +} | |
| 4333 | +} | |
| 4334 | +}; | |
| 4335 | +this.buildAndApplyFilter=function(){ | |
| 4336 | +_544=_552(); | |
| 4337 | +_557(); | |
| 4338 | +this.logger.removeListener(_542); | |
| 4339 | +this.logger.addListener(_542,_544,_551); | |
| 4340 | +}; | |
| 4341 | +var _558=bind(function(){ | |
| 4342 | +_543=this.logger.getMessages(); | |
| 4343 | +_557(); | |
| 4344 | +},this); | |
| 4345 | +var _559=bind(function(_560){ | |
| 4346 | +_560=_560||window.event; | |
| 4347 | +key=_560.which||_560.keyCode; | |
| 4348 | +if(key==13){ | |
| 4349 | +this.buildAndApplyFilter(); | |
| 4350 | +} | |
| 4351 | +},this); | |
| 4352 | +var _561="display: block; z-index: 1000; left: 0px; bottom: 0px; position: fixed; width: 100%; background-color: white; font: "+this.logFont; | |
| 4353 | +if(_524){ | |
| 4354 | +_561+="; height: 10em; border-top: 2px solid black"; | |
| 4355 | +}else{ | |
| 4356 | +_561+="; height: 100%;"; | |
| 4357 | +} | |
| 4358 | +_531.style.cssText=_561; | |
| 4359 | +if(!_532){ | |
| 4360 | +doc.body.appendChild(_531); | |
| 4361 | +} | |
| 4362 | +_561={"cssText":"width: 33%; display: inline; font: "+this.logFont}; | |
| 4363 | +_527(_534,{"value":"FATAL|ERROR|WARNING|INFO|DEBUG","onkeypress":_559,"style":_561}); | |
| 4364 | +_531.appendChild(_534); | |
| 4365 | +_527(_535,{"value":".*","onkeypress":_559,"style":_561}); | |
| 4366 | +_531.appendChild(_535); | |
| 4367 | +_561="width: 8%; display:inline; font: "+this.logFont; | |
| 4368 | +_536.appendChild(doc.createTextNode("Filter")); | |
| 4369 | +_536.onclick=bind("buildAndApplyFilter",this); | |
| 4370 | +_536.style.cssText=_561; | |
| 4371 | +_531.appendChild(_536); | |
| 4372 | +_537.appendChild(doc.createTextNode("Load")); | |
| 4373 | +_537.onclick=_558; | |
| 4374 | +_537.style.cssText=_561; | |
| 4375 | +_531.appendChild(_537); | |
| 4376 | +_538.appendChild(doc.createTextNode("Clear")); | |
| 4377 | +_538.onclick=_555; | |
| 4378 | +_538.style.cssText=_561; | |
| 4379 | +_531.appendChild(_538); | |
| 4380 | +_539.appendChild(doc.createTextNode("Close")); | |
| 4381 | +_539.onclick=_556; | |
| 4382 | +_539.style.cssText=_561; | |
| 4383 | +_531.appendChild(_539); | |
| 4384 | +_540.style.cssText="overflow: auto; width: 100%"; | |
| 4385 | +_541.style.cssText="width: 100%; height: "+(_524?"8em":"100%"); | |
| 4386 | +_540.appendChild(_541); | |
| 4387 | +_531.appendChild(_540); | |
| 4388 | +this.buildAndApplyFilter(); | |
| 4389 | +_558(); | |
| 4390 | +if(_524){ | |
| 4391 | +this.win=undefined; | |
| 4392 | +}else{ | |
| 4393 | +this.win=win; | |
| 4394 | +} | |
| 4395 | +this.inline=_524; | |
| 4396 | +this.closePane=_556; | |
| 4397 | +this.closed=false; | |
| 4398 | +return this; | |
| 4399 | +}; | |
| 4400 | +MochiKit.LoggingPane.LoggingPane.prototype={"logFont":"8pt Verdana,sans-serif","colorTable":{"ERROR":"red","FATAL":"darkred","WARNING":"blue","INFO":"black","DEBUG":"green"}}; | |
| 4401 | +MochiKit.LoggingPane.EXPORT_OK=["LoggingPane"]; | |
| 4402 | +MochiKit.LoggingPane.EXPORT=["createLoggingPane"]; | |
| 4403 | +MochiKit.LoggingPane.__new__=function(){ | |
| 4404 | +this.EXPORT_TAGS={":common":this.EXPORT,":all":MochiKit.Base.concat(this.EXPORT,this.EXPORT_OK)}; | |
| 4405 | +MochiKit.Base.nameFunctions(this); | |
| 4406 | +MochiKit.LoggingPane._loggingPane=null; | |
| 4407 | +}; | |
| 4408 | +MochiKit.LoggingPane.__new__(); | |
| 4409 | +MochiKit.Base._exportSymbols(this,MochiKit.LoggingPane); | |
| 4410 | +if(typeof (dojo)!="undefined"){ | |
| 4411 | +dojo.provide("MochiKit.Color"); | |
| 4412 | +dojo.require("MochiKit.Base"); | |
| 4413 | +dojo.require("MochiKit.DOM"); | |
| 4414 | +dojo.require("MochiKit.Style"); | |
| 4415 | +} | |
| 4416 | +if(typeof (JSAN)!="undefined"){ | |
| 4417 | +JSAN.use("MochiKit.Base",[]); | |
| 4418 | +JSAN.use("MochiKit.DOM",[]); | |
| 4419 | +JSAN.use("MochiKit.Style",[]); | |
| 4420 | +} | |
| 4421 | +try{ | |
| 4422 | +if(typeof (MochiKit.Base)=="undefined"){ | |
| 4423 | +throw ""; | |
| 4424 | +} | |
| 4425 | +} | |
| 4426 | +catch(e){ | |
| 4427 | +throw "MochiKit.Color depends on MochiKit.Base"; | |
| 4428 | +} | |
| 4429 | +try{ | |
| 4430 | +if(typeof (MochiKit.Base)=="undefined"){ | |
| 4431 | +throw ""; | |
| 4432 | +} | |
| 4433 | +} | |
| 4434 | +catch(e){ | |
| 4435 | +throw "MochiKit.Color depends on MochiKit.DOM"; | |
| 4436 | +} | |
| 4437 | +try{ | |
| 4438 | +if(typeof (MochiKit.Base)=="undefined"){ | |
| 4439 | +throw ""; | |
| 4440 | +} | |
| 4441 | +} | |
| 4442 | +catch(e){ | |
| 4443 | +throw "MochiKit.Color depends on MochiKit.Style"; | |
| 4444 | +} | |
| 4445 | +if(typeof (MochiKit.Color)=="undefined"){ | |
| 4446 | +MochiKit.Color={}; | |
| 4447 | +} | |
| 4448 | +MochiKit.Color.NAME="MochiKit.Color"; | |
| 4449 | +MochiKit.Color.VERSION="1.4"; | |
| 4450 | +MochiKit.Color.__repr__=function(){ | |
| 4451 | +return "["+this.NAME+" "+this.VERSION+"]"; | |
| 4452 | +}; | |
| 4453 | +MochiKit.Color.toString=function(){ | |
| 4454 | +return this.__repr__(); | |
| 4455 | +}; | |
| 4456 | +MochiKit.Color.Color=function(red,_563,blue,_565){ | |
| 4457 | +if(typeof (_565)=="undefined"||_565===null){ | |
| 4458 | +_565=1; | |
| 4459 | +} | |
| 4460 | +this.rgb={r:red,g:_563,b:blue,a:_565}; | |
| 4461 | +}; | |
| 4462 | +MochiKit.Color.Color.prototype={__class__:MochiKit.Color.Color,colorWithAlpha:function(_566){ | |
| 4463 | +var rgb=this.rgb; | |
| 4464 | +var m=MochiKit.Color; | |
| 4465 | +return m.Color.fromRGB(rgb.r,rgb.g,rgb.b,_566); | |
| 4466 | +},colorWithHue:function(hue){ | |
| 4467 | +var hsl=this.asHSL(); | |
| 4468 | +hsl.h=hue; | |
| 4469 | +var m=MochiKit.Color; | |
| 4470 | +return m.Color.fromHSL(hsl); | |
| 4471 | +},colorWithSaturation:function(_570){ | |
| 4472 | +var hsl=this.asHSL(); | |
| 4473 | +hsl.s=_570; | |
| 4474 | +var m=MochiKit.Color; | |
| 4475 | +return m.Color.fromHSL(hsl); | |
| 4476 | +},colorWithLightness:function(_571){ | |
| 4477 | +var hsl=this.asHSL(); | |
| 4478 | +hsl.l=_571; | |
| 4479 | +var m=MochiKit.Color; | |
| 4480 | +return m.Color.fromHSL(hsl); | |
| 4481 | +},darkerColorWithLevel:function(_572){ | |
| 4482 | +var hsl=this.asHSL(); | |
| 4483 | +hsl.l=Math.max(hsl.l-_572,0); | |
| 4484 | +var m=MochiKit.Color; | |
| 4485 | +return m.Color.fromHSL(hsl); | |
| 4486 | +},lighterColorWithLevel:function(_573){ | |
| 4487 | +var hsl=this.asHSL(); | |
| 4488 | +hsl.l=Math.min(hsl.l+_573,1); | |
| 4489 | +var m=MochiKit.Color; | |
| 4490 | +return m.Color.fromHSL(hsl); | |
| 4491 | +},blendedColor:function(_574,_575){ | |
| 4492 | +if(typeof (_575)=="undefined"||_575===null){ | |
| 4493 | +_575=0.5; | |
| 4494 | +} | |
| 4495 | +var sf=1-_575; | |
| 4496 | +var s=this.rgb; | |
| 4497 | +var d=_574.rgb; | |
| 4498 | +var df=_575; | |
| 4499 | +return MochiKit.Color.Color.fromRGB((s.r*sf)+(d.r*df),(s.g*sf)+(d.g*df),(s.b*sf)+(d.b*df),(s.a*sf)+(d.a*df)); | |
| 4500 | +},compareRGB:function(_578){ | |
| 4501 | +var a=this.asRGB(); | |
| 4502 | +var b=_578.asRGB(); | |
| 4503 | +return MochiKit.Base.compare([a.r,a.g,a.b,a.a],[b.r,b.g,b.b,b.a]); | |
| 4504 | +},isLight:function(){ | |
| 4505 | +return this.asHSL().b>0.5; | |
| 4506 | +},isDark:function(){ | |
| 4507 | +return (!this.isLight()); | |
| 4508 | +},toHSLString:function(){ | |
| 4509 | +var c=this.asHSL(); | |
| 4510 | +var ccc=MochiKit.Color.clampColorComponent; | |
| 4511 | +var rval=this._hslString; | |
| 4512 | +if(!rval){ | |
| 4513 | +var mid=(ccc(c.h,360).toFixed(0)+","+ccc(c.s,100).toPrecision(4)+"%"+","+ccc(c.l,100).toPrecision(4)+"%"); | |
| 4514 | +var a=c.a; | |
| 4515 | +if(a>=1){ | |
| 4516 | +a=1; | |
| 4517 | +rval="hsl("+mid+")"; | |
| 4518 | +}else{ | |
| 4519 | +if(a<=0){ | |
| 4520 | +a=0; | |
| 4521 | +} | |
| 4522 | +rval="hsla("+mid+","+a+")"; | |
| 4523 | +} | |
| 4524 | +this._hslString=rval; | |
| 4525 | +} | |
| 4526 | +return rval; | |
| 4527 | +},toRGBString:function(){ | |
| 4528 | +var c=this.rgb; | |
| 4529 | +var ccc=MochiKit.Color.clampColorComponent; | |
| 4530 | +var rval=this._rgbString; | |
| 4531 | +if(!rval){ | |
| 4532 | +var mid=(ccc(c.r,255).toFixed(0)+","+ccc(c.g,255).toFixed(0)+","+ccc(c.b,255).toFixed(0)); | |
| 4533 | +if(c.a!=1){ | |
| 4534 | +rval="rgba("+mid+","+c.a+")"; | |
| 4535 | +}else{ | |
| 4536 | +rval="rgb("+mid+")"; | |
| 4537 | +} | |
| 4538 | +this._rgbString=rval; | |
| 4539 | +} | |
| 4540 | +return rval; | |
| 4541 | +},asRGB:function(){ | |
| 4542 | +return MochiKit.Base.clone(this.rgb); | |
| 4543 | +},toHexString:function(){ | |
| 4544 | +var m=MochiKit.Color; | |
| 4545 | +var c=this.rgb; | |
| 4546 | +var ccc=MochiKit.Color.clampColorComponent; | |
| 4547 | +var rval=this._hexString; | |
| 4548 | +if(!rval){ | |
| 4549 | +rval=("#"+m.toColorPart(ccc(c.r,255))+m.toColorPart(ccc(c.g,255))+m.toColorPart(ccc(c.b,255))); | |
| 4550 | +this._hexString=rval; | |
| 4551 | +} | |
| 4552 | +return rval; | |
| 4553 | +},asHSV:function(){ | |
| 4554 | +var hsv=this.hsv; | |
| 4555 | +var c=this.rgb; | |
| 4556 | +if(typeof (hsv)=="undefined"||hsv===null){ | |
| 4557 | +hsv=MochiKit.Color.rgbToHSV(this.rgb); | |
| 4558 | +this.hsv=hsv; | |
| 4559 | +} | |
| 4560 | +return MochiKit.Base.clone(hsv); | |
| 4561 | +},asHSL:function(){ | |
| 4562 | +var hsl=this.hsl; | |
| 4563 | +var c=this.rgb; | |
| 4564 | +if(typeof (hsl)=="undefined"||hsl===null){ | |
| 4565 | +hsl=MochiKit.Color.rgbToHSL(this.rgb); | |
| 4566 | +this.hsl=hsl; | |
| 4567 | +} | |
| 4568 | +return MochiKit.Base.clone(hsl); | |
| 4569 | +},toString:function(){ | |
| 4570 | +return this.toRGBString(); | |
| 4571 | +},repr:function(){ | |
| 4572 | +var c=this.rgb; | |
| 4573 | +var col=[c.r,c.g,c.b,c.a]; | |
| 4574 | +return this.__class__.NAME+"("+col.join(", ")+")"; | |
| 4575 | +}}; | |
| 4576 | +MochiKit.Base.update(MochiKit.Color.Color,{fromRGB:function(red,_583,blue,_584){ | |
| 4577 | +var _585=MochiKit.Color.Color; | |
| 4578 | +if(arguments.length==1){ | |
| 4579 | +var rgb=red; | |
| 4580 | +red=rgb.r; | |
| 4581 | +_583=rgb.g; | |
| 4582 | +blue=rgb.b; | |
| 4583 | +if(typeof (rgb.a)=="undefined"){ | |
| 4584 | +_584=undefined; | |
| 4585 | +}else{ | |
| 4586 | +_584=rgb.a; | |
| 4587 | +} | |
| 4588 | +} | |
| 4589 | +return new _585(red,_583,blue,_584); | |
| 4590 | +},fromHSL:function(hue,_586,_587,_588){ | |
| 4591 | +var m=MochiKit.Color; | |
| 4592 | +return m.Color.fromRGB(m.hslToRGB.apply(m,arguments)); | |
| 4593 | +},fromHSV:function(hue,_589,_590,_591){ | |
| 4594 | +var m=MochiKit.Color; | |
| 4595 | +return m.Color.fromRGB(m.hsvToRGB.apply(m,arguments)); | |
| 4596 | +},fromName:function(name){ | |
| 4597 | +var _592=MochiKit.Color.Color; | |
| 4598 | +if(name.charAt(0)=="\""){ | |
| 4599 | +name=name.substr(1,name.length-2); | |
| 4600 | +} | |
| 4601 | +var _593=_592._namedColors[name.toLowerCase()]; | |
| 4602 | +if(typeof (_593)=="string"){ | |
| 4603 | +return _592.fromHexString(_593); | |
| 4604 | +}else{ | |
| 4605 | +if(name=="transparent"){ | |
| 4606 | +return _592.transparentColor(); | |
| 4607 | +} | |
| 4608 | +} | |
| 4609 | +return null; | |
| 4610 | +},fromString:function(_594){ | |
| 4611 | +var self=MochiKit.Color.Color; | |
| 4612 | +var _595=_594.substr(0,3); | |
| 4613 | +if(_595=="rgb"){ | |
| 4614 | +return self.fromRGBString(_594); | |
| 4615 | +}else{ | |
| 4616 | +if(_595=="hsl"){ | |
| 4617 | +return self.fromHSLString(_594); | |
| 4618 | +}else{ | |
| 4619 | +if(_594.charAt(0)=="#"){ | |
| 4620 | +return self.fromHexString(_594); | |
| 4621 | +} | |
| 4622 | +} | |
| 4623 | +} | |
| 4624 | +return self.fromName(_594); | |
| 4625 | +},fromHexString:function(_596){ | |
| 4626 | +if(_596.charAt(0)=="#"){ | |
| 4627 | +_596=_596.substring(1); | |
| 4628 | +} | |
| 4629 | +var _597=[]; | |
| 4630 | +var i,hex; | |
| 4631 | +if(_596.length==3){ | |
| 4632 | +for(i=0;i<3;i++){ | |
| 4633 | +hex=_596.substr(i,1); | |
| 4634 | +_597.push(parseInt(hex+hex,16)/255); | |
| 4635 | +} | |
| 4636 | +}else{ | |
| 4637 | +for(i=0;i<6;i+=2){ | |
| 4638 | +hex=_596.substr(i,2); | |
| 4639 | +_597.push(parseInt(hex,16)/255); | |
| 4640 | +} | |
| 4641 | +} | |
| 4642 | +var _598=MochiKit.Color.Color; | |
| 4643 | +return _598.fromRGB.apply(_598,_597); | |
| 4644 | +},_fromColorString:function(pre,_600,_601,_602){ | |
| 4645 | +if(_602.indexOf(pre)===0){ | |
| 4646 | +_602=_602.substring(_602.indexOf("(",3)+1,_602.length-1); | |
| 4647 | +} | |
| 4648 | +var _603=_602.split(/\s*,\s*/); | |
| 4649 | +var _604=[]; | |
| 4650 | +for(var i=0;i<_603.length;i++){ | |
| 4651 | +var c=_603[i]; | |
| 4652 | +var val; | |
| 4653 | +var _605=c.substring(c.length-3); | |
| 4654 | +if(c.charAt(c.length-1)=="%"){ | |
| 4655 | +val=0.01*parseFloat(c.substring(0,c.length-1)); | |
| 4656 | +}else{ | |
| 4657 | +if(_605=="deg"){ | |
| 4658 | +val=parseFloat(c)/360; | |
| 4659 | +}else{ | |
| 4660 | +if(_605=="rad"){ | |
| 4661 | +val=parseFloat(c)/(Math.PI*2); | |
| 4662 | +}else{ | |
| 4663 | +val=_601[i]*parseFloat(c); | |
| 4664 | +} | |
| 4665 | +} | |
| 4666 | +} | |
| 4667 | +_604.push(val); | |
| 4668 | +} | |
| 4669 | +return this[_600].apply(this,_604); | |
| 4670 | +},fromComputedStyle:function(elem,_606){ | |
| 4671 | +var d=MochiKit.DOM; | |
| 4672 | +var cls=MochiKit.Color.Color; | |
| 4673 | +for(elem=d.getElement(elem);elem;elem=elem.parentNode){ | |
| 4674 | +var _607=MochiKit.Style.getStyle.apply(d,arguments); | |
| 4675 | +if(!_607){ | |
| 4676 | +continue; | |
| 4677 | +} | |
| 4678 | +var _608=cls.fromString(_607); | |
| 4679 | +if(!_608){ | |
| 4680 | +break; | |
| 4681 | +} | |
| 4682 | +if(_608.asRGB().a>0){ | |
| 4683 | +return _608; | |
| 4684 | +} | |
| 4685 | +} | |
| 4686 | +return null; | |
| 4687 | +},fromBackground:function(elem){ | |
| 4688 | +var cls=MochiKit.Color.Color; | |
| 4689 | +return cls.fromComputedStyle(elem,"backgroundColor","background-color")||cls.whiteColor(); | |
| 4690 | +},fromText:function(elem){ | |
| 4691 | +var cls=MochiKit.Color.Color; | |
| 4692 | +return cls.fromComputedStyle(elem,"color","color")||cls.blackColor(); | |
| 4693 | +},namedColors:function(){ | |
| 4694 | +return MochiKit.Base.clone(MochiKit.Color.Color._namedColors); | |
| 4695 | +}}); | |
| 4696 | +MochiKit.Base.update(MochiKit.Color,{clampColorComponent:function(v,_609){ | |
| 4697 | +v*=_609; | |
| 4698 | +if(v<0){ | |
| 4699 | +return 0; | |
| 4700 | +}else{ | |
| 4701 | +if(v>_609){ | |
| 4702 | +return _609; | |
| 4703 | +}else{ | |
| 4704 | +return v; | |
| 4705 | +} | |
| 4706 | +} | |
| 4707 | +},_hslValue:function(n1,n2,hue){ | |
| 4708 | +if(hue>6){ | |
| 4709 | +hue-=6; | |
| 4710 | +}else{ | |
| 4711 | +if(hue<0){ | |
| 4712 | +hue+=6; | |
| 4713 | +} | |
| 4714 | +} | |
| 4715 | +var val; | |
| 4716 | +if(hue<1){ | |
| 4717 | +val=n1+(n2-n1)*hue; | |
| 4718 | +}else{ | |
| 4719 | +if(hue<3){ | |
| 4720 | +val=n2; | |
| 4721 | +}else{ | |
| 4722 | +if(hue<4){ | |
| 4723 | +val=n1+(n2-n1)*(4-hue); | |
| 4724 | +}else{ | |
| 4725 | +val=n1; | |
| 4726 | +} | |
| 4727 | +} | |
| 4728 | +} | |
| 4729 | +return val; | |
| 4730 | +},hsvToRGB:function(hue,_612,_613,_614){ | |
| 4731 | +if(arguments.length==1){ | |
| 4732 | +var hsv=hue; | |
| 4733 | +hue=hsv.h; | |
| 4734 | +_612=hsv.s; | |
| 4735 | +_613=hsv.v; | |
| 4736 | +_614=hsv.a; | |
| 4737 | +} | |
| 4738 | +var red; | |
| 4739 | +var _615; | |
| 4740 | +var blue; | |
| 4741 | +if(_612===0){ | |
| 4742 | +red=0; | |
| 4743 | +_615=0; | |
| 4744 | +blue=0; | |
| 4745 | +}else{ | |
| 4746 | +var i=Math.floor(hue*6); | |
| 4747 | +var f=(hue*6)-i; | |
| 4748 | +var p=_613*(1-_612); | |
| 4749 | +var q=_613*(1-(_612*f)); | |
| 4750 | +var t=_613*(1-(_612*(1-f))); | |
| 4751 | +switch(i){ | |
| 4752 | +case 1: | |
| 4753 | +red=q; | |
| 4754 | +_615=_613; | |
| 4755 | +blue=p; | |
| 4756 | +break; | |
| 4757 | +case 2: | |
| 4758 | +red=p; | |
| 4759 | +_615=_613; | |
| 4760 | +blue=t; | |
| 4761 | +break; | |
| 4762 | +case 3: | |
| 4763 | +red=p; | |
| 4764 | +_615=q; | |
| 4765 | +blue=_613; | |
| 4766 | +break; | |
| 4767 | +case 4: | |
| 4768 | +red=t; | |
| 4769 | +_615=p; | |
| 4770 | +blue=_613; | |
| 4771 | +break; | |
| 4772 | +case 5: | |
| 4773 | +red=_613; | |
| 4774 | +_615=p; | |
| 4775 | +blue=q; | |
| 4776 | +break; | |
| 4777 | +case 6: | |
| 4778 | +case 0: | |
| 4779 | +red=_613; | |
| 4780 | +_615=t; | |
| 4781 | +blue=p; | |
| 4782 | +break; | |
| 4783 | +} | |
| 4784 | +} | |
| 4785 | +return {r:red,g:_615,b:blue,a:_614}; | |
| 4786 | +},hslToRGB:function(hue,_617,_618,_619){ | |
| 4787 | +if(arguments.length==1){ | |
| 4788 | +var hsl=hue; | |
| 4789 | +hue=hsl.h; | |
| 4790 | +_617=hsl.s; | |
| 4791 | +_618=hsl.l; | |
| 4792 | +_619=hsl.a; | |
| 4793 | +} | |
| 4794 | +var red; | |
| 4795 | +var _620; | |
| 4796 | +var blue; | |
| 4797 | +if(_617===0){ | |
| 4798 | +red=_618; | |
| 4799 | +_620=_618; | |
| 4800 | +blue=_618; | |
| 4801 | +}else{ | |
| 4802 | +var m2; | |
| 4803 | +if(_618<=0.5){ | |
| 4804 | +m2=_618*(1+_617); | |
| 4805 | +}else{ | |
| 4806 | +m2=_618+_617-(_618*_617); | |
| 4807 | +} | |
| 4808 | +var m1=(2*_618)-m2; | |
| 4809 | +var f=MochiKit.Color._hslValue; | |
| 4810 | +var h6=hue*6; | |
| 4811 | +red=f(m1,m2,h6+2); | |
| 4812 | +_620=f(m1,m2,h6); | |
| 4813 | +blue=f(m1,m2,h6-2); | |
| 4814 | +} | |
| 4815 | +return {r:red,g:_620,b:blue,a:_619}; | |
| 4816 | +},rgbToHSV:function(red,_624,blue,_625){ | |
| 4817 | +if(arguments.length==1){ | |
| 4818 | +var rgb=red; | |
| 4819 | +red=rgb.r; | |
| 4820 | +_624=rgb.g; | |
| 4821 | +blue=rgb.b; | |
| 4822 | +_625=rgb.a; | |
| 4823 | +} | |
| 4824 | +var max=Math.max(Math.max(red,_624),blue); | |
| 4825 | +var min=Math.min(Math.min(red,_624),blue); | |
| 4826 | +var hue; | |
| 4827 | +var _628; | |
| 4828 | +var _629=max; | |
| 4829 | +if(min==max){ | |
| 4830 | +hue=0; | |
| 4831 | +_628=0; | |
| 4832 | +}else{ | |
| 4833 | +var _630=(max-min); | |
| 4834 | +_628=_630/max; | |
| 4835 | +if(red==max){ | |
| 4836 | +hue=(_624-blue)/_630; | |
| 4837 | +}else{ | |
| 4838 | +if(_624==max){ | |
| 4839 | +hue=2+((blue-red)/_630); | |
| 4840 | +}else{ | |
| 4841 | +hue=4+((red-_624)/_630); | |
| 4842 | +} | |
| 4843 | +} | |
| 4844 | +hue/=6; | |
| 4845 | +if(hue<0){ | |
| 4846 | +hue+=1; | |
| 4847 | +} | |
| 4848 | +if(hue>1){ | |
| 4849 | +hue-=1; | |
| 4850 | +} | |
| 4851 | +} | |
| 4852 | +return {h:hue,s:_628,v:_629,a:_625}; | |
| 4853 | +},rgbToHSL:function(red,_631,blue,_632){ | |
| 4854 | +if(arguments.length==1){ | |
| 4855 | +var rgb=red; | |
| 4856 | +red=rgb.r; | |
| 4857 | +_631=rgb.g; | |
| 4858 | +blue=rgb.b; | |
| 4859 | +_632=rgb.a; | |
| 4860 | +} | |
| 4861 | +var max=Math.max(red,Math.max(_631,blue)); | |
| 4862 | +var min=Math.min(red,Math.min(_631,blue)); | |
| 4863 | +var hue; | |
| 4864 | +var _633; | |
| 4865 | +var _634=(max+min)/2; | |
| 4866 | +var _635=max-min; | |
| 4867 | +if(_635===0){ | |
| 4868 | +hue=0; | |
| 4869 | +_633=0; | |
| 4870 | +}else{ | |
| 4871 | +if(_634<=0.5){ | |
| 4872 | +_633=_635/(max+min); | |
| 4873 | +}else{ | |
| 4874 | +_633=_635/(2-max-min); | |
| 4875 | +} | |
| 4876 | +if(red==max){ | |
| 4877 | +hue=(_631-blue)/_635; | |
| 4878 | +}else{ | |
| 4879 | +if(_631==max){ | |
| 4880 | +hue=2+((blue-red)/_635); | |
| 4881 | +}else{ | |
| 4882 | +hue=4+((red-_631)/_635); | |
| 4883 | +} | |
| 4884 | +} | |
| 4885 | +hue/=6; | |
| 4886 | +if(hue<0){ | |
| 4887 | +hue+=1; | |
| 4888 | +} | |
| 4889 | +if(hue>1){ | |
| 4890 | +hue-=1; | |
| 4891 | +} | |
| 4892 | +} | |
| 4893 | +return {h:hue,s:_633,l:_634,a:_632}; | |
| 4894 | +},toColorPart:function(num){ | |
| 4895 | +num=Math.round(num); | |
| 4896 | +var _636=num.toString(16); | |
| 4897 | +if(num<16){ | |
| 4898 | +return "0"+_636; | |
| 4899 | +} | |
| 4900 | +return _636; | |
| 4901 | +},__new__:function(){ | |
| 4902 | +var m=MochiKit.Base; | |
| 4903 | +this.Color.fromRGBString=m.bind(this.Color._fromColorString,this.Color,"rgb","fromRGB",[1/255,1/255,1/255,1]); | |
| 4904 | +this.Color.fromHSLString=m.bind(this.Color._fromColorString,this.Color,"hsl","fromHSL",[1/360,0.01,0.01,1]); | |
| 4905 | +var _637=1/3; | |
| 4906 | +var _638={black:[0,0,0],blue:[0,0,1],brown:[0.6,0.4,0.2],cyan:[0,1,1],darkGray:[_637,_637,_637],gray:[0.5,0.5,0.5],green:[0,1,0],lightGray:[2*_637,2*_637,2*_637],magenta:[1,0,1],orange:[1,0.5,0],purple:[0.5,0,0.5],red:[1,0,0],transparent:[0,0,0,0],white:[1,1,1],yellow:[1,1,0]}; | |
| 4907 | +var _639=function(name,r,g,b,a){ | |
| 4908 | +var rval=this.fromRGB(r,g,b,a); | |
| 4909 | +this[name]=function(){ | |
| 4910 | +return rval; | |
| 4911 | +}; | |
| 4912 | +return rval; | |
| 4913 | +}; | |
| 4914 | +for(var k in _638){ | |
| 4915 | +var name=k+"Color"; | |
| 4916 | +var _641=m.concat([_639,this.Color,name],_638[k]); | |
| 4917 | +this.Color[name]=m.bind.apply(null,_641); | |
| 4918 | +} | |
| 4919 | +var _642=function(){ | |
| 4920 | +for(var i=0;i<arguments.length;i++){ | |
| 4921 | +if(!(arguments[i] instanceof Color)){ | |
| 4922 | +return false; | |
| 4923 | +} | |
| 4924 | +} | |
| 4925 | +return true; | |
| 4926 | +}; | |
| 4927 | +var _643=function(a,b){ | |
| 4928 | +return a.compareRGB(b); | |
| 4929 | +}; | |
| 4930 | +m.nameFunctions(this); | |
| 4931 | +m.registerComparator(this.Color.NAME,_642,_643); | |
| 4932 | +this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; | |
| 4933 | +}}); | |
| 4934 | +MochiKit.Color.EXPORT=["Color"]; | |
| 4935 | +MochiKit.Color.EXPORT_OK=["clampColorComponent","rgbToHSL","hslToRGB","rgbToHSV","hsvToRGB","toColorPart"]; | |
| 4936 | +MochiKit.Color.__new__(); | |
| 4937 | +MochiKit.Base._exportSymbols(this,MochiKit.Color); | |
| 4938 | +MochiKit.Color.Color._namedColors={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}; | |
| 4939 | +if(typeof (dojo)!="undefined"){ | |
| 4940 | +dojo.provide("MochiKit.Signal"); | |
| 4941 | +dojo.require("MochiKit.Base"); | |
| 4942 | +dojo.require("MochiKit.DOM"); | |
| 4943 | +dojo.require("MochiKit.Style"); | |
| 4944 | +} | |
| 4945 | +if(typeof (JSAN)!="undefined"){ | |
| 4946 | +JSAN.use("MochiKit.Base",[]); | |
| 4947 | +JSAN.use("MochiKit.DOM",[]); | |
| 4948 | +JSAN.use("MochiKit.Style",[]); | |
| 4949 | +} | |
| 4950 | +try{ | |
| 4951 | +if(typeof (MochiKit.Base)=="undefined"){ | |
| 4952 | +throw ""; | |
| 4953 | +} | |
| 4954 | +} | |
| 4955 | +catch(e){ | |
| 4956 | +throw "MochiKit.Signal depends on MochiKit.Base!"; | |
| 4957 | +} | |
| 4958 | +try{ | |
| 4959 | +if(typeof (MochiKit.DOM)=="undefined"){ | |
| 4960 | +throw ""; | |
| 4961 | +} | |
| 4962 | +} | |
| 4963 | +catch(e){ | |
| 4964 | +throw "MochiKit.Signal depends on MochiKit.DOM!"; | |
| 4965 | +} | |
| 4966 | +try{ | |
| 4967 | +if(typeof (MochiKit.Style)=="undefined"){ | |
| 4968 | +throw ""; | |
| 4969 | +} | |
| 4970 | +} | |
| 4971 | +catch(e){ | |
| 4972 | +throw "MochiKit.Signal depends on MochiKit.Style!"; | |
| 4973 | +} | |
| 4974 | +if(typeof (MochiKit.Signal)=="undefined"){ | |
| 4975 | +MochiKit.Signal={}; | |
| 4976 | +} | |
| 4977 | +MochiKit.Signal.NAME="MochiKit.Signal"; | |
| 4978 | +MochiKit.Signal.VERSION="1.4"; | |
| 4979 | +MochiKit.Signal._observers=[]; | |
| 4980 | +MochiKit.Signal.Event=function(src,e){ | |
| 4981 | +this._event=e||window.event; | |
| 4982 | +this._src=src; | |
| 4983 | +}; | |
| 4984 | +MochiKit.Base.update(MochiKit.Signal.Event.prototype,{__repr__:function(){ | |
| 4985 | +var repr=MochiKit.Base.repr; | |
| 4986 | +var str="{event(): "+repr(this.event())+", src(): "+repr(this.src())+", type(): "+repr(this.type())+", target(): "+repr(this.target()); | |
| 4987 | +if(this.type()&&this.type().indexOf("key")===0||this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu"){ | |
| 4988 | +str+=", modifier(): "+"{alt: "+repr(this.modifier().alt)+", ctrl: "+repr(this.modifier().ctrl)+", meta: "+repr(this.modifier().meta)+", shift: "+repr(this.modifier().shift)+", any: "+repr(this.modifier().any)+"}"; | |
| 4989 | +} | |
| 4990 | +if(this.type()&&this.type().indexOf("key")===0){ | |
| 4991 | +str+=", key(): {code: "+repr(this.key().code)+", string: "+repr(this.key().string)+"}"; | |
| 4992 | +} | |
| 4993 | +if(this.type()&&(this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu")){ | |
| 4994 | +str+=", mouse(): {page: "+repr(this.mouse().page)+", client: "+repr(this.mouse().client); | |
| 4995 | +if(this.type()!="mousemove"){ | |
| 4996 | +str+=", button: {left: "+repr(this.mouse().button.left)+", middle: "+repr(this.mouse().button.middle)+", right: "+repr(this.mouse().button.right)+"}}"; | |
| 4997 | +}else{ | |
| 4998 | +str+="}"; | |
| 4999 | +} | |
| 5000 | +} | |
| 5001 | +if(this.type()=="mouseover"||this.type()=="mouseout"){ | |
| 5002 | +str+=", relatedTarget(): "+repr(this.relatedTarget()); | |
| 5003 | +} | |
| 5004 | +str+="}"; | |
| 5005 | +return str; | |
| 5006 | +},toString:function(){ | |
| 5007 | +return this.__repr__(); | |
| 5008 | +},src:function(){ | |
| 5009 | +return this._src; | |
| 5010 | +},event:function(){ | |
| 5011 | +return this._event; | |
| 5012 | +},type:function(){ | |
| 5013 | +return this._event.type||undefined; | |
| 5014 | +},target:function(){ | |
| 5015 | +return this._event.target||this._event.srcElement; | |
| 5016 | +},_relatedTarget:null,relatedTarget:function(){ | |
| 5017 | +if(this._relatedTarget!==null){ | |
| 5018 | +return this._relatedTarget; | |
| 5019 | +} | |
| 5020 | +var elem=null; | |
| 5021 | +if(this.type()=="mouseover"){ | |
| 5022 | +elem=(this._event.relatedTarget||this._event.fromElement); | |
| 5023 | +}else{ | |
| 5024 | +if(this.type()=="mouseout"){ | |
| 5025 | +elem=(this._event.relatedTarget||this._event.toElement); | |
| 5026 | +} | |
| 5027 | +} | |
| 5028 | +if(elem!==null){ | |
| 5029 | +this._relatedTarget=elem; | |
| 5030 | +return elem; | |
| 5031 | +} | |
| 5032 | +return undefined; | |
| 5033 | +},_modifier:null,modifier:function(){ | |
| 5034 | +if(this._modifier!==null){ | |
| 5035 | +return this._modifier; | |
| 5036 | +} | |
| 5037 | +var m={}; | |
| 5038 | +m.alt=this._event.altKey; | |
| 5039 | +m.ctrl=this._event.ctrlKey; | |
| 5040 | +m.meta=this._event.metaKey||false; | |
| 5041 | +m.shift=this._event.shiftKey; | |
| 5042 | +m.any=m.alt||m.ctrl||m.shift||m.meta; | |
| 5043 | +this._modifier=m; | |
| 5044 | +return m; | |
| 5045 | +},_key:null,key:function(){ | |
| 5046 | +if(this._key!==null){ | |
| 5047 | +return this._key; | |
| 5048 | +} | |
| 5049 | +var k={}; | |
| 5050 | +if(this.type()&&this.type().indexOf("key")===0){ | |
| 5051 | +if(this.type()=="keydown"||this.type()=="keyup"){ | |
| 5052 | +k.code=this._event.keyCode; | |
| 5053 | +k.string=(MochiKit.Signal._specialKeys[k.code]||"KEY_UNKNOWN"); | |
| 5054 | +this._key=k; | |
| 5055 | +return k; | |
| 5056 | +}else{ | |
| 5057 | +if(this.type()=="keypress"){ | |
| 5058 | +k.code=0; | |
| 5059 | +k.string=""; | |
| 5060 | +if(typeof (this._event.charCode)!="undefined"&&this._event.charCode!==0&&!MochiKit.Signal._specialMacKeys[this._event.charCode]){ | |
| 5061 | +k.code=this._event.charCode; | |
| 5062 | +k.string=String.fromCharCode(k.code); | |
| 5063 | +}else{ | |
| 5064 | +if(this._event.keyCode&&typeof (this._event.charCode)=="undefined"){ | |
| 5065 | +k.code=this._event.keyCode; | |
| 5066 | +k.string=String.fromCharCode(k.code); | |
| 5067 | +} | |
| 5068 | +} | |
| 5069 | +this._key=k; | |
| 5070 | +return k; | |
| 5071 | +} | |
| 5072 | +} | |
| 5073 | +} | |
| 5074 | +return undefined; | |
| 5075 | +},_mouse:null,mouse:function(){ | |
| 5076 | +if(this._mouse!==null){ | |
| 5077 | +return this._mouse; | |
| 5078 | +} | |
| 5079 | +var m={}; | |
| 5080 | +var e=this._event; | |
| 5081 | +if(this.type()&&(this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu")){ | |
| 5082 | +m.client=new MochiKit.Style.Coordinates(0,0); | |
| 5083 | +if(e.clientX||e.clientY){ | |
| 5084 | +m.client.x=(!e.clientX||e.clientX<0)?0:e.clientX; | |
| 5085 | +m.client.y=(!e.clientY||e.clientY<0)?0:e.clientY; | |
| 5086 | +} | |
| 5087 | +m.page=new MochiKit.Style.Coordinates(0,0); | |
| 5088 | +if(e.pageX||e.pageY){ | |
| 5089 | +m.page.x=(!e.pageX||e.pageX<0)?0:e.pageX; | |
| 5090 | +m.page.y=(!e.pageY||e.pageY<0)?0:e.pageY; | |
| 5091 | +}else{ | |
| 5092 | +var de=MochiKit.DOM._document.documentElement; | |
| 5093 | +var b=MochiKit.DOM._document.body; | |
| 5094 | +m.page.x=e.clientX+(de.scrollLeft||b.scrollLeft)-(de.clientLeft||0); | |
| 5095 | +m.page.y=e.clientY+(de.scrollTop||b.scrollTop)-(de.clientTop||0); | |
| 5096 | +} | |
| 5097 | +if(this.type()!="mousemove"){ | |
| 5098 | +m.button={}; | |
| 5099 | +m.button.left=false; | |
| 5100 | +m.button.right=false; | |
| 5101 | +m.button.middle=false; | |
| 5102 | +if(e.which){ | |
| 5103 | +m.button.left=(e.which==1); | |
| 5104 | +m.button.middle=(e.which==2); | |
| 5105 | +m.button.right=(e.which==3); | |
| 5106 | +}else{ | |
| 5107 | +m.button.left=!!(e.button&1); | |
| 5108 | +m.button.right=!!(e.button&2); | |
| 5109 | +m.button.middle=!!(e.button&4); | |
| 5110 | +} | |
| 5111 | +} | |
| 5112 | +this._mouse=m; | |
| 5113 | +return m; | |
| 5114 | +} | |
| 5115 | +return undefined; | |
| 5116 | +},stop:function(){ | |
| 5117 | +this.stopPropagation(); | |
| 5118 | +this.preventDefault(); | |
| 5119 | +},stopPropagation:function(){ | |
| 5120 | +if(this._event.stopPropagation){ | |
| 5121 | +this._event.stopPropagation(); | |
| 5122 | +}else{ | |
| 5123 | +this._event.cancelBubble=true; | |
| 5124 | +} | |
| 5125 | +},preventDefault:function(){ | |
| 5126 | +if(this._event.preventDefault){ | |
| 5127 | +this._event.preventDefault(); | |
| 5128 | +}else{ | |
| 5129 | +if(this._confirmUnload===null){ | |
| 5130 | +this._event.returnValue=false; | |
| 5131 | +} | |
| 5132 | +} | |
| 5133 | +},_confirmUnload:null,confirmUnload:function(msg){ | |
| 5134 | +if(this.type()=="beforeunload"){ | |
| 5135 | +this._confirmUnload=msg; | |
| 5136 | +this._event.returnValue=msg; | |
| 5137 | +} | |
| 5138 | +}}); | |
| 5139 | +MochiKit.Signal._specialMacKeys={3:"KEY_ENTER",63289:"KEY_NUM_PAD_CLEAR",63276:"KEY_PAGE_UP",63277:"KEY_PAGE_DOWN",63275:"KEY_END",63273:"KEY_HOME",63234:"KEY_ARROW_LEFT",63232:"KEY_ARROW_UP",63235:"KEY_ARROW_RIGHT",63233:"KEY_ARROW_DOWN",63302:"KEY_INSERT",63272:"KEY_DELETE"}; | |
| 5140 | +(function(){ | |
| 5141 | +var _644=MochiKit.Signal._specialMacKeys; | |
| 5142 | +for(i=63236;i<=63242;i++){ | |
| 5143 | +_644[i]="KEY_F"+(i-63236+1); | |
| 5144 | +} | |
| 5145 | +})(); | |
| 5146 | +MochiKit.Signal._specialKeys={8:"KEY_BACKSPACE",9:"KEY_TAB",12:"KEY_NUM_PAD_CLEAR",13:"KEY_ENTER",16:"KEY_SHIFT",17:"KEY_CTRL",18:"KEY_ALT",19:"KEY_PAUSE",20:"KEY_CAPS_LOCK",27:"KEY_ESCAPE",32:"KEY_SPACEBAR",33:"KEY_PAGE_UP",34:"KEY_PAGE_DOWN",35:"KEY_END",36:"KEY_HOME",37:"KEY_ARROW_LEFT",38:"KEY_ARROW_UP",39:"KEY_ARROW_RIGHT",40:"KEY_ARROW_DOWN",44:"KEY_PRINT_SCREEN",45:"KEY_INSERT",46:"KEY_DELETE",59:"KEY_SEMICOLON",91:"KEY_WINDOWS_LEFT",92:"KEY_WINDOWS_RIGHT",93:"KEY_SELECT",106:"KEY_NUM_PAD_ASTERISK",107:"KEY_NUM_PAD_PLUS_SIGN",109:"KEY_NUM_PAD_HYPHEN-MINUS",110:"KEY_NUM_PAD_FULL_STOP",111:"KEY_NUM_PAD_SOLIDUS",144:"KEY_NUM_LOCK",145:"KEY_SCROLL_LOCK",186:"KEY_SEMICOLON",187:"KEY_EQUALS_SIGN",188:"KEY_COMMA",189:"KEY_HYPHEN-MINUS",190:"KEY_FULL_STOP",191:"KEY_SOLIDUS",192:"KEY_GRAVE_ACCENT",219:"KEY_LEFT_SQUARE_BRACKET",220:"KEY_REVERSE_SOLIDUS",221:"KEY_RIGHT_SQUARE_BRACKET",222:"KEY_APOSTROPHE"}; | |
| 5147 | +(function(){ | |
| 5148 | +var _645=MochiKit.Signal._specialKeys; | |
| 5149 | +for(var i=48;i<=57;i++){ | |
| 5150 | +_645[i]="KEY_"+(i-48); | |
| 5151 | +} | |
| 5152 | +for(i=65;i<=90;i++){ | |
| 5153 | +_645[i]="KEY_"+String.fromCharCode(i); | |
| 5154 | +} | |
| 5155 | +for(i=96;i<=105;i++){ | |
| 5156 | +_645[i]="KEY_NUM_PAD_"+(i-96); | |
| 5157 | +} | |
| 5158 | +for(i=112;i<=123;i++){ | |
| 5159 | +_645[i]="KEY_F"+(i-112+1); | |
| 5160 | +} | |
| 5161 | +})(); | |
| 5162 | +MochiKit.Base.update(MochiKit.Signal,{__repr__:function(){ | |
| 5163 | +return "["+this.NAME+" "+this.VERSION+"]"; | |
| 5164 | +},toString:function(){ | |
| 5165 | +return this.__repr__(); | |
| 5166 | +},_unloadCache:function(){ | |
| 5167 | +var self=MochiKit.Signal; | |
| 5168 | +var _646=self._observers; | |
| 5169 | +for(var i=0;i<_646.length;i++){ | |
| 5170 | +self._disconnect(_646[i]); | |
| 5171 | +} | |
| 5172 | +delete self._observers; | |
| 5173 | +try{ | |
| 5174 | +window.onload=undefined; | |
| 5175 | +} | |
| 5176 | +catch(e){ | |
| 5177 | +} | |
| 5178 | +try{ | |
| 5179 | +window.onunload=undefined; | |
| 5180 | +} | |
| 5181 | +catch(e){ | |
| 5182 | +} | |
| 5183 | +},_listener:function(src,func,obj,_647){ | |
| 5184 | +var self=MochiKit.Signal; | |
| 5185 | +var E=self.Event; | |
| 5186 | +if(!_647){ | |
| 5187 | +return MochiKit.Base.bind(func,obj); | |
| 5188 | +} | |
| 5189 | +obj=obj||src; | |
| 5190 | +if(typeof (func)=="string"){ | |
| 5191 | +return function(_649){ | |
| 5192 | +obj[func].apply(obj,[new E(src,_649)]); | |
| 5193 | +}; | |
| 5194 | +}else{ | |
| 5195 | +return function(_650){ | |
| 5196 | +func.apply(obj,[new E(src,_650)]); | |
| 5197 | +}; | |
| 5198 | +} | |
| 5199 | +},_browserAlreadyHasMouseEnterAndLeave:function(){ | |
| 5200 | +return /MSIE/.test(navigator.userAgent); | |
| 5201 | +},_mouseEnterListener:function(src,sig,func,obj){ | |
| 5202 | +var E=MochiKit.Signal.Event; | |
| 5203 | +return function(_652){ | |
| 5204 | +var e=new E(src,_652); | |
| 5205 | +try{ | |
| 5206 | +e.relatedTarget().nodeName; | |
| 5207 | +} | |
| 5208 | +catch(err){ | |
| 5209 | +return; | |
| 5210 | +} | |
| 5211 | +e.stop(); | |
| 5212 | +if(MochiKit.DOM.isChildNode(e.relatedTarget(),src)){ | |
| 5213 | +return; | |
| 5214 | +} | |
| 5215 | +e.type=function(){ | |
| 5216 | +return sig; | |
| 5217 | +}; | |
| 5218 | +if(typeof (func)=="string"){ | |
| 5219 | +return obj[func].apply(obj,[e]); | |
| 5220 | +}else{ | |
| 5221 | +return func.apply(obj,[e]); | |
| 5222 | +} | |
| 5223 | +}; | |
| 5224 | +},_getDestPair:function(_653,_654){ | |
| 5225 | +var obj=null; | |
| 5226 | +var func=null; | |
| 5227 | +if(typeof (_654)!="undefined"){ | |
| 5228 | +obj=_653; | |
| 5229 | +func=_654; | |
| 5230 | +if(typeof (_654)=="string"){ | |
| 5231 | +if(typeof (_653[_654])!="function"){ | |
| 5232 | +throw new Error("'funcOrStr' must be a function on 'objOrFunc'"); | |
| 5233 | +} | |
| 5234 | +}else{ | |
| 5235 | +if(typeof (_654)!="function"){ | |
| 5236 | +throw new Error("'funcOrStr' must be a function or string"); | |
| 5237 | +} | |
| 5238 | +} | |
| 5239 | +}else{ | |
| 5240 | +if(typeof (_653)!="function"){ | |
| 5241 | +throw new Error("'objOrFunc' must be a function if 'funcOrStr' is not given"); | |
| 5242 | +}else{ | |
| 5243 | +func=_653; | |
| 5244 | +} | |
| 5245 | +} | |
| 5246 | +return [obj,func]; | |
| 5247 | +},connect:function(src,sig,_655,_656){ | |
| 5248 | +src=MochiKit.DOM.getElement(src); | |
| 5249 | +var self=MochiKit.Signal; | |
| 5250 | +if(typeof (sig)!="string"){ | |
| 5251 | +throw new Error("'sig' must be a string"); | |
| 5252 | +} | |
| 5253 | +var _657=self._getDestPair(_655,_656); | |
| 5254 | +var obj=_657[0]; | |
| 5255 | +var func=_657[1]; | |
| 5256 | +if(typeof (obj)=="undefined"||obj===null){ | |
| 5257 | +obj=src; | |
| 5258 | +} | |
| 5259 | +var _658=!!(src.addEventListener||src.attachEvent); | |
| 5260 | +if(_658&&(sig==="onmouseenter"||sig==="onmouseleave")&&!self._browserAlreadyHasMouseEnterAndLeave()){ | |
| 5261 | +var _659=self._mouseEnterListener(src,sig.substr(2),func,obj); | |
| 5262 | +if(sig==="onmouseenter"){ | |
| 5263 | +sig="onmouseover"; | |
| 5264 | +}else{ | |
| 5265 | +sig="onmouseout"; | |
| 5266 | +} | |
| 5267 | +}else{ | |
| 5268 | +var _659=self._listener(src,func,obj,_658); | |
| 5269 | +} | |
| 5270 | +if(src.addEventListener){ | |
| 5271 | +src.addEventListener(sig.substr(2),_659,false); | |
| 5272 | +}else{ | |
| 5273 | +if(src.attachEvent){ | |
| 5274 | +src.attachEvent(sig,_659); | |
| 5275 | +} | |
| 5276 | +} | |
| 5277 | +var _660=[src,sig,_659,_658,_655,_656,true]; | |
| 5278 | +self._observers.push(_660); | |
| 5279 | +if(!_658&&typeof (src.__connect__)=="function"){ | |
| 5280 | +var args=MochiKit.Base.extend([_660],arguments,1); | |
| 5281 | +src.__connect__.apply(src,args); | |
| 5282 | +} | |
| 5283 | +return _660; | |
| 5284 | +},_disconnect:function(_661){ | |
| 5285 | +if(!_661[6]){ | |
| 5286 | +return; | |
| 5287 | +} | |
| 5288 | +_661[6]=false; | |
| 5289 | +if(!_661[3]){ | |
| 5290 | +return; | |
| 5291 | +} | |
| 5292 | +var src=_661[0]; | |
| 5293 | +var sig=_661[1]; | |
| 5294 | +var _662=_661[2]; | |
| 5295 | +if(src.removeEventListener){ | |
| 5296 | +src.removeEventListener(sig.substr(2),_662,false); | |
| 5297 | +}else{ | |
| 5298 | +if(src.detachEvent){ | |
| 5299 | +src.detachEvent(sig,_662); | |
| 5300 | +}else{ | |
| 5301 | +throw new Error("'src' must be a DOM element"); | |
| 5302 | +} | |
| 5303 | +} | |
| 5304 | +},disconnect:function(_663){ | |
| 5305 | +var self=MochiKit.Signal; | |
| 5306 | +var _664=self._observers; | |
| 5307 | +var m=MochiKit.Base; | |
| 5308 | +if(arguments.length>1){ | |
| 5309 | +var src=MochiKit.DOM.getElement(arguments[0]); | |
| 5310 | +var sig=arguments[1]; | |
| 5311 | +var obj=arguments[2]; | |
| 5312 | +var func=arguments[3]; | |
| 5313 | +for(var i=_664.length-1;i>=0;i--){ | |
| 5314 | +var o=_664[i]; | |
| 5315 | +if(o[0]===src&&o[1]===sig&&o[4]===obj&&o[5]===func){ | |
| 5316 | +self._disconnect(o); | |
| 5317 | +if(!self._lock){ | |
| 5318 | +_664.splice(i,1); | |
| 5319 | +}else{ | |
| 5320 | +self._dirty=true; | |
| 5321 | +} | |
| 5322 | +return true; | |
| 5323 | +} | |
| 5324 | +} | |
| 5325 | +}else{ | |
| 5326 | +var idx=m.findIdentical(_664,_663); | |
| 5327 | +if(idx>=0){ | |
| 5328 | +self._disconnect(_663); | |
| 5329 | +if(!self._lock){ | |
| 5330 | +_664.splice(idx,1); | |
| 5331 | +}else{ | |
| 5332 | +self._dirty=true; | |
| 5333 | +} | |
| 5334 | +return true; | |
| 5335 | +} | |
| 5336 | +} | |
| 5337 | +return false; | |
| 5338 | +},disconnectAllTo:function(_665,_666){ | |
| 5339 | +var self=MochiKit.Signal; | |
| 5340 | +var _667=self._observers; | |
| 5341 | +var _668=self._disconnect; | |
| 5342 | +var _669=self._lock; | |
| 5343 | +var _670=self._dirty; | |
| 5344 | +if(typeof (_666)==="undefined"){ | |
| 5345 | +_666=null; | |
| 5346 | +} | |
| 5347 | +for(var i=_667.length-1;i>=0;i--){ | |
| 5348 | +var _671=_667[i]; | |
| 5349 | +if(_671[4]===_665&&(_666===null||_671[5]===_666)){ | |
| 5350 | +_668(_671); | |
| 5351 | +if(_669){ | |
| 5352 | +_670=true; | |
| 5353 | +}else{ | |
| 5354 | +_667.splice(i,1); | |
| 5355 | +} | |
| 5356 | +} | |
| 5357 | +} | |
| 5358 | +self._dirty=_670; | |
| 5359 | +},disconnectAll:function(src,sig){ | |
| 5360 | +src=MochiKit.DOM.getElement(src); | |
| 5361 | +var m=MochiKit.Base; | |
| 5362 | +var _672=m.flattenArguments(m.extend(null,arguments,1)); | |
| 5363 | +var self=MochiKit.Signal; | |
| 5364 | +var _673=self._disconnect; | |
| 5365 | +var _674=self._observers; | |
| 5366 | +var i,ident; | |
| 5367 | +var _675=self._lock; | |
| 5368 | +var _676=self._dirty; | |
| 5369 | +if(_672.length===0){ | |
| 5370 | +for(i=_674.length-1;i>=0;i--){ | |
| 5371 | +ident=_674[i]; | |
| 5372 | +if(ident[0]===src){ | |
| 5373 | +_673(ident); | |
| 5374 | +if(!_675){ | |
| 5375 | +_674.splice(i,1); | |
| 5376 | +}else{ | |
| 5377 | +_676=true; | |
| 5378 | +} | |
| 5379 | +} | |
| 5380 | +} | |
| 5381 | +}else{ | |
| 5382 | +var sigs={}; | |
| 5383 | +for(i=0;i<_672.length;i++){ | |
| 5384 | +sigs[_672[i]]=true; | |
| 5385 | +} | |
| 5386 | +for(i=_674.length-1;i>=0;i--){ | |
| 5387 | +ident=_674[i]; | |
| 5388 | +if(ident[0]===src&&ident[1] in sigs){ | |
| 5389 | +_673(ident); | |
| 5390 | +if(!_675){ | |
| 5391 | +_674.splice(i,1); | |
| 5392 | +}else{ | |
| 5393 | +_676=true; | |
| 5394 | +} | |
| 5395 | +} | |
| 5396 | +} | |
| 5397 | +} | |
| 5398 | +self._dirty=_676; | |
| 5399 | +},signal:function(src,sig){ | |
| 5400 | +var self=MochiKit.Signal; | |
| 5401 | +var _678=self._observers; | |
| 5402 | +src=MochiKit.DOM.getElement(src); | |
| 5403 | +var args=MochiKit.Base.extend(null,arguments,2); | |
| 5404 | +var _679=[]; | |
| 5405 | +self._lock=true; | |
| 5406 | +for(var i=0;i<_678.length;i++){ | |
| 5407 | +var _680=_678[i]; | |
| 5408 | +if(_680[0]===src&&_680[1]===sig){ | |
| 5409 | +try{ | |
| 5410 | +_680[2].apply(src,args); | |
| 5411 | +} | |
| 5412 | +catch(e){ | |
| 5413 | +_679.push(e); | |
| 5414 | +} | |
| 5415 | +} | |
| 5416 | +} | |
| 5417 | +self._lock=false; | |
| 5418 | +if(self._dirty){ | |
| 5419 | +self._dirty=false; | |
| 5420 | +for(var i=_678.length-1;i>=0;i--){ | |
| 5421 | +if(!_678[i][6]){ | |
| 5422 | +_678.splice(i,1); | |
| 5423 | +} | |
| 5424 | +} | |
| 5425 | +} | |
| 5426 | +if(_679.length==1){ | |
| 5427 | +throw _679[0]; | |
| 5428 | +}else{ | |
| 5429 | +if(_679.length>1){ | |
| 5430 | +var e=new Error("Multiple errors thrown in handling 'sig', see errors property"); | |
| 5431 | +e.errors=_679; | |
| 5432 | +throw e; | |
| 5433 | +} | |
| 5434 | +} | |
| 5435 | +}}); | |
| 5436 | +MochiKit.Signal.EXPORT_OK=[]; | |
| 5437 | +MochiKit.Signal.EXPORT=["connect","disconnect","signal","disconnectAll","disconnectAllTo"]; | |
| 5438 | +MochiKit.Signal.__new__=function(win){ | |
| 5439 | +var m=MochiKit.Base; | |
| 5440 | +this._document=document; | |
| 5441 | +this._window=win; | |
| 5442 | +this._lock=false; | |
| 5443 | +this._dirty=false; | |
| 5444 | +try{ | |
| 5445 | +this.connect(window,"onunload",this._unloadCache); | |
| 5446 | +} | |
| 5447 | +catch(e){ | |
| 5448 | +} | |
| 5449 | +this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; | |
| 5450 | +m.nameFunctions(this); | |
| 5451 | +}; | |
| 5452 | +MochiKit.Signal.__new__(this); | |
| 5453 | +if(MochiKit.__export__){ | |
| 5454 | +connect=MochiKit.Signal.connect; | |
| 5455 | +disconnect=MochiKit.Signal.disconnect; | |
| 5456 | +disconnectAll=MochiKit.Signal.disconnectAll; | |
| 5457 | +signal=MochiKit.Signal.signal; | |
| 5458 | +} | |
| 5459 | +MochiKit.Base._exportSymbols(this,MochiKit.Signal); | |
| 5460 | +if(typeof (dojo)!="undefined"){ | |
| 5461 | +dojo.provide("MochiKit.Position"); | |
| 5462 | +dojo.require("MochiKit.Base"); | |
| 5463 | +dojo.require("MochiKit.DOM"); | |
| 5464 | +dojo.require("MochiKit.Style"); | |
| 5465 | +} | |
| 5466 | +if(typeof (JSAN)!="undefined"){ | |
| 5467 | +JSAN.use("MochiKit.Base",[]); | |
| 5468 | +JSAN.use("MochiKit.DOM",[]); | |
| 5469 | +JSAN.use("MochiKit.Style",[]); | |
| 5470 | +} | |
| 5471 | +try{ | |
| 5472 | +if(typeof (MochiKit.Base)=="undefined"||typeof (MochiKit.Style)=="undefined"||typeof (MochiKit.DOM)=="undefined"){ | |
| 5473 | +throw ""; | |
| 5474 | +} | |
| 5475 | +} | |
| 5476 | +catch(e){ | |
| 5477 | +throw "MochiKit.Style depends on MochiKit.Base, MochiKit.DOM, and MochiKit.Style!"; | |
| 5478 | +} | |
| 5479 | +if(typeof (MochiKit.Position)=="undefined"){ | |
| 5480 | +MochiKit.Position={}; | |
| 5481 | +} | |
| 5482 | +MochiKit.Position.NAME="MochiKit.Position"; | |
| 5483 | +MochiKit.Position.VERSION="1.4"; | |
| 5484 | +MochiKit.Position.__repr__=function(){ | |
| 5485 | +return "["+this.NAME+" "+this.VERSION+"]"; | |
| 5486 | +}; | |
| 5487 | +MochiKit.Position.toString=function(){ | |
| 5488 | +return this.__repr__(); | |
| 5489 | +}; | |
| 5490 | +MochiKit.Position.EXPORT_OK=[]; | |
| 5491 | +MochiKit.Position.EXPORT=[]; | |
| 5492 | +MochiKit.Base.update(MochiKit.Position,{includeScrollOffsets:false,prepare:function(){ | |
| 5493 | +var _681=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0; | |
| 5494 | +var _682=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0; | |
| 5495 | +this.windowOffset=new MochiKit.Style.Coordinates(_681,_682); | |
| 5496 | +},cumulativeOffset:function(_683){ | |
| 5497 | +var _684=0; | |
| 5498 | +var _685=0; | |
| 5499 | +do{ | |
| 5500 | +_684+=_683.offsetTop||0; | |
| 5501 | +_685+=_683.offsetLeft||0; | |
| 5502 | +_683=_683.offsetParent; | |
| 5503 | +}while(_683); | |
| 5504 | +return new MochiKit.Style.Coordinates(_685,_684); | |
| 5505 | +},realOffset:function(_686){ | |
| 5506 | +var _687=0; | |
| 5507 | +var _688=0; | |
| 5508 | +do{ | |
| 5509 | +_687+=_686.scrollTop||0; | |
| 5510 | +_688+=_686.scrollLeft||0; | |
| 5511 | +_686=_686.parentNode; | |
| 5512 | +}while(_686); | |
| 5513 | +return new MochiKit.Style.Coordinates(_688,_687); | |
| 5514 | +},within:function(_689,x,y){ | |
| 5515 | +if(this.includeScrollOffsets){ | |
| 5516 | +return this.withinIncludingScrolloffsets(_689,x,y); | |
| 5517 | +} | |
| 5518 | +this.xcomp=x; | |
| 5519 | +this.ycomp=y; | |
| 5520 | +this.offset=this.cumulativeOffset(_689); | |
| 5521 | +if(_689.style.position=="fixed"){ | |
| 5522 | +this.offset.x+=this.windowOffset.x; | |
| 5523 | +this.offset.y+=this.windowOffset.y; | |
| 5524 | +} | |
| 5525 | +return (y>=this.offset.y&&y<this.offset.y+_689.offsetHeight&&x>=this.offset.x&&x<this.offset.x+_689.offsetWidth); | |
| 5526 | +},withinIncludingScrolloffsets:function(_690,x,y){ | |
| 5527 | +var _691=this.realOffset(_690); | |
| 5528 | +this.xcomp=x+_691.x-this.windowOffset.x; | |
| 5529 | +this.ycomp=y+_691.y-this.windowOffset.y; | |
| 5530 | +this.offset=this.cumulativeOffset(_690); | |
| 5531 | +return (this.ycomp>=this.offset.y&&this.ycomp<this.offset.y+_690.offsetHeight&&this.xcomp>=this.offset.x&&this.xcomp<this.offset.x+_690.offsetWidth); | |
| 5532 | +},overlap:function(mode,_693){ | |
| 5533 | +if(!mode){ | |
| 5534 | +return 0; | |
| 5535 | +} | |
| 5536 | +if(mode=="vertical"){ | |
| 5537 | +return ((this.offset.y+_693.offsetHeight)-this.ycomp)/_693.offsetHeight; | |
| 5538 | +} | |
| 5539 | +if(mode=="horizontal"){ | |
| 5540 | +return ((this.offset.x+_693.offsetWidth)-this.xcomp)/_693.offsetWidth; | |
| 5541 | +} | |
| 5542 | +},absolutize:function(_694){ | |
| 5543 | +_694=MochiKit.DOM.getElement(_694); | |
| 5544 | +if(_694.style.position=="absolute"){ | |
| 5545 | +return; | |
| 5546 | +} | |
| 5547 | +MochiKit.Position.prepare(); | |
| 5548 | +var _695=MochiKit.Position.positionedOffset(_694); | |
| 5549 | +var _696=_694.clientWidth; | |
| 5550 | +var _697=_694.clientHeight; | |
| 5551 | +var _698={"position":_694.style.position,"left":_695.x-parseFloat(_694.style.left||0),"top":_695.y-parseFloat(_694.style.top||0),"width":_694.style.width,"height":_694.style.height}; | |
| 5552 | +_694.style.position="absolute"; | |
| 5553 | +_694.style.top=_695.y+"px"; | |
| 5554 | +_694.style.left=_695.x+"px"; | |
| 5555 | +_694.style.width=_696+"px"; | |
| 5556 | +_694.style.height=_697+"px"; | |
| 5557 | +return _698; | |
| 5558 | +},positionedOffset:function(_699){ | |
| 5559 | +var _700=0,valueL=0; | |
| 5560 | +do{ | |
| 5561 | +_700+=_699.offsetTop||0; | |
| 5562 | +valueL+=_699.offsetLeft||0; | |
| 5563 | +_699=_699.offsetParent; | |
| 5564 | +if(_699){ | |
| 5565 | +p=MochiKit.Style.getStyle(_699,"position"); | |
| 5566 | +if(p=="relative"||p=="absolute"){ | |
| 5567 | +break; | |
| 5568 | +} | |
| 5569 | +} | |
| 5570 | +}while(_699); | |
| 5571 | +return new MochiKit.Style.Coordinates(valueL,_700); | |
| 5572 | +},relativize:function(_701,_702){ | |
| 5573 | +_701=MochiKit.DOM.getElement(_701); | |
| 5574 | +if(_701.style.position=="relative"){ | |
| 5575 | +return; | |
| 5576 | +} | |
| 5577 | +MochiKit.Position.prepare(); | |
| 5578 | +var top=parseFloat(_701.style.top||0)-(_702["top"]||0); | |
| 5579 | +var left=parseFloat(_701.style.left||0)-(_702["left"]||0); | |
| 5580 | +_701.style.position=_702["position"]; | |
| 5581 | +_701.style.top=top+"px"; | |
| 5582 | +_701.style.left=left+"px"; | |
| 5583 | +_701.style.width=_702["width"]; | |
| 5584 | +_701.style.height=_702["height"]; | |
| 5585 | +},clone:function(_705,_706){ | |
| 5586 | +_705=MochiKit.DOM.getElement(_705); | |
| 5587 | +_706=MochiKit.DOM.getElement(_706); | |
| 5588 | +_706.style.position="absolute"; | |
| 5589 | +var _707=this.cumulativeOffset(_705); | |
| 5590 | +_706.style.top=_707.y+"px"; | |
| 5591 | +_706.style.left=_707.x+"px"; | |
| 5592 | +_706.style.width=_705.offsetWidth+"px"; | |
| 5593 | +_706.style.height=_705.offsetHeight+"px"; | |
| 5594 | +},page:function(_708){ | |
| 5595 | +var _709=0; | |
| 5596 | +var _710=0; | |
| 5597 | +var _711=_708; | |
| 5598 | +do{ | |
| 5599 | +_709+=_711.offsetTop||0; | |
| 5600 | +_710+=_711.offsetLeft||0; | |
| 5601 | +if(_711.offsetParent==document.body&&MochiKit.Style.getStyle(_711,"position")=="absolute"){ | |
| 5602 | +break; | |
| 5603 | +} | |
| 5604 | +}while(_711=_711.offsetParent); | |
| 5605 | +_711=_708; | |
| 5606 | +do{ | |
| 5607 | +_709-=_711.scrollTop||0; | |
| 5608 | +_710-=_711.scrollLeft||0; | |
| 5609 | +}while(_711=_711.parentNode); | |
| 5610 | +return new MochiKit.Style.Coordinates(_710,_709); | |
| 5611 | +}}); | |
| 5612 | +if(typeof (dojo)!="undefined"){ | |
| 5613 | +dojo.provide("MochiKit.Visual"); | |
| 5614 | +dojo.require("MochiKit.Base"); | |
| 5615 | +dojo.require("MochiKit.DOM"); | |
| 5616 | +dojo.require("MochiKit.Style"); | |
| 5617 | +dojo.require("MochiKit.Color"); | |
| 5618 | +dojo.require("MochiKit.Position"); | |
| 5619 | +} | |
| 5620 | +if(typeof (JSAN)!="undefined"){ | |
| 5621 | +JSAN.use("MochiKit.Base",[]); | |
| 5622 | +JSAN.use("MochiKit.DOM",[]); | |
| 5623 | +JSAN.use("MochiKit.Style",[]); | |
| 5624 | +JSAN.use("MochiKit.Color",[]); | |
| 5625 | +JSAN.use("MochiKit.Position",[]); | |
| 5626 | +} | |
| 5627 | +try{ | |
| 5628 | +if(typeof (MochiKit.Base)==="undefined"||typeof (MochiKit.DOM)==="undefined"||typeof (MochiKit.Style)==="undefined"||typeof (MochiKit.Position)==="undefined"||typeof (MochiKit.Color)==="undefined"){ | |
| 5629 | +throw ""; | |
| 5630 | +} | |
| 5631 | +} | |
| 5632 | +catch(e){ | |
| 5633 | +throw "MochiKit.Visual depends on MochiKit.Base, MochiKit.DOM, MochiKit.Style, MochiKit.Position and MochiKit.Color!"; | |
| 5634 | +} | |
| 5635 | +if(typeof (MochiKit.Visual)=="undefined"){ | |
| 5636 | +MochiKit.Visual={}; | |
| 5637 | +} | |
| 5638 | +MochiKit.Visual.NAME="MochiKit.Visual"; | |
| 5639 | +MochiKit.Visual.VERSION="1.4"; | |
| 5640 | +MochiKit.Visual.__repr__=function(){ | |
| 5641 | +return "["+this.NAME+" "+this.VERSION+"]"; | |
| 5642 | +}; | |
| 5643 | +MochiKit.Visual.toString=function(){ | |
| 5644 | +return this.__repr__(); | |
| 5645 | +}; | |
| 5646 | +MochiKit.Visual._RoundCorners=function(e,_712){ | |
| 5647 | +e=MochiKit.DOM.getElement(e); | |
| 5648 | +this._setOptions(_712); | |
| 5649 | +if(this.options.__unstable__wrapElement){ | |
| 5650 | +e=this._doWrap(e); | |
| 5651 | +} | |
| 5652 | +var _713=this.options.color; | |
| 5653 | +var C=MochiKit.Color.Color; | |
| 5654 | +if(this.options.color==="fromElement"){ | |
| 5655 | +_713=C.fromBackground(e); | |
| 5656 | +}else{ | |
| 5657 | +if(!(_713 instanceof C)){ | |
| 5658 | +_713=C.fromString(_713); | |
| 5659 | +} | |
| 5660 | +} | |
| 5661 | +this.isTransparent=(_713.asRGB().a<=0); | |
| 5662 | +var _715=this.options.bgColor; | |
| 5663 | +if(this.options.bgColor==="fromParent"){ | |
| 5664 | +_715=C.fromBackground(e.offsetParent); | |
| 5665 | +}else{ | |
| 5666 | +if(!(_715 instanceof C)){ | |
| 5667 | +_715=C.fromString(_715); | |
| 5668 | +} | |
| 5669 | +} | |
| 5670 | +this._roundCornersImpl(e,_713,_715); | |
| 5671 | +}; | |
| 5672 | +MochiKit.Visual._RoundCorners.prototype={_doWrap:function(e){ | |
| 5673 | +var _716=e.parentNode; | |
| 5674 | +var doc=MochiKit.DOM.currentDocument(); | |
| 5675 | +if(typeof (doc.defaultView)==="undefined"||doc.defaultView===null){ | |
| 5676 | +return e; | |
| 5677 | +} | |
| 5678 | +var _717=doc.defaultView.getComputedStyle(e,null); | |
| 5679 | +if(typeof (_717)==="undefined"||_717===null){ | |
| 5680 | +return e; | |
| 5681 | +} | |
| 5682 | +var _718=MochiKit.DOM.DIV({"style":{display:"block",marginTop:_717.getPropertyValue("padding-top"),marginRight:_717.getPropertyValue("padding-right"),marginBottom:_717.getPropertyValue("padding-bottom"),marginLeft:_717.getPropertyValue("padding-left"),padding:"0px"}}); | |
| 5683 | +_718.innerHTML=e.innerHTML; | |
| 5684 | +e.innerHTML=""; | |
| 5685 | +e.appendChild(_718); | |
| 5686 | +return e; | |
| 5687 | +},_roundCornersImpl:function(e,_719,_720){ | |
| 5688 | +if(this.options.border){ | |
| 5689 | +this._renderBorder(e,_720); | |
| 5690 | +} | |
| 5691 | +if(this._isTopRounded()){ | |
| 5692 | +this._roundTopCorners(e,_719,_720); | |
| 5693 | +} | |
| 5694 | +if(this._isBottomRounded()){ | |
| 5695 | +this._roundBottomCorners(e,_719,_720); | |
| 5696 | +} | |
| 5697 | +},_renderBorder:function(el,_722){ | |
| 5698 | +var _723="1px solid "+this._borderColor(_722); | |
| 5699 | +var _724="border-left: "+_723; | |
| 5700 | +var _725="border-right: "+_723; | |
| 5701 | +var _726="style='"+_724+";"+_725+"'"; | |
| 5702 | +el.innerHTML="<div "+_726+">"+el.innerHTML+"</div>"; | |
| 5703 | +},_roundTopCorners:function(el,_727,_728){ | |
| 5704 | +var _729=this._createCorner(_728); | |
| 5705 | +for(var i=0;i<this.options.numSlices;i++){ | |
| 5706 | +_729.appendChild(this._createCornerSlice(_727,_728,i,"top")); | |
| 5707 | +} | |
| 5708 | +el.style.paddingTop=0; | |
| 5709 | +el.insertBefore(_729,el.firstChild); | |
| 5710 | +},_roundBottomCorners:function(el,_730,_731){ | |
| 5711 | +var _732=this._createCorner(_731); | |
| 5712 | +for(var i=(this.options.numSlices-1);i>=0;i--){ | |
| 5713 | +_732.appendChild(this._createCornerSlice(_730,_731,i,"bottom")); | |
| 5714 | +} | |
| 5715 | +el.style.paddingBottom=0; | |
| 5716 | +el.appendChild(_732); | |
| 5717 | +},_createCorner:function(_733){ | |
| 5718 | +var dom=MochiKit.DOM; | |
| 5719 | +return dom.DIV({style:{backgroundColor:_733.toString()}}); | |
| 5720 | +},_createCornerSlice:function(_734,_735,n,_736){ | |
| 5721 | +var _737=MochiKit.DOM.SPAN(); | |
| 5722 | +var _738=_737.style; | |
| 5723 | +_738.backgroundColor=_734.toString(); | |
| 5724 | +_738.display="block"; | |
| 5725 | +_738.height="1px"; | |
| 5726 | +_738.overflow="hidden"; | |
| 5727 | +_738.fontSize="1px"; | |
| 5728 | +var _739=this._borderColor(_734,_735); | |
| 5729 | +if(this.options.border&&n===0){ | |
| 5730 | +_738.borderTopStyle="solid"; | |
| 5731 | +_738.borderTopWidth="1px"; | |
| 5732 | +_738.borderLeftWidth="0px"; | |
| 5733 | +_738.borderRightWidth="0px"; | |
| 5734 | +_738.borderBottomWidth="0px"; | |
| 5735 | +_738.height="0px"; | |
| 5736 | +_738.borderColor=_739.toString(); | |
| 5737 | +}else{ | |
| 5738 | +if(_739){ | |
| 5739 | +_738.borderColor=_739.toString(); | |
| 5740 | +_738.borderStyle="solid"; | |
| 5741 | +_738.borderWidth="0px 1px"; | |
| 5742 | +} | |
| 5743 | +} | |
| 5744 | +if(!this.options.compact&&(n==(this.options.numSlices-1))){ | |
| 5745 | +_738.height="2px"; | |
| 5746 | +} | |
| 5747 | +this._setMargin(_737,n,_736); | |
| 5748 | +this._setBorder(_737,n,_736); | |
| 5749 | +return _737; | |
| 5750 | +},_setOptions:function(_740){ | |
| 5751 | +this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false,__unstable__wrapElement:false}; | |
| 5752 | +MochiKit.Base.update(this.options,_740); | |
| 5753 | +this.options.numSlices=(this.options.compact?2:4); | |
| 5754 | +},_whichSideTop:function(){ | |
| 5755 | +var _741=this.options.corners; | |
| 5756 | +if(this._hasString(_741,"all","top")){ | |
| 5757 | +return ""; | |
| 5758 | +} | |
| 5759 | +var _742=(_741.indexOf("tl")!=-1); | |
| 5760 | +var _743=(_741.indexOf("tr")!=-1); | |
| 5761 | +if(_742&&_743){ | |
| 5762 | +return ""; | |
| 5763 | +} | |
| 5764 | +if(_742){ | |
| 5765 | +return "left"; | |
| 5766 | +} | |
| 5767 | +if(_743){ | |
| 5768 | +return "right"; | |
| 5769 | +} | |
| 5770 | +return ""; | |
| 5771 | +},_whichSideBottom:function(){ | |
| 5772 | +var _744=this.options.corners; | |
| 5773 | +if(this._hasString(_744,"all","bottom")){ | |
| 5774 | +return ""; | |
| 5775 | +} | |
| 5776 | +var _745=(_744.indexOf("bl")!=-1); | |
| 5777 | +var _746=(_744.indexOf("br")!=-1); | |
| 5778 | +if(_745&&_746){ | |
| 5779 | +return ""; | |
| 5780 | +} | |
| 5781 | +if(_745){ | |
| 5782 | +return "left"; | |
| 5783 | +} | |
| 5784 | +if(_746){ | |
| 5785 | +return "right"; | |
| 5786 | +} | |
| 5787 | +return ""; | |
| 5788 | +},_borderColor:function(_747,_748){ | |
| 5789 | +if(_747=="transparent"){ | |
| 5790 | +return _748; | |
| 5791 | +}else{ | |
| 5792 | +if(this.options.border){ | |
| 5793 | +return this.options.border; | |
| 5794 | +}else{ | |
| 5795 | +if(this.options.blend){ | |
| 5796 | +return _748.blendedColor(_747); | |
| 5797 | +} | |
| 5798 | +} | |
| 5799 | +} | |
| 5800 | +return ""; | |
| 5801 | +},_setMargin:function(el,n,_749){ | |
| 5802 | +var _750=this._marginSize(n)+"px"; | |
| 5803 | +var _751=(_749=="top"?this._whichSideTop():this._whichSideBottom()); | |
| 5804 | +var _752=el.style; | |
| 5805 | +if(_751=="left"){ | |
| 5806 | +_752.marginLeft=_750; | |
| 5807 | +_752.marginRight="0px"; | |
| 5808 | +}else{ | |
| 5809 | +if(_751=="right"){ | |
| 5810 | +_752.marginRight=_750; | |
| 5811 | +_752.marginLeft="0px"; | |
| 5812 | +}else{ | |
| 5813 | +_752.marginLeft=_750; | |
| 5814 | +_752.marginRight=_750; | |
| 5815 | +} | |
| 5816 | +} | |
| 5817 | +},_setBorder:function(el,n,_753){ | |
| 5818 | +var _754=this._borderSize(n)+"px"; | |
| 5819 | +var _755=(_753=="top"?this._whichSideTop():this._whichSideBottom()); | |
| 5820 | +var _756=el.style; | |
| 5821 | +if(_755=="left"){ | |
| 5822 | +_756.borderLeftWidth=_754; | |
| 5823 | +_756.borderRightWidth="0px"; | |
| 5824 | +}else{ | |
| 5825 | +if(_755=="right"){ | |
| 5826 | +_756.borderRightWidth=_754; | |
| 5827 | +_756.borderLeftWidth="0px"; | |
| 5828 | +}else{ | |
| 5829 | +_756.borderLeftWidth=_754; | |
| 5830 | +_756.borderRightWidth=_754; | |
| 5831 | +} | |
| 5832 | +} | |
| 5833 | +},_marginSize:function(n){ | |
| 5834 | +if(this.isTransparent){ | |
| 5835 | +return 0; | |
| 5836 | +} | |
| 5837 | +var o=this.options; | |
| 5838 | +if(o.compact&&o.blend){ | |
| 5839 | +var _757=[1,0]; | |
| 5840 | +return _757[n]; | |
| 5841 | +}else{ | |
| 5842 | +if(o.compact){ | |
| 5843 | +var _758=[2,1]; | |
| 5844 | +return _758[n]; | |
| 5845 | +}else{ | |
| 5846 | +if(o.blend){ | |
| 5847 | +var _759=[3,2,1,0]; | |
| 5848 | +return _759[n]; | |
| 5849 | +}else{ | |
| 5850 | +var _760=[5,3,2,1]; | |
| 5851 | +return _760[n]; | |
| 5852 | +} | |
| 5853 | +} | |
| 5854 | +} | |
| 5855 | +},_borderSize:function(n){ | |
| 5856 | +var o=this.options; | |
| 5857 | +var _761; | |
| 5858 | +if(o.compact&&(o.blend||this.isTransparent)){ | |
| 5859 | +return 1; | |
| 5860 | +}else{ | |
| 5861 | +if(o.compact){ | |
| 5862 | +_761=[1,0]; | |
| 5863 | +}else{ | |
| 5864 | +if(o.blend){ | |
| 5865 | +_761=[2,1,1,1]; | |
| 5866 | +}else{ | |
| 5867 | +if(o.border){ | |
| 5868 | +_761=[0,2,0,0]; | |
| 5869 | +}else{ | |
| 5870 | +if(this.isTransparent){ | |
| 5871 | +_761=[5,3,2,1]; | |
| 5872 | +}else{ | |
| 5873 | +return 0; | |
| 5874 | +} | |
| 5875 | +} | |
| 5876 | +} | |
| 5877 | +} | |
| 5878 | +} | |
| 5879 | +return _761[n]; | |
| 5880 | +},_hasString:function(str){ | |
| 5881 | +for(var i=1;i<arguments.length;i++){ | |
| 5882 | +if(str.indexOf(arguments[i])!=-1){ | |
| 5883 | +return true; | |
| 5884 | +} | |
| 5885 | +} | |
| 5886 | +return false; | |
| 5887 | +},_isTopRounded:function(){ | |
| 5888 | +return this._hasString(this.options.corners,"all","top","tl","tr"); | |
| 5889 | +},_isBottomRounded:function(){ | |
| 5890 | +return this._hasString(this.options.corners,"all","bottom","bl","br"); | |
| 5891 | +},_hasSingleTextChild:function(el){ | |
| 5892 | +return (el.childNodes.length==1&&el.childNodes[0].nodeType==3); | |
| 5893 | +}}; | |
| 5894 | +MochiKit.Visual.roundElement=function(e,_762){ | |
| 5895 | +new MochiKit.Visual._RoundCorners(e,_762); | |
| 5896 | +}; | |
| 5897 | +MochiKit.Visual.roundClass=function(_763,_764,_765){ | |
| 5898 | +var _766=MochiKit.DOM.getElementsByTagAndClassName(_763,_764); | |
| 5899 | +for(var i=0;i<_766.length;i++){ | |
| 5900 | +MochiKit.Visual.roundElement(_766[i],_765); | |
| 5901 | +} | |
| 5902 | +}; | |
| 5903 | +MochiKit.Visual.tagifyText=function(_767,_768){ | |
| 5904 | +var _768=_768||"position:relative"; | |
| 5905 | +if(/MSIE/.test(navigator.userAgent)){ | |
| 5906 | +_768+=";zoom:1"; | |
| 5907 | +} | |
| 5908 | +_767=MochiKit.DOM.getElement(_767); | |
| 5909 | +var ma=MochiKit.Base.map; | |
| 5910 | +ma(function(_770){ | |
| 5911 | +if(_770.nodeType==3){ | |
| 5912 | +ma(function(_771){ | |
| 5913 | +_767.insertBefore(MochiKit.DOM.SPAN({style:_768},_771==" "?String.fromCharCode(160):_771),_770); | |
| 5914 | +},_770.nodeValue.split("")); | |
| 5915 | +MochiKit.DOM.removeElement(_770); | |
| 5916 | +} | |
| 5917 | +},_767.childNodes); | |
| 5918 | +}; | |
| 5919 | +MochiKit.Visual.forceRerendering=function(_772){ | |
| 5920 | +try{ | |
| 5921 | +_772=MochiKit.DOM.getElement(_772); | |
| 5922 | +var n=document.createTextNode(" "); | |
| 5923 | +_772.appendChild(n); | |
| 5924 | +_772.removeChild(n); | |
| 5925 | +} | |
| 5926 | +catch(e){ | |
| 5927 | +} | |
| 5928 | +}; | |
| 5929 | +MochiKit.Visual.multiple=function(_773,_774,_775){ | |
| 5930 | +_775=MochiKit.Base.update({speed:0.1,delay:0},_775||{}); | |
| 5931 | +var _776=_775.delay; | |
| 5932 | +var _777=0; | |
| 5933 | +MochiKit.Base.map(function(_778){ | |
| 5934 | +_775.delay=_777*_775.speed+_776; | |
| 5935 | +new _774(_778,_775); | |
| 5936 | +_777+=1; | |
| 5937 | +},_773); | |
| 5938 | +}; | |
| 5939 | +MochiKit.Visual.PAIRS={"slide":["slideDown","slideUp"],"blind":["blindDown","blindUp"],"appear":["appear","fade"],"size":["grow","shrink"]}; | |
| 5940 | +MochiKit.Visual.toggle=function(_779,_780,_781){ | |
| 5941 | +_779=MochiKit.DOM.getElement(_779); | |
| 5942 | +_780=(_780||"appear").toLowerCase(); | |
| 5943 | +_781=MochiKit.Base.update({queue:{position:"end",scope:(_779.id||"global"),limit:1}},_781||{}); | |
| 5944 | +var v=MochiKit.Visual; | |
| 5945 | +v[_779.style.display!="none"?v.PAIRS[_780][1]:v.PAIRS[_780][0]](_779,_781); | |
| 5946 | +}; | |
| 5947 | +MochiKit.Visual.Transitions={}; | |
| 5948 | +MochiKit.Visual.Transitions.linear=function(pos){ | |
| 5949 | +return pos; | |
| 5950 | +}; | |
| 5951 | +MochiKit.Visual.Transitions.sinoidal=function(pos){ | |
| 5952 | +return (-Math.cos(pos*Math.PI)/2)+0.5; | |
| 5953 | +}; | |
| 5954 | +MochiKit.Visual.Transitions.reverse=function(pos){ | |
| 5955 | +return 1-pos; | |
| 5956 | +}; | |
| 5957 | +MochiKit.Visual.Transitions.flicker=function(pos){ | |
| 5958 | +return ((-Math.cos(pos*Math.PI)/4)+0.75)+Math.random()/4; | |
| 5959 | +}; | |
| 5960 | +MochiKit.Visual.Transitions.wobble=function(pos){ | |
| 5961 | +return (-Math.cos(pos*Math.PI*(9*pos))/2)+0.5; | |
| 5962 | +}; | |
| 5963 | +MochiKit.Visual.Transitions.pulse=function(pos){ | |
| 5964 | +return (Math.floor(pos*10)%2==0?(pos*10-Math.floor(pos*10)):1-(pos*10-Math.floor(pos*10))); | |
| 5965 | +}; | |
| 5966 | +MochiKit.Visual.Transitions.none=function(pos){ | |
| 5967 | +return 0; | |
| 5968 | +}; | |
| 5969 | +MochiKit.Visual.Transitions.full=function(pos){ | |
| 5970 | +return 1; | |
| 5971 | +}; | |
| 5972 | +MochiKit.Visual.ScopedQueue=function(){ | |
| 5973 | +var cls=arguments.callee; | |
| 5974 | +if(!(this instanceof cls)){ | |
| 5975 | +return new cls(); | |
| 5976 | +} | |
| 5977 | +this.__init__(); | |
| 5978 | +}; | |
| 5979 | +MochiKit.Base.update(MochiKit.Visual.ScopedQueue.prototype,{__init__:function(){ | |
| 5980 | +this.effects=[]; | |
| 5981 | +this.interval=null; | |
| 5982 | +},add:function(_782){ | |
| 5983 | +var _783=new Date().getTime(); | |
| 5984 | +var _784=(typeof (_782.options.queue)=="string")?_782.options.queue:_782.options.queue.position; | |
| 5985 | +var ma=MochiKit.Base.map; | |
| 5986 | +switch(_784){ | |
| 5987 | +case "front": | |
| 5988 | +ma(function(e){ | |
| 5989 | +if(e.state=="idle"){ | |
| 5990 | +e.startOn+=_782.finishOn; | |
| 5991 | +e.finishOn+=_782.finishOn; | |
| 5992 | +} | |
| 5993 | +},this.effects); | |
| 5994 | +break; | |
| 5995 | +case "end": | |
| 5996 | +var _785; | |
| 5997 | +ma(function(e){ | |
| 5998 | +var i=e.finishOn; | |
| 5999 | +if(i>=(_785||i)){ | |
| 6000 | +_785=i; | |
| 6001 | +} | |
| 6002 | +},this.effects); | |
| 6003 | +_783=_785||_783; | |
| 6004 | +break; | |
| 6005 | +case "break": | |
| 6006 | +ma(function(e){ | |
| 6007 | +e.finalize(); | |
| 6008 | +},this.effects); | |
| 6009 | +break; | |
| 6010 | +} | |
| 6011 | +_782.startOn+=_783; | |
| 6012 | +_782.finishOn+=_783; | |
| 6013 | +if(!_782.options.queue.limit||this.effects.length<_782.options.queue.limit){ | |
| 6014 | +this.effects.push(_782); | |
| 6015 | +} | |
| 6016 | +if(!this.interval){ | |
| 6017 | +this.interval=this.startLoop(MochiKit.Base.bind(this.loop,this),40); | |
| 6018 | +} | |
| 6019 | +},startLoop:function(func,_786){ | |
| 6020 | +return setInterval(func,_786); | |
| 6021 | +},remove:function(_787){ | |
| 6022 | +this.effects=MochiKit.Base.filter(function(e){ | |
| 6023 | +return e!=_787; | |
| 6024 | +},this.effects); | |
| 6025 | +if(this.effects.length==0){ | |
| 6026 | +this.stopLoop(this.interval); | |
| 6027 | +this.interval=null; | |
| 6028 | +} | |
| 6029 | +},stopLoop:function(_788){ | |
| 6030 | +clearInterval(_788); | |
| 6031 | +},loop:function(){ | |
| 6032 | +var _789=new Date().getTime(); | |
| 6033 | +MochiKit.Base.map(function(_790){ | |
| 6034 | +_790.loop(_789); | |
| 6035 | +},this.effects); | |
| 6036 | +}}); | |
| 6037 | +MochiKit.Visual.Queues={instances:{},get:function(_791){ | |
| 6038 | +if(typeof (_791)!="string"){ | |
| 6039 | +return _791; | |
| 6040 | +} | |
| 6041 | +if(!this.instances[_791]){ | |
| 6042 | +this.instances[_791]=new MochiKit.Visual.ScopedQueue(); | |
| 6043 | +} | |
| 6044 | +return this.instances[_791]; | |
| 6045 | +}}; | |
| 6046 | +MochiKit.Visual.Queue=MochiKit.Visual.Queues.get("global"); | |
| 6047 | +MochiKit.Visual.DefaultOptions={transition:MochiKit.Visual.Transitions.sinoidal,duration:1,fps:25,sync:false,from:0,to:1,delay:0,queue:"parallel"}; | |
| 6048 | +MochiKit.Visual.Base=function(){ | |
| 6049 | +}; | |
| 6050 | +MochiKit.Visual.Base.prototype={__class__:MochiKit.Visual.Base,start:function(_792){ | |
| 6051 | +var v=MochiKit.Visual; | |
| 6052 | +this.options=MochiKit.Base.setdefault(_792||{},v.DefaultOptions); | |
| 6053 | +this.currentFrame=0; | |
| 6054 | +this.state="idle"; | |
| 6055 | +this.startOn=this.options.delay*1000; | |
| 6056 | +this.finishOn=this.startOn+(this.options.duration*1000); | |
| 6057 | +this.event("beforeStart"); | |
| 6058 | +if(!this.options.sync){ | |
| 6059 | +v.Queues.get(typeof (this.options.queue)=="string"?"global":this.options.queue.scope).add(this); | |
| 6060 | +} | |
| 6061 | +},loop:function(_793){ | |
| 6062 | +if(_793>=this.startOn){ | |
| 6063 | +if(_793>=this.finishOn){ | |
| 6064 | +return this.finalize(); | |
| 6065 | +} | |
| 6066 | +var pos=(_793-this.startOn)/(this.finishOn-this.startOn); | |
| 6067 | +var _794=Math.round(pos*this.options.fps*this.options.duration); | |
| 6068 | +if(_794>this.currentFrame){ | |
| 6069 | +this.render(pos); | |
| 6070 | +this.currentFrame=_794; | |
| 6071 | +} | |
| 6072 | +} | |
| 6073 | +},render:function(pos){ | |
| 6074 | +if(this.state=="idle"){ | |
| 6075 | +this.state="running"; | |
| 6076 | +this.event("beforeSetup"); | |
| 6077 | +this.setup(); | |
| 6078 | +this.event("afterSetup"); | |
| 6079 | +} | |
| 6080 | +if(this.state=="running"){ | |
| 6081 | +if(this.options.transition){ | |
| 6082 | +pos=this.options.transition(pos); | |
| 6083 | +} | |
| 6084 | +pos*=(this.options.to-this.options.from); | |
| 6085 | +pos+=this.options.from; | |
| 6086 | +this.event("beforeUpdate"); | |
| 6087 | +this.update(pos); | |
| 6088 | +this.event("afterUpdate"); | |
| 6089 | +} | |
| 6090 | +},cancel:function(){ | |
| 6091 | +if(!this.options.sync){ | |
| 6092 | +MochiKit.Visual.Queues.get(typeof (this.options.queue)=="string"?"global":this.options.queue.scope).remove(this); | |
| 6093 | +} | |
| 6094 | +this.state="finished"; | |
| 6095 | +},finalize:function(){ | |
| 6096 | +this.render(1); | |
| 6097 | +this.cancel(); | |
| 6098 | +this.event("beforeFinish"); | |
| 6099 | +this.finish(); | |
| 6100 | +this.event("afterFinish"); | |
| 6101 | +},setup:function(){ | |
| 6102 | +},finish:function(){ | |
| 6103 | +},update:function(_795){ | |
| 6104 | +},event:function(_796){ | |
| 6105 | +if(this.options[_796+"Internal"]){ | |
| 6106 | +this.options[_796+"Internal"](this); | |
| 6107 | +} | |
| 6108 | +if(this.options[_796]){ | |
| 6109 | +this.options[_796](this); | |
| 6110 | +} | |
| 6111 | +},repr:function(){ | |
| 6112 | +return "["+this.__class__.NAME+", options:"+MochiKit.Base.repr(this.options)+"]"; | |
| 6113 | +}}; | |
| 6114 | +MochiKit.Visual.Parallel=function(_797,_798){ | |
| 6115 | +var cls=arguments.callee; | |
| 6116 | +if(!(this instanceof cls)){ | |
| 6117 | +return new cls(_797,_798); | |
| 6118 | +} | |
| 6119 | +this.__init__(_797,_798); | |
| 6120 | +}; | |
| 6121 | +MochiKit.Visual.Parallel.prototype=new MochiKit.Visual.Base(); | |
| 6122 | +MochiKit.Base.update(MochiKit.Visual.Parallel.prototype,{__init__:function(_799,_800){ | |
| 6123 | +this.effects=_799||[]; | |
| 6124 | +this.start(_800); | |
| 6125 | +},update:function(_801){ | |
| 6126 | +MochiKit.Base.map(function(_802){ | |
| 6127 | +_802.render(_801); | |
| 6128 | +},this.effects); | |
| 6129 | +},finish:function(){ | |
| 6130 | +MochiKit.Base.map(function(_803){ | |
| 6131 | +_803.finalize(); | |
| 6132 | +},this.effects); | |
| 6133 | +}}); | |
| 6134 | +MochiKit.Visual.Opacity=function(_804,_805){ | |
| 6135 | +var cls=arguments.callee; | |
| 6136 | +if(!(this instanceof cls)){ | |
| 6137 | +return new cls(_804,_805); | |
| 6138 | +} | |
| 6139 | +this.__init__(_804,_805); | |
| 6140 | +}; | |
| 6141 | +MochiKit.Visual.Opacity.prototype=new MochiKit.Visual.Base(); | |
| 6142 | +MochiKit.Base.update(MochiKit.Visual.Opacity.prototype,{__init__:function(_806,_807){ | |
| 6143 | +var b=MochiKit.Base; | |
| 6144 | +var s=MochiKit.Style; | |
| 6145 | +this.element=MochiKit.DOM.getElement(_806); | |
| 6146 | +if(this.element.currentStyle&&(!this.element.currentStyle.hasLayout)){ | |
| 6147 | +s.setStyle(this.element,{zoom:1}); | |
| 6148 | +} | |
| 6149 | +_807=b.update({from:s.getStyle(this.element,"opacity")||0,to:1},_807||{}); | |
| 6150 | +this.start(_807); | |
| 6151 | +},update:function(_808){ | |
| 6152 | +MochiKit.Style.setStyle(this.element,{"opacity":_808}); | |
| 6153 | +}}); | |
| 6154 | +MochiKit.Visual.Move=function(_809,_810){ | |
| 6155 | +var cls=arguments.callee; | |
| 6156 | +if(!(this instanceof cls)){ | |
| 6157 | +return new cls(_809,_810); | |
| 6158 | +} | |
| 6159 | +this.__init__(_809,_810); | |
| 6160 | +}; | |
| 6161 | +MochiKit.Visual.Move.prototype=new MochiKit.Visual.Base(); | |
| 6162 | +MochiKit.Base.update(MochiKit.Visual.Move.prototype,{__init__:function(_811,_812){ | |
| 6163 | +this.element=MochiKit.DOM.getElement(_811); | |
| 6164 | +_812=MochiKit.Base.update({x:0,y:0,mode:"relative"},_812||{}); | |
| 6165 | +this.start(_812); | |
| 6166 | +},setup:function(){ | |
| 6167 | +MochiKit.DOM.makePositioned(this.element); | |
| 6168 | +var s=this.element.style; | |
| 6169 | +var _813=s.visibility; | |
| 6170 | +var _814=s.display; | |
| 6171 | +if(_814=="none"){ | |
| 6172 | +s.visibility="hidden"; | |
| 6173 | +s.display=""; | |
| 6174 | +} | |
| 6175 | +this.originalLeft=parseFloat(MochiKit.Style.getStyle(this.element,"left")||"0"); | |
| 6176 | +this.originalTop=parseFloat(MochiKit.Style.getStyle(this.element,"top")||"0"); | |
| 6177 | +if(this.options.mode=="absolute"){ | |
| 6178 | +this.options.x-=this.originalLeft; | |
| 6179 | +this.options.y-=this.originalTop; | |
| 6180 | +} | |
| 6181 | +if(_814=="none"){ | |
| 6182 | +s.visibility=_813; | |
| 6183 | +s.display=_814; | |
| 6184 | +} | |
| 6185 | +},update:function(_815){ | |
| 6186 | +MochiKit.Style.setStyle(this.element,{left:Math.round(this.options.x*_815+this.originalLeft)+"px",top:Math.round(this.options.y*_815+this.originalTop)+"px"}); | |
| 6187 | +}}); | |
| 6188 | +MochiKit.Visual.Scale=function(_816,_817,_818){ | |
| 6189 | +var cls=arguments.callee; | |
| 6190 | +if(!(this instanceof cls)){ | |
| 6191 | +return new cls(_816,_817,_818); | |
| 6192 | +} | |
| 6193 | +this.__init__(_816,_817,_818); | |
| 6194 | +}; | |
| 6195 | +MochiKit.Visual.Scale.prototype=new MochiKit.Visual.Base(); | |
| 6196 | +MochiKit.Base.update(MochiKit.Visual.Scale.prototype,{__init__:function(_819,_820,_821){ | |
| 6197 | +this.element=MochiKit.DOM.getElement(_819); | |
| 6198 | +_821=MochiKit.Base.update({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:_820},_821||{}); | |
| 6199 | +this.start(_821); | |
| 6200 | +},setup:function(){ | |
| 6201 | +this.restoreAfterFinish=this.options.restoreAfterFinish||false; | |
| 6202 | +this.elementPositioning=MochiKit.Style.getStyle(this.element,"position"); | |
| 6203 | +var ma=MochiKit.Base.map; | |
| 6204 | +var b=MochiKit.Base.bind; | |
| 6205 | +this.originalStyle={}; | |
| 6206 | +ma(b(function(k){ | |
| 6207 | +this.originalStyle[k]=this.element.style[k]; | |
| 6208 | +},this),["top","left","width","height","fontSize"]); | |
| 6209 | +this.originalTop=this.element.offsetTop; | |
| 6210 | +this.originalLeft=this.element.offsetLeft; | |
| 6211 | +var _822=MochiKit.Style.getStyle(this.element,"font-size")||"100%"; | |
| 6212 | +ma(b(function(_823){ | |
| 6213 | +if(_822.indexOf(_823)>0){ | |
| 6214 | +this.fontSize=parseFloat(_822); | |
| 6215 | +this.fontSizeType=_823; | |
| 6216 | +} | |
| 6217 | +},this),["em","px","%"]); | |
| 6218 | +this.factor=(this.options.scaleTo-this.options.scaleFrom)/100; | |
| 6219 | +if(/^content/.test(this.options.scaleMode)){ | |
| 6220 | +this.dims=[this.element.scrollHeight,this.element.scrollWidth]; | |
| 6221 | +}else{ | |
| 6222 | +if(this.options.scaleMode=="box"){ | |
| 6223 | +this.dims=[this.element.offsetHeight,this.element.offsetWidth]; | |
| 6224 | +}else{ | |
| 6225 | +this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]; | |
| 6226 | +} | |
| 6227 | +} | |
| 6228 | +},update:function(_824){ | |
| 6229 | +var _825=(this.options.scaleFrom/100)+(this.factor*_824); | |
| 6230 | +if(this.options.scaleContent&&this.fontSize){ | |
| 6231 | +MochiKit.Style.setStyle(this.element,{fontSize:this.fontSize*_825+this.fontSizeType}); | |
| 6232 | +} | |
| 6233 | +this.setDimensions(this.dims[0]*_825,this.dims[1]*_825); | |
| 6234 | +},finish:function(){ | |
| 6235 | +if(this.restoreAfterFinish){ | |
| 6236 | +MochiKit.Style.setStyle(this.element,this.originalStyle); | |
| 6237 | +} | |
| 6238 | +},setDimensions:function(_826,_827){ | |
| 6239 | +var d={}; | |
| 6240 | +var r=Math.round; | |
| 6241 | +if(/MSIE/.test(navigator.userAgent)){ | |
| 6242 | +r=Math.ceil; | |
| 6243 | +} | |
| 6244 | +if(this.options.scaleX){ | |
| 6245 | +d.width=r(_827)+"px"; | |
| 6246 | +} | |
| 6247 | +if(this.options.scaleY){ | |
| 6248 | +d.height=r(_826)+"px"; | |
| 6249 | +} | |
| 6250 | +if(this.options.scaleFromCenter){ | |
| 6251 | +var topd=(_826-this.dims[0])/2; | |
| 6252 | +var _829=(_827-this.dims[1])/2; | |
| 6253 | +if(this.elementPositioning=="absolute"){ | |
| 6254 | +if(this.options.scaleY){ | |
| 6255 | +d.top=this.originalTop-topd+"px"; | |
| 6256 | +} | |
| 6257 | +if(this.options.scaleX){ | |
| 6258 | +d.left=this.originalLeft-_829+"px"; | |
| 6259 | +} | |
| 6260 | +}else{ | |
| 6261 | +if(this.options.scaleY){ | |
| 6262 | +d.top=-topd+"px"; | |
| 6263 | +} | |
| 6264 | +if(this.options.scaleX){ | |
| 6265 | +d.left=-_829+"px"; | |
| 6266 | +} | |
| 6267 | +} | |
| 6268 | +} | |
| 6269 | +MochiKit.Style.setStyle(this.element,d); | |
| 6270 | +}}); | |
| 6271 | +MochiKit.Visual.Highlight=function(_830,_831){ | |
| 6272 | +var cls=arguments.callee; | |
| 6273 | +if(!(this instanceof cls)){ | |
| 6274 | +return new cls(_830,_831); | |
| 6275 | +} | |
| 6276 | +this.__init__(_830,_831); | |
| 6277 | +}; | |
| 6278 | +MochiKit.Visual.Highlight.prototype=new MochiKit.Visual.Base(); | |
| 6279 | +MochiKit.Base.update(MochiKit.Visual.Highlight.prototype,{__init__:function(_832,_833){ | |
| 6280 | +this.element=MochiKit.DOM.getElement(_832); | |
| 6281 | +_833=MochiKit.Base.update({startcolor:"#ffff99"},_833||{}); | |
| 6282 | +this.start(_833); | |
| 6283 | +},setup:function(){ | |
| 6284 | +var b=MochiKit.Base; | |
| 6285 | +var s=MochiKit.Style; | |
| 6286 | +if(s.getStyle(this.element,"display")=="none"){ | |
| 6287 | +this.cancel(); | |
| 6288 | +return; | |
| 6289 | +} | |
| 6290 | +this.oldStyle={backgroundImage:s.getStyle(this.element,"background-image")}; | |
| 6291 | +s.setStyle(this.element,{backgroundImage:"none"}); | |
| 6292 | +if(!this.options.endcolor){ | |
| 6293 | +this.options.endcolor=MochiKit.Color.Color.fromBackground(this.element).toHexString(); | |
| 6294 | +} | |
| 6295 | +if(b.isUndefinedOrNull(this.options.restorecolor)){ | |
| 6296 | +this.options.restorecolor=s.getStyle(this.element,"background-color"); | |
| 6297 | +} | |
| 6298 | +this._base=b.map(b.bind(function(i){ | |
| 6299 | +return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16); | |
| 6300 | +},this),[0,1,2]); | |
| 6301 | +this._delta=b.map(b.bind(function(i){ | |
| 6302 | +return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]; | |
| 6303 | +},this),[0,1,2]); | |
| 6304 | +},update:function(_834){ | |
| 6305 | +var m="#"; | |
| 6306 | +MochiKit.Base.map(MochiKit.Base.bind(function(i){ | |
| 6307 | +m+=MochiKit.Color.toColorPart(Math.round(this._base[i]+this._delta[i]*_834)); | |
| 6308 | +},this),[0,1,2]); | |
| 6309 | +MochiKit.Style.setStyle(this.element,{backgroundColor:m}); | |
| 6310 | +},finish:function(){ | |
| 6311 | +MochiKit.Style.setStyle(this.element,MochiKit.Base.update(this.oldStyle,{backgroundColor:this.options.restorecolor})); | |
| 6312 | +}}); | |
| 6313 | +MochiKit.Visual.ScrollTo=function(_835,_836){ | |
| 6314 | +var cls=arguments.callee; | |
| 6315 | +if(!(this instanceof cls)){ | |
| 6316 | +return new cls(_835,_836); | |
| 6317 | +} | |
| 6318 | +this.__init__(_835,_836); | |
| 6319 | +}; | |
| 6320 | +MochiKit.Visual.ScrollTo.prototype=new MochiKit.Visual.Base(); | |
| 6321 | +MochiKit.Base.update(MochiKit.Visual.ScrollTo.prototype,{__init__:function(_837,_838){ | |
| 6322 | +this.element=MochiKit.DOM.getElement(_837); | |
| 6323 | +this.start(_838||{}); | |
| 6324 | +},setup:function(){ | |
| 6325 | +var p=MochiKit.Position; | |
| 6326 | +p.prepare(); | |
| 6327 | +var _839=p.cumulativeOffset(this.element); | |
| 6328 | +if(this.options.offset){ | |
| 6329 | +_839.y+=this.options.offset; | |
| 6330 | +} | |
| 6331 | +var max; | |
| 6332 | +if(window.innerHeight){ | |
| 6333 | +max=window.innerHeight-window.height; | |
| 6334 | +}else{ | |
| 6335 | +if(document.documentElement&&document.documentElement.clientHeight){ | |
| 6336 | +max=document.documentElement.clientHeight-document.body.scrollHeight; | |
| 6337 | +}else{ | |
| 6338 | +if(document.body){ | |
| 6339 | +max=document.body.clientHeight-document.body.scrollHeight; | |
| 6340 | +} | |
| 6341 | +} | |
| 6342 | +} | |
| 6343 | +this.scrollStart=p.windowOffset.y; | |
| 6344 | +this.delta=(_839.y>max?max:_839.y)-this.scrollStart; | |
| 6345 | +},update:function(_840){ | |
| 6346 | +var p=MochiKit.Position; | |
| 6347 | +p.prepare(); | |
| 6348 | +window.scrollTo(p.windowOffset.x,this.scrollStart+(_840*this.delta)); | |
| 6349 | +}}); | |
| 6350 | +MochiKit.Visual.fade=function(_841,_842){ | |
| 6351 | +var s=MochiKit.Style; | |
| 6352 | +var _843=s.getStyle(_841,"opacity"); | |
| 6353 | +_842=MochiKit.Base.update({from:s.getStyle(_841,"opacity")||1,to:0,afterFinishInternal:function(_844){ | |
| 6354 | +if(_844.options.to!==0){ | |
| 6355 | +return; | |
| 6356 | +} | |
| 6357 | +s.hideElement(_844.element); | |
| 6358 | +s.setStyle(_844.element,{"opacity":_843}); | |
| 6359 | +}},_842||{}); | |
| 6360 | +return new MochiKit.Visual.Opacity(_841,_842); | |
| 6361 | +}; | |
| 6362 | +MochiKit.Visual.appear=function(_845,_846){ | |
| 6363 | +var s=MochiKit.Style; | |
| 6364 | +var v=MochiKit.Visual; | |
| 6365 | +_846=MochiKit.Base.update({from:(s.getStyle(_845,"display")=="none"?0:s.getStyle(_845,"opacity")||0),to:1,afterFinishInternal:function(_847){ | |
| 6366 | +v.forceRerendering(_847.element); | |
| 6367 | +},beforeSetupInternal:function(_848){ | |
| 6368 | +s.setStyle(_848.element,{"opacity":_848.options.from}); | |
| 6369 | +s.showElement(_848.element); | |
| 6370 | +}},_846||{}); | |
| 6371 | +return new v.Opacity(_845,_846); | |
| 6372 | +}; | |
| 6373 | +MochiKit.Visual.puff=function(_849,_850){ | |
| 6374 | +var s=MochiKit.Style; | |
| 6375 | +var v=MochiKit.Visual; | |
| 6376 | +_849=MochiKit.DOM.getElement(_849); | |
| 6377 | +var _851={position:s.getStyle(_849,"position"),top:_849.style.top,left:_849.style.left,width:_849.style.width,height:_849.style.height,opacity:s.getStyle(_849,"opacity")}; | |
| 6378 | +_850=MochiKit.Base.update({beforeSetupInternal:function(_852){ | |
| 6379 | +MochiKit.Position.absolutize(_852.effects[0].element); | |
| 6380 | +},afterFinishInternal:function(_853){ | |
| 6381 | +s.hideElement(_853.effects[0].element); | |
| 6382 | +s.setStyle(_853.effects[0].element,_851); | |
| 6383 | +}},_850||{}); | |
| 6384 | +return new v.Parallel([new v.Scale(_849,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new v.Opacity(_849,{sync:true,to:0})],_850); | |
| 6385 | +}; | |
| 6386 | +MochiKit.Visual.blindUp=function(_854,_855){ | |
| 6387 | +var d=MochiKit.DOM; | |
| 6388 | +_854=d.getElement(_854); | |
| 6389 | +var _856=d.makeClipping(_854); | |
| 6390 | +_855=MochiKit.Base.update({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(_857){ | |
| 6391 | +MochiKit.Style.hideElement(_857.element); | |
| 6392 | +d.undoClipping(_857.element,_856); | |
| 6393 | +}},_855||{}); | |
| 6394 | +return new MochiKit.Visual.Scale(_854,0,_855); | |
| 6395 | +}; | |
| 6396 | +MochiKit.Visual.blindDown=function(_858,_859){ | |
| 6397 | +var d=MochiKit.DOM; | |
| 6398 | +var s=MochiKit.Style; | |
| 6399 | +_858=d.getElement(_858); | |
| 6400 | +var _860=s.getElementDimensions(_858); | |
| 6401 | +var _861; | |
| 6402 | +_859=MochiKit.Base.update({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:_860.h,originalWidth:_860.w},restoreAfterFinish:true,afterSetupInternal:function(_862){ | |
| 6403 | +_861=d.makeClipping(_862.element); | |
| 6404 | +s.setStyle(_862.element,{height:"0px"}); | |
| 6405 | +s.showElement(_862.element); | |
| 6406 | +},afterFinishInternal:function(_863){ | |
| 6407 | +d.undoClipping(_863.element,_861); | |
| 6408 | +}},_859||{}); | |
| 6409 | +return new MochiKit.Visual.Scale(_858,100,_859); | |
| 6410 | +}; | |
| 6411 | +MochiKit.Visual.switchOff=function(_864,_865){ | |
| 6412 | +var d=MochiKit.DOM; | |
| 6413 | +_864=d.getElement(_864); | |
| 6414 | +var _866=MochiKit.Style.getStyle(_864,"opacity"); | |
| 6415 | +var _867; | |
| 6416 | +var _865=MochiKit.Base.update({duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetupInternal:function(_868){ | |
| 6417 | +d.makePositioned(_868.element); | |
| 6418 | +_867=d.makeClipping(_868.element); | |
| 6419 | +},afterFinishInternal:function(_869){ | |
| 6420 | +MochiKit.Style.hideElement(_869.element); | |
| 6421 | +d.undoClipping(_869.element,_867); | |
| 6422 | +d.undoPositioned(_869.element); | |
| 6423 | +MochiKit.Style.setStyle(_869.element,{"opacity":_866}); | |
| 6424 | +}},_865||{}); | |
| 6425 | +var v=MochiKit.Visual; | |
| 6426 | +return new v.appear(_864,{duration:0.4,from:0,transition:v.Transitions.flicker,afterFinishInternal:function(_870){ | |
| 6427 | +new v.Scale(_870.element,1,_865); | |
| 6428 | +}}); | |
| 6429 | +}; | |
| 6430 | +MochiKit.Visual.dropOut=function(_871,_872){ | |
| 6431 | +var d=MochiKit.DOM; | |
| 6432 | +var s=MochiKit.Style; | |
| 6433 | +_871=d.getElement(_871); | |
| 6434 | +var _873={top:s.getStyle(_871,"top"),left:s.getStyle(_871,"left"),opacity:s.getStyle(_871,"opacity")}; | |
| 6435 | +_872=MochiKit.Base.update({duration:0.5,distance:100,beforeSetupInternal:function(_874){ | |
| 6436 | +d.makePositioned(_874.effects[0].element); | |
| 6437 | +},afterFinishInternal:function(_875){ | |
| 6438 | +s.hideElement(_875.effects[0].element); | |
| 6439 | +d.undoPositioned(_875.effects[0].element); | |
| 6440 | +s.setStyle(_875.effects[0].element,_873); | |
| 6441 | +}},_872||{}); | |
| 6442 | +var v=MochiKit.Visual; | |
| 6443 | +return new v.Parallel([new v.Move(_871,{x:0,y:_872.distance,sync:true}),new v.Opacity(_871,{sync:true,to:0})],_872); | |
| 6444 | +}; | |
| 6445 | +MochiKit.Visual.shake=function(_876,_877){ | |
| 6446 | +var d=MochiKit.DOM; | |
| 6447 | +var v=MochiKit.Visual; | |
| 6448 | +var s=MochiKit.Style; | |
| 6449 | +_876=d.getElement(_876); | |
| 6450 | +_877=MochiKit.Base.update({x:-20,y:0,duration:0.05,afterFinishInternal:function(_878){ | |
| 6451 | +d.undoPositioned(_878.element); | |
| 6452 | +s.setStyle(_878.element,oldStyle); | |
| 6453 | +}},_877||{}); | |
| 6454 | +var _879={top:s.getStyle(_876,"top"),left:s.getStyle(_876,"left")}; | |
| 6455 | +return new v.Move(_876,{x:20,y:0,duration:0.05,afterFinishInternal:function(_880){ | |
| 6456 | +new v.Move(_880.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(_880){ | |
| 6457 | +new v.Move(_880.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(_880){ | |
| 6458 | +new v.Move(_880.element,{x:-40,y:0,duration:0.1,afterFinishInternal:function(_880){ | |
| 6459 | +new v.Move(_880.element,{x:40,y:0,duration:0.1,afterFinishInternal:function(_880){ | |
| 6460 | +new v.Move(_880.element,_877); | |
| 6461 | +}}); | |
| 6462 | +}}); | |
| 6463 | +}}); | |
| 6464 | +}}); | |
| 6465 | +}}); | |
| 6466 | +}; | |
| 6467 | +MochiKit.Visual.slideDown=function(_881,_882){ | |
| 6468 | +var d=MochiKit.DOM; | |
| 6469 | +var b=MochiKit.Base; | |
| 6470 | +var s=MochiKit.Style; | |
| 6471 | +_881=d.getElement(_881); | |
| 6472 | +if(!_881.firstChild){ | |
| 6473 | +throw "MochiKit.Visual.slideDown must be used on a element with a child"; | |
| 6474 | +} | |
| 6475 | +d.removeEmptyTextNodes(_881); | |
| 6476 | +var _883=s.getStyle(_881.firstChild,"bottom")||0; | |
| 6477 | +var _884=s.getElementDimensions(_881); | |
| 6478 | +var _885; | |
| 6479 | +_882=b.update({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:_884.h,originalWidth:_884.w},restoreAfterFinish:true,afterSetupInternal:function(_886){ | |
| 6480 | +d.makePositioned(_886.element); | |
| 6481 | +d.makePositioned(_886.element.firstChild); | |
| 6482 | +if(/Opera/.test(navigator.userAgent)){ | |
| 6483 | +s.setStyle(_886.element,{top:""}); | |
| 6484 | +} | |
| 6485 | +_885=d.makeClipping(_886.element); | |
| 6486 | +s.setStyle(_886.element,{height:"0px"}); | |
| 6487 | +s.showElement(_886.element); | |
| 6488 | +},afterUpdateInternal:function(_887){ | |
| 6489 | +s.setStyle(_887.element.firstChild,{bottom:(_887.dims[0]-_887.element.clientHeight)+"px"}); | |
| 6490 | +},afterFinishInternal:function(_888){ | |
| 6491 | +d.undoClipping(_888.element,_885); | |
| 6492 | +if(/MSIE/.test(navigator.userAgent)){ | |
| 6493 | +d.undoPositioned(_888.element); | |
| 6494 | +d.undoPositioned(_888.element.firstChild); | |
| 6495 | +}else{ | |
| 6496 | +d.undoPositioned(_888.element.firstChild); | |
| 6497 | +d.undoPositioned(_888.element); | |
| 6498 | +} | |
| 6499 | +s.setStyle(_888.element.firstChild,{bottom:_883}); | |
| 6500 | +}},_882||{}); | |
| 6501 | +return new MochiKit.Visual.Scale(_881,100,_882); | |
| 6502 | +}; | |
| 6503 | +MochiKit.Visual.slideUp=function(_889,_890){ | |
| 6504 | +var d=MochiKit.DOM; | |
| 6505 | +var b=MochiKit.Base; | |
| 6506 | +var s=MochiKit.Style; | |
| 6507 | +_889=d.getElement(_889); | |
| 6508 | +if(!_889.firstChild){ | |
| 6509 | +throw "MochiKit.Visual.slideUp must be used on a element with a child"; | |
| 6510 | +} | |
| 6511 | +d.removeEmptyTextNodes(_889); | |
| 6512 | +var _891=s.getStyle(_889.firstChild,"bottom"); | |
| 6513 | +var _892; | |
| 6514 | +_890=b.update({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(_893){ | |
| 6515 | +d.makePositioned(_893.element); | |
| 6516 | +d.makePositioned(_893.element.firstChild); | |
| 6517 | +if(/Opera/.test(navigator.userAgent)){ | |
| 6518 | +s.setStyle(_893.element,{top:""}); | |
| 6519 | +} | |
| 6520 | +_892=d.makeClipping(_893.element); | |
| 6521 | +s.showElement(_893.element); | |
| 6522 | +},afterUpdateInternal:function(_894){ | |
| 6523 | +s.setStyle(_894.element.firstChild,{bottom:(_894.dims[0]-_894.element.clientHeight)+"px"}); | |
| 6524 | +},afterFinishInternal:function(_895){ | |
| 6525 | +s.hideElement(_895.element); | |
| 6526 | +d.undoClipping(_895.element,_892); | |
| 6527 | +d.undoPositioned(_895.element.firstChild); | |
| 6528 | +d.undoPositioned(_895.element); | |
| 6529 | +s.setStyle(_895.element.firstChild,{bottom:_891}); | |
| 6530 | +}},_890||{}); | |
| 6531 | +return new MochiKit.Visual.Scale(_889,0,_890); | |
| 6532 | +}; | |
| 6533 | +MochiKit.Visual.squish=function(_896,_897){ | |
| 6534 | +var d=MochiKit.DOM; | |
| 6535 | +var b=MochiKit.Base; | |
| 6536 | +var _898; | |
| 6537 | +_897=b.update({restoreAfterFinish:true,beforeSetupInternal:function(_899){ | |
| 6538 | +_898=d.makeClipping(_899.element); | |
| 6539 | +},afterFinishInternal:function(_900){ | |
| 6540 | +MochiKit.Style.hideElement(_900.element); | |
| 6541 | +d.undoClipping(_900.element,_898); | |
| 6542 | +}},_897||{}); | |
| 6543 | +return new MochiKit.Visual.Scale(_896,/Opera/.test(navigator.userAgent)?1:0,_897); | |
| 6544 | +}; | |
| 6545 | +MochiKit.Visual.grow=function(_901,_902){ | |
| 6546 | +var d=MochiKit.DOM; | |
| 6547 | +var v=MochiKit.Visual; | |
| 6548 | +var s=MochiKit.Style; | |
| 6549 | +_901=d.getElement(_901); | |
| 6550 | +_902=MochiKit.Base.update({direction:"center",moveTransition:v.Transitions.sinoidal,scaleTransition:v.Transitions.sinoidal,opacityTransition:v.Transitions.full},_902||{}); | |
| 6551 | +var _903={top:_901.style.top,left:_901.style.left,height:_901.style.height,width:_901.style.width,opacity:s.getStyle(_901,"opacity")}; | |
| 6552 | +var dims=s.getElementDimensions(_901); | |
| 6553 | +var _905,initialMoveY; | |
| 6554 | +var _906,moveY; | |
| 6555 | +switch(_902.direction){ | |
| 6556 | +case "top-left": | |
| 6557 | +_905=initialMoveY=_906=moveY=0; | |
| 6558 | +break; | |
| 6559 | +case "top-right": | |
| 6560 | +_905=dims.w; | |
| 6561 | +initialMoveY=moveY=0; | |
| 6562 | +_906=-dims.w; | |
| 6563 | +break; | |
| 6564 | +case "bottom-left": | |
| 6565 | +_905=_906=0; | |
| 6566 | +initialMoveY=dims.h; | |
| 6567 | +moveY=-dims.h; | |
| 6568 | +break; | |
| 6569 | +case "bottom-right": | |
| 6570 | +_905=dims.w; | |
| 6571 | +initialMoveY=dims.h; | |
| 6572 | +_906=-dims.w; | |
| 6573 | +moveY=-dims.h; | |
| 6574 | +break; | |
| 6575 | +case "center": | |
| 6576 | +_905=dims.w/2; | |
| 6577 | +initialMoveY=dims.h/2; | |
| 6578 | +_906=-dims.w/2; | |
| 6579 | +moveY=-dims.h/2; | |
| 6580 | +break; | |
| 6581 | +} | |
| 6582 | +var _907=MochiKit.Base.update({beforeSetupInternal:function(_908){ | |
| 6583 | +s.setStyle(_908.effects[0].element,{height:"0px"}); | |
| 6584 | +s.showElement(_908.effects[0].element); | |
| 6585 | +},afterFinishInternal:function(_909){ | |
| 6586 | +d.undoClipping(_909.effects[0].element); | |
| 6587 | +d.undoPositioned(_909.effects[0].element); | |
| 6588 | +s.setStyle(_909.effects[0].element,_903); | |
| 6589 | +}},_902||{}); | |
| 6590 | +return new v.Move(_901,{x:_905,y:initialMoveY,duration:0.01,beforeSetupInternal:function(_910){ | |
| 6591 | +s.hideElement(_910.element); | |
| 6592 | +d.makeClipping(_910.element); | |
| 6593 | +d.makePositioned(_910.element); | |
| 6594 | +},afterFinishInternal:function(_911){ | |
| 6595 | +new v.Parallel([new v.Opacity(_911.element,{sync:true,to:1,from:0,transition:_902.opacityTransition}),new v.Move(_911.element,{x:_906,y:moveY,sync:true,transition:_902.moveTransition}),new v.Scale(_911.element,100,{scaleMode:{originalHeight:dims.h,originalWidth:dims.w},sync:true,scaleFrom:/Opera/.test(navigator.userAgent)?1:0,transition:_902.scaleTransition,restoreAfterFinish:true})],_907); | |
| 6596 | +}}); | |
| 6597 | +}; | |
| 6598 | +MochiKit.Visual.shrink=function(_912,_913){ | |
| 6599 | +var d=MochiKit.DOM; | |
| 6600 | +var v=MochiKit.Visual; | |
| 6601 | +var s=MochiKit.Style; | |
| 6602 | +_912=d.getElement(_912); | |
| 6603 | +_913=MochiKit.Base.update({direction:"center",moveTransition:v.Transitions.sinoidal,scaleTransition:v.Transitions.sinoidal,opacityTransition:v.Transitions.none},_913||{}); | |
| 6604 | +var _914={top:_912.style.top,left:_912.style.left,height:_912.style.height,width:_912.style.width,opacity:s.getStyle(_912,"opacity")}; | |
| 6605 | +var dims=s.getElementDimensions(_912); | |
| 6606 | +var _915,moveY; | |
| 6607 | +switch(_913.direction){ | |
| 6608 | +case "top-left": | |
| 6609 | +_915=moveY=0; | |
| 6610 | +break; | |
| 6611 | +case "top-right": | |
| 6612 | +_915=dims.w; | |
| 6613 | +moveY=0; | |
| 6614 | +break; | |
| 6615 | +case "bottom-left": | |
| 6616 | +_915=0; | |
| 6617 | +moveY=dims.h; | |
| 6618 | +break; | |
| 6619 | +case "bottom-right": | |
| 6620 | +_915=dims.w; | |
| 6621 | +moveY=dims.h; | |
| 6622 | +break; | |
| 6623 | +case "center": | |
| 6624 | +_915=dims.w/2; | |
| 6625 | +moveY=dims.h/2; | |
| 6626 | +break; | |
| 6627 | +} | |
| 6628 | +var _916; | |
| 6629 | +var _917=MochiKit.Base.update({beforeStartInternal:function(_918){ | |
| 6630 | +_916=d.makePositioned(_918.effects[0].element); | |
| 6631 | +d.makeClipping(_918.effects[0].element); | |
| 6632 | +},afterFinishInternal:function(_919){ | |
| 6633 | +s.hideElement(_919.effects[0].element); | |
| 6634 | +d.undoClipping(_919.effects[0].element,_916); | |
| 6635 | +d.undoPositioned(_919.effects[0].element); | |
| 6636 | +s.setStyle(_919.effects[0].element,_914); | |
| 6637 | +}},_913||{}); | |
| 6638 | +return new v.Parallel([new v.Opacity(_912,{sync:true,to:0,from:1,transition:_913.opacityTransition}),new v.Scale(_912,/Opera/.test(navigator.userAgent)?1:0,{sync:true,transition:_913.scaleTransition,restoreAfterFinish:true}),new v.Move(_912,{x:_915,y:moveY,sync:true,transition:_913.moveTransition})],_917); | |
| 6639 | +}; | |
| 6640 | +MochiKit.Visual.pulsate=function(_920,_921){ | |
| 6641 | +var d=MochiKit.DOM; | |
| 6642 | +var v=MochiKit.Visual; | |
| 6643 | +var b=MochiKit.Base; | |
| 6644 | +var _922=MochiKit.Style.getStyle(_920,"opacity"); | |
| 6645 | +_921=b.update({duration:3,from:0,afterFinishInternal:function(_923){ | |
| 6646 | +MochiKit.Style.setStyle(_923.element,{"opacity":_922}); | |
| 6647 | +}},_921||{}); | |
| 6648 | +var _924=_921.transition||v.Transitions.sinoidal; | |
| 6649 | +var _925=b.bind(function(pos){ | |
| 6650 | +return _924(1-v.Transitions.pulse(pos)); | |
| 6651 | +},_924); | |
| 6652 | +b.bind(_925,_924); | |
| 6653 | +return new v.Opacity(_920,b.update({transition:_925},_921)); | |
| 6654 | +}; | |
| 6655 | +MochiKit.Visual.fold=function(_926,_927){ | |
| 6656 | +var d=MochiKit.DOM; | |
| 6657 | +var v=MochiKit.Visual; | |
| 6658 | +var s=MochiKit.Style; | |
| 6659 | +_926=d.getElement(_926); | |
| 6660 | +var _928={top:_926.style.top,left:_926.style.left,width:_926.style.width,height:_926.style.height}; | |
| 6661 | +var _929=d.makeClipping(_926); | |
| 6662 | +_927=MochiKit.Base.update({scaleContent:false,scaleX:false,afterFinishInternal:function(_930){ | |
| 6663 | +new v.Scale(_926,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(_930){ | |
| 6664 | +s.hideElement(_930.element); | |
| 6665 | +d.undoClipping(_930.element,_929); | |
| 6666 | +s.setStyle(_930.element,_928); | |
| 6667 | +}}); | |
| 6668 | +}},_927||{}); | |
| 6669 | +return new v.Scale(_926,5,_927); | |
| 6670 | +}; | |
| 6671 | +MochiKit.Visual.Color=MochiKit.Color.Color; | |
| 6672 | +MochiKit.Visual.getElementsComputedStyle=MochiKit.DOM.computedStyle; | |
| 6673 | +MochiKit.Visual.__new__=function(){ | |
| 6674 | +var m=MochiKit.Base; | |
| 6675 | +m.nameFunctions(this); | |
| 6676 | +this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; | |
| 6677 | +}; | |
| 6678 | +MochiKit.Visual.EXPORT=["roundElement","roundClass","tagifyText","multiple","toggle","Parallel","Opacity","Move","Scale","Highlight","ScrollTo","fade","appear","puff","blindUp","blindDown","switchOff","dropOut","shake","slideDown","slideUp","squish","grow","shrink","pulsate","fold"]; | |
| 6679 | +MochiKit.Visual.EXPORT_OK=["Base","PAIRS"]; | |
| 6680 | +MochiKit.Visual.__new__(); | |
| 6681 | +MochiKit.Base._exportSymbols(this,MochiKit.Visual); | |
| 6682 | +if(typeof (MochiKit)=="undefined"){ | |
| 6683 | +MochiKit={}; | |
| 6684 | +} | |
| 6685 | +if(typeof (MochiKit.MochiKit)=="undefined"){ | |
| 6686 | +MochiKit.MochiKit={}; | |
| 6687 | +} | |
| 6688 | +MochiKit.MochiKit.NAME="MochiKit.MochiKit"; | |
| 6689 | +MochiKit.MochiKit.VERSION="1.4"; | |
| 6690 | +MochiKit.MochiKit.__repr__=function(){ | |
| 6691 | +return "["+this.NAME+" "+this.VERSION+"]"; | |
| 6692 | +}; | |
| 6693 | +MochiKit.MochiKit.toString=function(){ | |
| 6694 | +return this.__repr__(); | |
| 6695 | +}; | |
| 6696 | +MochiKit.MochiKit.SUBMODULES=["Base","Iter","Logging","DateTime","Format","Async","DOM","Selector","Style","LoggingPane","Color","Signal","Position","Visual"]; | |
| 6697 | +if(typeof (JSAN)!="undefined"||typeof (dojo)!="undefined"){ | |
| 6698 | +if(typeof (dojo)!="undefined"){ | |
| 6699 | +dojo.provide("MochiKit.MochiKit"); | |
| 6700 | +dojo.require("MochiKit.*"); | |
| 6701 | +} | |
| 6702 | +if(typeof (JSAN)!="undefined"){ | |
| 6703 | +(function(lst){ | |
| 6704 | +for(var i=0;i<lst.length;i++){ | |
| 6705 | +JSAN.use("MochiKit."+lst[i],[]); | |
| 6706 | +} | |
| 6707 | +})(MochiKit.MochiKit.SUBMODULES); | |
| 6708 | +} | |
| 6709 | +(function(){ | |
| 6710 | +var _931=MochiKit.Base.extend; | |
| 6711 | +var self=MochiKit.MochiKit; | |
| 6712 | +var _932=self.SUBMODULES; | |
| 6713 | +var _933=[]; | |
| 6714 | +var _934=[]; | |
| 6715 | +var _935={}; | |
| 6716 | +var i,k,m,all; | |
| 6717 | +for(i=0;i<_932.length;i++){ | |
| 6718 | +m=MochiKit[_932[i]]; | |
| 6719 | +_931(_933,m.EXPORT); | |
| 6720 | +_931(_934,m.EXPORT_OK); | |
| 6721 | +for(k in m.EXPORT_TAGS){ | |
| 6722 | +_935[k]=_931(_935[k],m.EXPORT_TAGS[k]); | |
| 6723 | +} | |
| 6724 | +all=m.EXPORT_TAGS[":all"]; | |
| 6725 | +if(!all){ | |
| 6726 | +all=_931(null,m.EXPORT,m.EXPORT_OK); | |
| 6727 | +} | |
| 6728 | +var j; | |
| 6729 | +for(j=0;j<all.length;j++){ | |
| 6730 | +k=all[j]; | |
| 6731 | +self[k]=m[k]; | |
| 6732 | +} | |
| 6733 | +} | |
| 6734 | +self.EXPORT=_933; | |
| 6735 | +self.EXPORT_OK=_934; | |
| 6736 | +self.EXPORT_TAGS=_935; | |
| 6737 | +}()); | |
| 6738 | +}else{ | |
| 6739 | +if(typeof (MochiKit.__compat__)=="undefined"){ | |
| 6740 | +MochiKit.__compat__=true; | |
| 6741 | +} | |
| 6742 | +(function(){ | |
| 6743 | +if(typeof (document)=="undefined"){ | |
| 6744 | +return; | |
| 6745 | +} | |
| 6746 | +var _936=document.getElementsByTagName("script"); | |
| 6747 | +var _937="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; | |
| 6748 | +var base=null; | |
| 6749 | +var _938=null; | |
| 6750 | +var _939={}; | |
| 6751 | +var i; | |
| 6752 | +for(i=0;i<_936.length;i++){ | |
| 6753 | +var src=_936[i].getAttribute("src"); | |
| 6754 | +if(!src){ | |
| 6755 | +continue; | |
| 6756 | +} | |
| 6757 | +_939[src]=true; | |
| 6758 | +if(src.match(/MochiKit.js$/)){ | |
| 6759 | +base=src.substring(0,src.lastIndexOf("MochiKit.js")); | |
| 6760 | +_938=_936[i]; | |
| 6761 | +} | |
| 6762 | +} | |
| 6763 | +if(base===null){ | |
| 6764 | +return; | |
| 6765 | +} | |
| 6766 | +var _940=MochiKit.MochiKit.SUBMODULES; | |
| 6767 | +for(var i=0;i<_940.length;i++){ | |
| 6768 | +if(MochiKit[_940[i]]){ | |
| 6769 | +continue; | |
| 6770 | +} | |
| 6771 | +var uri=base+_940[i]+".js"; | |
| 6772 | +if(uri in _939){ | |
| 6773 | +continue; | |
| 6774 | +} | |
| 6775 | +if(document.documentElement&&document.documentElement.namespaceURI==_937){ | |
| 6776 | +var s=document.createElementNS(_937,"script"); | |
| 6777 | +s.setAttribute("id","MochiKit_"+base+_940[i]); | |
| 6778 | +s.setAttribute("src",uri); | |
| 6779 | +s.setAttribute("type","application/x-javascript"); | |
| 6780 | +_938.parentNode.appendChild(s); | |
| 6781 | +}else{ | |
| 6782 | +document.write("<script src=\""+uri+"\" type=\"text/javascript\"></script>"); | |
| 6783 | +} | |
| 6784 | +} | |
| 6785 | +})(); | |
| 6786 | +} | |
| 6787 | + | |
| 6788 | + | ... | ... |