1 /*** 2 3 MochiKit.MochiKit 1.4.2 : 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.2"; 27 MochiKit.Base.NAME="MochiKit.Base"; 28 MochiKit.Base.update=function(_1,_2){ 29 if(_1===null||_1===undefined){ 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(_b){ 61 var me=arguments.callee; 62 if(arguments.length==1){ 63 me.prototype=_b; 64 return new me(); 65 } 66 },_deps:function(_d,_e){ 67 if(!(_d in MochiKit)){ 68 MochiKit[_d]={}; 69 } 70 if(typeof (dojo)!="undefined"){ 71 dojo.provide("MochiKit."+_d); 72 } 73 for(var i=0;i<_e.length;i++){ 74 if(typeof (dojo)!="undefined"){ 75 dojo.require("MochiKit."+_e[i]); 76 } 77 if(typeof (JSAN)!="undefined"){ 78 JSAN.use("MochiKit."+_e[i],[]); 79 } 80 if(!(_e[i] in MochiKit)){ 81 throw "MochiKit."+_d+" depends on MochiKit."+_e[i]+"!"; 82 } 83 } 84 },_flattenArray:function(res,lst){ 85 for(var i=0;i<lst.length;i++){ 86 var o=lst[i]; 87 if(o instanceof Array){ 88 arguments.callee(res,o); 89 }else{ 90 res.push(o); 91 } 92 } 93 return res; 94 },flattenArray:function(lst){ 95 return MochiKit.Base._flattenArray([],lst); 96 },flattenArguments:function(lst){ 97 var res=[]; 98 var m=MochiKit.Base; 99 var _18=m.extend(null,arguments); 100 while(_18.length){ 101 var o=_18.shift(); 102 if(o&&typeof (o)=="object"&&typeof (o.length)=="number"){ 103 for(var i=o.length-1;i>=0;i--){ 104 _18.unshift(o[i]); 105 } 106 }else{ 107 res.push(o); 108 } 109 } 110 return res; 111 },extend:function(_1b,obj,_1d){ 112 if(!_1d){ 113 _1d=0; 114 } 115 if(obj){ 116 var l=obj.length; 117 if(typeof (l)!="number"){ 118 if(typeof (MochiKit.Iter)!="undefined"){ 119 obj=MochiKit.Iter.list(obj); 120 l=obj.length; 121 }else{ 122 throw new TypeError("Argument not an array-like and MochiKit.Iter not present"); 123 } 124 } 125 if(!_1b){ 126 _1b=[]; 127 } 128 for(var i=_1d;i<l;i++){ 129 _1b.push(obj[i]); 130 } 131 } 132 return _1b; 133 },updatetree:function(_20,obj){ 134 if(_20===null||_20===undefined){ 135 _20={}; 136 } 137 for(var i=1;i<arguments.length;i++){ 138 var o=arguments[i]; 139 if(typeof (o)!="undefined"&&o!==null){ 140 for(var k in o){ 141 var v=o[k]; 142 if(typeof (_20[k])=="object"&&typeof (v)=="object"){ 143 arguments.callee(_20[k],v); 144 }else{ 145 _20[k]=v; 146 } 147 } 148 } 149 } 150 return _20; 151 },setdefault:function(_26,obj){ 152 if(_26===null||_26===undefined){ 153 _26={}; 154 } 155 for(var i=1;i<arguments.length;i++){ 156 var o=arguments[i]; 157 for(var k in o){ 158 if(!(k in _26)){ 159 _26[k]=o[k]; 160 } 161 } 162 } 163 return _26; 164 },keys:function(obj){ 165 var _2c=[]; 166 for(var _2d in obj){ 167 _2c.push(_2d); 168 } 169 return _2c; 170 },values:function(obj){ 171 var _2f=[]; 172 for(var _30 in obj){ 173 _2f.push(obj[_30]); 174 } 175 return _2f; 176 },items:function(obj){ 177 var _32=[]; 178 var e; 179 for(var _34 in obj){ 180 var v; 181 try{ 182 v=obj[_34]; 183 } 184 catch(e){ 185 continue; 186 } 187 _32.push([_34,v]); 188 } 189 return _32; 190 },_newNamedError:function(_36,_37,_38){ 191 _38.prototype=new MochiKit.Base.NamedError(_36.NAME+"."+_37); 192 _36[_37]=_38; 193 },operator:{truth:function(a){ 194 return !!a; 195 },lognot:function(a){ 196 return !a; 197 },identity:function(a){ 198 return a; 199 },not:function(a){ 200 return ~a; 201 },neg:function(a){ 202 return -a; 203 },add:function(a,b){ 204 return a+b; 205 },sub:function(a,b){ 206 return a-b; 207 },div:function(a,b){ 208 return a/b; 209 },mod:function(a,b){ 210 return a%b; 211 },mul:function(a,b){ 212 return a*b; 213 },and:function(a,b){ 214 return a&b; 215 },or:function(a,b){ 216 return a|b; 217 },xor:function(a,b){ 218 return a^b; 219 },lshift:function(a,b){ 220 return a<<b; 221 },rshift:function(a,b){ 222 return a>>b; 223 },zrshift:function(a,b){ 224 return a>>>b; 225 },eq:function(a,b){ 226 return a==b; 227 },ne:function(a,b){ 228 return a!=b; 229 },gt:function(a,b){ 230 return a>b; 231 },ge:function(a,b){ 232 return a>=b; 233 },lt:function(a,b){ 234 return a<b; 235 },le:function(a,b){ 236 return a<=b; 237 },seq:function(a,b){ 238 return a===b; 239 },sne:function(a,b){ 240 return a!==b; 241 },ceq:function(a,b){ 242 return MochiKit.Base.compare(a,b)===0; 243 },cne:function(a,b){ 244 return MochiKit.Base.compare(a,b)!==0; 245 },cgt:function(a,b){ 246 return MochiKit.Base.compare(a,b)==1; 247 },cge:function(a,b){ 248 return MochiKit.Base.compare(a,b)!=-1; 249 },clt:function(a,b){ 250 return MochiKit.Base.compare(a,b)==-1; 251 },cle:function(a,b){ 252 return MochiKit.Base.compare(a,b)!=1; 253 },logand:function(a,b){ 254 return a&&b; 255 },logor:function(a,b){ 256 return a||b; 257 },contains:function(a,b){ 258 return b in a; 259 }},forwardCall:function(_76){ 260 return function(){ 261 return this[_76].apply(this,arguments); 262 }; 263 },itemgetter:function(_77){ 264 return function(arg){ 265 return arg[_77]; 266 }; 267 },typeMatcher:function(){ 268 var _79={}; 269 for(var i=0;i<arguments.length;i++){ 270 var typ=arguments[i]; 271 _79[typ]=typ; 272 } 273 return function(){ 274 for(var i=0;i<arguments.length;i++){ 275 if(!(typeof (arguments[i]) in _79)){ 276 return false; 277 } 278 } 279 return true; 280 }; 281 },isNull:function(){ 282 for(var i=0;i<arguments.length;i++){ 283 if(arguments[i]!==null){ 284 return false; 285 } 286 } 287 return true; 288 },isUndefinedOrNull:function(){ 289 for(var i=0;i<arguments.length;i++){ 290 var o=arguments[i]; 291 if(!(typeof (o)=="undefined"||o===null)){ 292 return false; 293 } 294 } 295 return true; 296 },isEmpty:function(obj){ 297 return !MochiKit.Base.isNotEmpty.apply(this,arguments); 298 },isNotEmpty:function(obj){ 299 for(var i=0;i<arguments.length;i++){ 300 var o=arguments[i]; 301 if(!(o&&o.length)){ 302 return false; 303 } 304 } 305 return true; 306 },isArrayLike:function(){ 307 for(var i=0;i<arguments.length;i++){ 308 var o=arguments[i]; 309 var typ=typeof (o); 310 if((typ!="object"&&!(typ=="function"&&typeof (o.item)=="function"))||o===null||typeof (o.length)!="number"||o.nodeType===3||o.nodeType===4){ 311 return false; 312 } 313 } 314 return true; 315 },isDateLike:function(){ 316 for(var i=0;i<arguments.length;i++){ 317 var o=arguments[i]; 318 if(typeof (o)!="object"||o===null||typeof (o.getTime)!="function"){ 319 return false; 320 } 321 } 322 return true; 323 },xmap:function(fn){ 324 if(fn===null){ 325 return MochiKit.Base.extend(null,arguments,1); 326 } 327 var _8a=[]; 328 for(var i=1;i<arguments.length;i++){ 329 _8a.push(fn(arguments[i])); 330 } 331 return _8a; 332 },map:function(fn,lst){ 333 var m=MochiKit.Base; 334 var itr=MochiKit.Iter; 335 var _90=m.isArrayLike; 336 if(arguments.length<=2){ 337 if(!_90(lst)){ 338 if(itr){ 339 lst=itr.list(lst); 340 if(fn===null){ 341 return lst; 342 } 343 }else{ 344 throw new TypeError("Argument not an array-like and MochiKit.Iter not present"); 345 } 346 } 347 if(fn===null){ 348 return m.extend(null,lst); 349 } 350 var _91=[]; 351 for(var i=0;i<lst.length;i++){ 352 _91.push(fn(lst[i])); 353 } 354 return _91; 355 }else{ 356 if(fn===null){ 357 fn=Array; 358 } 359 var _93=null; 360 for(i=1;i<arguments.length;i++){ 361 if(!_90(arguments[i])){ 362 if(itr){ 363 return itr.list(itr.imap.apply(null,arguments)); 364 }else{ 365 throw new TypeError("Argument not an array-like and MochiKit.Iter not present"); 366 } 367 } 368 var l=arguments[i].length; 369 if(_93===null||_93>l){ 370 _93=l; 371 } 372 } 373 _91=[]; 374 for(i=0;i<_93;i++){ 375 var _95=[]; 376 for(var j=1;j<arguments.length;j++){ 377 _95.push(arguments[j][i]); 378 } 379 _91.push(fn.apply(this,_95)); 380 } 381 return _91; 382 } 383 },xfilter:function(fn){ 384 var _98=[]; 385 if(fn===null){ 386 fn=MochiKit.Base.operator.truth; 387 } 388 for(var i=1;i<arguments.length;i++){ 389 var o=arguments[i]; 390 if(fn(o)){ 391 _98.push(o); 392 } 393 } 394 return _98; 395 },filter:function(fn,lst,_9d){ 396 var _9e=[]; 397 var m=MochiKit.Base; 398 if(!m.isArrayLike(lst)){ 399 if(MochiKit.Iter){ 400 lst=MochiKit.Iter.list(lst); 401 }else{ 402 throw new TypeError("Argument not an array-like and MochiKit.Iter not present"); 403 } 404 } 405 if(fn===null){ 406 fn=m.operator.truth; 407 } 408 if(typeof (Array.prototype.filter)=="function"){ 409 return Array.prototype.filter.call(lst,fn,_9d); 410 }else{ 411 if(typeof (_9d)=="undefined"||_9d===null){ 412 for(var i=0;i<lst.length;i++){ 413 var o=lst[i]; 414 if(fn(o)){ 415 _9e.push(o); 416 } 417 } 418 }else{ 419 for(i=0;i<lst.length;i++){ 420 o=lst[i]; 421 if(fn.call(_9d,o)){ 422 _9e.push(o); 423 } 424 } 425 } 426 } 427 return _9e; 428 },_wrapDumbFunction:function(_a2){ 429 return function(){ 430 switch(arguments.length){ 431 case 0: 432 return _a2(); 433 case 1: 434 return _a2(arguments[0]); 435 case 2: 436 return _a2(arguments[0],arguments[1]); 437 case 3: 438 return _a2(arguments[0],arguments[1],arguments[2]); 439 } 440 var _a3=[]; 441 for(var i=0;i<arguments.length;i++){ 442 _a3.push("arguments["+i+"]"); 443 } 444 return eval("(func("+_a3.join(",")+"))"); 445 }; 446 },methodcaller:function(_a5){ 447 var _a6=MochiKit.Base.extend(null,arguments,1); 448 if(typeof (_a5)=="function"){ 449 return function(obj){ 450 return _a5.apply(obj,_a6); 451 }; 452 }else{ 453 return function(obj){ 454 return obj[_a5].apply(obj,_a6); 455 }; 456 } 457 },method:function(_a9,_aa){ 458 var m=MochiKit.Base; 459 return m.bind.apply(this,m.extend([_aa,_a9],arguments,2)); 460 },compose:function(f1,f2){ 461 var _ae=[]; 462 var m=MochiKit.Base; 463 if(arguments.length===0){ 464 throw new TypeError("compose() requires at least one argument"); 465 } 466 for(var i=0;i<arguments.length;i++){ 467 var fn=arguments[i]; 468 if(typeof (fn)!="function"){ 469 throw new TypeError(m.repr(fn)+" is not a function"); 470 } 471 _ae.push(fn); 472 } 473 return function(){ 474 var _b2=arguments; 475 for(var i=_ae.length-1;i>=0;i--){ 476 _b2=[_ae[i].apply(this,_b2)]; 477 } 478 return _b2[0]; 479 }; 480 },bind:function(_b4,_b5){ 481 if(typeof (_b4)=="string"){ 482 _b4=_b5[_b4]; 483 } 484 var _b6=_b4.im_func; 485 var _b7=_b4.im_preargs; 486 var _b8=_b4.im_self; 487 var m=MochiKit.Base; 488 if(typeof (_b4)=="function"&&typeof (_b4.apply)=="undefined"){ 489 _b4=m._wrapDumbFunction(_b4); 490 } 491 if(typeof (_b6)!="function"){ 492 _b6=_b4; 493 } 494 if(typeof (_b5)!="undefined"){ 495 _b8=_b5; 496 } 497 if(typeof (_b7)=="undefined"){ 498 _b7=[]; 499 }else{ 500 _b7=_b7.slice(); 501 } 502 m.extend(_b7,arguments,2); 503 var _ba=function(){ 504 var _bb=arguments; 505 var me=arguments.callee; 506 if(me.im_preargs.length>0){ 507 _bb=m.concat(me.im_preargs,_bb); 508 } 509 var _bd=me.im_self; 510 if(!_bd){ 511 _bd=this; 512 } 513 return me.im_func.apply(_bd,_bb); 514 }; 515 _ba.im_self=_b8; 516 _ba.im_func=_b6; 517 _ba.im_preargs=_b7; 518 return _ba; 519 },bindLate:function(_be,_bf){ 520 var m=MochiKit.Base; 521 if(typeof (_be)!="string"){ 522 return m.bind.apply(this,arguments); 523 } 524 var _c1=m.extend([],arguments,2); 525 var _c2=function(){ 526 var _c3=arguments; 527 var me=arguments.callee; 528 if(me.im_preargs.length>0){ 529 _c3=m.concat(me.im_preargs,_c3); 530 } 531 var _c5=me.im_self; 532 if(!_c5){ 533 _c5=this; 534 } 535 return _c5[me.im_func].apply(_c5,_c3); 536 }; 537 _c2.im_self=_bf; 538 _c2.im_func=_be; 539 _c2.im_preargs=_c1; 540 return _c2; 541 },bindMethods:function(_c6){ 542 var _c7=MochiKit.Base.bind; 543 for(var k in _c6){ 544 var _c9=_c6[k]; 545 if(typeof (_c9)=="function"){ 546 _c6[k]=_c7(_c9,_c6); 547 } 548 } 549 },registerComparator:function(_ca,_cb,_cc,_cd){ 550 MochiKit.Base.comparatorRegistry.register(_ca,_cb,_cc,_cd); 551 },_primitives:{"boolean":true,"string":true,"number":true},compare:function(a,b){ 552 if(a==b){ 553 return 0; 554 } 555 var _d0=(typeof (a)=="undefined"||a===null); 556 var _d1=(typeof (b)=="undefined"||b===null); 557 if(_d0&&_d1){ 558 return 0; 559 }else{ 560 if(_d0){ 561 return -1; 562 }else{ 563 if(_d1){ 564 return 1; 565 } 566 } 567 } 568 var m=MochiKit.Base; 569 var _d3=m._primitives; 570 if(!(typeof (a) in _d3&&typeof (b) in _d3)){ 571 try{ 572 return m.comparatorRegistry.match(a,b); 573 } 574 catch(e){ 575 if(e!=m.NotFound){ 576 throw e; 577 } 578 } 579 } 580 if(a<b){ 581 return -1; 582 }else{ 583 if(a>b){ 584 return 1; 585 } 586 } 587 var _d4=m.repr; 588 throw new TypeError(_d4(a)+" and "+_d4(b)+" can not be compared"); 589 },compareDateLike:function(a,b){ 590 return MochiKit.Base.compare(a.getTime(),b.getTime()); 591 },compareArrayLike:function(a,b){ 592 var _d9=MochiKit.Base.compare; 593 var _da=a.length; 594 var _db=0; 595 if(_da>b.length){ 596 _db=1; 597 _da=b.length; 598 }else{ 599 if(_da<b.length){ 600 _db=-1; 601 } 602 } 603 for(var i=0;i<_da;i++){ 604 var cmp=_d9(a[i],b[i]); 605 if(cmp){ 606 return cmp; 607 } 608 } 609 return _db; 610 },registerRepr:function(_de,_df,_e0,_e1){ 611 MochiKit.Base.reprRegistry.register(_de,_df,_e0,_e1); 612 },repr:function(o){ 613 if(typeof (o)=="undefined"){ 614 return "undefined"; 615 }else{ 616 if(o===null){ 617 return "null"; 618 } 619 } 620 try{ 621 if(typeof (o.__repr__)=="function"){ 622 return o.__repr__(); 623 }else{ 624 if(typeof (o.repr)=="function"&&o.repr!=arguments.callee){ 625 return o.repr(); 626 } 627 } 628 return MochiKit.Base.reprRegistry.match(o); 629 } 630 catch(e){ 631 if(typeof (o.NAME)=="string"&&(o.toString==Function.prototype.toString||o.toString==Object.prototype.toString)){ 632 return o.NAME; 633 } 634 } 635 try{ 636 var _e3=(o+""); 637 } 638 catch(e){ 639 return "["+typeof (o)+"]"; 640 } 641 if(typeof (o)=="function"){ 642 _e3=_e3.replace(/^\s+/,"").replace(/\s+/g," "); 643 _e3=_e3.replace(/,(\S)/,", $1"); 644 var idx=_e3.indexOf("{"); 645 if(idx!=-1){ 646 _e3=_e3.substr(0,idx)+"{...}"; 647 } 648 } 649 return _e3; 650 },reprArrayLike:function(o){ 651 var m=MochiKit.Base; 652 return "["+m.map(m.repr,o).join(", ")+"]"; 653 },reprString:function(o){ 654 return ("\""+o.replace(/(["\\])/g,"\\$1")+"\"").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\v]/g,"\\v").replace(/[\r]/g,"\\r"); 655 },reprNumber:function(o){ 656 return o+""; 657 },registerJSON:function(_e9,_ea,_eb,_ec){ 658 MochiKit.Base.jsonRegistry.register(_e9,_ea,_eb,_ec); 659 },evalJSON:function(){ 660 return eval("("+MochiKit.Base._filterJSON(arguments[0])+")"); 661 },_filterJSON:function(s){ 662 var m=s.match(/^\s*\/\*(.*)\*\/\s*$/); 663 if(m){ 664 return m[1]; 665 } 666 return s; 667 },serializeJSON:function(o){ 668 var _f0=typeof (o); 669 if(_f0=="number"||_f0=="boolean"){ 670 return o+""; 671 }else{ 672 if(o===null){ 673 return "null"; 674 }else{ 675 if(_f0=="string"){ 676 var res=""; 677 for(var i=0;i<o.length;i++){ 678 var c=o.charAt(i); 679 if(c=="\""){ 680 res+="\\\""; 681 }else{ 682 if(c=="\\"){ 683 res+="\\\\"; 684 }else{ 685 if(c=="\b"){ 686 res+="\\b"; 687 }else{ 688 if(c=="\f"){ 689 res+="\\f"; 690 }else{ 691 if(c=="\n"){ 692 res+="\\n"; 693 }else{ 694 if(c=="\r"){ 695 res+="\\r"; 696 }else{ 697 if(c=="\t"){ 698 res+="\\t"; 699 }else{ 700 if(o.charCodeAt(i)<=31){ 701 var hex=o.charCodeAt(i).toString(16); 702 if(hex.length<2){ 703 hex="0"+hex; 704 } 705 res+="\\u00"+hex.toUpperCase(); 706 }else{ 707 res+=c; 708 } 709 } 710 } 711 } 712 } 713 } 714 } 715 } 716 } 717 return "\""+res+"\""; 718 } 719 } 720 } 721 var me=arguments.callee; 722 var _f6; 723 if(typeof (o.__json__)=="function"){ 724 _f6=o.__json__(); 725 if(o!==_f6){ 726 return me(_f6); 727 } 728 } 729 if(typeof (o.json)=="function"){ 730 _f6=o.json(); 731 if(o!==_f6){ 732 return me(_f6); 733 } 734 } 735 if(_f0!="function"&&typeof (o.length)=="number"){ 736 var res=[]; 737 for(var i=0;i<o.length;i++){ 738 var val=me(o[i]); 739 if(typeof (val)!="string"){ 740 continue; 741 } 742 res.push(val); 743 } 744 return "["+res.join(", ")+"]"; 745 } 746 var m=MochiKit.Base; 747 try{ 748 _f6=m.jsonRegistry.match(o); 749 if(o!==_f6){ 750 return me(_f6); 751 } 752 } 753 catch(e){ 754 if(e!=m.NotFound){ 755 throw e; 756 } 757 } 758 if(_f0=="undefined"){ 759 throw new TypeError("undefined can not be serialized as JSON"); 760 } 761 if(_f0=="function"){ 762 return null; 763 } 764 res=[]; 765 for(var k in o){ 766 var _fa; 767 if(typeof (k)=="number"){ 768 _fa="\""+k+"\""; 769 }else{ 770 if(typeof (k)=="string"){ 771 _fa=me(k); 772 }else{ 773 continue; 774 } 775 } 776 val=me(o[k]); 777 if(typeof (val)!="string"){ 778 continue; 779 } 780 res.push(_fa+":"+val); 781 } 782 return "{"+res.join(", ")+"}"; 783 },objEqual:function(a,b){ 784 return (MochiKit.Base.compare(a,b)===0); 785 },arrayEqual:function(_fd,arr){ 786 if(_fd.length!=arr.length){ 787 return false; 788 } 789 return (MochiKit.Base.compare(_fd,arr)===0); 790 },concat:function(){ 791 var _ff=[]; 792 var _100=MochiKit.Base.extend; 793 for(var i=0;i<arguments.length;i++){ 794 _100(_ff,arguments[i]); 795 } 796 return _ff; 797 },keyComparator:function(key){ 798 var m=MochiKit.Base; 799 var _104=m.compare; 800 if(arguments.length==1){ 801 return function(a,b){ 802 return _104(a[key],b[key]); 803 }; 804 } 805 var _107=m.extend(null,arguments); 806 return function(a,b){ 807 var rval=0; 808 for(var i=0;(rval===0)&&(i<_107.length);i++){ 809 var key=_107[i]; 810 rval=_104(a[key],b[key]); 811 } 812 return rval; 813 }; 814 },reverseKeyComparator:function(key){ 815 var _10e=MochiKit.Base.keyComparator.apply(this,arguments); 816 return function(a,b){ 817 return _10e(b,a); 818 }; 819 },partial:function(func){ 820 var m=MochiKit.Base; 821 return m.bind.apply(this,m.extend([func,undefined],arguments,1)); 822 },listMinMax:function(_113,lst){ 823 if(lst.length===0){ 824 return null; 825 } 826 var cur=lst[0]; 827 var _116=MochiKit.Base.compare; 828 for(var i=1;i<lst.length;i++){ 829 var o=lst[i]; 830 if(_116(o,cur)==_113){ 831 cur=o; 832 } 833 } 834 return cur; 835 },objMax:function(){ 836 return MochiKit.Base.listMinMax(1,arguments); 837 },objMin:function(){ 838 return MochiKit.Base.listMinMax(-1,arguments); 839 },findIdentical:function(lst,_11a,_11b,end){ 840 if(typeof (end)=="undefined"||end===null){ 841 end=lst.length; 842 } 843 if(typeof (_11b)=="undefined"||_11b===null){ 844 _11b=0; 845 } 846 for(var i=_11b;i<end;i++){ 847 if(lst[i]===_11a){ 848 return i; 849 } 850 } 851 return -1; 852 },mean:function(){ 853 var sum=0; 854 var m=MochiKit.Base; 855 var args=m.extend(null,arguments); 856 var _121=args.length; 857 while(args.length){ 858 var o=args.shift(); 859 if(o&&typeof (o)=="object"&&typeof (o.length)=="number"){ 860 _121+=o.length-1; 861 for(var i=o.length-1;i>=0;i--){ 862 sum+=o[i]; 863 } 864 }else{ 865 sum+=o; 866 } 867 } 868 if(_121<=0){ 869 throw new TypeError("mean() requires at least one argument"); 870 } 871 return sum/_121; 872 },median:function(){ 873 var data=MochiKit.Base.flattenArguments(arguments); 874 if(data.length===0){ 875 throw new TypeError("median() requires at least one argument"); 876 } 877 data.sort(compare); 878 if(data.length%2==0){ 879 var _125=data.length/2; 880 return (data[_125]+data[_125-1])/2; 881 }else{ 882 return data[(data.length-1)/2]; 883 } 884 },findValue:function(lst,_127,_128,end){ 885 if(typeof (end)=="undefined"||end===null){ 886 end=lst.length; 887 } 888 if(typeof (_128)=="undefined"||_128===null){ 889 _128=0; 890 } 891 var cmp=MochiKit.Base.compare; 892 for(var i=_128;i<end;i++){ 893 if(cmp(lst[i],_127)===0){ 894 return i; 895 } 896 } 897 return -1; 898 },nodeWalk:function(node,_12d){ 899 var _12e=[node]; 900 var _12f=MochiKit.Base.extend; 901 while(_12e.length){ 902 var res=_12d(_12e.shift()); 903 if(res){ 904 _12f(_12e,res); 905 } 906 } 907 },nameFunctions:function(_131){ 908 var base=_131.NAME; 909 if(typeof (base)=="undefined"){ 910 base=""; 911 }else{ 912 base=base+"."; 913 } 914 for(var name in _131){ 915 var o=_131[name]; 916 if(typeof (o)=="function"&&typeof (o.NAME)=="undefined"){ 917 try{ 918 o.NAME=base+name; 919 } 920 catch(e){ 921 } 922 } 923 } 924 },queryString:function(_135,_136){ 925 if(typeof (MochiKit.DOM)!="undefined"&&arguments.length==1&&(typeof (_135)=="string"||(typeof (_135.nodeType)!="undefined"&&_135.nodeType>0))){ 926 var kv=MochiKit.DOM.formContents(_135); 927 _135=kv[0]; 928 _136=kv[1]; 929 }else{ 930 if(arguments.length==1){ 931 if(typeof (_135.length)=="number"&&_135.length==2){ 932 return arguments.callee(_135[0],_135[1]); 933 } 934 var o=_135; 935 _135=[]; 936 _136=[]; 937 for(var k in o){ 938 var v=o[k]; 939 if(typeof (v)=="function"){ 940 continue; 941 }else{ 942 if(MochiKit.Base.isArrayLike(v)){ 943 for(var i=0;i<v.length;i++){ 944 _135.push(k); 945 _136.push(v[i]); 946 } 947 }else{ 948 _135.push(k); 949 _136.push(v); 950 } 951 } 952 } 953 } 954 } 955 var rval=[]; 956 var len=Math.min(_135.length,_136.length); 957 var _13e=MochiKit.Base.urlEncode; 958 for(var i=0;i<len;i++){ 959 v=_136[i]; 960 if(typeof (v)!="undefined"&&v!==null){ 961 rval.push(_13e(_135[i])+"="+_13e(v)); 962 } 963 } 964 return rval.join("&"); 965 },parseQueryString:function(_13f,_140){ 966 var qstr=(_13f.charAt(0)=="?")?_13f.substring(1):_13f; 967 var _142=qstr.replace(/\+/g,"%20").split(/\&\;|\&\#38\;|\&|\&/); 968 var o={}; 969 var _144; 970 if(typeof (decodeURIComponent)!="undefined"){ 971 _144=decodeURIComponent; 972 }else{ 973 _144=unescape; 974 } 975 if(_140){ 976 for(var i=0;i<_142.length;i++){ 977 var pair=_142[i].split("="); 978 var name=_144(pair.shift()); 979 if(!name){ 980 continue; 981 } 982 var arr=o[name]; 983 if(!(arr instanceof Array)){ 984 arr=[]; 985 o[name]=arr; 986 } 987 arr.push(_144(pair.join("="))); 988 } 989 }else{ 990 for(i=0;i<_142.length;i++){ 991 pair=_142[i].split("="); 992 var name=pair.shift(); 993 if(!name){ 994 continue; 995 } 996 o[_144(name)]=_144(pair.join("=")); 997 } 998 } 999 return o; 1000 }}); 1001 MochiKit.Base.AdapterRegistry=function(){ 1002 this.pairs=[]; 1003 }; 1004 MochiKit.Base.AdapterRegistry.prototype={register:function(name,_14a,wrap,_14c){ 1005 if(_14c){ 1006 this.pairs.unshift([name,_14a,wrap]); 1007 }else{ 1008 this.pairs.push([name,_14a,wrap]); 1009 } 1010 },match:function(){ 1011 for(var i=0;i<this.pairs.length;i++){ 1012 var pair=this.pairs[i]; 1013 if(pair[1].apply(this,arguments)){ 1014 return pair[2].apply(this,arguments); 1015 } 1016 } 1017 throw MochiKit.Base.NotFound; 1018 },unregister:function(name){ 1019 for(var i=0;i<this.pairs.length;i++){ 1020 var pair=this.pairs[i]; 1021 if(pair[0]==name){ 1022 this.pairs.splice(i,1); 1023 return true; 1024 } 1025 } 1026 return false; 1027 }}; 1028 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","bindLate","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"]; 1029 MochiKit.Base.EXPORT_OK=["nameFunctions","comparatorRegistry","reprRegistry","jsonRegistry","compareDateLike","compareArrayLike","reprArrayLike","reprString","reprNumber"]; 1030 MochiKit.Base._exportSymbols=function(_152,_153){ 1031 if(!MochiKit.__export__){ 1032 return; 1033 } 1034 var all=_153.EXPORT_TAGS[":all"]; 1035 for(var i=0;i<all.length;i++){ 1036 _152[all[i]]=_153[all[i]]; 1037 } 1038 }; 1039 MochiKit.Base.__new__=function(){ 1040 var m=this; 1041 m.noop=m.operator.identity; 1042 m.forward=m.forwardCall; 1043 m.find=m.findValue; 1044 if(typeof (encodeURIComponent)!="undefined"){ 1045 m.urlEncode=function(_157){ 1046 return encodeURIComponent(_157).replace(/\'/g,"%27"); 1047 }; 1048 }else{ 1049 m.urlEncode=function(_158){ 1050 return escape(_158).replace(/\+/g,"%2B").replace(/\"/g,"%22").rval.replace(/\'/g,"%27"); 1051 }; 1052 } 1053 m.NamedError=function(name){ 1054 this.message=name; 1055 this.name=name; 1056 }; 1057 m.NamedError.prototype=new Error(); 1058 m.update(m.NamedError.prototype,{repr:function(){ 1059 if(this.message&&this.message!=this.name){ 1060 return this.name+"("+m.repr(this.message)+")"; 1061 }else{ 1062 return this.name+"()"; 1063 } 1064 },toString:m.forwardCall("repr")}); 1065 m.NotFound=new m.NamedError("MochiKit.Base.NotFound"); 1066 m.listMax=m.partial(m.listMinMax,1); 1067 m.listMin=m.partial(m.listMinMax,-1); 1068 m.isCallable=m.typeMatcher("function"); 1069 m.isUndefined=m.typeMatcher("undefined"); 1070 m.merge=m.partial(m.update,null); 1071 m.zip=m.partial(m.map,null); 1072 m.average=m.mean; 1073 m.comparatorRegistry=new m.AdapterRegistry(); 1074 m.registerComparator("dateLike",m.isDateLike,m.compareDateLike); 1075 m.registerComparator("arrayLike",m.isArrayLike,m.compareArrayLike); 1076 m.reprRegistry=new m.AdapterRegistry(); 1077 m.registerRepr("arrayLike",m.isArrayLike,m.reprArrayLike); 1078 m.registerRepr("string",m.typeMatcher("string"),m.reprString); 1079 m.registerRepr("numbers",m.typeMatcher("number","boolean"),m.reprNumber); 1080 m.jsonRegistry=new m.AdapterRegistry(); 1081 var all=m.concat(m.EXPORT,m.EXPORT_OK); 1082 m.EXPORT_TAGS={":common":m.concat(m.EXPORT_OK),":all":all}; 1083 m.nameFunctions(this); 1084 }; 1085 MochiKit.Base.__new__(); 1086 if(MochiKit.__export__){ 1087 compare=MochiKit.Base.compare; 1088 compose=MochiKit.Base.compose; 1089 serializeJSON=MochiKit.Base.serializeJSON; 1090 mean=MochiKit.Base.mean; 1091 median=MochiKit.Base.median; 1092 } 1093 MochiKit.Base._exportSymbols(this,MochiKit.Base); 1094 MochiKit.Base._deps("Iter",["Base"]); 1095 MochiKit.Iter.NAME="MochiKit.Iter"; 1096 MochiKit.Iter.VERSION="1.4.2"; 1097 MochiKit.Base.update(MochiKit.Iter,{__repr__:function(){ 1098 return "["+this.NAME+" "+this.VERSION+"]"; 1099 },toString:function(){ 1100 return this.__repr__(); 1101 },registerIteratorFactory:function(name,_15c,_15d,_15e){ 1102 MochiKit.Iter.iteratorRegistry.register(name,_15c,_15d,_15e); 1103 },isIterable:function(o){ 1104 return o!=null&&(typeof (o.next)=="function"||typeof (o.iter)=="function"); 1105 },iter:function(_160,_161){ 1106 var self=MochiKit.Iter; 1107 if(arguments.length==2){ 1108 return self.takewhile(function(a){ 1109 return a!=_161; 1110 },_160); 1111 } 1112 if(typeof (_160.next)=="function"){ 1113 return _160; 1114 }else{ 1115 if(typeof (_160.iter)=="function"){ 1116 return _160.iter(); 1117 } 1118 } 1119 try{ 1120 return self.iteratorRegistry.match(_160); 1121 } 1122 catch(e){ 1123 var m=MochiKit.Base; 1124 if(e==m.NotFound){ 1125 e=new TypeError(typeof (_160)+": "+m.repr(_160)+" is not iterable"); 1126 } 1127 throw e; 1128 } 1129 },count:function(n){ 1130 if(!n){ 1131 n=0; 1132 } 1133 var m=MochiKit.Base; 1134 return {repr:function(){ 1135 return "count("+n+")"; 1136 },toString:m.forwardCall("repr"),next:m.counter(n)}; 1137 },cycle:function(p){ 1138 var self=MochiKit.Iter; 1139 var m=MochiKit.Base; 1140 var lst=[]; 1141 var _16b=self.iter(p); 1142 return {repr:function(){ 1143 return "cycle(...)"; 1144 },toString:m.forwardCall("repr"),next:function(){ 1145 try{ 1146 var rval=_16b.next(); 1147 lst.push(rval); 1148 return rval; 1149 } 1150 catch(e){ 1151 if(e!=self.StopIteration){ 1152 throw e; 1153 } 1154 if(lst.length===0){ 1155 this.next=function(){ 1156 throw self.StopIteration; 1157 }; 1158 }else{ 1159 var i=-1; 1160 this.next=function(){ 1161 i=(i+1)%lst.length; 1162 return lst[i]; 1163 }; 1164 } 1165 return this.next(); 1166 } 1167 }}; 1168 },repeat:function(elem,n){ 1169 var m=MochiKit.Base; 1170 if(typeof (n)=="undefined"){ 1171 return {repr:function(){ 1172 return "repeat("+m.repr(elem)+")"; 1173 },toString:m.forwardCall("repr"),next:function(){ 1174 return elem; 1175 }}; 1176 } 1177 return {repr:function(){ 1178 return "repeat("+m.repr(elem)+", "+n+")"; 1179 },toString:m.forwardCall("repr"),next:function(){ 1180 if(n<=0){ 1181 throw MochiKit.Iter.StopIteration; 1182 } 1183 n-=1; 1184 return elem; 1185 }}; 1186 },next:function(_171){ 1187 return _171.next(); 1188 },izip:function(p,q){ 1189 var m=MochiKit.Base; 1190 var self=MochiKit.Iter; 1191 var next=self.next; 1192 var _177=m.map(self.iter,arguments); 1193 return {repr:function(){ 1194 return "izip(...)"; 1195 },toString:m.forwardCall("repr"),next:function(){ 1196 return m.map(next,_177); 1197 }}; 1198 },ifilter:function(pred,seq){ 1199 var m=MochiKit.Base; 1200 seq=MochiKit.Iter.iter(seq); 1201 if(pred===null){ 1202 pred=m.operator.truth; 1203 } 1204 return {repr:function(){ 1205 return "ifilter(...)"; 1206 },toString:m.forwardCall("repr"),next:function(){ 1207 while(true){ 1208 var rval=seq.next(); 1209 if(pred(rval)){ 1210 return rval; 1211 } 1212 } 1213 return undefined; 1214 }}; 1215 },ifilterfalse:function(pred,seq){ 1216 var m=MochiKit.Base; 1217 seq=MochiKit.Iter.iter(seq); 1218 if(pred===null){ 1219 pred=m.operator.truth; 1220 } 1221 return {repr:function(){ 1222 return "ifilterfalse(...)"; 1223 },toString:m.forwardCall("repr"),next:function(){ 1224 while(true){ 1225 var rval=seq.next(); 1226 if(!pred(rval)){ 1227 return rval; 1228 } 1229 } 1230 return undefined; 1231 }}; 1232 },islice:function(seq){ 1233 var self=MochiKit.Iter; 1234 var m=MochiKit.Base; 1235 seq=self.iter(seq); 1236 var _183=0; 1237 var stop=0; 1238 var step=1; 1239 var i=-1; 1240 if(arguments.length==2){ 1241 stop=arguments[1]; 1242 }else{ 1243 if(arguments.length==3){ 1244 _183=arguments[1]; 1245 stop=arguments[2]; 1246 }else{ 1247 _183=arguments[1]; 1248 stop=arguments[2]; 1249 step=arguments[3]; 1250 } 1251 } 1252 return {repr:function(){ 1253 return "islice("+["...",_183,stop,step].join(", ")+")"; 1254 },toString:m.forwardCall("repr"),next:function(){ 1255 var rval; 1256 while(i<_183){ 1257 rval=seq.next(); 1258 i++; 1259 } 1260 if(_183>=stop){ 1261 throw self.StopIteration; 1262 } 1263 _183+=step; 1264 return rval; 1265 }}; 1266 },imap:function(fun,p,q){ 1267 var m=MochiKit.Base; 1268 var self=MochiKit.Iter; 1269 var _18d=m.map(self.iter,m.extend(null,arguments,1)); 1270 var map=m.map; 1271 var next=self.next; 1272 return {repr:function(){ 1273 return "imap(...)"; 1274 },toString:m.forwardCall("repr"),next:function(){ 1275 return fun.apply(this,map(next,_18d)); 1276 }}; 1277 },applymap:function(fun,seq,self){ 1278 seq=MochiKit.Iter.iter(seq); 1279 var m=MochiKit.Base; 1280 return {repr:function(){ 1281 return "applymap(...)"; 1282 },toString:m.forwardCall("repr"),next:function(){ 1283 return fun.apply(self,seq.next()); 1284 }}; 1285 },chain:function(p,q){ 1286 var self=MochiKit.Iter; 1287 var m=MochiKit.Base; 1288 if(arguments.length==1){ 1289 return self.iter(arguments[0]); 1290 } 1291 var _198=m.map(self.iter,arguments); 1292 return {repr:function(){ 1293 return "chain(...)"; 1294 },toString:m.forwardCall("repr"),next:function(){ 1295 while(_198.length>1){ 1296 try{ 1297 var _199=_198[0].next(); 1298 return _199; 1299 } 1300 catch(e){ 1301 if(e!=self.StopIteration){ 1302 throw e; 1303 } 1304 _198.shift(); 1305 var _199=_198[0].next(); 1306 return _199; 1307 } 1308 } 1309 if(_198.length==1){ 1310 var arg=_198.shift(); 1311 this.next=m.bind("next",arg); 1312 return this.next(); 1313 } 1314 throw self.StopIteration; 1315 }}; 1316 },takewhile:function(pred,seq){ 1317 var self=MochiKit.Iter; 1318 seq=self.iter(seq); 1319 return {repr:function(){ 1320 return "takewhile(...)"; 1321 },toString:MochiKit.Base.forwardCall("repr"),next:function(){ 1322 var rval=seq.next(); 1323 if(!pred(rval)){ 1324 this.next=function(){ 1325 throw self.StopIteration; 1326 }; 1327 this.next(); 1328 } 1329 return rval; 1330 }}; 1331 },dropwhile:function(pred,seq){ 1332 seq=MochiKit.Iter.iter(seq); 1333 var m=MochiKit.Base; 1334 var bind=m.bind; 1335 return {"repr":function(){ 1336 return "dropwhile(...)"; 1337 },"toString":m.forwardCall("repr"),"next":function(){ 1338 while(true){ 1339 var rval=seq.next(); 1340 if(!pred(rval)){ 1341 break; 1342 } 1343 } 1344 this.next=bind("next",seq); 1345 return rval; 1346 }}; 1347 },_tee:function(_1a4,sync,_1a6){ 1348 sync.pos[_1a4]=-1; 1349 var m=MochiKit.Base; 1350 var _1a8=m.listMin; 1351 return {repr:function(){ 1352 return "tee("+_1a4+", ...)"; 1353 },toString:m.forwardCall("repr"),next:function(){ 1354 var rval; 1355 var i=sync.pos[_1a4]; 1356 if(i==sync.max){ 1357 rval=_1a6.next(); 1358 sync.deque.push(rval); 1359 sync.max+=1; 1360 sync.pos[_1a4]+=1; 1361 }else{ 1362 rval=sync.deque[i-sync.min]; 1363 sync.pos[_1a4]+=1; 1364 if(i==sync.min&&_1a8(sync.pos)!=sync.min){ 1365 sync.min+=1; 1366 sync.deque.shift(); 1367 } 1368 } 1369 return rval; 1370 }}; 1371 },tee:function(_1ab,n){ 1372 var rval=[]; 1373 var sync={"pos":[],"deque":[],"max":-1,"min":-1}; 1374 if(arguments.length==1||typeof (n)=="undefined"||n===null){ 1375 n=2; 1376 } 1377 var self=MochiKit.Iter; 1378 _1ab=self.iter(_1ab); 1379 var _tee=self._tee; 1380 for(var i=0;i<n;i++){ 1381 rval.push(_tee(i,sync,_1ab)); 1382 } 1383 return rval; 1384 },list:function(_1b2){ 1385 var rval; 1386 if(_1b2 instanceof Array){ 1387 return _1b2.slice(); 1388 } 1389 if(typeof (_1b2)=="function"&&!(_1b2 instanceof Function)&&typeof (_1b2.length)=="number"){ 1390 rval=[]; 1391 for(var i=0;i<_1b2.length;i++){ 1392 rval.push(_1b2[i]); 1393 } 1394 return rval; 1395 } 1396 var self=MochiKit.Iter; 1397 _1b2=self.iter(_1b2); 1398 var rval=[]; 1399 var _1b6; 1400 try{ 1401 while(true){ 1402 _1b6=_1b2.next(); 1403 rval.push(_1b6); 1404 } 1405 } 1406 catch(e){ 1407 if(e!=self.StopIteration){ 1408 throw e; 1409 } 1410 return rval; 1411 } 1412 return undefined; 1413 },reduce:function(fn,_1b8,_1b9){ 1414 var i=0; 1415 var x=_1b9; 1416 var self=MochiKit.Iter; 1417 _1b8=self.iter(_1b8); 1418 if(arguments.length<3){ 1419 try{ 1420 x=_1b8.next(); 1421 } 1422 catch(e){ 1423 if(e==self.StopIteration){ 1424 e=new TypeError("reduce() of empty sequence with no initial value"); 1425 } 1426 throw e; 1427 } 1428 i++; 1429 } 1430 try{ 1431 while(true){ 1432 x=fn(x,_1b8.next()); 1433 } 1434 } 1435 catch(e){ 1436 if(e!=self.StopIteration){ 1437 throw e; 1438 } 1439 } 1440 return x; 1441 },range:function(){ 1442 var _1bd=0; 1443 var stop=0; 1444 var step=1; 1445 if(arguments.length==1){ 1446 stop=arguments[0]; 1447 }else{ 1448 if(arguments.length==2){ 1449 _1bd=arguments[0]; 1450 stop=arguments[1]; 1451 }else{ 1452 if(arguments.length==3){ 1453 _1bd=arguments[0]; 1454 stop=arguments[1]; 1455 step=arguments[2]; 1456 }else{ 1457 throw new TypeError("range() takes 1, 2, or 3 arguments!"); 1458 } 1459 } 1460 } 1461 if(step===0){ 1462 throw new TypeError("range() step must not be 0"); 1463 } 1464 return {next:function(){ 1465 if((step>0&&_1bd>=stop)||(step<0&&_1bd<=stop)){ 1466 throw MochiKit.Iter.StopIteration; 1467 } 1468 var rval=_1bd; 1469 _1bd+=step; 1470 return rval; 1471 },repr:function(){ 1472 return "range("+[_1bd,stop,step].join(", ")+")"; 1473 },toString:MochiKit.Base.forwardCall("repr")}; 1474 },sum:function(_1c1,_1c2){ 1475 if(typeof (_1c2)=="undefined"||_1c2===null){ 1476 _1c2=0; 1477 } 1478 var x=_1c2; 1479 var self=MochiKit.Iter; 1480 _1c1=self.iter(_1c1); 1481 try{ 1482 while(true){ 1483 x+=_1c1.next(); 1484 } 1485 } 1486 catch(e){ 1487 if(e!=self.StopIteration){ 1488 throw e; 1489 } 1490 } 1491 return x; 1492 },exhaust:function(_1c5){ 1493 var self=MochiKit.Iter; 1494 _1c5=self.iter(_1c5); 1495 try{ 1496 while(true){ 1497 _1c5.next(); 1498 } 1499 } 1500 catch(e){ 1501 if(e!=self.StopIteration){ 1502 throw e; 1503 } 1504 } 1505 },forEach:function(_1c7,func,obj){ 1506 var m=MochiKit.Base; 1507 var self=MochiKit.Iter; 1508 if(arguments.length>2){ 1509 func=m.bind(func,obj); 1510 } 1511 if(m.isArrayLike(_1c7)&&!self.isIterable(_1c7)){ 1512 try{ 1513 for(var i=0;i<_1c7.length;i++){ 1514 func(_1c7[i]); 1515 } 1516 } 1517 catch(e){ 1518 if(e!=self.StopIteration){ 1519 throw e; 1520 } 1521 } 1522 }else{ 1523 self.exhaust(self.imap(func,_1c7)); 1524 } 1525 },every:function(_1cd,func){ 1526 var self=MochiKit.Iter; 1527 try{ 1528 self.ifilterfalse(func,_1cd).next(); 1529 return false; 1530 } 1531 catch(e){ 1532 if(e!=self.StopIteration){ 1533 throw e; 1534 } 1535 return true; 1536 } 1537 },sorted:function(_1d0,cmp){ 1538 var rval=MochiKit.Iter.list(_1d0); 1539 if(arguments.length==1){ 1540 cmp=MochiKit.Base.compare; 1541 } 1542 rval.sort(cmp); 1543 return rval; 1544 },reversed:function(_1d3){ 1545 var rval=MochiKit.Iter.list(_1d3); 1546 rval.reverse(); 1547 return rval; 1548 },some:function(_1d5,func){ 1549 var self=MochiKit.Iter; 1550 try{ 1551 self.ifilter(func,_1d5).next(); 1552 return true; 1553 } 1554 catch(e){ 1555 if(e!=self.StopIteration){ 1556 throw e; 1557 } 1558 return false; 1559 } 1560 },iextend:function(lst,_1d9){ 1561 var m=MochiKit.Base; 1562 var self=MochiKit.Iter; 1563 if(m.isArrayLike(_1d9)&&!self.isIterable(_1d9)){ 1564 for(var i=0;i<_1d9.length;i++){ 1565 lst.push(_1d9[i]); 1566 } 1567 }else{ 1568 _1d9=self.iter(_1d9); 1569 try{ 1570 while(true){ 1571 lst.push(_1d9.next()); 1572 } 1573 } 1574 catch(e){ 1575 if(e!=self.StopIteration){ 1576 throw e; 1577 } 1578 } 1579 } 1580 return lst; 1581 },groupby:function(_1dd,_1de){ 1582 var m=MochiKit.Base; 1583 var self=MochiKit.Iter; 1584 if(arguments.length<2){ 1585 _1de=m.operator.identity; 1586 } 1587 _1dd=self.iter(_1dd); 1588 var pk=undefined; 1589 var k=undefined; 1590 var v; 1591 function fetch(){ 1592 v=_1dd.next(); 1593 k=_1de(v); 1594 } 1595 function eat(){ 1596 var ret=v; 1597 v=undefined; 1598 return ret; 1599 } 1600 var _1e5=true; 1601 var _1e6=m.compare; 1602 return {repr:function(){ 1603 return "groupby(...)"; 1604 },next:function(){ 1605 while(_1e6(k,pk)===0){ 1606 fetch(); 1607 if(_1e5){ 1608 _1e5=false; 1609 break; 1610 } 1611 } 1612 pk=k; 1613 return [k,{next:function(){ 1614 if(v==undefined){ 1615 fetch(); 1616 } 1617 if(_1e6(k,pk)!==0){ 1618 throw self.StopIteration; 1619 } 1620 return eat(); 1621 }}]; 1622 }}; 1623 },groupby_as_array:function(_1e7,_1e8){ 1624 var m=MochiKit.Base; 1625 var self=MochiKit.Iter; 1626 if(arguments.length<2){ 1627 _1e8=m.operator.identity; 1628 } 1629 _1e7=self.iter(_1e7); 1630 var _1eb=[]; 1631 var _1ec=true; 1632 var _1ed; 1633 var _1ee=m.compare; 1634 while(true){ 1635 try{ 1636 var _1ef=_1e7.next(); 1637 var key=_1e8(_1ef); 1638 } 1639 catch(e){ 1640 if(e==self.StopIteration){ 1641 break; 1642 } 1643 throw e; 1644 } 1645 if(_1ec||_1ee(key,_1ed)!==0){ 1646 var _1f1=[]; 1647 _1eb.push([key,_1f1]); 1648 } 1649 _1f1.push(_1ef); 1650 _1ec=false; 1651 _1ed=key; 1652 } 1653 return _1eb; 1654 },arrayLikeIter:function(_1f2){ 1655 var i=0; 1656 return {repr:function(){ 1657 return "arrayLikeIter(...)"; 1658 },toString:MochiKit.Base.forwardCall("repr"),next:function(){ 1659 if(i>=_1f2.length){ 1660 throw MochiKit.Iter.StopIteration; 1661 } 1662 return _1f2[i++]; 1663 }}; 1664 },hasIterateNext:function(_1f4){ 1665 return (_1f4&&typeof (_1f4.iterateNext)=="function"); 1666 },iterateNextIter:function(_1f5){ 1667 return {repr:function(){ 1668 return "iterateNextIter(...)"; 1669 },toString:MochiKit.Base.forwardCall("repr"),next:function(){ 1670 var rval=_1f5.iterateNext(); 1671 if(rval===null||rval===undefined){ 1672 throw MochiKit.Iter.StopIteration; 1673 } 1674 return rval; 1675 }}; 1676 }}); 1677 MochiKit.Iter.EXPORT_OK=["iteratorRegistry","arrayLikeIter","hasIterateNext","iterateNextIter"]; 1678 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"]; 1679 MochiKit.Iter.__new__=function(){ 1680 var m=MochiKit.Base; 1681 if(typeof (StopIteration)!="undefined"){ 1682 this.StopIteration=StopIteration; 1683 }else{ 1684 this.StopIteration=new m.NamedError("StopIteration"); 1685 } 1686 this.iteratorRegistry=new m.AdapterRegistry(); 1687 this.registerIteratorFactory("arrayLike",m.isArrayLike,this.arrayLikeIter); 1688 this.registerIteratorFactory("iterateNext",this.hasIterateNext,this.iterateNextIter); 1689 this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; 1690 m.nameFunctions(this); 1691 }; 1692 MochiKit.Iter.__new__(); 1693 if(MochiKit.__export__){ 1694 reduce=MochiKit.Iter.reduce; 1695 } 1696 MochiKit.Base._exportSymbols(this,MochiKit.Iter); 1697 MochiKit.Base._deps("Logging",["Base"]); 1698 MochiKit.Logging.NAME="MochiKit.Logging"; 1699 MochiKit.Logging.VERSION="1.4.2"; 1700 MochiKit.Logging.__repr__=function(){ 1701 return "["+this.NAME+" "+this.VERSION+"]"; 1702 }; 1703 MochiKit.Logging.toString=function(){ 1704 return this.__repr__(); 1705 }; 1706 MochiKit.Logging.EXPORT=["LogLevel","LogMessage","Logger","alertListener","logger","log","logError","logDebug","logFatal","logWarning"]; 1707 MochiKit.Logging.EXPORT_OK=["logLevelAtLeast","isLogMessage","compareLogMessage"]; 1708 MochiKit.Logging.LogMessage=function(num,_1f9,info){ 1709 this.num=num; 1710 this.level=_1f9; 1711 this.info=info; 1712 this.timestamp=new Date(); 1713 }; 1714 MochiKit.Logging.LogMessage.prototype={repr:function(){ 1715 var m=MochiKit.Base; 1716 return "LogMessage("+m.map(m.repr,[this.num,this.level,this.info]).join(", ")+")"; 1717 },toString:MochiKit.Base.forwardCall("repr")}; 1718 MochiKit.Base.update(MochiKit.Logging,{logLevelAtLeast:function(_1fc){ 1719 var self=MochiKit.Logging; 1720 if(typeof (_1fc)=="string"){ 1721 _1fc=self.LogLevel[_1fc]; 1722 } 1723 return function(msg){ 1724 var _1ff=msg.level; 1725 if(typeof (_1ff)=="string"){ 1726 _1ff=self.LogLevel[_1ff]; 1727 } 1728 return _1ff>=_1fc; 1729 }; 1730 },isLogMessage:function(){ 1731 var _200=MochiKit.Logging.LogMessage; 1732 for(var i=0;i<arguments.length;i++){ 1733 if(!(arguments[i] instanceof _200)){ 1734 return false; 1735 } 1736 } 1737 return true; 1738 },compareLogMessage:function(a,b){ 1739 return MochiKit.Base.compare([a.level,a.info],[b.level,b.info]); 1740 },alertListener:function(msg){ 1741 alert("num: "+msg.num+"\nlevel: "+msg.level+"\ninfo: "+msg.info.join(" ")); 1742 }}); 1743 MochiKit.Logging.Logger=function(_205){ 1744 this.counter=0; 1745 if(typeof (_205)=="undefined"||_205===null){ 1746 _205=-1; 1747 } 1748 this.maxSize=_205; 1749 this._messages=[]; 1750 this.listeners={}; 1751 this.useNativeConsole=false; 1752 }; 1753 MochiKit.Logging.Logger.prototype={clear:function(){ 1754 this._messages.splice(0,this._messages.length); 1755 },logToConsole:function(msg){ 1756 if(typeof (window)!="undefined"&&window.console&&window.console.log){ 1757 window.console.log(msg.replace(/%/g,"\uff05")); 1758 }else{ 1759 if(typeof (opera)!="undefined"&&opera.postError){ 1760 opera.postError(msg); 1761 }else{ 1762 if(typeof (printfire)=="function"){ 1763 printfire(msg); 1764 }else{ 1765 if(typeof (Debug)!="undefined"&&Debug.writeln){ 1766 Debug.writeln(msg); 1767 }else{ 1768 if(typeof (debug)!="undefined"&&debug.trace){ 1769 debug.trace(msg); 1770 } 1771 } 1772 } 1773 } 1774 } 1775 },dispatchListeners:function(msg){ 1776 for(var k in this.listeners){ 1777 var pair=this.listeners[k]; 1778 if(pair.ident!=k||(pair[0]&&!pair[0](msg))){ 1779 continue; 1780 } 1781 pair[1](msg); 1782 } 1783 },addListener:function(_20a,_20b,_20c){ 1784 if(typeof (_20b)=="string"){ 1785 _20b=MochiKit.Logging.logLevelAtLeast(_20b); 1786 } 1787 var _20d=[_20b,_20c]; 1788 _20d.ident=_20a; 1789 this.listeners[_20a]=_20d; 1790 },removeListener:function(_20e){ 1791 delete this.listeners[_20e]; 1792 },baseLog:function(_20f,_210){ 1793 if(typeof (_20f)=="number"){ 1794 if(_20f>=MochiKit.Logging.LogLevel.FATAL){ 1795 _20f="FATAL"; 1796 }else{ 1797 if(_20f>=MochiKit.Logging.LogLevel.ERROR){ 1798 _20f="ERROR"; 1799 }else{ 1800 if(_20f>=MochiKit.Logging.LogLevel.WARNING){ 1801 _20f="WARNING"; 1802 }else{ 1803 if(_20f>=MochiKit.Logging.LogLevel.INFO){ 1804 _20f="INFO"; 1805 }else{ 1806 _20f="DEBUG"; 1807 } 1808 } 1809 } 1810 } 1811 } 1812 var msg=new MochiKit.Logging.LogMessage(this.counter,_20f,MochiKit.Base.extend(null,arguments,1)); 1813 this._messages.push(msg); 1814 this.dispatchListeners(msg); 1815 if(this.useNativeConsole){ 1816 this.logToConsole(msg.level+": "+msg.info.join(" ")); 1817 } 1818 this.counter+=1; 1819 while(this.maxSize>=0&&this._messages.length>this.maxSize){ 1820 this._messages.shift(); 1821 } 1822 },getMessages:function(_212){ 1823 var _213=0; 1824 if(!(typeof (_212)=="undefined"||_212===null)){ 1825 _213=Math.max(0,this._messages.length-_212); 1826 } 1827 return this._messages.slice(_213); 1828 },getMessageText:function(_214){ 1829 if(typeof (_214)=="undefined"||_214===null){ 1830 _214=30; 1831 } 1832 var _215=this.getMessages(_214); 1833 if(_215.length){ 1834 var lst=map(function(m){ 1835 return "\n ["+m.num+"] "+m.level+": "+m.info.join(" "); 1836 },_215); 1837 lst.unshift("LAST "+_215.length+" MESSAGES:"); 1838 return lst.join(""); 1839 } 1840 return ""; 1841 },debuggingBookmarklet:function(_218){ 1842 if(typeof (MochiKit.LoggingPane)=="undefined"){ 1843 alert(this.getMessageText()); 1844 }else{ 1845 MochiKit.LoggingPane.createLoggingPane(_218||false); 1846 } 1847 }}; 1848 MochiKit.Logging.__new__=function(){ 1849 this.LogLevel={ERROR:40,FATAL:50,WARNING:30,INFO:20,DEBUG:10}; 1850 var m=MochiKit.Base; 1851 m.registerComparator("LogMessage",this.isLogMessage,this.compareLogMessage); 1852 var _21a=m.partial; 1853 var _21b=this.Logger; 1854 var _21c=_21b.prototype.baseLog; 1855 m.update(this.Logger.prototype,{debug:_21a(_21c,"DEBUG"),log:_21a(_21c,"INFO"),error:_21a(_21c,"ERROR"),fatal:_21a(_21c,"FATAL"),warning:_21a(_21c,"WARNING")}); 1856 var self=this; 1857 var _21e=function(name){ 1858 return function(){ 1859 self.logger[name].apply(self.logger,arguments); 1860 }; 1861 }; 1862 this.log=_21e("log"); 1863 this.logError=_21e("error"); 1864 this.logDebug=_21e("debug"); 1865 this.logFatal=_21e("fatal"); 1866 this.logWarning=_21e("warning"); 1867 this.logger=new _21b(); 1868 this.logger.useNativeConsole=true; 1869 this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; 1870 m.nameFunctions(this); 1871 }; 1872 if(typeof (printfire)=="undefined"&&typeof (document)!="undefined"&&document.createEvent&&typeof (dispatchEvent)!="undefined"){ 1873 printfire=function(){ 1874 printfire.args=arguments; 1875 var ev=document.createEvent("Events"); 1876 ev.initEvent("printfire",false,true); 1877 dispatchEvent(ev); 1878 }; 1879 } 1880 MochiKit.Logging.__new__(); 1881 MochiKit.Base._exportSymbols(this,MochiKit.Logging); 1882 MochiKit.Base._deps("DateTime",["Base"]); 1883 MochiKit.DateTime.NAME="MochiKit.DateTime"; 1884 MochiKit.DateTime.VERSION="1.4.2"; 1885 MochiKit.DateTime.__repr__=function(){ 1886 return "["+this.NAME+" "+this.VERSION+"]"; 1887 }; 1888 MochiKit.DateTime.toString=function(){ 1889 return this.__repr__(); 1890 }; 1891 MochiKit.DateTime.isoDate=function(str){ 1892 str=str+""; 1893 if(typeof (str)!="string"||str.length===0){ 1894 return null; 1895 } 1896 var iso=str.split("-"); 1897 if(iso.length===0){ 1898 return null; 1899 } 1900 var date=new Date(iso[0],iso[1]-1,iso[2]); 1901 date.setFullYear(iso[0]); 1902 date.setMonth(iso[1]-1); 1903 date.setDate(iso[2]); 1904 return date; 1905 }; 1906 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}))?)?)?)?)?/; 1907 MochiKit.DateTime.isoTimestamp=function(str){ 1908 str=str+""; 1909 if(typeof (str)!="string"||str.length===0){ 1910 return null; 1911 } 1912 var res=str.match(MochiKit.DateTime._isoRegexp); 1913 if(typeof (res)=="undefined"||res===null){ 1914 return null; 1915 } 1916 var year,_227,day,hour,min,sec,msec; 1917 year=parseInt(res[1],10); 1918 if(typeof (res[2])=="undefined"||res[2]===""){ 1919 return new Date(year); 1920 } 1921 _227=parseInt(res[2],10)-1; 1922 day=parseInt(res[3],10); 1923 if(typeof (res[4])=="undefined"||res[4]===""){ 1924 return new Date(year,_227,day); 1925 } 1926 hour=parseInt(res[4],10); 1927 min=parseInt(res[5],10); 1928 sec=(typeof (res[6])!="undefined"&&res[6]!=="")?parseInt(res[6],10):0; 1929 if(typeof (res[7])!="undefined"&&res[7]!==""){ 1930 msec=Math.round(1000*parseFloat("0."+res[7])); 1931 }else{ 1932 msec=0; 1933 } 1934 if((typeof (res[8])=="undefined"||res[8]==="")&&(typeof (res[9])=="undefined"||res[9]==="")){ 1935 return new Date(year,_227,day,hour,min,sec,msec); 1936 } 1937 var ofs; 1938 if(typeof (res[9])!="undefined"&&res[9]!==""){ 1939 ofs=parseInt(res[10],10)*3600000; 1940 if(typeof (res[11])!="undefined"&&res[11]!==""){ 1941 ofs+=parseInt(res[11],10)*60000; 1942 } 1943 if(res[9]=="-"){ 1944 ofs=-ofs; 1945 } 1946 }else{ 1947 ofs=0; 1948 } 1949 return new Date(Date.UTC(year,_227,day,hour,min,sec,msec)-ofs); 1950 }; 1951 MochiKit.DateTime.toISOTime=function(date,_22f){ 1952 if(typeof (date)=="undefined"||date===null){ 1953 return null; 1954 } 1955 var hh=date.getHours(); 1956 var mm=date.getMinutes(); 1957 var ss=date.getSeconds(); 1958 var lst=[((_22f&&(hh<10))?"0"+hh:hh),((mm<10)?"0"+mm:mm),((ss<10)?"0"+ss:ss)]; 1959 return lst.join(":"); 1960 }; 1961 MochiKit.DateTime.toISOTimestamp=function(date,_235){ 1962 if(typeof (date)=="undefined"||date===null){ 1963 return null; 1964 } 1965 var sep=_235?"T":" "; 1966 var foot=_235?"Z":""; 1967 if(_235){ 1968 date=new Date(date.getTime()+(date.getTimezoneOffset()*60000)); 1969 } 1970 return MochiKit.DateTime.toISODate(date)+sep+MochiKit.DateTime.toISOTime(date,_235)+foot; 1971 }; 1972 MochiKit.DateTime.toISODate=function(date){ 1973 if(typeof (date)=="undefined"||date===null){ 1974 return null; 1975 } 1976 var _239=MochiKit.DateTime._padTwo; 1977 var _23a=MochiKit.DateTime._padFour; 1978 return [_23a(date.getFullYear()),_239(date.getMonth()+1),_239(date.getDate())].join("-"); 1979 }; 1980 MochiKit.DateTime.americanDate=function(d){ 1981 d=d+""; 1982 if(typeof (d)!="string"||d.length===0){ 1983 return null; 1984 } 1985 var a=d.split("/"); 1986 return new Date(a[2],a[0]-1,a[1]); 1987 }; 1988 MochiKit.DateTime._padTwo=function(n){ 1989 return (n>9)?n:"0"+n; 1990 }; 1991 MochiKit.DateTime._padFour=function(n){ 1992 switch(n.toString().length){ 1993 case 1: 1994 return "000"+n; 1995 break; 1996 case 2: 1997 return "00"+n; 1998 break; 1999 case 3: 2000 return "0"+n; 2001 break; 2002 case 4: 2003 default: 2004 return n; 2005 } 2006 }; 2007 MochiKit.DateTime.toPaddedAmericanDate=function(d){ 2008 if(typeof (d)=="undefined"||d===null){ 2009 return null; 2010 } 2011 var _240=MochiKit.DateTime._padTwo; 2012 return [_240(d.getMonth()+1),_240(d.getDate()),d.getFullYear()].join("/"); 2013 }; 2014 MochiKit.DateTime.toAmericanDate=function(d){ 2015 if(typeof (d)=="undefined"||d===null){ 2016 return null; 2017 } 2018 return [d.getMonth()+1,d.getDate(),d.getFullYear()].join("/"); 2019 }; 2020 MochiKit.DateTime.EXPORT=["isoDate","isoTimestamp","toISOTime","toISOTimestamp","toISODate","americanDate","toPaddedAmericanDate","toAmericanDate"]; 2021 MochiKit.DateTime.EXPORT_OK=[]; 2022 MochiKit.DateTime.EXPORT_TAGS={":common":MochiKit.DateTime.EXPORT,":all":MochiKit.DateTime.EXPORT}; 2023 MochiKit.DateTime.__new__=function(){ 2024 var base=this.NAME+"."; 2025 for(var k in this){ 2026 var o=this[k]; 2027 if(typeof (o)=="function"&&typeof (o.NAME)=="undefined"){ 2028 try{ 2029 o.NAME=base+k; 2030 } 2031 catch(e){ 2032 } 2033 } 2034 } 2035 }; 2036 MochiKit.DateTime.__new__(); 2037 if(typeof (MochiKit.Base)!="undefined"){ 2038 MochiKit.Base._exportSymbols(this,MochiKit.DateTime); 2039 }else{ 2040 (function(_245,_246){ 2041 if((typeof (JSAN)=="undefined"&&typeof (dojo)=="undefined")||(MochiKit.__export__===false)){ 2042 var all=_246.EXPORT_TAGS[":all"]; 2043 for(var i=0;i<all.length;i++){ 2044 _245[all[i]]=_246[all[i]]; 2045 } 2046 } 2047 })(this,MochiKit.DateTime); 2048 } 2049 MochiKit.Base._deps("Format",["Base"]); 2050 MochiKit.Format.NAME="MochiKit.Format"; 2051 MochiKit.Format.VERSION="1.4.2"; 2052 MochiKit.Format.__repr__=function(){ 2053 return "["+this.NAME+" "+this.VERSION+"]"; 2054 }; 2055 MochiKit.Format.toString=function(){ 2056 return this.__repr__(); 2057 }; 2058 MochiKit.Format._numberFormatter=function(_249,_24a,_24b,_24c,_24d,_24e,_24f,_250,_251){ 2059 return function(num){ 2060 num=parseFloat(num); 2061 if(typeof (num)=="undefined"||num===null||isNaN(num)){ 2062 return _249; 2063 } 2064 var _253=_24a; 2065 var _254=_24b; 2066 if(num<0){ 2067 num=-num; 2068 }else{ 2069 _253=_253.replace(/-/,""); 2070 } 2071 var me=arguments.callee; 2072 var fmt=MochiKit.Format.formatLocale(_24c); 2073 if(_24d){ 2074 num=num*100; 2075 _254=fmt.percent+_254; 2076 } 2077 num=MochiKit.Format.roundToFixed(num,_24e); 2078 var _257=num.split(/\./); 2079 var _258=_257[0]; 2080 var frac=(_257.length==1)?"":_257[1]; 2081 var res=""; 2082 while(_258.length<_24f){ 2083 _258="0"+_258; 2084 } 2085 if(_250){ 2086 while(_258.length>_250){ 2087 var i=_258.length-_250; 2088 res=fmt.separator+_258.substring(i,_258.length)+res; 2089 _258=_258.substring(0,i); 2090 } 2091 } 2092 res=_258+res; 2093 if(_24e>0){ 2094 while(frac.length<_251){ 2095 frac=frac+"0"; 2096 } 2097 res=res+fmt.decimal+frac; 2098 } 2099 return _253+res+_254; 2100 }; 2101 }; 2102 MochiKit.Format.numberFormatter=function(_25c,_25d,_25e){ 2103 if(typeof (_25d)=="undefined"){ 2104 _25d=""; 2105 } 2106 var _25f=_25c.match(/((?:[0#]+,)?[0#]+)(?:\.([0#]+))?(%)?/); 2107 if(!_25f){ 2108 throw TypeError("Invalid pattern"); 2109 } 2110 var _260=_25c.substr(0,_25f.index); 2111 var _261=_25c.substr(_25f.index+_25f[0].length); 2112 if(_260.search(/-/)==-1){ 2113 _260=_260+"-"; 2114 } 2115 var _262=_25f[1]; 2116 var frac=(typeof (_25f[2])=="string"&&_25f[2]!="")?_25f[2]:""; 2117 var _264=(typeof (_25f[3])=="string"&&_25f[3]!=""); 2118 var tmp=_262.split(/,/); 2119 var _266; 2120 if(typeof (_25e)=="undefined"){ 2121 _25e="default"; 2122 } 2123 if(tmp.length==1){ 2124 _266=null; 2125 }else{ 2126 _266=tmp[1].length; 2127 } 2128 var _267=_262.length-_262.replace(/0/g,"").length; 2129 var _268=frac.length-frac.replace(/0/g,"").length; 2130 var _269=frac.length; 2131 var rval=MochiKit.Format._numberFormatter(_25d,_260,_261,_25e,_264,_269,_267,_266,_268); 2132 var m=MochiKit.Base; 2133 if(m){ 2134 var fn=arguments.callee; 2135 var args=m.concat(arguments); 2136 rval.repr=function(){ 2137 return [self.NAME,"(",map(m.repr,args).join(", "),")"].join(""); 2138 }; 2139 } 2140 return rval; 2141 }; 2142 MochiKit.Format.formatLocale=function(_26e){ 2143 if(typeof (_26e)=="undefined"||_26e===null){ 2144 _26e="default"; 2145 } 2146 if(typeof (_26e)=="string"){ 2147 var rval=MochiKit.Format.LOCALE[_26e]; 2148 if(typeof (rval)=="string"){ 2149 rval=arguments.callee(rval); 2150 MochiKit.Format.LOCALE[_26e]=rval; 2151 } 2152 return rval; 2153 }else{ 2154 return _26e; 2155 } 2156 }; 2157 MochiKit.Format.twoDigitAverage=function(_270,_271){ 2158 if(_271){ 2159 var res=_270/_271; 2160 if(!isNaN(res)){ 2161 return MochiKit.Format.twoDigitFloat(res); 2162 } 2163 } 2164 return "0"; 2165 }; 2166 MochiKit.Format.twoDigitFloat=function(_273){ 2167 var res=roundToFixed(_273,2); 2168 if(res.indexOf(".00")>0){ 2169 return res.substring(0,res.length-3); 2170 }else{ 2171 if(res.charAt(res.length-1)=="0"){ 2172 return res.substring(0,res.length-1); 2173 }else{ 2174 return res; 2175 } 2176 } 2177 }; 2178 MochiKit.Format.lstrip=function(str,_276){ 2179 str=str+""; 2180 if(typeof (str)!="string"){ 2181 return null; 2182 } 2183 if(!_276){ 2184 return str.replace(/^\s+/,""); 2185 }else{ 2186 return str.replace(new RegExp("^["+_276+"]+"),""); 2187 } 2188 }; 2189 MochiKit.Format.rstrip=function(str,_278){ 2190 str=str+""; 2191 if(typeof (str)!="string"){ 2192 return null; 2193 } 2194 if(!_278){ 2195 return str.replace(/\s+$/,""); 2196 }else{ 2197 return str.replace(new RegExp("["+_278+"]+$"),""); 2198 } 2199 }; 2200 MochiKit.Format.strip=function(str,_27a){ 2201 var self=MochiKit.Format; 2202 return self.rstrip(self.lstrip(str,_27a),_27a); 2203 }; 2204 MochiKit.Format.truncToFixed=function(_27c,_27d){ 2205 var res=Math.floor(_27c).toFixed(0); 2206 if(_27c<0){ 2207 res=Math.ceil(_27c).toFixed(0); 2208 if(res.charAt(0)!="-"&&_27d>0){ 2209 res="-"+res; 2210 } 2211 } 2212 if(res.indexOf("e")<0&&_27d>0){ 2213 var tail=_27c.toString(); 2214 if(tail.indexOf("e")>0){ 2215 tail="."; 2216 }else{ 2217 if(tail.indexOf(".")<0){ 2218 tail="."; 2219 }else{ 2220 tail=tail.substring(tail.indexOf(".")); 2221 } 2222 } 2223 if(tail.length-1>_27d){ 2224 tail=tail.substring(0,_27d+1); 2225 } 2226 while(tail.length-1<_27d){ 2227 tail+="0"; 2228 } 2229 res+=tail; 2230 } 2231 return res; 2232 }; 2233 MochiKit.Format.roundToFixed=function(_280,_281){ 2234 var _282=Math.abs(_280)+0.5*Math.pow(10,-_281); 2235 var res=MochiKit.Format.truncToFixed(_282,_281); 2236 if(_280<0){ 2237 res="-"+res; 2238 } 2239 return res; 2240 }; 2241 MochiKit.Format.percentFormat=function(_284){ 2242 return MochiKit.Format.twoDigitFloat(100*_284)+"%"; 2243 }; 2244 MochiKit.Format.EXPORT=["truncToFixed","roundToFixed","numberFormatter","formatLocale","twoDigitAverage","twoDigitFloat","percentFormat","lstrip","rstrip","strip"]; 2245 MochiKit.Format.LOCALE={en_US:{separator:",",decimal:".",percent:"%"},de_DE:{separator:".",decimal:",",percent:"%"},pt_BR:{separator:".",decimal:",",percent:"%"},fr_FR:{separator:" ",decimal:",",percent:"%"},"default":"en_US"}; 2246 MochiKit.Format.EXPORT_OK=[]; 2247 MochiKit.Format.EXPORT_TAGS={":all":MochiKit.Format.EXPORT,":common":MochiKit.Format.EXPORT}; 2248 MochiKit.Format.__new__=function(){ 2249 var base=this.NAME+"."; 2250 var k,v,o; 2251 for(k in this.LOCALE){ 2252 o=this.LOCALE[k]; 2253 if(typeof (o)=="object"){ 2254 o.repr=function(){ 2255 return this.NAME; 2256 }; 2257 o.NAME=base+"LOCALE."+k; 2258 } 2259 } 2260 for(k in this){ 2261 o=this[k]; 2262 if(typeof (o)=="function"&&typeof (o.NAME)=="undefined"){ 2263 try{ 2264 o.NAME=base+k; 2265 } 2266 catch(e){ 2267 } 2268 } 2269 } 2270 }; 2271 MochiKit.Format.__new__(); 2272 if(typeof (MochiKit.Base)!="undefined"){ 2273 MochiKit.Base._exportSymbols(this,MochiKit.Format); 2274 }else{ 2275 (function(_289,_28a){ 2276 if((typeof (JSAN)=="undefined"&&typeof (dojo)=="undefined")||(MochiKit.__export__===false)){ 2277 var all=_28a.EXPORT_TAGS[":all"]; 2278 for(var i=0;i<all.length;i++){ 2279 _289[all[i]]=_28a[all[i]]; 2280 } 2281 } 2282 })(this,MochiKit.Format); 2283 } 2284 MochiKit.Base._deps("Async",["Base"]); 2285 MochiKit.Async.NAME="MochiKit.Async"; 2286 MochiKit.Async.VERSION="1.4.2"; 2287 MochiKit.Async.__repr__=function(){ 2288 return "["+this.NAME+" "+this.VERSION+"]"; 2289 }; 2290 MochiKit.Async.toString=function(){ 2291 return this.__repr__(); 2292 }; 2293 MochiKit.Async.Deferred=function(_28d){ 2294 this.chain=[]; 2295 this.id=this._nextId(); 2296 this.fired=-1; 2297 this.paused=0; 2298 this.results=[null,null]; 2299 this.canceller=_28d; 2300 this.silentlyCancelled=false; 2301 this.chained=false; 2302 }; 2303 MochiKit.Async.Deferred.prototype={repr:function(){ 2304 var _28e; 2305 if(this.fired==-1){ 2306 _28e="unfired"; 2307 }else{ 2308 if(this.fired===0){ 2309 _28e="success"; 2310 }else{ 2311 _28e="error"; 2312 } 2313 } 2314 return "Deferred("+this.id+", "+_28e+")"; 2315 },toString:MochiKit.Base.forwardCall("repr"),_nextId:MochiKit.Base.counter(),cancel:function(){ 2316 var self=MochiKit.Async; 2317 if(this.fired==-1){ 2318 if(this.canceller){ 2319 this.canceller(this); 2320 }else{ 2321 this.silentlyCancelled=true; 2322 } 2323 if(this.fired==-1){ 2324 this.errback(new self.CancelledError(this)); 2325 } 2326 }else{ 2327 if((this.fired===0)&&(this.results[0] instanceof self.Deferred)){ 2328 this.results[0].cancel(); 2329 } 2330 } 2331 },_resback:function(res){ 2332 this.fired=((res instanceof Error)?1:0); 2333 this.results[this.fired]=res; 2334 this._fire(); 2335 },_check:function(){ 2336 if(this.fired!=-1){ 2337 if(!this.silentlyCancelled){ 2338 throw new MochiKit.Async.AlreadyCalledError(this); 2339 } 2340 this.silentlyCancelled=false; 2341 return; 2342 } 2343 },callback:function(res){ 2344 this._check(); 2345 if(res instanceof MochiKit.Async.Deferred){ 2346 throw new Error("Deferred instances can only be chained if they are the result of a callback"); 2347 } 2348 this._resback(res); 2349 },errback:function(res){ 2350 this._check(); 2351 var self=MochiKit.Async; 2352 if(res instanceof self.Deferred){ 2353 throw new Error("Deferred instances can only be chained if they are the result of a callback"); 2354 } 2355 if(!(res instanceof Error)){ 2356 res=new self.GenericError(res); 2357 } 2358 this._resback(res); 2359 },addBoth:function(fn){ 2360 if(arguments.length>1){ 2361 fn=MochiKit.Base.partial.apply(null,arguments); 2362 } 2363 return this.addCallbacks(fn,fn); 2364 },addCallback:function(fn){ 2365 if(arguments.length>1){ 2366 fn=MochiKit.Base.partial.apply(null,arguments); 2367 } 2368 return this.addCallbacks(fn,null); 2369 },addErrback:function(fn){ 2370 if(arguments.length>1){ 2371 fn=MochiKit.Base.partial.apply(null,arguments); 2372 } 2373 return this.addCallbacks(null,fn); 2374 },addCallbacks:function(cb,eb){ 2375 if(this.chained){ 2376 throw new Error("Chained Deferreds can not be re-used"); 2377 } 2378 this.chain.push([cb,eb]); 2379 if(this.fired>=0){ 2380 this._fire(); 2381 } 2382 return this; 2383 },_fire:function(){ 2384 var _299=this.chain; 2385 var _29a=this.fired; 2386 var res=this.results[_29a]; 2387 var self=this; 2388 var cb=null; 2389 while(_299.length>0&&this.paused===0){ 2390 var pair=_299.shift(); 2391 var f=pair[_29a]; 2392 if(f===null){ 2393 continue; 2394 } 2395 try{ 2396 res=f(res); 2397 _29a=((res instanceof Error)?1:0); 2398 if(res instanceof MochiKit.Async.Deferred){ 2399 cb=function(res){ 2400 self._resback(res); 2401 self.paused--; 2402 if((self.paused===0)&&(self.fired>=0)){ 2403 self._fire(); 2404 } 2405 }; 2406 this.paused++; 2407 } 2408 } 2409 catch(err){ 2410 _29a=1; 2411 if(!(err instanceof Error)){ 2412 err=new MochiKit.Async.GenericError(err); 2413 } 2414 res=err; 2415 } 2416 } 2417 this.fired=_29a; 2418 this.results[_29a]=res; 2419 if(cb&&this.paused){ 2420 res.addBoth(cb); 2421 res.chained=true; 2422 } 2423 }}; 2424 MochiKit.Base.update(MochiKit.Async,{evalJSONRequest:function(req){ 2425 return MochiKit.Base.evalJSON(req.responseText); 2426 },succeed:function(_2a2){ 2427 var d=new MochiKit.Async.Deferred(); 2428 d.callback.apply(d,arguments); 2429 return d; 2430 },fail:function(_2a4){ 2431 var d=new MochiKit.Async.Deferred(); 2432 d.errback.apply(d,arguments); 2433 return d; 2434 },getXMLHttpRequest:function(){ 2435 var self=arguments.callee; 2436 if(!self.XMLHttpRequest){ 2437 var _2a7=[function(){ 2438 return new XMLHttpRequest(); 2439 },function(){ 2440 return new ActiveXObject("Msxml2.XMLHTTP"); 2441 },function(){ 2442 return new ActiveXObject("Microsoft.XMLHTTP"); 2443 },function(){ 2444 return new ActiveXObject("Msxml2.XMLHTTP.4.0"); 2445 },function(){ 2446 throw new MochiKit.Async.BrowserComplianceError("Browser does not support XMLHttpRequest"); 2447 }]; 2448 for(var i=0;i<_2a7.length;i++){ 2449 var func=_2a7[i]; 2450 try{ 2451 self.XMLHttpRequest=func; 2452 return func(); 2453 } 2454 catch(e){ 2455 } 2456 } 2457 } 2458 return self.XMLHttpRequest(); 2459 },_xhr_onreadystatechange:function(d){ 2460 var m=MochiKit.Base; 2461 if(this.readyState==4){ 2462 try{ 2463 this.onreadystatechange=null; 2464 } 2465 catch(e){ 2466 try{ 2467 this.onreadystatechange=m.noop; 2468 } 2469 catch(e){ 2470 } 2471 } 2472 var _2ac=null; 2473 try{ 2474 _2ac=this.status; 2475 if(!_2ac&&m.isNotEmpty(this.responseText)){ 2476 _2ac=304; 2477 } 2478 } 2479 catch(e){ 2480 } 2481 if(_2ac==200||_2ac==201||_2ac==204||_2ac==304||_2ac==1223){ 2482 d.callback(this); 2483 }else{ 2484 var err=new MochiKit.Async.XMLHttpRequestError(this,"Request failed"); 2485 if(err.number){ 2486 d.errback(err); 2487 }else{ 2488 d.errback(err); 2489 } 2490 } 2491 } 2492 },_xhr_canceller:function(req){ 2493 try{ 2494 req.onreadystatechange=null; 2495 } 2496 catch(e){ 2497 try{ 2498 req.onreadystatechange=MochiKit.Base.noop; 2499 } 2500 catch(e){ 2501 } 2502 } 2503 req.abort(); 2504 },sendXMLHttpRequest:function(req,_2b0){ 2505 if(typeof (_2b0)=="undefined"||_2b0===null){ 2506 _2b0=""; 2507 } 2508 var m=MochiKit.Base; 2509 var self=MochiKit.Async; 2510 var d=new self.Deferred(m.partial(self._xhr_canceller,req)); 2511 try{ 2512 req.onreadystatechange=m.bind(self._xhr_onreadystatechange,req,d); 2513 req.send(_2b0); 2514 } 2515 catch(e){ 2516 try{ 2517 req.onreadystatechange=null; 2518 } 2519 catch(ignore){ 2520 } 2521 d.errback(e); 2522 } 2523 return d; 2524 },doXHR:function(url,opts){ 2525 var self=MochiKit.Async; 2526 return self.callLater(0,self._doXHR,url,opts); 2527 },_doXHR:function(url,opts){ 2528 var m=MochiKit.Base; 2529 opts=m.update({method:"GET",sendContent:""},opts); 2530 var self=MochiKit.Async; 2531 var req=self.getXMLHttpRequest(); 2532 if(opts.queryString){ 2533 var qs=m.queryString(opts.queryString); 2534 if(qs){ 2535 url+="?"+qs; 2536 } 2537 } 2538 if("username" in opts){ 2539 req.open(opts.method,url,true,opts.username,opts.password); 2540 }else{ 2541 req.open(opts.method,url,true); 2542 } 2543 if(req.overrideMimeType&&opts.mimeType){ 2544 req.overrideMimeType(opts.mimeType); 2545 } 2546 req.setRequestHeader("X-Requested-With","XMLHttpRequest"); 2547 if(opts.headers){ 2548 var _2bd=opts.headers; 2549 if(!m.isArrayLike(_2bd)){ 2550 _2bd=m.items(_2bd); 2551 } 2552 for(var i=0;i<_2bd.length;i++){ 2553 var _2bf=_2bd[i]; 2554 var name=_2bf[0]; 2555 var _2c1=_2bf[1]; 2556 req.setRequestHeader(name,_2c1); 2557 } 2558 } 2559 return self.sendXMLHttpRequest(req,opts.sendContent); 2560 },_buildURL:function(url){ 2561 if(arguments.length>1){ 2562 var m=MochiKit.Base; 2563 var qs=m.queryString.apply(null,m.extend(null,arguments,1)); 2564 if(qs){ 2565 return url+"?"+qs; 2566 } 2567 } 2568 return url; 2569 },doSimpleXMLHttpRequest:function(url){ 2570 var self=MochiKit.Async; 2571 url=self._buildURL.apply(self,arguments); 2572 return self.doXHR(url); 2573 },loadJSONDoc:function(url){ 2574 var self=MochiKit.Async; 2575 url=self._buildURL.apply(self,arguments); 2576 var d=self.doXHR(url,{"mimeType":"text/plain","headers":[["Accept","application/json"]]}); 2577 d=d.addCallback(self.evalJSONRequest); 2578 return d; 2579 },wait:function(_2ca,_2cb){ 2580 var d=new MochiKit.Async.Deferred(); 2581 var m=MochiKit.Base; 2582 if(typeof (_2cb)!="undefined"){ 2583 d.addCallback(function(){ 2584 return _2cb; 2585 }); 2586 } 2587 var _2ce=setTimeout(m.bind("callback",d),Math.floor(_2ca*1000)); 2588 d.canceller=function(){ 2589 try{ 2590 clearTimeout(_2ce); 2591 } 2592 catch(e){ 2593 } 2594 }; 2595 return d; 2596 },callLater:function(_2cf,func){ 2597 var m=MochiKit.Base; 2598 var _2d2=m.partial.apply(m,m.extend(null,arguments,1)); 2599 return MochiKit.Async.wait(_2cf).addCallback(function(res){ 2600 return _2d2(); 2601 }); 2602 }}); 2603 MochiKit.Async.DeferredLock=function(){ 2604 this.waiting=[]; 2605 this.locked=false; 2606 this.id=this._nextId(); 2607 }; 2608 MochiKit.Async.DeferredLock.prototype={__class__:MochiKit.Async.DeferredLock,acquire:function(){ 2609 var d=new MochiKit.Async.Deferred(); 2610 if(this.locked){ 2611 this.waiting.push(d); 2612 }else{ 2613 this.locked=true; 2614 d.callback(this); 2615 } 2616 return d; 2617 },release:function(){ 2618 if(!this.locked){ 2619 throw TypeError("Tried to release an unlocked DeferredLock"); 2620 } 2621 this.locked=false; 2622 if(this.waiting.length>0){ 2623 this.locked=true; 2624 this.waiting.shift().callback(this); 2625 } 2626 },_nextId:MochiKit.Base.counter(),repr:function(){ 2627 var _2d5; 2628 if(this.locked){ 2629 _2d5="locked, "+this.waiting.length+" waiting"; 2630 }else{ 2631 _2d5="unlocked"; 2632 } 2633 return "DeferredLock("+this.id+", "+_2d5+")"; 2634 },toString:MochiKit.Base.forwardCall("repr")}; 2635 MochiKit.Async.DeferredList=function(list,_2d7,_2d8,_2d9,_2da){ 2636 MochiKit.Async.Deferred.apply(this,[_2da]); 2637 this.list=list; 2638 var _2db=[]; 2639 this.resultList=_2db; 2640 this.finishedCount=0; 2641 this.fireOnOneCallback=_2d7; 2642 this.fireOnOneErrback=_2d8; 2643 this.consumeErrors=_2d9; 2644 var cb=MochiKit.Base.bind(this._cbDeferred,this); 2645 for(var i=0;i<list.length;i++){ 2646 var d=list[i]; 2647 _2db.push(undefined); 2648 d.addCallback(cb,i,true); 2649 d.addErrback(cb,i,false); 2650 } 2651 if(list.length===0&&!_2d7){ 2652 this.callback(this.resultList); 2653 } 2654 }; 2655 MochiKit.Async.DeferredList.prototype=new MochiKit.Async.Deferred(); 2656 MochiKit.Async.DeferredList.prototype._cbDeferred=function(_2df,_2e0,_2e1){ 2657 this.resultList[_2df]=[_2e0,_2e1]; 2658 this.finishedCount+=1; 2659 if(this.fired==-1){ 2660 if(_2e0&&this.fireOnOneCallback){ 2661 this.callback([_2df,_2e1]); 2662 }else{ 2663 if(!_2e0&&this.fireOnOneErrback){ 2664 this.errback(_2e1); 2665 }else{ 2666 if(this.finishedCount==this.list.length){ 2667 this.callback(this.resultList); 2668 } 2669 } 2670 } 2671 } 2672 if(!_2e0&&this.consumeErrors){ 2673 _2e1=null; 2674 } 2675 return _2e1; 2676 }; 2677 MochiKit.Async.gatherResults=function(_2e2){ 2678 var d=new MochiKit.Async.DeferredList(_2e2,false,true,false); 2679 d.addCallback(function(_2e4){ 2680 var ret=[]; 2681 for(var i=0;i<_2e4.length;i++){ 2682 ret.push(_2e4[i][1]); 2683 } 2684 return ret; 2685 }); 2686 return d; 2687 }; 2688 MochiKit.Async.maybeDeferred=function(func){ 2689 var self=MochiKit.Async; 2690 var _2e9; 2691 try{ 2692 var r=func.apply(null,MochiKit.Base.extend([],arguments,1)); 2693 if(r instanceof self.Deferred){ 2694 _2e9=r; 2695 }else{ 2696 if(r instanceof Error){ 2697 _2e9=self.fail(r); 2698 }else{ 2699 _2e9=self.succeed(r); 2700 } 2701 } 2702 } 2703 catch(e){ 2704 _2e9=self.fail(e); 2705 } 2706 return _2e9; 2707 }; 2708 MochiKit.Async.EXPORT=["AlreadyCalledError","CancelledError","BrowserComplianceError","GenericError","XMLHttpRequestError","Deferred","succeed","fail","getXMLHttpRequest","doSimpleXMLHttpRequest","loadJSONDoc","wait","callLater","sendXMLHttpRequest","DeferredLock","DeferredList","gatherResults","maybeDeferred","doXHR"]; 2709 MochiKit.Async.EXPORT_OK=["evalJSONRequest"]; 2710 MochiKit.Async.__new__=function(){ 2711 var m=MochiKit.Base; 2712 var ne=m.partial(m._newNamedError,this); 2713 ne("AlreadyCalledError",function(_2ed){ 2714 this.deferred=_2ed; 2715 }); 2716 ne("CancelledError",function(_2ee){ 2717 this.deferred=_2ee; 2718 }); 2719 ne("BrowserComplianceError",function(msg){ 2720 this.message=msg; 2721 }); 2722 ne("GenericError",function(msg){ 2723 this.message=msg; 2724 }); 2725 ne("XMLHttpRequestError",function(req,msg){ 2726 this.req=req; 2727 this.message=msg; 2728 try{ 2729 this.number=req.status; 2730 } 2731 catch(e){ 2732 } 2733 }); 2734 this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; 2735 m.nameFunctions(this); 2736 }; 2737 MochiKit.Async.__new__(); 2738 MochiKit.Base._exportSymbols(this,MochiKit.Async); 2739 MochiKit.Base._deps("DOM",["Base"]); 2740 MochiKit.DOM.NAME="MochiKit.DOM"; 2741 MochiKit.DOM.VERSION="1.4.2"; 2742 MochiKit.DOM.__repr__=function(){ 2743 return "["+this.NAME+" "+this.VERSION+"]"; 2744 }; 2745 MochiKit.DOM.toString=function(){ 2746 return this.__repr__(); 2747 }; 2748 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","H4","H5","H6","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","DL","DT","DD","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG","getElement","$","getElementsByTagAndClassName","addToCallStack","addLoadEvent","focusOnLoad","setElementClass","toggleElementClass","addElementClass","removeElementClass","swapElementClass","hasElementClass","computedStyle","escapeHTML","toHTML","emitHTML","scrapeText","getFirstParentByTagAndClassName","getFirstElementByTagAndClassName"]; 2749 MochiKit.DOM.EXPORT_OK=["domConverters"]; 2750 MochiKit.DOM.DEPRECATED=[["computedStyle","MochiKit.Style.getStyle","1.4"],["elementDimensions","MochiKit.Style.getElementDimensions","1.4"],["elementPosition","MochiKit.Style.getElementPosition","1.4"],["getViewportDimensions","MochiKit.Style.getViewportDimensions","1.4"],["hideElement","MochiKit.Style.hideElement","1.4"],["makeClipping","MochiKit.Style.makeClipping","1.4.1"],["makePositioned","MochiKit.Style.makePositioned","1.4.1"],["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"],["undoClipping","MochiKit.Style.undoClipping","1.4.1"],["undoPositioned","MochiKit.Style.undoPositioned","1.4.1"],["Coordinates","MochiKit.Style.Coordinates","1.4"],["Dimensions","MochiKit.Style.Dimensions","1.4"]]; 2751 MochiKit.Base.update(MochiKit.DOM,{currentWindow:function(){ 2752 return MochiKit.DOM._window; 2753 },currentDocument:function(){ 2754 return MochiKit.DOM._document; 2755 },withWindow:function(win,func){ 2756 var self=MochiKit.DOM; 2757 var _2f6=self._document; 2758 var _2f7=self._window; 2759 var rval; 2760 try{ 2761 self._window=win; 2762 self._document=win.document; 2763 rval=func(); 2764 } 2765 catch(e){ 2766 self._window=_2f7; 2767 self._document=_2f6; 2768 throw e; 2769 } 2770 self._window=_2f7; 2771 self._document=_2f6; 2772 return rval; 2773 },formContents:function(elem){ 2774 var _2fa=[]; 2775 var _2fb=[]; 2776 var m=MochiKit.Base; 2777 var self=MochiKit.DOM; 2778 if(typeof (elem)=="undefined"||elem===null){ 2779 elem=self._document.body; 2780 }else{ 2781 elem=self.getElement(elem); 2782 } 2783 m.nodeWalk(elem,function(elem){ 2784 var name=elem.name; 2785 if(m.isNotEmpty(name)){ 2786 var _300=elem.tagName.toUpperCase(); 2787 if(_300==="INPUT"&&(elem.type=="radio"||elem.type=="checkbox")&&!elem.checked){ 2788 return null; 2789 } 2790 if(_300==="SELECT"){ 2791 if(elem.type=="select-one"){ 2792 if(elem.selectedIndex>=0){ 2793 var opt=elem.options[elem.selectedIndex]; 2794 var v=opt.value; 2795 if(!v){ 2796 var h=opt.outerHTML; 2797 if(h&&!h.match(/^[^>]+\svalue\s*=/i)){ 2798 v=opt.text; 2799 } 2800 } 2801 _2fa.push(name); 2802 _2fb.push(v); 2803 return null; 2804 } 2805 _2fa.push(name); 2806 _2fb.push(""); 2807 return null; 2808 }else{ 2809 var opts=elem.options; 2810 if(!opts.length){ 2811 _2fa.push(name); 2812 _2fb.push(""); 2813 return null; 2814 } 2815 for(var i=0;i<opts.length;i++){ 2816 var opt=opts[i]; 2817 if(!opt.selected){ 2818 continue; 2819 } 2820 var v=opt.value; 2821 if(!v){ 2822 var h=opt.outerHTML; 2823 if(h&&!h.match(/^[^>]+\svalue\s*=/i)){ 2824 v=opt.text; 2825 } 2826 } 2827 _2fa.push(name); 2828 _2fb.push(v); 2829 } 2830 return null; 2831 } 2832 } 2833 if(_300==="FORM"||_300==="P"||_300==="SPAN"||_300==="DIV"){ 2834 return elem.childNodes; 2835 } 2836 _2fa.push(name); 2837 _2fb.push(elem.value||""); 2838 return null; 2839 } 2840 return elem.childNodes; 2841 }); 2842 return [_2fa,_2fb]; 2843 },withDocument:function(doc,func){ 2844 var self=MochiKit.DOM; 2845 var _309=self._document; 2846 var rval; 2847 try{ 2848 self._document=doc; 2849 rval=func(); 2850 } 2851 catch(e){ 2852 self._document=_309; 2853 throw e; 2854 } 2855 self._document=_309; 2856 return rval; 2857 },registerDOMConverter:function(name,_30c,wrap,_30e){ 2858 MochiKit.DOM.domConverters.register(name,_30c,wrap,_30e); 2859 },coerceToDOM:function(node,ctx){ 2860 var m=MochiKit.Base; 2861 var im=MochiKit.Iter; 2862 var self=MochiKit.DOM; 2863 if(im){ 2864 var iter=im.iter; 2865 var _315=im.repeat; 2866 } 2867 var map=m.map; 2868 var _317=self.domConverters; 2869 var _318=arguments.callee; 2870 var _319=m.NotFound; 2871 while(true){ 2872 if(typeof (node)=="undefined"||node===null){ 2873 return null; 2874 } 2875 if(typeof (node)=="function"&&typeof (node.length)=="number"&&!(node instanceof Function)){ 2876 node=im?im.list(node):m.extend(null,node); 2877 } 2878 if(typeof (node.nodeType)!="undefined"&&node.nodeType>0){ 2879 return node; 2880 } 2881 if(typeof (node)=="number"||typeof (node)=="boolean"){ 2882 node=node.toString(); 2883 } 2884 if(typeof (node)=="string"){ 2885 return self._document.createTextNode(node); 2886 } 2887 if(typeof (node.__dom__)=="function"){ 2888 node=node.__dom__(ctx); 2889 continue; 2890 } 2891 if(typeof (node.dom)=="function"){ 2892 node=node.dom(ctx); 2893 continue; 2894 } 2895 if(typeof (node)=="function"){ 2896 node=node.apply(ctx,[ctx]); 2897 continue; 2898 } 2899 if(im){ 2900 var _31a=null; 2901 try{ 2902 _31a=iter(node); 2903 } 2904 catch(e){ 2905 } 2906 if(_31a){ 2907 return map(_318,_31a,_315(ctx)); 2908 } 2909 }else{ 2910 if(m.isArrayLike(node)){ 2911 var func=function(n){ 2912 return _318(n,ctx); 2913 }; 2914 return map(func,node); 2915 } 2916 } 2917 try{ 2918 node=_317.match(node,ctx); 2919 continue; 2920 } 2921 catch(e){ 2922 if(e!=_319){ 2923 throw e; 2924 } 2925 } 2926 return self._document.createTextNode(node.toString()); 2927 } 2928 return undefined; 2929 },isChildNode:function(node,_31e){ 2930 var self=MochiKit.DOM; 2931 if(typeof (node)=="string"){ 2932 node=self.getElement(node); 2933 } 2934 if(typeof (_31e)=="string"){ 2935 _31e=self.getElement(_31e); 2936 } 2937 if(typeof (node)=="undefined"||node===null){ 2938 return false; 2939 } 2940 while(node!=null&&node!==self._document){ 2941 if(node===_31e){ 2942 return true; 2943 } 2944 node=node.parentNode; 2945 } 2946 return false; 2947 },setNodeAttribute:function(node,attr,_322){ 2948 var o={}; 2949 o[attr]=_322; 2950 try{ 2951 return MochiKit.DOM.updateNodeAttributes(node,o); 2952 } 2953 catch(e){ 2954 } 2955 return null; 2956 },getNodeAttribute:function(node,attr){ 2957 var self=MochiKit.DOM; 2958 var _327=self.attributeArray.renames[attr]; 2959 var _328=self.attributeArray.ignoreAttr[attr]; 2960 node=self.getElement(node); 2961 try{ 2962 if(_327){ 2963 return node[_327]; 2964 } 2965 var _329=node.getAttribute(attr); 2966 if(_329!=_328){ 2967 return _329; 2968 } 2969 } 2970 catch(e){ 2971 } 2972 return null; 2973 },removeNodeAttribute:function(node,attr){ 2974 var self=MochiKit.DOM; 2975 var _32d=self.attributeArray.renames[attr]; 2976 node=self.getElement(node); 2977 try{ 2978 if(_32d){ 2979 return node[_32d]; 2980 } 2981 return node.removeAttribute(attr); 2982 } 2983 catch(e){ 2984 } 2985 return null; 2986 },updateNodeAttributes:function(node,_32f){ 2987 var elem=node; 2988 var self=MochiKit.DOM; 2989 if(typeof (node)=="string"){ 2990 elem=self.getElement(node); 2991 } 2992 if(_32f){ 2993 var _332=MochiKit.Base.updatetree; 2994 if(self.attributeArray.compliant){ 2995 for(var k in _32f){ 2996 var v=_32f[k]; 2997 if(typeof (v)=="object"&&typeof (elem[k])=="object"){ 2998 if(k=="style"&&MochiKit.Style){ 2999 MochiKit.Style.setStyle(elem,v); 3000 }else{ 3001 _332(elem[k],v); 3002 } 3003 }else{ 3004 if(k.substring(0,2)=="on"){ 3005 if(typeof (v)=="string"){ 3006 v=new Function(v); 3007 } 3008 elem[k]=v; 3009 }else{ 3010 elem.setAttribute(k,v); 3011 } 3012 } 3013 if(typeof (elem[k])=="string"&&elem[k]!=v){ 3014 elem[k]=v; 3015 } 3016 } 3017 }else{ 3018 var _335=self.attributeArray.renames; 3019 for(var k in _32f){ 3020 v=_32f[k]; 3021 var _336=_335[k]; 3022 if(k=="style"&&typeof (v)=="string"){ 3023 elem.style.cssText=v; 3024 }else{ 3025 if(typeof (_336)=="string"){ 3026 elem[_336]=v; 3027 }else{ 3028 if(typeof (elem[k])=="object"&&typeof (v)=="object"){ 3029 if(k=="style"&&MochiKit.Style){ 3030 MochiKit.Style.setStyle(elem,v); 3031 }else{ 3032 _332(elem[k],v); 3033 } 3034 }else{ 3035 if(k.substring(0,2)=="on"){ 3036 if(typeof (v)=="string"){ 3037 v=new Function(v); 3038 } 3039 elem[k]=v; 3040 }else{ 3041 elem.setAttribute(k,v); 3042 } 3043 } 3044 } 3045 } 3046 if(typeof (elem[k])=="string"&&elem[k]!=v){ 3047 elem[k]=v; 3048 } 3049 } 3050 } 3051 } 3052 return elem; 3053 },appendChildNodes:function(node){ 3054 var elem=node; 3055 var self=MochiKit.DOM; 3056 if(typeof (node)=="string"){ 3057 elem=self.getElement(node); 3058 } 3059 var _33a=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; 3060 var _33b=MochiKit.Base.concat; 3061 while(_33a.length){ 3062 var n=_33a.shift(); 3063 if(typeof (n)=="undefined"||n===null){ 3064 }else{ 3065 if(typeof (n.nodeType)=="number"){ 3066 elem.appendChild(n); 3067 }else{ 3068 _33a=_33b(n,_33a); 3069 } 3070 } 3071 } 3072 return elem; 3073 },insertSiblingNodesBefore:function(node){ 3074 var elem=node; 3075 var self=MochiKit.DOM; 3076 if(typeof (node)=="string"){ 3077 elem=self.getElement(node); 3078 } 3079 var _340=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; 3080 var _341=elem.parentNode; 3081 var _342=MochiKit.Base.concat; 3082 while(_340.length){ 3083 var n=_340.shift(); 3084 if(typeof (n)=="undefined"||n===null){ 3085 }else{ 3086 if(typeof (n.nodeType)=="number"){ 3087 _341.insertBefore(n,elem); 3088 }else{ 3089 _340=_342(n,_340); 3090 } 3091 } 3092 } 3093 return _341; 3094 },insertSiblingNodesAfter:function(node){ 3095 var elem=node; 3096 var self=MochiKit.DOM; 3097 if(typeof (node)=="string"){ 3098 elem=self.getElement(node); 3099 } 3100 var _347=[self.coerceToDOM(MochiKit.Base.extend(null,arguments,1),elem)]; 3101 if(elem.nextSibling){ 3102 return self.insertSiblingNodesBefore(elem.nextSibling,_347); 3103 }else{ 3104 return self.appendChildNodes(elem.parentNode,_347); 3105 } 3106 },replaceChildNodes:function(node){ 3107 var elem=node; 3108 var self=MochiKit.DOM; 3109 if(typeof (node)=="string"){ 3110 elem=self.getElement(node); 3111 arguments[0]=elem; 3112 } 3113 var _34b; 3114 while((_34b=elem.firstChild)){ 3115 elem.removeChild(_34b); 3116 } 3117 if(arguments.length<2){ 3118 return elem; 3119 }else{ 3120 return self.appendChildNodes.apply(this,arguments); 3121 } 3122 },createDOM:function(name,_34d){ 3123 var elem; 3124 var self=MochiKit.DOM; 3125 var m=MochiKit.Base; 3126 if(typeof (_34d)=="string"||typeof (_34d)=="number"){ 3127 var args=m.extend([name,null],arguments,1); 3128 return arguments.callee.apply(this,args); 3129 } 3130 if(typeof (name)=="string"){ 3131 var _352=self._xhtml; 3132 if(_34d&&!self.attributeArray.compliant){ 3133 var _353=""; 3134 if("name" in _34d){ 3135 _353+=" name=\""+self.escapeHTML(_34d.name)+"\""; 3136 } 3137 if(name=="input"&&"type" in _34d){ 3138 _353+=" type=\""+self.escapeHTML(_34d.type)+"\""; 3139 } 3140 if(_353){ 3141 name="<"+name+_353+">"; 3142 _352=false; 3143 } 3144 } 3145 var d=self._document; 3146 if(_352&&d===document){ 3147 elem=d.createElementNS("http://www.w3.org/1999/xhtml",name); 3148 }else{ 3149 elem=d.createElement(name); 3150 } 3151 }else{ 3152 elem=name; 3153 } 3154 if(_34d){ 3155 self.updateNodeAttributes(elem,_34d); 3156 } 3157 if(arguments.length<=2){ 3158 return elem; 3159 }else{ 3160 var args=m.extend([elem],arguments,2); 3161 return self.appendChildNodes.apply(this,args); 3162 } 3163 },createDOMFunc:function(){ 3164 var m=MochiKit.Base; 3165 return m.partial.apply(this,m.extend([MochiKit.DOM.createDOM],arguments)); 3166 },removeElement:function(elem){ 3167 var self=MochiKit.DOM; 3168 var e=self.coerceToDOM(self.getElement(elem)); 3169 e.parentNode.removeChild(e); 3170 return e; 3171 },swapDOM:function(dest,src){ 3172 var self=MochiKit.DOM; 3173 dest=self.getElement(dest); 3174 var _35c=dest.parentNode; 3175 if(src){ 3176 src=self.coerceToDOM(self.getElement(src),_35c); 3177 _35c.replaceChild(src,dest); 3178 }else{ 3179 _35c.removeChild(dest); 3180 } 3181 return src; 3182 },getElement:function(id){ 3183 var self=MochiKit.DOM; 3184 if(arguments.length==1){ 3185 return ((typeof (id)=="string")?self._document.getElementById(id):id); 3186 }else{ 3187 return MochiKit.Base.map(self.getElement,arguments); 3188 } 3189 },getElementsByTagAndClassName:function(_35f,_360,_361){ 3190 var self=MochiKit.DOM; 3191 if(typeof (_35f)=="undefined"||_35f===null){ 3192 _35f="*"; 3193 } 3194 if(typeof (_361)=="undefined"||_361===null){ 3195 _361=self._document; 3196 } 3197 _361=self.getElement(_361); 3198 if(_361==null){ 3199 return []; 3200 } 3201 var _363=(_361.getElementsByTagName(_35f)||self._document.all); 3202 if(typeof (_360)=="undefined"||_360===null){ 3203 return MochiKit.Base.extend(null,_363); 3204 } 3205 var _364=[]; 3206 for(var i=0;i<_363.length;i++){ 3207 var _366=_363[i]; 3208 var cls=_366.className; 3209 if(typeof (cls)!="string"){ 3210 cls=_366.getAttribute("class"); 3211 } 3212 if(typeof (cls)=="string"){ 3213 var _368=cls.split(" "); 3214 for(var j=0;j<_368.length;j++){ 3215 if(_368[j]==_360){ 3216 _364.push(_366); 3217 break; 3218 } 3219 } 3220 } 3221 } 3222 return _364; 3223 },_newCallStack:function(path,once){ 3224 var rval=function(){ 3225 var _36d=arguments.callee.callStack; 3226 for(var i=0;i<_36d.length;i++){ 3227 if(_36d[i].apply(this,arguments)===false){ 3228 break; 3229 } 3230 } 3231 if(once){ 3232 try{ 3233 this[path]=null; 3234 } 3235 catch(e){ 3236 } 3237 } 3238 }; 3239 rval.callStack=[]; 3240 return rval; 3241 },addToCallStack:function(_36f,path,func,once){ 3242 var self=MochiKit.DOM; 3243 var _374=_36f[path]; 3244 var _375=_374; 3245 if(!(typeof (_374)=="function"&&typeof (_374.callStack)=="object"&&_374.callStack!==null)){ 3246 _375=self._newCallStack(path,once); 3247 if(typeof (_374)=="function"){ 3248 _375.callStack.push(_374); 3249 } 3250 _36f[path]=_375; 3251 } 3252 _375.callStack.push(func); 3253 },addLoadEvent:function(func){ 3254 var self=MochiKit.DOM; 3255 self.addToCallStack(self._window,"onload",func,true); 3256 },focusOnLoad:function(_378){ 3257 var self=MochiKit.DOM; 3258 self.addLoadEvent(function(){ 3259 _378=self.getElement(_378); 3260 if(_378){ 3261 _378.focus(); 3262 } 3263 }); 3264 },setElementClass:function(_37a,_37b){ 3265 var self=MochiKit.DOM; 3266 var obj=self.getElement(_37a); 3267 if(self.attributeArray.compliant){ 3268 obj.setAttribute("class",_37b); 3269 }else{ 3270 obj.setAttribute("className",_37b); 3271 } 3272 },toggleElementClass:function(_37e){ 3273 var self=MochiKit.DOM; 3274 for(var i=1;i<arguments.length;i++){ 3275 var obj=self.getElement(arguments[i]); 3276 if(!self.addElementClass(obj,_37e)){ 3277 self.removeElementClass(obj,_37e); 3278 } 3279 } 3280 },addElementClass:function(_382,_383){ 3281 var self=MochiKit.DOM; 3282 var obj=self.getElement(_382); 3283 var cls=obj.className; 3284 if(typeof (cls)!="string"){ 3285 cls=obj.getAttribute("class"); 3286 } 3287 if(typeof (cls)!="string"||cls.length===0){ 3288 self.setElementClass(obj,_383); 3289 return true; 3290 } 3291 if(cls==_383){ 3292 return false; 3293 } 3294 var _387=cls.split(" "); 3295 for(var i=0;i<_387.length;i++){ 3296 if(_387[i]==_383){ 3297 return false; 3298 } 3299 } 3300 self.setElementClass(obj,cls+" "+_383); 3301 return true; 3302 },removeElementClass:function(_389,_38a){ 3303 var self=MochiKit.DOM; 3304 var obj=self.getElement(_389); 3305 var cls=obj.className; 3306 if(typeof (cls)!="string"){ 3307 cls=obj.getAttribute("class"); 3308 } 3309 if(typeof (cls)!="string"||cls.length===0){ 3310 return false; 3311 } 3312 if(cls==_38a){ 3313 self.setElementClass(obj,""); 3314 return true; 3315 } 3316 var _38e=cls.split(" "); 3317 for(var i=0;i<_38e.length;i++){ 3318 if(_38e[i]==_38a){ 3319 _38e.splice(i,1); 3320 self.setElementClass(obj,_38e.join(" ")); 3321 return true; 3322 } 3323 } 3324 return false; 3325 },swapElementClass:function(_390,_391,_392){ 3326 var obj=MochiKit.DOM.getElement(_390); 3327 var res=MochiKit.DOM.removeElementClass(obj,_391); 3328 if(res){ 3329 MochiKit.DOM.addElementClass(obj,_392); 3330 } 3331 return res; 3332 },hasElementClass:function(_395,_396){ 3333 var obj=MochiKit.DOM.getElement(_395); 3334 if(obj==null){ 3335 return false; 3336 } 3337 var cls=obj.className; 3338 if(typeof (cls)!="string"){ 3339 cls=obj.getAttribute("class"); 3340 } 3341 if(typeof (cls)!="string"){ 3342 return false; 3343 } 3344 var _399=cls.split(" "); 3345 for(var i=1;i<arguments.length;i++){ 3346 var good=false; 3347 for(var j=0;j<_399.length;j++){ 3348 if(_399[j]==arguments[i]){ 3349 good=true; 3350 break; 3351 } 3352 } 3353 if(!good){ 3354 return false; 3355 } 3356 } 3357 return true; 3358 },escapeHTML:function(s){ 3359 return s.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">"); 3360 },toHTML:function(dom){ 3361 return MochiKit.DOM.emitHTML(dom).join(""); 3362 },emitHTML:function(dom,lst){ 3363 if(typeof (lst)=="undefined"||lst===null){ 3364 lst=[]; 3365 } 3366 var _3a1=[dom]; 3367 var self=MochiKit.DOM; 3368 var _3a3=self.escapeHTML; 3369 var _3a4=self.attributeArray; 3370 while(_3a1.length){ 3371 dom=_3a1.pop(); 3372 if(typeof (dom)=="string"){ 3373 lst.push(dom); 3374 }else{ 3375 if(dom.nodeType==1){ 3376 lst.push("<"+dom.tagName.toLowerCase()); 3377 var _3a5=[]; 3378 var _3a6=_3a4(dom); 3379 for(var i=0;i<_3a6.length;i++){ 3380 var a=_3a6[i]; 3381 _3a5.push([" ",a.name,"=\"",_3a3(a.value),"\""]); 3382 } 3383 _3a5.sort(); 3384 for(i=0;i<_3a5.length;i++){ 3385 var _3a9=_3a5[i]; 3386 for(var j=0;j<_3a9.length;j++){ 3387 lst.push(_3a9[j]); 3388 } 3389 } 3390 if(dom.hasChildNodes()){ 3391 lst.push(">"); 3392 _3a1.push("</"+dom.tagName.toLowerCase()+">"); 3393 var _3ab=dom.childNodes; 3394 for(i=_3ab.length-1;i>=0;i--){ 3395 _3a1.push(_3ab[i]); 3396 } 3397 }else{ 3398 lst.push("/>"); 3399 } 3400 }else{ 3401 if(dom.nodeType==3){ 3402 lst.push(_3a3(dom.nodeValue)); 3403 } 3404 } 3405 } 3406 } 3407 return lst; 3408 },scrapeText:function(node,_3ad){ 3409 var rval=[]; 3410 (function(node){ 3411 var cn=node.childNodes; 3412 if(cn){ 3413 for(var i=0;i<cn.length;i++){ 3414 arguments.callee.call(this,cn[i]); 3415 } 3416 } 3417 var _3b2=node.nodeValue; 3418 if(typeof (_3b2)=="string"){ 3419 rval.push(_3b2); 3420 } 3421 })(MochiKit.DOM.getElement(node)); 3422 if(_3ad){ 3423 return rval; 3424 }else{ 3425 return rval.join(""); 3426 } 3427 },removeEmptyTextNodes:function(_3b3){ 3428 _3b3=MochiKit.DOM.getElement(_3b3); 3429 for(var i=0;i<_3b3.childNodes.length;i++){ 3430 var node=_3b3.childNodes[i]; 3431 if(node.nodeType==3&&!/\S/.test(node.nodeValue)){ 3432 node.parentNode.removeChild(node); 3433 } 3434 } 3435 },getFirstElementByTagAndClassName:function(_3b6,_3b7,_3b8){ 3436 var self=MochiKit.DOM; 3437 if(typeof (_3b6)=="undefined"||_3b6===null){ 3438 _3b6="*"; 3439 } 3440 if(typeof (_3b8)=="undefined"||_3b8===null){ 3441 _3b8=self._document; 3442 } 3443 _3b8=self.getElement(_3b8); 3444 if(_3b8==null){ 3445 return null; 3446 } 3447 var _3ba=(_3b8.getElementsByTagName(_3b6)||self._document.all); 3448 if(_3ba.length<=0){ 3449 return null; 3450 }else{ 3451 if(typeof (_3b7)=="undefined"||_3b7===null){ 3452 return _3ba[0]; 3453 } 3454 } 3455 for(var i=0;i<_3ba.length;i++){ 3456 var _3bc=_3ba[i]; 3457 var cls=_3bc.className; 3458 if(typeof (cls)!="string"){ 3459 cls=_3bc.getAttribute("class"); 3460 } 3461 if(typeof (cls)=="string"){ 3462 var _3be=cls.split(" "); 3463 for(var j=0;j<_3be.length;j++){ 3464 if(_3be[j]==_3b7){ 3465 return _3bc; 3466 } 3467 } 3468 } 3469 } 3470 return null; 3471 },getFirstParentByTagAndClassName:function(elem,_3c1,_3c2){ 3472 var self=MochiKit.DOM; 3473 elem=self.getElement(elem); 3474 if(typeof (_3c1)=="undefined"||_3c1===null){ 3475 _3c1="*"; 3476 }else{ 3477 _3c1=_3c1.toUpperCase(); 3478 } 3479 if(typeof (_3c2)=="undefined"||_3c2===null){ 3480 _3c2=null; 3481 } 3482 if(elem){ 3483 elem=elem.parentNode; 3484 } 3485 while(elem&&elem.tagName){ 3486 var _3c4=elem.tagName.toUpperCase(); 3487 if((_3c1==="*"||_3c1==_3c4)&&(_3c2===null||self.hasElementClass(elem,_3c2))){ 3488 return elem; 3489 } 3490 elem=elem.parentNode; 3491 } 3492 return null; 3493 },__new__:function(win){ 3494 var m=MochiKit.Base; 3495 if(typeof (document)!="undefined"){ 3496 this._document=document; 3497 var _3c7="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; 3498 this._xhtml=(document.documentElement&&document.createElementNS&&document.documentElement.namespaceURI===_3c7); 3499 }else{ 3500 if(MochiKit.MockDOM){ 3501 this._document=MochiKit.MockDOM.document; 3502 } 3503 } 3504 this._window=win; 3505 this.domConverters=new m.AdapterRegistry(); 3506 var _3c8=this._document.createElement("span"); 3507 var _3c9; 3508 if(_3c8&&_3c8.attributes&&_3c8.attributes.length>0){ 3509 var _3ca=m.filter; 3510 _3c9=function(node){ 3511 return _3ca(_3c9.ignoreAttrFilter,node.attributes); 3512 }; 3513 _3c9.ignoreAttr={}; 3514 var _3cc=_3c8.attributes; 3515 var _3cd=_3c9.ignoreAttr; 3516 for(var i=0;i<_3cc.length;i++){ 3517 var a=_3cc[i]; 3518 _3cd[a.name]=a.value; 3519 } 3520 _3c9.ignoreAttrFilter=function(a){ 3521 return (_3c9.ignoreAttr[a.name]!=a.value); 3522 }; 3523 _3c9.compliant=false; 3524 _3c9.renames={"class":"className","checked":"defaultChecked","usemap":"useMap","for":"htmlFor","readonly":"readOnly","colspan":"colSpan","bgcolor":"bgColor","cellspacing":"cellSpacing","cellpadding":"cellPadding"}; 3525 }else{ 3526 _3c9=function(node){ 3527 return node.attributes; 3528 }; 3529 _3c9.compliant=true; 3530 _3c9.ignoreAttr={}; 3531 _3c9.renames={}; 3532 } 3533 this.attributeArray=_3c9; 3534 var _3d2=function(_3d3,arr){ 3535 var _3d5=arr[0]; 3536 var _3d6=arr[1]; 3537 var _3d7=_3d6.split(".")[1]; 3538 var str=""; 3539 str+="if (!MochiKit."+_3d7+") { throw new Error(\""; 3540 str+="This function has been deprecated and depends on MochiKit."; 3541 str+=_3d7+".\");}"; 3542 str+="return "+_3d6+".apply(this, arguments);"; 3543 MochiKit[_3d3][_3d5]=new Function(str); 3544 }; 3545 for(var i=0;i<MochiKit.DOM.DEPRECATED.length;i++){ 3546 _3d2("DOM",MochiKit.DOM.DEPRECATED[i]); 3547 } 3548 var _3d9=this.createDOMFunc; 3549 this.UL=_3d9("ul"); 3550 this.OL=_3d9("ol"); 3551 this.LI=_3d9("li"); 3552 this.DL=_3d9("dl"); 3553 this.DT=_3d9("dt"); 3554 this.DD=_3d9("dd"); 3555 this.TD=_3d9("td"); 3556 this.TR=_3d9("tr"); 3557 this.TBODY=_3d9("tbody"); 3558 this.THEAD=_3d9("thead"); 3559 this.TFOOT=_3d9("tfoot"); 3560 this.TABLE=_3d9("table"); 3561 this.TH=_3d9("th"); 3562 this.INPUT=_3d9("input"); 3563 this.SPAN=_3d9("span"); 3564 this.A=_3d9("a"); 3565 this.DIV=_3d9("div"); 3566 this.IMG=_3d9("img"); 3567 this.BUTTON=_3d9("button"); 3568 this.TT=_3d9("tt"); 3569 this.PRE=_3d9("pre"); 3570 this.H1=_3d9("h1"); 3571 this.H2=_3d9("h2"); 3572 this.H3=_3d9("h3"); 3573 this.H4=_3d9("h4"); 3574 this.H5=_3d9("h5"); 3575 this.H6=_3d9("h6"); 3576 this.BR=_3d9("br"); 3577 this.HR=_3d9("hr"); 3578 this.LABEL=_3d9("label"); 3579 this.TEXTAREA=_3d9("textarea"); 3580 this.FORM=_3d9("form"); 3581 this.P=_3d9("p"); 3582 this.SELECT=_3d9("select"); 3583 this.OPTION=_3d9("option"); 3584 this.OPTGROUP=_3d9("optgroup"); 3585 this.LEGEND=_3d9("legend"); 3586 this.FIELDSET=_3d9("fieldset"); 3587 this.STRONG=_3d9("strong"); 3588 this.CANVAS=_3d9("canvas"); 3589 this.$=this.getElement; 3590 this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; 3591 m.nameFunctions(this); 3592 }}); 3593 MochiKit.DOM.__new__(((typeof (window)=="undefined")?this:window)); 3594 if(MochiKit.__export__){ 3595 withWindow=MochiKit.DOM.withWindow; 3596 withDocument=MochiKit.DOM.withDocument; 3597 } 3598 MochiKit.Base._exportSymbols(this,MochiKit.DOM); 3599 MochiKit.Base._deps("Selector",["Base","DOM","Iter"]); 3600 MochiKit.Selector.NAME="MochiKit.Selector"; 3601 MochiKit.Selector.VERSION="1.4.2"; 3602 MochiKit.Selector.__repr__=function(){ 3603 return "["+this.NAME+" "+this.VERSION+"]"; 3604 }; 3605 MochiKit.Selector.toString=function(){ 3606 return this.__repr__(); 3607 }; 3608 MochiKit.Selector.EXPORT=["Selector","findChildElements","findDocElements","$$"]; 3609 MochiKit.Selector.EXPORT_OK=[]; 3610 MochiKit.Selector.Selector=function(_3da){ 3611 this.params={classNames:[],pseudoClassNames:[]}; 3612 this.expression=_3da.toString().replace(/(^\s+|\s+$)/g,""); 3613 this.parseExpression(); 3614 this.compileMatcher(); 3615 }; 3616 MochiKit.Selector.Selector.prototype={__class__:MochiKit.Selector.Selector,parseExpression:function(){ 3617 function abort(_3db){ 3618 throw "Parse error in selector: "+_3db; 3619 } 3620 if(this.expression==""){ 3621 abort("empty expression"); 3622 } 3623 var repr=MochiKit.Base.repr; 3624 var _3dd=this.params; 3625 var expr=this.expression; 3626 var _3df,_3e0,_3e1,rest; 3627 while(_3df=expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!^$*]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)){ 3628 _3dd.attributes=_3dd.attributes||[]; 3629 _3dd.attributes.push({name:_3df[2],operator:_3df[3],value:_3df[4]||_3df[5]||""}); 3630 expr=_3df[1]; 3631 } 3632 if(expr=="*"){ 3633 return this.params.wildcard=true; 3634 } 3635 while(_3df=expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+(?:\([^)]*\))?)(.*)/i)){ 3636 _3e0=_3df[1]; 3637 _3e1=_3df[2]; 3638 rest=_3df[3]; 3639 switch(_3e0){ 3640 case "#": 3641 _3dd.id=_3e1; 3642 break; 3643 case ".": 3644 _3dd.classNames.push(_3e1); 3645 break; 3646 case ":": 3647 _3dd.pseudoClassNames.push(_3e1); 3648 break; 3649 case "": 3650 case undefined: 3651 _3dd.tagName=_3e1.toUpperCase(); 3652 break; 3653 default: 3654 abort(repr(expr)); 3655 } 3656 expr=rest; 3657 } 3658 if(expr.length>0){ 3659 abort(repr(expr)); 3660 } 3661 },buildMatchExpression:function(){ 3662 var repr=MochiKit.Base.repr; 3663 var _3e4=this.params; 3664 var _3e5=[]; 3665 var _3e6,i; 3666 function childElements(_3e8){ 3667 return "MochiKit.Base.filter(function (node) { return node.nodeType == 1; }, "+_3e8+".childNodes)"; 3668 } 3669 if(_3e4.wildcard){ 3670 _3e5.push("true"); 3671 } 3672 if(_3e6=_3e4.id){ 3673 _3e5.push("element.id == "+repr(_3e6)); 3674 } 3675 if(_3e6=_3e4.tagName){ 3676 _3e5.push("element.tagName.toUpperCase() == "+repr(_3e6)); 3677 } 3678 if((_3e6=_3e4.classNames).length>0){ 3679 for(i=0;i<_3e6.length;i++){ 3680 _3e5.push("MochiKit.DOM.hasElementClass(element, "+repr(_3e6[i])+")"); 3681 } 3682 } 3683 if((_3e6=_3e4.pseudoClassNames).length>0){ 3684 for(i=0;i<_3e6.length;i++){ 3685 var _3e9=_3e6[i].match(/^([^(]+)(?:\((.*)\))?$/); 3686 var _3ea=_3e9[1]; 3687 var _3eb=_3e9[2]; 3688 switch(_3ea){ 3689 case "root": 3690 _3e5.push("element.nodeType == 9 || element === element.ownerDocument.documentElement"); 3691 break; 3692 case "nth-child": 3693 case "nth-last-child": 3694 case "nth-of-type": 3695 case "nth-last-of-type": 3696 _3e9=_3eb.match(/^((?:(\d+)n\+)?(\d+)|odd|even)$/); 3697 if(!_3e9){ 3698 throw "Invalid argument to pseudo element nth-child: "+_3eb; 3699 } 3700 var a,b; 3701 if(_3e9[0]=="odd"){ 3702 a=2; 3703 b=1; 3704 }else{ 3705 if(_3e9[0]=="even"){ 3706 a=2; 3707 b=0; 3708 }else{ 3709 a=_3e9[2]&&parseInt(_3e9)||null; 3710 b=parseInt(_3e9[3]); 3711 } 3712 } 3713 _3e5.push("this.nthChild(element,"+a+","+b+","+!!_3ea.match("^nth-last")+","+!!_3ea.match("of-type$")+")"); 3714 break; 3715 case "first-child": 3716 _3e5.push("this.nthChild(element, null, 1)"); 3717 break; 3718 case "last-child": 3719 _3e5.push("this.nthChild(element, null, 1, true)"); 3720 break; 3721 case "first-of-type": 3722 _3e5.push("this.nthChild(element, null, 1, false, true)"); 3723 break; 3724 case "last-of-type": 3725 _3e5.push("this.nthChild(element, null, 1, true, true)"); 3726 break; 3727 case "only-child": 3728 _3e5.push(childElements("element.parentNode")+".length == 1"); 3729 break; 3730 case "only-of-type": 3731 _3e5.push("MochiKit.Base.filter(function (node) { return node.tagName == element.tagName; }, "+childElements("element.parentNode")+").length == 1"); 3732 break; 3733 case "empty": 3734 _3e5.push("element.childNodes.length == 0"); 3735 break; 3736 case "enabled": 3737 _3e5.push("(this.isUIElement(element) && element.disabled === false)"); 3738 break; 3739 case "disabled": 3740 _3e5.push("(this.isUIElement(element) && element.disabled === true)"); 3741 break; 3742 case "checked": 3743 _3e5.push("(this.isUIElement(element) && element.checked === true)"); 3744 break; 3745 case "not": 3746 var _3ee=new MochiKit.Selector.Selector(_3eb); 3747 _3e5.push("!( "+_3ee.buildMatchExpression()+")"); 3748 break; 3749 } 3750 } 3751 } 3752 if(_3e6=_3e4.attributes){ 3753 MochiKit.Base.map(function(_3ef){ 3754 var _3f0="MochiKit.DOM.getNodeAttribute(element, "+repr(_3ef.name)+")"; 3755 var _3f1=function(_3f2){ 3756 return _3f0+".split("+repr(_3f2)+")"; 3757 }; 3758 _3e5.push(_3f0+" != null"); 3759 switch(_3ef.operator){ 3760 case "=": 3761 _3e5.push(_3f0+" == "+repr(_3ef.value)); 3762 break; 3763 case "~=": 3764 _3e5.push("MochiKit.Base.findValue("+_3f1(" ")+", "+repr(_3ef.value)+") > -1"); 3765 break; 3766 case "^=": 3767 _3e5.push(_3f0+".substring(0, "+_3ef.value.length+") == "+repr(_3ef.value)); 3768 break; 3769 case "$=": 3770 _3e5.push(_3f0+".substring("+_3f0+".length - "+_3ef.value.length+") == "+repr(_3ef.value)); 3771 break; 3772 case "*=": 3773 _3e5.push(_3f0+".match("+repr(_3ef.value)+")"); 3774 break; 3775 case "|=": 3776 _3e5.push(_3f1("-")+"[0].toUpperCase() == "+repr(_3ef.value.toUpperCase())); 3777 break; 3778 case "!=": 3779 _3e5.push(_3f0+" != "+repr(_3ef.value)); 3780 break; 3781 case "": 3782 case undefined: 3783 break; 3784 default: 3785 throw "Unknown operator "+_3ef.operator+" in selector"; 3786 } 3787 },_3e6); 3788 } 3789 return _3e5.join(" && "); 3790 },compileMatcher:function(){ 3791 var code="return (!element.tagName) ? false : "+this.buildMatchExpression()+";"; 3792 this.match=new Function("element",code); 3793 },nthChild:function(_3f4,a,b,_3f7,_3f8){ 3794 var _3f9=MochiKit.Base.filter(function(node){ 3795 return node.nodeType==1; 3796 },_3f4.parentNode.childNodes); 3797 if(_3f8){ 3798 _3f9=MochiKit.Base.filter(function(node){ 3799 return node.tagName==_3f4.tagName; 3800 },_3f9); 3801 } 3802 if(_3f7){ 3803 _3f9=MochiKit.Iter.reversed(_3f9); 3804 } 3805 if(a){ 3806 var _3fc=MochiKit.Base.findIdentical(_3f9,_3f4); 3807 return ((_3fc+1-b)/a)%1==0; 3808 }else{ 3809 return b==MochiKit.Base.findIdentical(_3f9,_3f4)+1; 3810 } 3811 },isUIElement:function(_3fd){ 3812 return MochiKit.Base.findValue(["input","button","select","option","textarea","object"],_3fd.tagName.toLowerCase())>-1; 3813 },findElements:function(_3fe,axis){ 3814 var _400; 3815 if(axis==undefined){ 3816 axis=""; 3817 } 3818 function inScope(_401,_402){ 3819 if(axis==""){ 3820 return MochiKit.DOM.isChildNode(_401,_402); 3821 }else{ 3822 if(axis==">"){ 3823 return _401.parentNode===_402; 3824 }else{ 3825 if(axis=="+"){ 3826 return _401===nextSiblingElement(_402); 3827 }else{ 3828 if(axis=="~"){ 3829 var _403=_402; 3830 while(_403=nextSiblingElement(_403)){ 3831 if(_401===_403){ 3832 return true; 3833 } 3834 } 3835 return false; 3836 }else{ 3837 throw "Invalid axis: "+axis; 3838 } 3839 } 3840 } 3841 } 3842 } 3843 if(_400=MochiKit.DOM.getElement(this.params.id)){ 3844 if(this.match(_400)){ 3845 if(!_3fe||inScope(_400,_3fe)){ 3846 return [_400]; 3847 } 3848 } 3849 } 3850 function nextSiblingElement(node){ 3851 node=node.nextSibling; 3852 while(node&&node.nodeType!=1){ 3853 node=node.nextSibling; 3854 } 3855 return node; 3856 } 3857 if(axis==""){ 3858 _3fe=(_3fe||MochiKit.DOM.currentDocument()).getElementsByTagName(this.params.tagName||"*"); 3859 }else{ 3860 if(axis==">"){ 3861 if(!_3fe){ 3862 throw "> combinator not allowed without preceeding expression"; 3863 } 3864 _3fe=MochiKit.Base.filter(function(node){ 3865 return node.nodeType==1; 3866 },_3fe.childNodes); 3867 }else{ 3868 if(axis=="+"){ 3869 if(!_3fe){ 3870 throw "+ combinator not allowed without preceeding expression"; 3871 } 3872 _3fe=nextSiblingElement(_3fe)&&[nextSiblingElement(_3fe)]; 3873 }else{ 3874 if(axis=="~"){ 3875 if(!_3fe){ 3876 throw "~ combinator not allowed without preceeding expression"; 3877 } 3878 var _406=[]; 3879 while(nextSiblingElement(_3fe)){ 3880 _3fe=nextSiblingElement(_3fe); 3881 _406.push(_3fe); 3882 } 3883 _3fe=_406; 3884 } 3885 } 3886 } 3887 } 3888 if(!_3fe){ 3889 return []; 3890 } 3891 var _407=MochiKit.Base.filter(MochiKit.Base.bind(function(_408){ 3892 return this.match(_408); 3893 },this),_3fe); 3894 return _407; 3895 },repr:function(){ 3896 return "Selector("+this.expression+")"; 3897 },toString:MochiKit.Base.forwardCall("repr")}; 3898 MochiKit.Base.update(MochiKit.Selector,{findChildElements:function(_409,_40a){ 3899 var uniq=function(arr){ 3900 var res=[]; 3901 for(var i=0;i<arr.length;i++){ 3902 if(MochiKit.Base.findIdentical(res,arr[i])<0){ 3903 res.push(arr[i]); 3904 } 3905 } 3906 return res; 3907 }; 3908 return MochiKit.Base.flattenArray(MochiKit.Base.map(function(_40f){ 3909 var _410=""; 3910 var _411=function(_412,expr){ 3911 if(match=expr.match(/^[>+~]$/)){ 3912 _410=match[0]; 3913 return _412; 3914 }else{ 3915 var _414=new MochiKit.Selector.Selector(expr); 3916 var _415=MochiKit.Iter.reduce(function(_416,_417){ 3917 return MochiKit.Base.extend(_416,_414.findElements(_417||_409,_410)); 3918 },_412,[]); 3919 _410=""; 3920 return _415; 3921 } 3922 }; 3923 var _418=_40f.replace(/(^\s+|\s+$)/g,"").split(/\s+/); 3924 return uniq(MochiKit.Iter.reduce(_411,_418,[null])); 3925 },_40a)); 3926 },findDocElements:function(){ 3927 return MochiKit.Selector.findChildElements(MochiKit.DOM.currentDocument(),arguments); 3928 },__new__:function(){ 3929 var m=MochiKit.Base; 3930 this.$$=this.findDocElements; 3931 this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; 3932 m.nameFunctions(this); 3933 }}); 3934 MochiKit.Selector.__new__(); 3935 MochiKit.Base._exportSymbols(this,MochiKit.Selector); 3936 MochiKit.Base._deps("Style",["Base","DOM"]); 3937 MochiKit.Style.NAME="MochiKit.Style"; 3938 MochiKit.Style.VERSION="1.4.2"; 3939 MochiKit.Style.__repr__=function(){ 3940 return "["+this.NAME+" "+this.VERSION+"]"; 3941 }; 3942 MochiKit.Style.toString=function(){ 3943 return this.__repr__(); 3944 }; 3945 MochiKit.Style.EXPORT_OK=[]; 3946 MochiKit.Style.EXPORT=["setStyle","setOpacity","getStyle","getElementDimensions","elementDimensions","setElementDimensions","getElementPosition","elementPosition","setElementPosition","makePositioned","undoPositioned","makeClipping","undoClipping","setDisplayForElement","hideElement","showElement","getViewportDimensions","getViewportPosition","Dimensions","Coordinates"]; 3947 MochiKit.Style.Dimensions=function(w,h){ 3948 this.w=w; 3949 this.h=h; 3950 }; 3951 MochiKit.Style.Dimensions.prototype.__repr__=function(){ 3952 var repr=MochiKit.Base.repr; 3953 return "{w: "+repr(this.w)+", h: "+repr(this.h)+"}"; 3954 }; 3955 MochiKit.Style.Dimensions.prototype.toString=function(){ 3956 return this.__repr__(); 3957 }; 3958 MochiKit.Style.Coordinates=function(x,y){ 3959 this.x=x; 3960 this.y=y; 3961 }; 3962 MochiKit.Style.Coordinates.prototype.__repr__=function(){ 3963 var repr=MochiKit.Base.repr; 3964 return "{x: "+repr(this.x)+", y: "+repr(this.y)+"}"; 3965 }; 3966 MochiKit.Style.Coordinates.prototype.toString=function(){ 3967 return this.__repr__(); 3968 }; 3969 MochiKit.Base.update(MochiKit.Style,{getStyle:function(elem,_421){ 3970 var dom=MochiKit.DOM; 3971 var d=dom._document; 3972 elem=dom.getElement(elem); 3973 _421=MochiKit.Base.camelize(_421); 3974 if(!elem||elem==d){ 3975 return undefined; 3976 } 3977 if(_421=="opacity"&&typeof (elem.filters)!="undefined"){ 3978 var _424=(MochiKit.Style.getStyle(elem,"filter")||"").match(/alpha\(opacity=(.*)\)/); 3979 if(_424&&_424[1]){ 3980 return parseFloat(_424[1])/100; 3981 } 3982 return 1; 3983 } 3984 if(_421=="float"||_421=="cssFloat"||_421=="styleFloat"){ 3985 if(elem.style["float"]){ 3986 return elem.style["float"]; 3987 }else{ 3988 if(elem.style.cssFloat){ 3989 return elem.style.cssFloat; 3990 }else{ 3991 if(elem.style.styleFloat){ 3992 return elem.style.styleFloat; 3993 }else{ 3994 return "none"; 3995 } 3996 } 3997 } 3998 } 3999 var _425=elem.style?elem.style[_421]:null; 4000 if(!_425){ 4001 if(d.defaultView&&d.defaultView.getComputedStyle){ 4002 var css=d.defaultView.getComputedStyle(elem,null); 4003 _421=_421.replace(/([A-Z])/g,"-$1").toLowerCase(); 4004 _425=css?css.getPropertyValue(_421):null; 4005 }else{ 4006 if(elem.currentStyle){ 4007 _425=elem.currentStyle[_421]; 4008 if(/^\d/.test(_425)&&!/px$/.test(_425)&&_421!="fontWeight"){ 4009 var left=elem.style.left; 4010 var _428=elem.runtimeStyle.left; 4011 elem.runtimeStyle.left=elem.currentStyle.left; 4012 elem.style.left=_425||0; 4013 _425=elem.style.pixelLeft+"px"; 4014 elem.style.left=left; 4015 elem.runtimeStyle.left=_428; 4016 } 4017 } 4018 } 4019 } 4020 if(_421=="opacity"){ 4021 _425=parseFloat(_425); 4022 } 4023 if(/Opera/.test(navigator.userAgent)&&(MochiKit.Base.findValue(["left","top","right","bottom"],_421)!=-1)){ 4024 if(MochiKit.Style.getStyle(elem,"position")=="static"){ 4025 _425="auto"; 4026 } 4027 } 4028 return _425=="auto"?null:_425; 4029 },setStyle:function(elem,_42a){ 4030 elem=MochiKit.DOM.getElement(elem); 4031 for(var name in _42a){ 4032 switch(name){ 4033 case "opacity": 4034 MochiKit.Style.setOpacity(elem,_42a[name]); 4035 break; 4036 case "float": 4037 case "cssFloat": 4038 case "styleFloat": 4039 if(typeof (elem.style["float"])!="undefined"){ 4040 elem.style["float"]=_42a[name]; 4041 }else{ 4042 if(typeof (elem.style.cssFloat)!="undefined"){ 4043 elem.style.cssFloat=_42a[name]; 4044 }else{ 4045 elem.style.styleFloat=_42a[name]; 4046 } 4047 } 4048 break; 4049 default: 4050 elem.style[MochiKit.Base.camelize(name)]=_42a[name]; 4051 } 4052 } 4053 },setOpacity:function(elem,o){ 4054 elem=MochiKit.DOM.getElement(elem); 4055 var self=MochiKit.Style; 4056 if(o==1){ 4057 var _42f=/Gecko/.test(navigator.userAgent)&&!(/Konqueror|AppleWebKit|KHTML/.test(navigator.userAgent)); 4058 elem.style["opacity"]=_42f?0.999999:1; 4059 if(/MSIE/.test(navigator.userAgent)){ 4060 elem.style["filter"]=self.getStyle(elem,"filter").replace(/alpha\([^\)]*\)/gi,""); 4061 } 4062 }else{ 4063 if(o<0.00001){ 4064 o=0; 4065 } 4066 elem.style["opacity"]=o; 4067 if(/MSIE/.test(navigator.userAgent)){ 4068 elem.style["filter"]=self.getStyle(elem,"filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+o*100+")"; 4069 } 4070 } 4071 },getElementPosition:function(elem,_431){ 4072 var self=MochiKit.Style; 4073 var dom=MochiKit.DOM; 4074 elem=dom.getElement(elem); 4075 if(!elem||(!(elem.x&&elem.y)&&(!elem.parentNode===null||self.getStyle(elem,"display")=="none"))){ 4076 return undefined; 4077 } 4078 var c=new self.Coordinates(0,0); 4079 var box=null; 4080 var _436=null; 4081 var d=MochiKit.DOM._document; 4082 var de=d.documentElement; 4083 var b=d.body; 4084 if(!elem.parentNode&&elem.x&&elem.y){ 4085 c.x+=elem.x||0; 4086 c.y+=elem.y||0; 4087 }else{ 4088 if(elem.getBoundingClientRect){ 4089 box=elem.getBoundingClientRect(); 4090 c.x+=box.left+(de.scrollLeft||b.scrollLeft)-(de.clientLeft||0); 4091 c.y+=box.top+(de.scrollTop||b.scrollTop)-(de.clientTop||0); 4092 }else{ 4093 if(elem.offsetParent){ 4094 c.x+=elem.offsetLeft; 4095 c.y+=elem.offsetTop; 4096 _436=elem.offsetParent; 4097 if(_436!=elem){ 4098 while(_436){ 4099 c.x+=parseInt(_436.style.borderLeftWidth)||0; 4100 c.y+=parseInt(_436.style.borderTopWidth)||0; 4101 c.x+=_436.offsetLeft; 4102 c.y+=_436.offsetTop; 4103 _436=_436.offsetParent; 4104 } 4105 } 4106 var ua=navigator.userAgent.toLowerCase(); 4107 if((typeof (opera)!="undefined"&&parseFloat(opera.version())<9)||(ua.indexOf("AppleWebKit")!=-1&&self.getStyle(elem,"position")=="absolute")){ 4108 c.x-=b.offsetLeft; 4109 c.y-=b.offsetTop; 4110 } 4111 if(elem.parentNode){ 4112 _436=elem.parentNode; 4113 }else{ 4114 _436=null; 4115 } 4116 while(_436){ 4117 var _43b=_436.tagName.toUpperCase(); 4118 if(_43b==="BODY"||_43b==="HTML"){ 4119 break; 4120 } 4121 var disp=self.getStyle(_436,"display"); 4122 if(disp.search(/^inline|table-row.*$/i)){ 4123 c.x-=_436.scrollLeft; 4124 c.y-=_436.scrollTop; 4125 } 4126 if(_436.parentNode){ 4127 _436=_436.parentNode; 4128 }else{ 4129 _436=null; 4130 } 4131 } 4132 } 4133 } 4134 } 4135 if(typeof (_431)!="undefined"){ 4136 _431=arguments.callee(_431); 4137 if(_431){ 4138 c.x-=(_431.x||0); 4139 c.y-=(_431.y||0); 4140 } 4141 } 4142 return c; 4143 },setElementPosition:function(elem,_43e,_43f){ 4144 elem=MochiKit.DOM.getElement(elem); 4145 if(typeof (_43f)=="undefined"){ 4146 _43f="px"; 4147 } 4148 var _440={}; 4149 var _441=MochiKit.Base.isUndefinedOrNull; 4150 if(!_441(_43e.x)){ 4151 _440["left"]=_43e.x+_43f; 4152 } 4153 if(!_441(_43e.y)){ 4154 _440["top"]=_43e.y+_43f; 4155 } 4156 MochiKit.DOM.updateNodeAttributes(elem,{"style":_440}); 4157 },makePositioned:function(_442){ 4158 _442=MochiKit.DOM.getElement(_442); 4159 var pos=MochiKit.Style.getStyle(_442,"position"); 4160 if(pos=="static"||!pos){ 4161 _442.style.position="relative"; 4162 if(/Opera/.test(navigator.userAgent)){ 4163 _442.style.top=0; 4164 _442.style.left=0; 4165 } 4166 } 4167 },undoPositioned:function(_444){ 4168 _444=MochiKit.DOM.getElement(_444); 4169 if(_444.style.position=="relative"){ 4170 _444.style.position=_444.style.top=_444.style.left=_444.style.bottom=_444.style.right=""; 4171 } 4172 },makeClipping:function(_445){ 4173 _445=MochiKit.DOM.getElement(_445); 4174 var s=_445.style; 4175 var _447={"overflow":s.overflow,"overflow-x":s.overflowX,"overflow-y":s.overflowY}; 4176 if((MochiKit.Style.getStyle(_445,"overflow")||"visible")!="hidden"){ 4177 _445.style.overflow="hidden"; 4178 _445.style.overflowX="hidden"; 4179 _445.style.overflowY="hidden"; 4180 } 4181 return _447; 4182 },undoClipping:function(_448,_449){ 4183 _448=MochiKit.DOM.getElement(_448); 4184 if(typeof (_449)=="string"){ 4185 _448.style.overflow=_449; 4186 }else{ 4187 if(_449!=null){ 4188 _448.style.overflow=_449["overflow"]; 4189 _448.style.overflowX=_449["overflow-x"]; 4190 _448.style.overflowY=_449["overflow-y"]; 4191 } 4192 } 4193 },getElementDimensions:function(elem,_44b){ 4194 var self=MochiKit.Style; 4195 var dom=MochiKit.DOM; 4196 if(typeof (elem.w)=="number"||typeof (elem.h)=="number"){ 4197 return new self.Dimensions(elem.w||0,elem.h||0); 4198 } 4199 elem=dom.getElement(elem); 4200 if(!elem){ 4201 return undefined; 4202 } 4203 var disp=self.getStyle(elem,"display"); 4204 if(disp=="none"||disp==""||typeof (disp)=="undefined"){ 4205 var s=elem.style; 4206 var _450=s.visibility; 4207 var _451=s.position; 4208 var _452=s.display; 4209 s.visibility="hidden"; 4210 s.position="absolute"; 4211 s.display=self._getDefaultDisplay(elem); 4212 var _453=elem.offsetWidth; 4213 var _454=elem.offsetHeight; 4214 s.display=_452; 4215 s.position=_451; 4216 s.visibility=_450; 4217 }else{ 4218 _453=elem.offsetWidth||0; 4219 _454=elem.offsetHeight||0; 4220 } 4221 if(_44b){ 4222 var _455="colSpan" in elem&&"rowSpan" in elem; 4223 var _456=(_455&&elem.parentNode&&self.getStyle(elem.parentNode,"borderCollapse")=="collapse"); 4224 if(_456){ 4225 if(/MSIE/.test(navigator.userAgent)){ 4226 var _457=elem.previousSibling?0.5:1; 4227 var _458=elem.nextSibling?0.5:1; 4228 }else{ 4229 var _457=0.5; 4230 var _458=0.5; 4231 } 4232 }else{ 4233 var _457=1; 4234 var _458=1; 4235 } 4236 _453-=Math.round((parseFloat(self.getStyle(elem,"paddingLeft"))||0)+(parseFloat(self.getStyle(elem,"paddingRight"))||0)+_457*(parseFloat(self.getStyle(elem,"borderLeftWidth"))||0)+_458*(parseFloat(self.getStyle(elem,"borderRightWidth"))||0)); 4237 if(_455){ 4238 if(/Gecko|Opera/.test(navigator.userAgent)&&!/Konqueror|AppleWebKit|KHTML/.test(navigator.userAgent)){ 4239 var _459=0; 4240 }else{ 4241 if(/MSIE/.test(navigator.userAgent)){ 4242 var _459=1; 4243 }else{ 4244 var _459=_456?0.5:1; 4245 } 4246 } 4247 }else{ 4248 var _459=1; 4249 } 4250 _454-=Math.round((parseFloat(self.getStyle(elem,"paddingTop"))||0)+(parseFloat(self.getStyle(elem,"paddingBottom"))||0)+_459*((parseFloat(self.getStyle(elem,"borderTopWidth"))||0)+(parseFloat(self.getStyle(elem,"borderBottomWidth"))||0))); 4251 } 4252 return new self.Dimensions(_453,_454); 4253 },setElementDimensions:function(elem,_45b,_45c){ 4254 elem=MochiKit.DOM.getElement(elem); 4255 if(typeof (_45c)=="undefined"){ 4256 _45c="px"; 4257 } 4258 var _45d={}; 4259 var _45e=MochiKit.Base.isUndefinedOrNull; 4260 if(!_45e(_45b.w)){ 4261 _45d["width"]=_45b.w+_45c; 4262 } 4263 if(!_45e(_45b.h)){ 4264 _45d["height"]=_45b.h+_45c; 4265 } 4266 MochiKit.DOM.updateNodeAttributes(elem,{"style":_45d}); 4267 },_getDefaultDisplay:function(elem){ 4268 var self=MochiKit.Style; 4269 var dom=MochiKit.DOM; 4270 elem=dom.getElement(elem); 4271 if(!elem){ 4272 return undefined; 4273 } 4274 var _462=elem.tagName.toUpperCase(); 4275 return self._defaultDisplay[_462]||"block"; 4276 },setDisplayForElement:function(_463,_464){ 4277 var _465=MochiKit.Base.extend(null,arguments,1); 4278 var _466=MochiKit.DOM.getElement; 4279 for(var i=0;i<_465.length;i++){ 4280 _464=_466(_465[i]); 4281 if(_464){ 4282 _464.style.display=_463; 4283 } 4284 } 4285 },getViewportDimensions:function(){ 4286 var d=new MochiKit.Style.Dimensions(); 4287 var w=MochiKit.DOM._window; 4288 var b=MochiKit.DOM._document.body; 4289 if(w.innerWidth){ 4290 d.w=w.innerWidth; 4291 d.h=w.innerHeight; 4292 }else{ 4293 if(b&&b.parentElement&&b.parentElement.clientWidth){ 4294 d.w=b.parentElement.clientWidth; 4295 d.h=b.parentElement.clientHeight; 4296 }else{ 4297 if(b&&b.clientWidth){ 4298 d.w=b.clientWidth; 4299 d.h=b.clientHeight; 4300 } 4301 } 4302 } 4303 return d; 4304 },getViewportPosition:function(){ 4305 var c=new MochiKit.Style.Coordinates(0,0); 4306 var d=MochiKit.DOM._document; 4307 var de=d.documentElement; 4308 var db=d.body; 4309 if(de&&(de.scrollTop||de.scrollLeft)){ 4310 c.x=de.scrollLeft; 4311 c.y=de.scrollTop; 4312 }else{ 4313 if(db){ 4314 c.x=db.scrollLeft; 4315 c.y=db.scrollTop; 4316 } 4317 } 4318 return c; 4319 },__new__:function(){ 4320 var m=MochiKit.Base; 4321 var _470=["A","ABBR","ACRONYM","B","BASEFONT","BDO","BIG","BR","CITE","CODE","DFN","EM","FONT","I","IMG","KBD","LABEL","Q","S","SAMP","SMALL","SPAN","STRIKE","STRONG","SUB","SUP","TEXTAREA","TT","U","VAR"]; 4322 this._defaultDisplay={"TABLE":"table","THEAD":"table-header-group","TBODY":"table-row-group","TFOOT":"table-footer-group","COLGROUP":"table-column-group","COL":"table-column","TR":"table-row","TD":"table-cell","TH":"table-cell","CAPTION":"table-caption","LI":"list-item","INPUT":"inline-block","SELECT":"inline-block"}; 4323 if(/MSIE/.test(navigator.userAgent)){ 4324 for(var k in this._defaultDisplay){ 4325 var v=this._defaultDisplay[k]; 4326 if(v.indexOf("table")==0){ 4327 this._defaultDisplay[k]="block"; 4328 } 4329 } 4330 } 4331 for(var i=0;i<_470.length;i++){ 4332 this._defaultDisplay[_470[i]]="inline"; 4333 } 4334 this.elementPosition=this.getElementPosition; 4335 this.elementDimensions=this.getElementDimensions; 4336 this.hideElement=m.partial(this.setDisplayForElement,"none"); 4337 this.showElement=m.partial(this.setDisplayForElement,"block"); 4338 this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; 4339 m.nameFunctions(this); 4340 }}); 4341 MochiKit.Style.__new__(); 4342 MochiKit.Base._exportSymbols(this,MochiKit.Style); 4343 MochiKit.Base._deps("LoggingPane",["Base","Logging"]); 4344 MochiKit.LoggingPane.NAME="MochiKit.LoggingPane"; 4345 MochiKit.LoggingPane.VERSION="1.4.2"; 4346 MochiKit.LoggingPane.__repr__=function(){ 4347 return "["+this.NAME+" "+this.VERSION+"]"; 4348 }; 4349 MochiKit.LoggingPane.toString=function(){ 4350 return this.__repr__(); 4351 }; 4352 MochiKit.LoggingPane.createLoggingPane=function(_474){ 4353 var m=MochiKit.LoggingPane; 4354 _474=!(!_474); 4355 if(m._loggingPane&&m._loggingPane.inline!=_474){ 4356 m._loggingPane.closePane(); 4357 m._loggingPane=null; 4358 } 4359 if(!m._loggingPane||m._loggingPane.closed){ 4360 m._loggingPane=new m.LoggingPane(_474,MochiKit.Logging.logger); 4361 } 4362 return m._loggingPane; 4363 }; 4364 MochiKit.LoggingPane.LoggingPane=function(_476,_477){ 4365 if(typeof (_477)=="undefined"||_477===null){ 4366 _477=MochiKit.Logging.logger; 4367 } 4368 this.logger=_477; 4369 var _478=MochiKit.Base.update; 4370 var _479=MochiKit.Base.updatetree; 4371 var bind=MochiKit.Base.bind; 4372 var _47b=MochiKit.Base.clone; 4373 var win=window; 4374 var uid="_MochiKit_LoggingPane"; 4375 if(typeof (MochiKit.DOM)!="undefined"){ 4376 win=MochiKit.DOM.currentWindow(); 4377 } 4378 if(!_476){ 4379 var url=win.location.href.split("?")[0].replace(/[#:\/.><&%-]/g,"_"); 4380 var name=uid+"_"+url; 4381 var nwin=win.open("",name,"dependent,resizable,height=200"); 4382 if(!nwin){ 4383 alert("Not able to open debugging window due to pop-up blocking."); 4384 return undefined; 4385 } 4386 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>"); 4387 nwin.document.close(); 4388 nwin.document.title+=" "+win.document.title; 4389 win=nwin; 4390 } 4391 var doc=win.document; 4392 this.doc=doc; 4393 var _482=doc.getElementById(uid); 4394 var _483=!!_482; 4395 if(_482&&typeof (_482.loggingPane)!="undefined"){ 4396 _482.loggingPane.logger=this.logger; 4397 _482.loggingPane.buildAndApplyFilter(); 4398 return _482.loggingPane; 4399 } 4400 if(_483){ 4401 var _484; 4402 while((_484=_482.firstChild)){ 4403 _482.removeChild(_484); 4404 } 4405 }else{ 4406 _482=doc.createElement("div"); 4407 _482.id=uid; 4408 } 4409 _482.loggingPane=this; 4410 var _485=doc.createElement("input"); 4411 var _486=doc.createElement("input"); 4412 var _487=doc.createElement("button"); 4413 var _488=doc.createElement("button"); 4414 var _489=doc.createElement("button"); 4415 var _48a=doc.createElement("button"); 4416 var _48b=doc.createElement("div"); 4417 var _48c=doc.createElement("div"); 4418 var _48d=uid+"_Listener"; 4419 this.colorTable=_47b(this.colorTable); 4420 var _48e=[]; 4421 var _48f=null; 4422 var _490=function(msg){ 4423 var _492=msg.level; 4424 if(typeof (_492)=="number"){ 4425 _492=MochiKit.Logging.LogLevel[_492]; 4426 } 4427 return _492; 4428 }; 4429 var _493=function(msg){ 4430 return msg.info.join(" "); 4431 }; 4432 var _495=bind(function(msg){ 4433 var _497=_490(msg); 4434 var text=_493(msg); 4435 var c=this.colorTable[_497]; 4436 var p=doc.createElement("span"); 4437 p.className="MochiKit-LogMessage MochiKit-LogLevel-"+_497; 4438 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; 4439 p.appendChild(doc.createTextNode(_497+": "+text)); 4440 _48c.appendChild(p); 4441 _48c.appendChild(doc.createElement("br")); 4442 if(_48b.offsetHeight>_48b.scrollHeight){ 4443 _48b.scrollTop=0; 4444 }else{ 4445 _48b.scrollTop=_48b.scrollHeight; 4446 } 4447 },this); 4448 var _49b=function(msg){ 4449 _48e[_48e.length]=msg; 4450 _495(msg); 4451 }; 4452 var _49d=function(){ 4453 var _49e,_49f; 4454 try{ 4455 _49e=new RegExp(_485.value); 4456 _49f=new RegExp(_486.value); 4457 } 4458 catch(e){ 4459 logDebug("Error in filter regex: "+e.message); 4460 return null; 4461 } 4462 return function(msg){ 4463 return (_49e.test(_490(msg))&&_49f.test(_493(msg))); 4464 }; 4465 }; 4466 var _4a1=function(){ 4467 while(_48c.firstChild){ 4468 _48c.removeChild(_48c.firstChild); 4469 } 4470 }; 4471 var _4a2=function(){ 4472 _48e=[]; 4473 _4a1(); 4474 }; 4475 var _4a3=bind(function(){ 4476 if(this.closed){ 4477 return; 4478 } 4479 this.closed=true; 4480 if(MochiKit.LoggingPane._loggingPane==this){ 4481 MochiKit.LoggingPane._loggingPane=null; 4482 } 4483 this.logger.removeListener(_48d); 4484 try{ 4485 try{ 4486 _482.loggingPane=null; 4487 } 4488 catch(e){ 4489 logFatal("Bookmarklet was closed incorrectly."); 4490 } 4491 if(_476){ 4492 _482.parentNode.removeChild(_482); 4493 }else{ 4494 this.win.close(); 4495 } 4496 } 4497 catch(e){ 4498 } 4499 },this); 4500 var _4a4=function(){ 4501 _4a1(); 4502 for(var i=0;i<_48e.length;i++){ 4503 var msg=_48e[i]; 4504 if(_48f===null||_48f(msg)){ 4505 _495(msg); 4506 } 4507 } 4508 }; 4509 this.buildAndApplyFilter=function(){ 4510 _48f=_49d(); 4511 _4a4(); 4512 this.logger.removeListener(_48d); 4513 this.logger.addListener(_48d,_48f,_49b); 4514 }; 4515 var _4a7=bind(function(){ 4516 _48e=this.logger.getMessages(); 4517 _4a4(); 4518 },this); 4519 var _4a8=bind(function(_4a9){ 4520 _4a9=_4a9||window.event; 4521 key=_4a9.which||_4a9.keyCode; 4522 if(key==13){ 4523 this.buildAndApplyFilter(); 4524 } 4525 },this); 4526 var _4aa="display: block; z-index: 1000; left: 0px; bottom: 0px; position: fixed; width: 100%; background-color: white; font: "+this.logFont; 4527 if(_476){ 4528 _4aa+="; height: 10em; border-top: 2px solid black"; 4529 }else{ 4530 _4aa+="; height: 100%;"; 4531 } 4532 _482.style.cssText=_4aa; 4533 if(!_483){ 4534 doc.body.appendChild(_482); 4535 } 4536 _4aa={"cssText":"width: 33%; display: inline; font: "+this.logFont}; 4537 _479(_485,{"value":"FATAL|ERROR|WARNING|INFO|DEBUG","onkeypress":_4a8,"style":_4aa}); 4538 _482.appendChild(_485); 4539 _479(_486,{"value":".*","onkeypress":_4a8,"style":_4aa}); 4540 _482.appendChild(_486); 4541 _4aa="width: 8%; display:inline; font: "+this.logFont; 4542 _487.appendChild(doc.createTextNode("Filter")); 4543 _487.onclick=bind("buildAndApplyFilter",this); 4544 _487.style.cssText=_4aa; 4545 _482.appendChild(_487); 4546 _488.appendChild(doc.createTextNode("Load")); 4547 _488.onclick=_4a7; 4548 _488.style.cssText=_4aa; 4549 _482.appendChild(_488); 4550 _489.appendChild(doc.createTextNode("Clear")); 4551 _489.onclick=_4a2; 4552 _489.style.cssText=_4aa; 4553 _482.appendChild(_489); 4554 _48a.appendChild(doc.createTextNode("Close")); 4555 _48a.onclick=_4a3; 4556 _48a.style.cssText=_4aa; 4557 _482.appendChild(_48a); 4558 _48b.style.cssText="overflow: auto; width: 100%"; 4559 _48c.style.cssText="width: 100%; height: "+(_476?"8em":"100%"); 4560 _48b.appendChild(_48c); 4561 _482.appendChild(_48b); 4562 this.buildAndApplyFilter(); 4563 _4a7(); 4564 if(_476){ 4565 this.win=undefined; 4566 }else{ 4567 this.win=win; 4568 } 4569 this.inline=_476; 4570 this.closePane=_4a3; 4571 this.closed=false; 4572 return this; 4573 }; 4574 MochiKit.LoggingPane.LoggingPane.prototype={"logFont":"8pt Verdana,sans-serif","colorTable":{"ERROR":"red","FATAL":"darkred","WARNING":"blue","INFO":"black","DEBUG":"green"}}; 4575 MochiKit.LoggingPane.EXPORT_OK=["LoggingPane"]; 4576 MochiKit.LoggingPane.EXPORT=["createLoggingPane"]; 4577 MochiKit.LoggingPane.__new__=function(){ 4578 this.EXPORT_TAGS={":common":this.EXPORT,":all":MochiKit.Base.concat(this.EXPORT,this.EXPORT_OK)}; 4579 MochiKit.Base.nameFunctions(this); 4580 MochiKit.LoggingPane._loggingPane=null; 4581 }; 4582 MochiKit.LoggingPane.__new__(); 4583 MochiKit.Base._exportSymbols(this,MochiKit.LoggingPane); 4584 MochiKit.Base._deps("Color",["Base","DOM","Style"]); 4585 MochiKit.Color.NAME="MochiKit.Color"; 4586 MochiKit.Color.VERSION="1.4.2"; 4587 MochiKit.Color.__repr__=function(){ 4588 return "["+this.NAME+" "+this.VERSION+"]"; 4589 }; 4590 MochiKit.Color.toString=function(){ 4591 return this.__repr__(); 4592 }; 4593 MochiKit.Color.Color=function(red,_4ac,blue,_4ae){ 4594 if(typeof (_4ae)=="undefined"||_4ae===null){ 4595 _4ae=1; 4596 } 4597 this.rgb={r:red,g:_4ac,b:blue,a:_4ae}; 4598 }; 4599 MochiKit.Color.Color.prototype={__class__:MochiKit.Color.Color,colorWithAlpha:function(_4af){ 4600 var rgb=this.rgb; 4601 var m=MochiKit.Color; 4602 return m.Color.fromRGB(rgb.r,rgb.g,rgb.b,_4af); 4603 },colorWithHue:function(hue){ 4604 var hsl=this.asHSL(); 4605 hsl.h=hue; 4606 var m=MochiKit.Color; 4607 return m.Color.fromHSL(hsl); 4608 },colorWithSaturation:function(_4b5){ 4609 var hsl=this.asHSL(); 4610 hsl.s=_4b5; 4611 var m=MochiKit.Color; 4612 return m.Color.fromHSL(hsl); 4613 },colorWithLightness:function(_4b8){ 4614 var hsl=this.asHSL(); 4615 hsl.l=_4b8; 4616 var m=MochiKit.Color; 4617 return m.Color.fromHSL(hsl); 4618 },darkerColorWithLevel:function(_4bb){ 4619 var hsl=this.asHSL(); 4620 hsl.l=Math.max(hsl.l-_4bb,0); 4621 var m=MochiKit.Color; 4622 return m.Color.fromHSL(hsl); 4623 },lighterColorWithLevel:function(_4be){ 4624 var hsl=this.asHSL(); 4625 hsl.l=Math.min(hsl.l+_4be,1); 4626 var m=MochiKit.Color; 4627 return m.Color.fromHSL(hsl); 4628 },blendedColor:function(_4c1,_4c2){ 4629 if(typeof (_4c2)=="undefined"||_4c2===null){ 4630 _4c2=0.5; 4631 } 4632 var sf=1-_4c2; 4633 var s=this.rgb; 4634 var d=_4c1.rgb; 4635 var df=_4c2; 4636 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)); 4637 },compareRGB:function(_4c7){ 4638 var a=this.asRGB(); 4639 var b=_4c7.asRGB(); 4640 return MochiKit.Base.compare([a.r,a.g,a.b,a.a],[b.r,b.g,b.b,b.a]); 4641 },isLight:function(){ 4642 return this.asHSL().b>0.5; 4643 },isDark:function(){ 4644 return (!this.isLight()); 4645 },toHSLString:function(){ 4646 var c=this.asHSL(); 4647 var ccc=MochiKit.Color.clampColorComponent; 4648 var rval=this._hslString; 4649 if(!rval){ 4650 var mid=(ccc(c.h,360).toFixed(0)+","+ccc(c.s,100).toPrecision(4)+"%"+","+ccc(c.l,100).toPrecision(4)+"%"); 4651 var a=c.a; 4652 if(a>=1){ 4653 a=1; 4654 rval="hsl("+mid+")"; 4655 }else{ 4656 if(a<=0){ 4657 a=0; 4658 } 4659 rval="hsla("+mid+","+a+")"; 4660 } 4661 this._hslString=rval; 4662 } 4663 return rval; 4664 },toRGBString:function(){ 4665 var c=this.rgb; 4666 var ccc=MochiKit.Color.clampColorComponent; 4667 var rval=this._rgbString; 4668 if(!rval){ 4669 var mid=(ccc(c.r,255).toFixed(0)+","+ccc(c.g,255).toFixed(0)+","+ccc(c.b,255).toFixed(0)); 4670 if(c.a!=1){ 4671 rval="rgba("+mid+","+c.a+")"; 4672 }else{ 4673 rval="rgb("+mid+")"; 4674 } 4675 this._rgbString=rval; 4676 } 4677 return rval; 4678 },asRGB:function(){ 4679 return MochiKit.Base.clone(this.rgb); 4680 },toHexString:function(){ 4681 var m=MochiKit.Color; 4682 var c=this.rgb; 4683 var ccc=MochiKit.Color.clampColorComponent; 4684 var rval=this._hexString; 4685 if(!rval){ 4686 rval=("#"+m.toColorPart(ccc(c.r,255))+m.toColorPart(ccc(c.g,255))+m.toColorPart(ccc(c.b,255))); 4687 this._hexString=rval; 4688 } 4689 return rval; 4690 },asHSV:function(){ 4691 var hsv=this.hsv; 4692 var c=this.rgb; 4693 if(typeof (hsv)=="undefined"||hsv===null){ 4694 hsv=MochiKit.Color.rgbToHSV(this.rgb); 4695 this.hsv=hsv; 4696 } 4697 return MochiKit.Base.clone(hsv); 4698 },asHSL:function(){ 4699 var hsl=this.hsl; 4700 var c=this.rgb; 4701 if(typeof (hsl)=="undefined"||hsl===null){ 4702 hsl=MochiKit.Color.rgbToHSL(this.rgb); 4703 this.hsl=hsl; 4704 } 4705 return MochiKit.Base.clone(hsl); 4706 },toString:function(){ 4707 return this.toRGBString(); 4708 },repr:function(){ 4709 var c=this.rgb; 4710 var col=[c.r,c.g,c.b,c.a]; 4711 return this.__class__.NAME+"("+col.join(", ")+")"; 4712 }}; 4713 MochiKit.Base.update(MochiKit.Color.Color,{fromRGB:function(red,_4de,blue,_4e0){ 4714 var _4e1=MochiKit.Color.Color; 4715 if(arguments.length==1){ 4716 var rgb=red; 4717 red=rgb.r; 4718 _4de=rgb.g; 4719 blue=rgb.b; 4720 if(typeof (rgb.a)=="undefined"){ 4721 _4e0=undefined; 4722 }else{ 4723 _4e0=rgb.a; 4724 } 4725 } 4726 return new _4e1(red,_4de,blue,_4e0); 4727 },fromHSL:function(hue,_4e4,_4e5,_4e6){ 4728 var m=MochiKit.Color; 4729 return m.Color.fromRGB(m.hslToRGB.apply(m,arguments)); 4730 },fromHSV:function(hue,_4e9,_4ea,_4eb){ 4731 var m=MochiKit.Color; 4732 return m.Color.fromRGB(m.hsvToRGB.apply(m,arguments)); 4733 },fromName:function(name){ 4734 var _4ee=MochiKit.Color.Color; 4735 if(name.charAt(0)=="\""){ 4736 name=name.substr(1,name.length-2); 4737 } 4738 var _4ef=_4ee._namedColors[name.toLowerCase()]; 4739 if(typeof (_4ef)=="string"){ 4740 return _4ee.fromHexString(_4ef); 4741 }else{ 4742 if(name=="transparent"){ 4743 return _4ee.transparentColor(); 4744 } 4745 } 4746 return null; 4747 },fromString:function(_4f0){ 4748 var self=MochiKit.Color.Color; 4749 var _4f2=_4f0.substr(0,3); 4750 if(_4f2=="rgb"){ 4751 return self.fromRGBString(_4f0); 4752 }else{ 4753 if(_4f2=="hsl"){ 4754 return self.fromHSLString(_4f0); 4755 }else{ 4756 if(_4f0.charAt(0)=="#"){ 4757 return self.fromHexString(_4f0); 4758 } 4759 } 4760 } 4761 return self.fromName(_4f0); 4762 },fromHexString:function(_4f3){ 4763 if(_4f3.charAt(0)=="#"){ 4764 _4f3=_4f3.substring(1); 4765 } 4766 var _4f4=[]; 4767 var i,hex; 4768 if(_4f3.length==3){ 4769 for(i=0;i<3;i++){ 4770 hex=_4f3.substr(i,1); 4771 _4f4.push(parseInt(hex+hex,16)/255); 4772 } 4773 }else{ 4774 for(i=0;i<6;i+=2){ 4775 hex=_4f3.substr(i,2); 4776 _4f4.push(parseInt(hex,16)/255); 4777 } 4778 } 4779 var _4f7=MochiKit.Color.Color; 4780 return _4f7.fromRGB.apply(_4f7,_4f4); 4781 },_fromColorString:function(pre,_4f9,_4fa,_4fb){ 4782 if(_4fb.indexOf(pre)===0){ 4783 _4fb=_4fb.substring(_4fb.indexOf("(",3)+1,_4fb.length-1); 4784 } 4785 var _4fc=_4fb.split(/\s*,\s*/); 4786 var _4fd=[]; 4787 for(var i=0;i<_4fc.length;i++){ 4788 var c=_4fc[i]; 4789 var val; 4790 var _501=c.substring(c.length-3); 4791 if(c.charAt(c.length-1)=="%"){ 4792 val=0.01*parseFloat(c.substring(0,c.length-1)); 4793 }else{ 4794 if(_501=="deg"){ 4795 val=parseFloat(c)/360; 4796 }else{ 4797 if(_501=="rad"){ 4798 val=parseFloat(c)/(Math.PI*2); 4799 }else{ 4800 val=_4fa[i]*parseFloat(c); 4801 } 4802 } 4803 } 4804 _4fd.push(val); 4805 } 4806 return this[_4f9].apply(this,_4fd); 4807 },fromComputedStyle:function(elem,_503){ 4808 var d=MochiKit.DOM; 4809 var cls=MochiKit.Color.Color; 4810 for(elem=d.getElement(elem);elem;elem=elem.parentNode){ 4811 var _506=MochiKit.Style.getStyle.apply(d,arguments); 4812 if(!_506){ 4813 continue; 4814 } 4815 var _507=cls.fromString(_506); 4816 if(!_507){ 4817 break; 4818 } 4819 if(_507.asRGB().a>0){ 4820 return _507; 4821 } 4822 } 4823 return null; 4824 },fromBackground:function(elem){ 4825 var cls=MochiKit.Color.Color; 4826 return cls.fromComputedStyle(elem,"backgroundColor","background-color")||cls.whiteColor(); 4827 },fromText:function(elem){ 4828 var cls=MochiKit.Color.Color; 4829 return cls.fromComputedStyle(elem,"color","color")||cls.blackColor(); 4830 },namedColors:function(){ 4831 return MochiKit.Base.clone(MochiKit.Color.Color._namedColors); 4832 }}); 4833 MochiKit.Base.update(MochiKit.Color,{clampColorComponent:function(v,_50d){ 4834 v*=_50d; 4835 if(v<0){ 4836 return 0; 4837 }else{ 4838 if(v>_50d){ 4839 return _50d; 4840 }else{ 4841 return v; 4842 } 4843 } 4844 },_hslValue:function(n1,n2,hue){ 4845 if(hue>6){ 4846 hue-=6; 4847 }else{ 4848 if(hue<0){ 4849 hue+=6; 4850 } 4851 } 4852 var val; 4853 if(hue<1){ 4854 val=n1+(n2-n1)*hue; 4855 }else{ 4856 if(hue<3){ 4857 val=n2; 4858 }else{ 4859 if(hue<4){ 4860 val=n1+(n2-n1)*(4-hue); 4861 }else{ 4862 val=n1; 4863 } 4864 } 4865 } 4866 return val; 4867 },hsvToRGB:function(hue,_513,_514,_515){ 4868 if(arguments.length==1){ 4869 var hsv=hue; 4870 hue=hsv.h; 4871 _513=hsv.s; 4872 _514=hsv.v; 4873 _515=hsv.a; 4874 } 4875 var red; 4876 var _518; 4877 var blue; 4878 if(_513===0){ 4879 red=_514; 4880 _518=_514; 4881 blue=_514; 4882 }else{ 4883 var i=Math.floor(hue*6); 4884 var f=(hue*6)-i; 4885 var p=_514*(1-_513); 4886 var q=_514*(1-(_513*f)); 4887 var t=_514*(1-(_513*(1-f))); 4888 switch(i){ 4889 case 1: 4890 red=q; 4891 _518=_514; 4892 blue=p; 4893 break; 4894 case 2: 4895 red=p; 4896 _518=_514; 4897 blue=t; 4898 break; 4899 case 3: 4900 red=p; 4901 _518=q; 4902 blue=_514; 4903 break; 4904 case 4: 4905 red=t; 4906 _518=p; 4907 blue=_514; 4908 break; 4909 case 5: 4910 red=_514; 4911 _518=p; 4912 blue=q; 4913 break; 4914 case 6: 4915 case 0: 4916 red=_514; 4917 _518=t; 4918 blue=p; 4919 break; 4920 } 4921 } 4922 return {r:red,g:_518,b:blue,a:_515}; 4923 },hslToRGB:function(hue,_520,_521,_522){ 4924 if(arguments.length==1){ 4925 var hsl=hue; 4926 hue=hsl.h; 4927 _520=hsl.s; 4928 _521=hsl.l; 4929 _522=hsl.a; 4930 } 4931 var red; 4932 var _525; 4933 var blue; 4934 if(_520===0){ 4935 red=_521; 4936 _525=_521; 4937 blue=_521; 4938 }else{ 4939 var m2; 4940 if(_521<=0.5){ 4941 m2=_521*(1+_520); 4942 }else{ 4943 m2=_521+_520-(_521*_520); 4944 } 4945 var m1=(2*_521)-m2; 4946 var f=MochiKit.Color._hslValue; 4947 var h6=hue*6; 4948 red=f(m1,m2,h6+2); 4949 _525=f(m1,m2,h6); 4950 blue=f(m1,m2,h6-2); 4951 } 4952 return {r:red,g:_525,b:blue,a:_522}; 4953 },rgbToHSV:function(red,_52c,blue,_52e){ 4954 if(arguments.length==1){ 4955 var rgb=red; 4956 red=rgb.r; 4957 _52c=rgb.g; 4958 blue=rgb.b; 4959 _52e=rgb.a; 4960 } 4961 var max=Math.max(Math.max(red,_52c),blue); 4962 var min=Math.min(Math.min(red,_52c),blue); 4963 var hue; 4964 var _533; 4965 var _534=max; 4966 if(min==max){ 4967 hue=0; 4968 _533=0; 4969 }else{ 4970 var _535=(max-min); 4971 _533=_535/max; 4972 if(red==max){ 4973 hue=(_52c-blue)/_535; 4974 }else{ 4975 if(_52c==max){ 4976 hue=2+((blue-red)/_535); 4977 }else{ 4978 hue=4+((red-_52c)/_535); 4979 } 4980 } 4981 hue/=6; 4982 if(hue<0){ 4983 hue+=1; 4984 } 4985 if(hue>1){ 4986 hue-=1; 4987 } 4988 } 4989 return {h:hue,s:_533,v:_534,a:_52e}; 4990 },rgbToHSL:function(red,_537,blue,_539){ 4991 if(arguments.length==1){ 4992 var rgb=red; 4993 red=rgb.r; 4994 _537=rgb.g; 4995 blue=rgb.b; 4996 _539=rgb.a; 4997 } 4998 var max=Math.max(red,Math.max(_537,blue)); 4999 var min=Math.min(red,Math.min(_537,blue)); 5000 var hue; 5001 var _53e; 5002 var _53f=(max+min)/2; 5003 var _540=max-min; 5004 if(_540===0){ 5005 hue=0; 5006 _53e=0; 5007 }else{ 5008 if(_53f<=0.5){ 5009 _53e=_540/(max+min); 5010 }else{ 5011 _53e=_540/(2-max-min); 5012 } 5013 if(red==max){ 5014 hue=(_537-blue)/_540; 5015 }else{ 5016 if(_537==max){ 5017 hue=2+((blue-red)/_540); 5018 }else{ 5019 hue=4+((red-_537)/_540); 5020 } 5021 } 5022 hue/=6; 5023 if(hue<0){ 5024 hue+=1; 5025 } 5026 if(hue>1){ 5027 hue-=1; 5028 } 5029 } 5030 return {h:hue,s:_53e,l:_53f,a:_539}; 5031 },toColorPart:function(num){ 5032 num=Math.round(num); 5033 var _542=num.toString(16); 5034 if(num<16){ 5035 return "0"+_542; 5036 } 5037 return _542; 5038 },__new__:function(){ 5039 var m=MochiKit.Base; 5040 this.Color.fromRGBString=m.bind(this.Color._fromColorString,this.Color,"rgb","fromRGB",[1/255,1/255,1/255,1]); 5041 this.Color.fromHSLString=m.bind(this.Color._fromColorString,this.Color,"hsl","fromHSL",[1/360,0.01,0.01,1]); 5042 var _544=1/3; 5043 var _545={black:[0,0,0],blue:[0,0,1],brown:[0.6,0.4,0.2],cyan:[0,1,1],darkGray:[_544,_544,_544],gray:[0.5,0.5,0.5],green:[0,1,0],lightGray:[2*_544,2*_544,2*_544],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]}; 5044 var _546=function(name,r,g,b,a){ 5045 var rval=this.fromRGB(r,g,b,a); 5046 this[name]=function(){ 5047 return rval; 5048 }; 5049 return rval; 5050 }; 5051 for(var k in _545){ 5052 var name=k+"Color"; 5053 var _54f=m.concat([_546,this.Color,name],_545[k]); 5054 this.Color[name]=m.bind.apply(null,_54f); 5055 } 5056 var _550=function(){ 5057 for(var i=0;i<arguments.length;i++){ 5058 if(!(arguments[i] instanceof MochiKit.Color.Color)){ 5059 return false; 5060 } 5061 } 5062 return true; 5063 }; 5064 var _552=function(a,b){ 5065 return a.compareRGB(b); 5066 }; 5067 m.nameFunctions(this); 5068 m.registerComparator(this.Color.NAME,_550,_552); 5069 this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; 5070 }}); 5071 MochiKit.Color.EXPORT=["Color"]; 5072 MochiKit.Color.EXPORT_OK=["clampColorComponent","rgbToHSL","hslToRGB","rgbToHSV","hsvToRGB","toColorPart"]; 5073 MochiKit.Color.__new__(); 5074 MochiKit.Base._exportSymbols(this,MochiKit.Color); 5075 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"}; 5076 MochiKit.Base._deps("Signal",["Base","DOM","Style"]); 5077 MochiKit.Signal.NAME="MochiKit.Signal"; 5078 MochiKit.Signal.VERSION="1.4.2"; 5079 MochiKit.Signal._observers=[]; 5080 MochiKit.Signal.Event=function(src,e){ 5081 this._event=e||window.event; 5082 this._src=src; 5083 }; 5084 MochiKit.Base.update(MochiKit.Signal.Event.prototype,{__repr__:function(){ 5085 var repr=MochiKit.Base.repr; 5086 var str="{event(): "+repr(this.event())+", src(): "+repr(this.src())+", type(): "+repr(this.type())+", target(): "+repr(this.target()); 5087 if(this.type()&&this.type().indexOf("key")===0||this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu"){ 5088 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)+"}"; 5089 } 5090 if(this.type()&&this.type().indexOf("key")===0){ 5091 str+=", key(): {code: "+repr(this.key().code)+", string: "+repr(this.key().string)+"}"; 5092 } 5093 if(this.type()&&(this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu")){ 5094 str+=", mouse(): {page: "+repr(this.mouse().page)+", client: "+repr(this.mouse().client); 5095 if(this.type()!="mousemove"&&this.type()!="mousewheel"){ 5096 str+=", button: {left: "+repr(this.mouse().button.left)+", middle: "+repr(this.mouse().button.middle)+", right: "+repr(this.mouse().button.right)+"}"; 5097 } 5098 if(this.type()=="mousewheel"){ 5099 str+=", wheel: "+repr(this.mouse().wheel); 5100 } 5101 str+="}"; 5102 } 5103 if(this.type()=="mouseover"||this.type()=="mouseout"||this.type()=="mouseenter"||this.type()=="mouseleave"){ 5104 str+=", relatedTarget(): "+repr(this.relatedTarget()); 5105 } 5106 str+="}"; 5107 return str; 5108 },toString:function(){ 5109 return this.__repr__(); 5110 },src:function(){ 5111 return this._src; 5112 },event:function(){ 5113 return this._event; 5114 },type:function(){ 5115 if(this._event.type==="DOMMouseScroll"){ 5116 return "mousewheel"; 5117 }else{ 5118 return this._event.type||undefined; 5119 } 5120 },target:function(){ 5121 return this._event.target||this._event.srcElement; 5122 },_relatedTarget:null,relatedTarget:function(){ 5123 if(this._relatedTarget!==null){ 5124 return this._relatedTarget; 5125 } 5126 var elem=null; 5127 if(this.type()=="mouseover"||this.type()=="mouseenter"){ 5128 elem=(this._event.relatedTarget||this._event.fromElement); 5129 }else{ 5130 if(this.type()=="mouseout"||this.type()=="mouseleave"){ 5131 elem=(this._event.relatedTarget||this._event.toElement); 5132 } 5133 } 5134 try{ 5135 if(elem!==null&&elem.nodeType!==null){ 5136 this._relatedTarget=elem; 5137 return elem; 5138 } 5139 } 5140 catch(ignore){ 5141 } 5142 return undefined; 5143 },_modifier:null,modifier:function(){ 5144 if(this._modifier!==null){ 5145 return this._modifier; 5146 } 5147 var m={}; 5148 m.alt=this._event.altKey; 5149 m.ctrl=this._event.ctrlKey; 5150 m.meta=this._event.metaKey||false; 5151 m.shift=this._event.shiftKey; 5152 m.any=m.alt||m.ctrl||m.shift||m.meta; 5153 this._modifier=m; 5154 return m; 5155 },_key:null,key:function(){ 5156 if(this._key!==null){ 5157 return this._key; 5158 } 5159 var k={}; 5160 if(this.type()&&this.type().indexOf("key")===0){ 5161 if(this.type()=="keydown"||this.type()=="keyup"){ 5162 k.code=this._event.keyCode; 5163 k.string=(MochiKit.Signal._specialKeys[k.code]||"KEY_UNKNOWN"); 5164 this._key=k; 5165 return k; 5166 }else{ 5167 if(this.type()=="keypress"){ 5168 k.code=0; 5169 k.string=""; 5170 if(typeof (this._event.charCode)!="undefined"&&this._event.charCode!==0&&!MochiKit.Signal._specialMacKeys[this._event.charCode]){ 5171 k.code=this._event.charCode; 5172 k.string=String.fromCharCode(k.code); 5173 }else{ 5174 if(this._event.keyCode&&typeof (this._event.charCode)=="undefined"){ 5175 k.code=this._event.keyCode; 5176 k.string=String.fromCharCode(k.code); 5177 } 5178 } 5179 this._key=k; 5180 return k; 5181 } 5182 } 5183 } 5184 return undefined; 5185 },_mouse:null,mouse:function(){ 5186 if(this._mouse!==null){ 5187 return this._mouse; 5188 } 5189 var m={}; 5190 var e=this._event; 5191 if(this.type()&&(this.type().indexOf("mouse")===0||this.type().indexOf("click")!=-1||this.type()=="contextmenu")){ 5192 m.client=new MochiKit.Style.Coordinates(0,0); 5193 if(e.clientX||e.clientY){ 5194 m.client.x=(!e.clientX||e.clientX<0)?0:e.clientX; 5195 m.client.y=(!e.clientY||e.clientY<0)?0:e.clientY; 5196 } 5197 m.page=new MochiKit.Style.Coordinates(0,0); 5198 if(e.pageX||e.pageY){ 5199 m.page.x=(!e.pageX||e.pageX<0)?0:e.pageX; 5200 m.page.y=(!e.pageY||e.pageY<0)?0:e.pageY; 5201 }else{ 5202 var de=MochiKit.DOM._document.documentElement; 5203 var b=MochiKit.DOM._document.body; 5204 m.page.x=e.clientX+(de.scrollLeft||b.scrollLeft)-(de.clientLeft||0); 5205 m.page.y=e.clientY+(de.scrollTop||b.scrollTop)-(de.clientTop||0); 5206 } 5207 if(this.type()!="mousemove"&&this.type()!="mousewheel"){ 5208 m.button={}; 5209 m.button.left=false; 5210 m.button.right=false; 5211 m.button.middle=false; 5212 if(e.which){ 5213 m.button.left=(e.which==1); 5214 m.button.middle=(e.which==2); 5215 m.button.right=(e.which==3); 5216 }else{ 5217 m.button.left=!!(e.button&1); 5218 m.button.right=!!(e.button&2); 5219 m.button.middle=!!(e.button&4); 5220 } 5221 } 5222 if(this.type()=="mousewheel"){ 5223 m.wheel=new MochiKit.Style.Coordinates(0,0); 5224 if(e.wheelDeltaX||e.wheelDeltaY){ 5225 m.wheel.x=e.wheelDeltaX/-40||0; 5226 m.wheel.y=e.wheelDeltaY/-40||0; 5227 }else{ 5228 if(e.wheelDelta){ 5229 m.wheel.y=e.wheelDelta/-40; 5230 }else{ 5231 m.wheel.y=e.detail||0; 5232 } 5233 } 5234 } 5235 this._mouse=m; 5236 return m; 5237 } 5238 return undefined; 5239 },stop:function(){ 5240 this.stopPropagation(); 5241 this.preventDefault(); 5242 },stopPropagation:function(){ 5243 if(this._event.stopPropagation){ 5244 this._event.stopPropagation(); 5245 }else{ 5246 this._event.cancelBubble=true; 5247 } 5248 },preventDefault:function(){ 5249 if(this._event.preventDefault){ 5250 this._event.preventDefault(); 5251 }else{ 5252 if(this._confirmUnload===null){ 5253 this._event.returnValue=false; 5254 } 5255 } 5256 },_confirmUnload:null,confirmUnload:function(msg){ 5257 if(this.type()=="beforeunload"){ 5258 this._confirmUnload=msg; 5259 this._event.returnValue=msg; 5260 } 5261 }}); 5262 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"}; 5263 (function(){ 5264 var _561=MochiKit.Signal._specialMacKeys; 5265 for(i=63236;i<=63242;i++){ 5266 _561[i]="KEY_F"+(i-63236+1); 5267 } 5268 })(); 5269 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"}; 5270 (function(){ 5271 var _562=MochiKit.Signal._specialKeys; 5272 for(var i=48;i<=57;i++){ 5273 _562[i]="KEY_"+(i-48); 5274 } 5275 for(i=65;i<=90;i++){ 5276 _562[i]="KEY_"+String.fromCharCode(i); 5277 } 5278 for(i=96;i<=105;i++){ 5279 _562[i]="KEY_NUM_PAD_"+(i-96); 5280 } 5281 for(i=112;i<=123;i++){ 5282 _562[i]="KEY_F"+(i-112+1); 5283 } 5284 })(); 5285 MochiKit.Signal.Ident=function(_564){ 5286 this.source=_564.source; 5287 this.signal=_564.signal; 5288 this.listener=_564.listener; 5289 this.isDOM=_564.isDOM; 5290 this.objOrFunc=_564.objOrFunc; 5291 this.funcOrStr=_564.funcOrStr; 5292 this.connected=_564.connected; 5293 }; 5294 MochiKit.Signal.Ident.prototype={}; 5295 MochiKit.Base.update(MochiKit.Signal,{__repr__:function(){ 5296 return "["+this.NAME+" "+this.VERSION+"]"; 5297 },toString:function(){ 5298 return this.__repr__(); 5299 },_unloadCache:function(){ 5300 var self=MochiKit.Signal; 5301 var _566=self._observers; 5302 for(var i=0;i<_566.length;i++){ 5303 if(_566[i].signal!=="onload"&&_566[i].signal!=="onunload"){ 5304 self._disconnect(_566[i]); 5305 } 5306 } 5307 },_listener:function(src,sig,func,obj,_56c){ 5308 var self=MochiKit.Signal; 5309 var E=self.Event; 5310 if(!_56c){ 5311 if(typeof (func.im_self)=="undefined"){ 5312 return MochiKit.Base.bindLate(func,obj); 5313 }else{ 5314 return func; 5315 } 5316 } 5317 obj=obj||src; 5318 if(typeof (func)=="string"){ 5319 if(sig==="onload"||sig==="onunload"){ 5320 return function(_56f){ 5321 obj[func].apply(obj,[new E(src,_56f)]); 5322 var _570=new MochiKit.Signal.Ident({source:src,signal:sig,objOrFunc:obj,funcOrStr:func}); 5323 MochiKit.Signal._disconnect(_570); 5324 }; 5325 }else{ 5326 return function(_571){ 5327 obj[func].apply(obj,[new E(src,_571)]); 5328 }; 5329 } 5330 }else{ 5331 if(sig==="onload"||sig==="onunload"){ 5332 return function(_572){ 5333 func.apply(obj,[new E(src,_572)]); 5334 var _573=new MochiKit.Signal.Ident({source:src,signal:sig,objOrFunc:func}); 5335 MochiKit.Signal._disconnect(_573); 5336 }; 5337 }else{ 5338 return function(_574){ 5339 func.apply(obj,[new E(src,_574)]); 5340 }; 5341 } 5342 } 5343 },_browserAlreadyHasMouseEnterAndLeave:function(){ 5344 return /MSIE/.test(navigator.userAgent); 5345 },_browserLacksMouseWheelEvent:function(){ 5346 return /Gecko\//.test(navigator.userAgent); 5347 },_mouseEnterListener:function(src,sig,func,obj){ 5348 var E=MochiKit.Signal.Event; 5349 return function(_57a){ 5350 var e=new E(src,_57a); 5351 try{ 5352 e.relatedTarget().nodeName; 5353 } 5354 catch(err){ 5355 return; 5356 } 5357 e.stop(); 5358 if(MochiKit.DOM.isChildNode(e.relatedTarget(),src)){ 5359 return; 5360 } 5361 e.type=function(){ 5362 return sig; 5363 }; 5364 if(typeof (func)=="string"){ 5365 return obj[func].apply(obj,[e]); 5366 }else{ 5367 return func.apply(obj,[e]); 5368 } 5369 }; 5370 },_getDestPair:function(_57c,_57d){ 5371 var obj=null; 5372 var func=null; 5373 if(typeof (_57d)!="undefined"){ 5374 obj=_57c; 5375 func=_57d; 5376 if(typeof (_57d)=="string"){ 5377 if(typeof (_57c[_57d])!="function"){ 5378 throw new Error("'funcOrStr' must be a function on 'objOrFunc'"); 5379 } 5380 }else{ 5381 if(typeof (_57d)!="function"){ 5382 throw new Error("'funcOrStr' must be a function or string"); 5383 } 5384 } 5385 }else{ 5386 if(typeof (_57c)!="function"){ 5387 throw new Error("'objOrFunc' must be a function if 'funcOrStr' is not given"); 5388 }else{ 5389 func=_57c; 5390 } 5391 } 5392 return [obj,func]; 5393 },connect:function(src,sig,_582,_583){ 5394 src=MochiKit.DOM.getElement(src); 5395 var self=MochiKit.Signal; 5396 if(typeof (sig)!="string"){ 5397 throw new Error("'sig' must be a string"); 5398 } 5399 var _585=self._getDestPair(_582,_583); 5400 var obj=_585[0]; 5401 var func=_585[1]; 5402 if(typeof (obj)=="undefined"||obj===null){ 5403 obj=src; 5404 } 5405 var _588=!!(src.addEventListener||src.attachEvent); 5406 if(_588&&(sig==="onmouseenter"||sig==="onmouseleave")&&!self._browserAlreadyHasMouseEnterAndLeave()){ 5407 var _589=self._mouseEnterListener(src,sig.substr(2),func,obj); 5408 if(sig==="onmouseenter"){ 5409 sig="onmouseover"; 5410 }else{ 5411 sig="onmouseout"; 5412 } 5413 }else{ 5414 if(_588&&sig=="onmousewheel"&&self._browserLacksMouseWheelEvent()){ 5415 var _589=self._listener(src,sig,func,obj,_588); 5416 sig="onDOMMouseScroll"; 5417 }else{ 5418 var _589=self._listener(src,sig,func,obj,_588); 5419 } 5420 } 5421 if(src.addEventListener){ 5422 src.addEventListener(sig.substr(2),_589,false); 5423 }else{ 5424 if(src.attachEvent){ 5425 src.attachEvent(sig,_589); 5426 } 5427 } 5428 var _58a=new MochiKit.Signal.Ident({source:src,signal:sig,listener:_589,isDOM:_588,objOrFunc:_582,funcOrStr:_583,connected:true}); 5429 self._observers.push(_58a); 5430 if(!_588&&typeof (src.__connect__)=="function"){ 5431 var args=MochiKit.Base.extend([_58a],arguments,1); 5432 src.__connect__.apply(src,args); 5433 } 5434 return _58a; 5435 },_disconnect:function(_58c){ 5436 if(!_58c.connected){ 5437 return; 5438 } 5439 _58c.connected=false; 5440 var src=_58c.source; 5441 var sig=_58c.signal; 5442 var _58f=_58c.listener; 5443 if(!_58c.isDOM){ 5444 if(typeof (src.__disconnect__)=="function"){ 5445 src.__disconnect__(_58c,sig,_58c.objOrFunc,_58c.funcOrStr); 5446 } 5447 return; 5448 } 5449 if(src.removeEventListener){ 5450 src.removeEventListener(sig.substr(2),_58f,false); 5451 }else{ 5452 if(src.detachEvent){ 5453 src.detachEvent(sig,_58f); 5454 }else{ 5455 throw new Error("'src' must be a DOM element"); 5456 } 5457 } 5458 },disconnect:function(_590){ 5459 var self=MochiKit.Signal; 5460 var _592=self._observers; 5461 var m=MochiKit.Base; 5462 if(arguments.length>1){ 5463 var src=MochiKit.DOM.getElement(arguments[0]); 5464 var sig=arguments[1]; 5465 var obj=arguments[2]; 5466 var func=arguments[3]; 5467 for(var i=_592.length-1;i>=0;i--){ 5468 var o=_592[i]; 5469 if(o.source===src&&o.signal===sig&&o.objOrFunc===obj&&o.funcOrStr===func){ 5470 self._disconnect(o); 5471 if(!self._lock){ 5472 _592.splice(i,1); 5473 }else{ 5474 self._dirty=true; 5475 } 5476 return true; 5477 } 5478 } 5479 }else{ 5480 var idx=m.findIdentical(_592,_590); 5481 if(idx>=0){ 5482 self._disconnect(_590); 5483 if(!self._lock){ 5484 _592.splice(idx,1); 5485 }else{ 5486 self._dirty=true; 5487 } 5488 return true; 5489 } 5490 } 5491 return false; 5492 },disconnectAllTo:function(_59b,_59c){ 5493 var self=MochiKit.Signal; 5494 var _59e=self._observers; 5495 var _59f=self._disconnect; 5496 var _5a0=self._lock; 5497 var _5a1=self._dirty; 5498 if(typeof (_59c)==="undefined"){ 5499 _59c=null; 5500 } 5501 for(var i=_59e.length-1;i>=0;i--){ 5502 var _5a3=_59e[i]; 5503 if(_5a3.objOrFunc===_59b&&(_59c===null||_5a3.funcOrStr===_59c)){ 5504 _59f(_5a3); 5505 if(_5a0){ 5506 _5a1=true; 5507 }else{ 5508 _59e.splice(i,1); 5509 } 5510 } 5511 } 5512 self._dirty=_5a1; 5513 },disconnectAll:function(src,sig){ 5514 src=MochiKit.DOM.getElement(src); 5515 var m=MochiKit.Base; 5516 var _5a7=m.flattenArguments(m.extend(null,arguments,1)); 5517 var self=MochiKit.Signal; 5518 var _5a9=self._disconnect; 5519 var _5aa=self._observers; 5520 var i,_5ac; 5521 var _5ad=self._lock; 5522 var _5ae=self._dirty; 5523 if(_5a7.length===0){ 5524 for(i=_5aa.length-1;i>=0;i--){ 5525 _5ac=_5aa[i]; 5526 if(_5ac.source===src){ 5527 _5a9(_5ac); 5528 if(!_5ad){ 5529 _5aa.splice(i,1); 5530 }else{ 5531 _5ae=true; 5532 } 5533 } 5534 } 5535 }else{ 5536 var sigs={}; 5537 for(i=0;i<_5a7.length;i++){ 5538 sigs[_5a7[i]]=true; 5539 } 5540 for(i=_5aa.length-1;i>=0;i--){ 5541 _5ac=_5aa[i]; 5542 if(_5ac.source===src&&_5ac.signal in sigs){ 5543 _5a9(_5ac); 5544 if(!_5ad){ 5545 _5aa.splice(i,1); 5546 }else{ 5547 _5ae=true; 5548 } 5549 } 5550 } 5551 } 5552 self._dirty=_5ae; 5553 },signal:function(src,sig){ 5554 var self=MochiKit.Signal; 5555 var _5b3=self._observers; 5556 src=MochiKit.DOM.getElement(src); 5557 var args=MochiKit.Base.extend(null,arguments,2); 5558 var _5b5=[]; 5559 self._lock=true; 5560 for(var i=0;i<_5b3.length;i++){ 5561 var _5b7=_5b3[i]; 5562 if(_5b7.source===src&&_5b7.signal===sig&&_5b7.connected){ 5563 try{ 5564 _5b7.listener.apply(src,args); 5565 } 5566 catch(e){ 5567 _5b5.push(e); 5568 } 5569 } 5570 } 5571 self._lock=false; 5572 if(self._dirty){ 5573 self._dirty=false; 5574 for(var i=_5b3.length-1;i>=0;i--){ 5575 if(!_5b3[i].connected){ 5576 _5b3.splice(i,1); 5577 } 5578 } 5579 } 5580 if(_5b5.length==1){ 5581 throw _5b5[0]; 5582 }else{ 5583 if(_5b5.length>1){ 5584 var e=new Error("Multiple errors thrown in handling 'sig', see errors property"); 5585 e.errors=_5b5; 5586 throw e; 5587 } 5588 } 5589 }}); 5590 MochiKit.Signal.EXPORT_OK=[]; 5591 MochiKit.Signal.EXPORT=["connect","disconnect","signal","disconnectAll","disconnectAllTo"]; 5592 MochiKit.Signal.__new__=function(win){ 5593 var m=MochiKit.Base; 5594 this._document=document; 5595 this._window=win; 5596 this._lock=false; 5597 this._dirty=false; 5598 try{ 5599 this.connect(window,"onunload",this._unloadCache); 5600 } 5601 catch(e){ 5602 } 5603 this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; 5604 m.nameFunctions(this); 5605 }; 5606 MochiKit.Signal.__new__(this); 5607 if(MochiKit.__export__){ 5608 connect=MochiKit.Signal.connect; 5609 disconnect=MochiKit.Signal.disconnect; 5610 disconnectAll=MochiKit.Signal.disconnectAll; 5611 signal=MochiKit.Signal.signal; 5612 } 5613 MochiKit.Base._exportSymbols(this,MochiKit.Signal); 5614 MochiKit.Base._deps("Position",["Base","DOM","Style"]); 5615 MochiKit.Position.NAME="MochiKit.Position"; 5616 MochiKit.Position.VERSION="1.4.2"; 5617 MochiKit.Position.__repr__=function(){ 5618 return "["+this.NAME+" "+this.VERSION+"]"; 5619 }; 5620 MochiKit.Position.toString=function(){ 5621 return this.__repr__(); 5622 }; 5623 MochiKit.Position.EXPORT_OK=[]; 5624 MochiKit.Position.EXPORT=[]; 5625 MochiKit.Base.update(MochiKit.Position,{includeScrollOffsets:false,prepare:function(){ 5626 var _5bb=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0; 5627 var _5bc=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0; 5628 this.windowOffset=new MochiKit.Style.Coordinates(_5bb,_5bc); 5629 },cumulativeOffset:function(_5bd){ 5630 var _5be=0; 5631 var _5bf=0; 5632 do{ 5633 _5be+=_5bd.offsetTop||0; 5634 _5bf+=_5bd.offsetLeft||0; 5635 _5bd=_5bd.offsetParent; 5636 }while(_5bd); 5637 return new MochiKit.Style.Coordinates(_5bf,_5be); 5638 },realOffset:function(_5c0){ 5639 var _5c1=0; 5640 var _5c2=0; 5641 do{ 5642 _5c1+=_5c0.scrollTop||0; 5643 _5c2+=_5c0.scrollLeft||0; 5644 _5c0=_5c0.parentNode; 5645 }while(_5c0); 5646 return new MochiKit.Style.Coordinates(_5c2,_5c1); 5647 },within:function(_5c3,x,y){ 5648 if(this.includeScrollOffsets){ 5649 return this.withinIncludingScrolloffsets(_5c3,x,y); 5650 } 5651 this.xcomp=x; 5652 this.ycomp=y; 5653 this.offset=this.cumulativeOffset(_5c3); 5654 if(_5c3.style.position=="fixed"){ 5655 this.offset.x+=this.windowOffset.x; 5656 this.offset.y+=this.windowOffset.y; 5657 } 5658 return (y>=this.offset.y&&y<this.offset.y+_5c3.offsetHeight&&x>=this.offset.x&&x<this.offset.x+_5c3.offsetWidth); 5659 },withinIncludingScrolloffsets:function(_5c6,x,y){ 5660 var _5c9=this.realOffset(_5c6); 5661 this.xcomp=x+_5c9.x-this.windowOffset.x; 5662 this.ycomp=y+_5c9.y-this.windowOffset.y; 5663 this.offset=this.cumulativeOffset(_5c6); 5664 return (this.ycomp>=this.offset.y&&this.ycomp<this.offset.y+_5c6.offsetHeight&&this.xcomp>=this.offset.x&&this.xcomp<this.offset.x+_5c6.offsetWidth); 5665 },overlap:function(mode,_5cb){ 5666 if(!mode){ 5667 return 0; 5668 } 5669 if(mode=="vertical"){ 5670 return ((this.offset.y+_5cb.offsetHeight)-this.ycomp)/_5cb.offsetHeight; 5671 } 5672 if(mode=="horizontal"){ 5673 return ((this.offset.x+_5cb.offsetWidth)-this.xcomp)/_5cb.offsetWidth; 5674 } 5675 },absolutize:function(_5cc){ 5676 _5cc=MochiKit.DOM.getElement(_5cc); 5677 if(_5cc.style.position=="absolute"){ 5678 return; 5679 } 5680 MochiKit.Position.prepare(); 5681 var _5cd=MochiKit.Position.positionedOffset(_5cc); 5682 var _5ce=_5cc.clientWidth; 5683 var _5cf=_5cc.clientHeight; 5684 var _5d0={"position":_5cc.style.position,"left":_5cd.x-parseFloat(_5cc.style.left||0),"top":_5cd.y-parseFloat(_5cc.style.top||0),"width":_5cc.style.width,"height":_5cc.style.height}; 5685 _5cc.style.position="absolute"; 5686 _5cc.style.top=_5cd.y+"px"; 5687 _5cc.style.left=_5cd.x+"px"; 5688 _5cc.style.width=_5ce+"px"; 5689 _5cc.style.height=_5cf+"px"; 5690 return _5d0; 5691 },positionedOffset:function(_5d1){ 5692 var _5d2=0,_5d3=0; 5693 do{ 5694 _5d2+=_5d1.offsetTop||0; 5695 _5d3+=_5d1.offsetLeft||0; 5696 _5d1=_5d1.offsetParent; 5697 if(_5d1){ 5698 p=MochiKit.Style.getStyle(_5d1,"position"); 5699 if(p=="relative"||p=="absolute"){ 5700 break; 5701 } 5702 } 5703 }while(_5d1); 5704 return new MochiKit.Style.Coordinates(_5d3,_5d2); 5705 },relativize:function(_5d4,_5d5){ 5706 _5d4=MochiKit.DOM.getElement(_5d4); 5707 if(_5d4.style.position=="relative"){ 5708 return; 5709 } 5710 MochiKit.Position.prepare(); 5711 var top=parseFloat(_5d4.style.top||0)-(_5d5["top"]||0); 5712 var left=parseFloat(_5d4.style.left||0)-(_5d5["left"]||0); 5713 _5d4.style.position=_5d5["position"]; 5714 _5d4.style.top=top+"px"; 5715 _5d4.style.left=left+"px"; 5716 _5d4.style.width=_5d5["width"]; 5717 _5d4.style.height=_5d5["height"]; 5718 },clone:function(_5d8,_5d9){ 5719 _5d8=MochiKit.DOM.getElement(_5d8); 5720 _5d9=MochiKit.DOM.getElement(_5d9); 5721 _5d9.style.position="absolute"; 5722 var _5da=this.cumulativeOffset(_5d8); 5723 _5d9.style.top=_5da.y+"px"; 5724 _5d9.style.left=_5da.x+"px"; 5725 _5d9.style.width=_5d8.offsetWidth+"px"; 5726 _5d9.style.height=_5d8.offsetHeight+"px"; 5727 },page:function(_5db){ 5728 var _5dc=0; 5729 var _5dd=0; 5730 var _5de=_5db; 5731 do{ 5732 _5dc+=_5de.offsetTop||0; 5733 _5dd+=_5de.offsetLeft||0; 5734 if(_5de.offsetParent==document.body&&MochiKit.Style.getStyle(_5de,"position")=="absolute"){ 5735 break; 5736 } 5737 }while(_5de=_5de.offsetParent); 5738 _5de=_5db; 5739 do{ 5740 _5dc-=_5de.scrollTop||0; 5741 _5dd-=_5de.scrollLeft||0; 5742 }while(_5de=_5de.parentNode); 5743 return new MochiKit.Style.Coordinates(_5dd,_5dc); 5744 }}); 5745 MochiKit.Position.__new__=function(win){ 5746 var m=MochiKit.Base; 5747 this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; 5748 m.nameFunctions(this); 5749 }; 5750 MochiKit.Position.__new__(this); 5751 MochiKit.Base._exportSymbols(this,MochiKit.Position); 5752 MochiKit.Base._deps("Visual",["Base","DOM","Style","Color","Position"]); 5753 MochiKit.Visual.NAME="MochiKit.Visual"; 5754 MochiKit.Visual.VERSION="1.4.2"; 5755 MochiKit.Visual.__repr__=function(){ 5756 return "["+this.NAME+" "+this.VERSION+"]"; 5757 }; 5758 MochiKit.Visual.toString=function(){ 5759 return this.__repr__(); 5760 }; 5761 MochiKit.Visual._RoundCorners=function(e,_5e2){ 5762 e=MochiKit.DOM.getElement(e); 5763 this._setOptions(_5e2); 5764 if(this.options.__unstable__wrapElement){ 5765 e=this._doWrap(e); 5766 } 5767 var _5e3=this.options.color; 5768 var C=MochiKit.Color.Color; 5769 if(this.options.color==="fromElement"){ 5770 _5e3=C.fromBackground(e); 5771 }else{ 5772 if(!(_5e3 instanceof C)){ 5773 _5e3=C.fromString(_5e3); 5774 } 5775 } 5776 this.isTransparent=(_5e3.asRGB().a<=0); 5777 var _5e5=this.options.bgColor; 5778 if(this.options.bgColor==="fromParent"){ 5779 _5e5=C.fromBackground(e.offsetParent); 5780 }else{ 5781 if(!(_5e5 instanceof C)){ 5782 _5e5=C.fromString(_5e5); 5783 } 5784 } 5785 this._roundCornersImpl(e,_5e3,_5e5); 5786 }; 5787 MochiKit.Visual._RoundCorners.prototype={_doWrap:function(e){ 5788 var _5e7=e.parentNode; 5789 var doc=MochiKit.DOM.currentDocument(); 5790 if(typeof (doc.defaultView)==="undefined"||doc.defaultView===null){ 5791 return e; 5792 } 5793 var _5e9=doc.defaultView.getComputedStyle(e,null); 5794 if(typeof (_5e9)==="undefined"||_5e9===null){ 5795 return e; 5796 } 5797 var _5ea=MochiKit.DOM.DIV({"style":{display:"block",marginTop:_5e9.getPropertyValue("padding-top"),marginRight:_5e9.getPropertyValue("padding-right"),marginBottom:_5e9.getPropertyValue("padding-bottom"),marginLeft:_5e9.getPropertyValue("padding-left"),padding:"0px"}}); 5798 _5ea.innerHTML=e.innerHTML; 5799 e.innerHTML=""; 5800 e.appendChild(_5ea); 5801 return e; 5802 },_roundCornersImpl:function(e,_5ec,_5ed){ 5803 if(this.options.border){ 5804 this._renderBorder(e,_5ed); 5805 } 5806 if(this._isTopRounded()){ 5807 this._roundTopCorners(e,_5ec,_5ed); 5808 } 5809 if(this._isBottomRounded()){ 5810 this._roundBottomCorners(e,_5ec,_5ed); 5811 } 5812 },_renderBorder:function(el,_5ef){ 5813 var _5f0="1px solid "+this._borderColor(_5ef); 5814 var _5f1="border-left: "+_5f0; 5815 var _5f2="border-right: "+_5f0; 5816 var _5f3="style='"+_5f1+";"+_5f2+"'"; 5817 el.innerHTML="<div "+_5f3+">"+el.innerHTML+"</div>"; 5818 },_roundTopCorners:function(el,_5f5,_5f6){ 5819 var _5f7=this._createCorner(_5f6); 5820 for(var i=0;i<this.options.numSlices;i++){ 5821 _5f7.appendChild(this._createCornerSlice(_5f5,_5f6,i,"top")); 5822 } 5823 el.style.paddingTop=0; 5824 el.insertBefore(_5f7,el.firstChild); 5825 },_roundBottomCorners:function(el,_5fa,_5fb){ 5826 var _5fc=this._createCorner(_5fb); 5827 for(var i=(this.options.numSlices-1);i>=0;i--){ 5828 _5fc.appendChild(this._createCornerSlice(_5fa,_5fb,i,"bottom")); 5829 } 5830 el.style.paddingBottom=0; 5831 el.appendChild(_5fc); 5832 },_createCorner:function(_5fe){ 5833 var dom=MochiKit.DOM; 5834 return dom.DIV({style:{backgroundColor:_5fe.toString()}}); 5835 },_createCornerSlice:function(_600,_601,n,_603){ 5836 var _604=MochiKit.DOM.SPAN(); 5837 var _605=_604.style; 5838 _605.backgroundColor=_600.toString(); 5839 _605.display="block"; 5840 _605.height="1px"; 5841 _605.overflow="hidden"; 5842 _605.fontSize="1px"; 5843 var _606=this._borderColor(_600,_601); 5844 if(this.options.border&&n===0){ 5845 _605.borderTopStyle="solid"; 5846 _605.borderTopWidth="1px"; 5847 _605.borderLeftWidth="0px"; 5848 _605.borderRightWidth="0px"; 5849 _605.borderBottomWidth="0px"; 5850 _605.height="0px"; 5851 _605.borderColor=_606.toString(); 5852 }else{ 5853 if(_606){ 5854 _605.borderColor=_606.toString(); 5855 _605.borderStyle="solid"; 5856 _605.borderWidth="0px 1px"; 5857 } 5858 } 5859 if(!this.options.compact&&(n==(this.options.numSlices-1))){ 5860 _605.height="2px"; 5861 } 5862 this._setMargin(_604,n,_603); 5863 this._setBorder(_604,n,_603); 5864 return _604; 5865 },_setOptions:function(_607){ 5866 this.options={corners:"all",color:"fromElement",bgColor:"fromParent",blend:true,border:false,compact:false,__unstable__wrapElement:false}; 5867 MochiKit.Base.update(this.options,_607); 5868 this.options.numSlices=(this.options.compact?2:4); 5869 },_whichSideTop:function(){ 5870 var _608=this.options.corners; 5871 if(this._hasString(_608,"all","top")){ 5872 return ""; 5873 } 5874 var _609=(_608.indexOf("tl")!=-1); 5875 var _60a=(_608.indexOf("tr")!=-1); 5876 if(_609&&_60a){ 5877 return ""; 5878 } 5879 if(_609){ 5880 return "left"; 5881 } 5882 if(_60a){ 5883 return "right"; 5884 } 5885 return ""; 5886 },_whichSideBottom:function(){ 5887 var _60b=this.options.corners; 5888 if(this._hasString(_60b,"all","bottom")){ 5889 return ""; 5890 } 5891 var _60c=(_60b.indexOf("bl")!=-1); 5892 var _60d=(_60b.indexOf("br")!=-1); 5893 if(_60c&&_60d){ 5894 return ""; 5895 } 5896 if(_60c){ 5897 return "left"; 5898 } 5899 if(_60d){ 5900 return "right"; 5901 } 5902 return ""; 5903 },_borderColor:function(_60e,_60f){ 5904 if(_60e=="transparent"){ 5905 return _60f; 5906 }else{ 5907 if(this.options.border){ 5908 return this.options.border; 5909 }else{ 5910 if(this.options.blend){ 5911 return _60f.blendedColor(_60e); 5912 } 5913 } 5914 } 5915 return ""; 5916 },_setMargin:function(el,n,_612){ 5917 var _613=this._marginSize(n)+"px"; 5918 var _614=(_612=="top"?this._whichSideTop():this._whichSideBottom()); 5919 var _615=el.style; 5920 if(_614=="left"){ 5921 _615.marginLeft=_613; 5922 _615.marginRight="0px"; 5923 }else{ 5924 if(_614=="right"){ 5925 _615.marginRight=_613; 5926 _615.marginLeft="0px"; 5927 }else{ 5928 _615.marginLeft=_613; 5929 _615.marginRight=_613; 5930 } 5931 } 5932 },_setBorder:function(el,n,_618){ 5933 var _619=this._borderSize(n)+"px"; 5934 var _61a=(_618=="top"?this._whichSideTop():this._whichSideBottom()); 5935 var _61b=el.style; 5936 if(_61a=="left"){ 5937 _61b.borderLeftWidth=_619; 5938 _61b.borderRightWidth="0px"; 5939 }else{ 5940 if(_61a=="right"){ 5941 _61b.borderRightWidth=_619; 5942 _61b.borderLeftWidth="0px"; 5943 }else{ 5944 _61b.borderLeftWidth=_619; 5945 _61b.borderRightWidth=_619; 5946 } 5947 } 5948 },_marginSize:function(n){ 5949 if(this.isTransparent){ 5950 return 0; 5951 } 5952 var o=this.options; 5953 if(o.compact&&o.blend){ 5954 var _61e=[1,0]; 5955 return _61e[n]; 5956 }else{ 5957 if(o.compact){ 5958 var _61f=[2,1]; 5959 return _61f[n]; 5960 }else{ 5961 if(o.blend){ 5962 var _620=[3,2,1,0]; 5963 return _620[n]; 5964 }else{ 5965 var _621=[5,3,2,1]; 5966 return _621[n]; 5967 } 5968 } 5969 } 5970 },_borderSize:function(n){ 5971 var o=this.options; 5972 var _624; 5973 if(o.compact&&(o.blend||this.isTransparent)){ 5974 return 1; 5975 }else{ 5976 if(o.compact){ 5977 _624=[1,0]; 5978 }else{ 5979 if(o.blend){ 5980 _624=[2,1,1,1]; 5981 }else{ 5982 if(o.border){ 5983 _624=[0,2,0,0]; 5984 }else{ 5985 if(this.isTransparent){ 5986 _624=[5,3,2,1]; 5987 }else{ 5988 return 0; 5989 } 5990 } 5991 } 5992 } 5993 } 5994 return _624[n]; 5995 },_hasString:function(str){ 5996 for(var i=1;i<arguments.length;i++){ 5997 if(str.indexOf(arguments[i])!=-1){ 5998 return true; 5999 } 6000 } 6001 return false; 6002 },_isTopRounded:function(){ 6003 return this._hasString(this.options.corners,"all","top","tl","tr"); 6004 },_isBottomRounded:function(){ 6005 return this._hasString(this.options.corners,"all","bottom","bl","br"); 6006 },_hasSingleTextChild:function(el){ 6007 return (el.childNodes.length==1&&el.childNodes[0].nodeType==3); 6008 }}; 6009 MochiKit.Visual.roundElement=function(e,_629){ 6010 new MochiKit.Visual._RoundCorners(e,_629); 6011 }; 6012 MochiKit.Visual.roundClass=function(_62a,_62b,_62c){ 6013 var _62d=MochiKit.DOM.getElementsByTagAndClassName(_62a,_62b); 6014 for(var i=0;i<_62d.length;i++){ 6015 MochiKit.Visual.roundElement(_62d[i],_62c); 6016 } 6017 }; 6018 MochiKit.Visual.tagifyText=function(_62f,_630){ 6019 _630=_630||"position:relative"; 6020 if(/MSIE/.test(navigator.userAgent)){ 6021 _630+=";zoom:1"; 6022 } 6023 _62f=MochiKit.DOM.getElement(_62f); 6024 var ma=MochiKit.Base.map; 6025 ma(function(_632){ 6026 if(_632.nodeType==3){ 6027 ma(function(_633){ 6028 _62f.insertBefore(MochiKit.DOM.SPAN({style:_630},_633==" "?String.fromCharCode(160):_633),_632); 6029 },_632.nodeValue.split("")); 6030 MochiKit.DOM.removeElement(_632); 6031 } 6032 },_62f.childNodes); 6033 }; 6034 MochiKit.Visual.forceRerendering=function(_634){ 6035 try{ 6036 _634=MochiKit.DOM.getElement(_634); 6037 var n=document.createTextNode(" "); 6038 _634.appendChild(n); 6039 _634.removeChild(n); 6040 } 6041 catch(e){ 6042 } 6043 }; 6044 MochiKit.Visual.multiple=function(_636,_637,_638){ 6045 _638=MochiKit.Base.update({speed:0.1,delay:0},_638); 6046 var _639=_638.delay; 6047 var _63a=0; 6048 MochiKit.Base.map(function(_63b){ 6049 _638.delay=_63a*_638.speed+_639; 6050 new _637(_63b,_638); 6051 _63a+=1; 6052 },_636); 6053 }; 6054 MochiKit.Visual.PAIRS={"slide":["slideDown","slideUp"],"blind":["blindDown","blindUp"],"appear":["appear","fade"],"size":["grow","shrink"]}; 6055 MochiKit.Visual.toggle=function(_63c,_63d,_63e){ 6056 _63c=MochiKit.DOM.getElement(_63c); 6057 _63d=(_63d||"appear").toLowerCase(); 6058 _63e=MochiKit.Base.update({queue:{position:"end",scope:(_63c.id||"global"),limit:1}},_63e); 6059 var v=MochiKit.Visual; 6060 v[MochiKit.Style.getStyle(_63c,"display")!="none"?v.PAIRS[_63d][1]:v.PAIRS[_63d][0]](_63c,_63e); 6061 }; 6062 MochiKit.Visual.Transitions={}; 6063 MochiKit.Visual.Transitions.linear=function(pos){ 6064 return pos; 6065 }; 6066 MochiKit.Visual.Transitions.sinoidal=function(pos){ 6067 return 0.5-Math.cos(pos*Math.PI)/2; 6068 }; 6069 MochiKit.Visual.Transitions.reverse=function(pos){ 6070 return 1-pos; 6071 }; 6072 MochiKit.Visual.Transitions.flicker=function(pos){ 6073 return 0.25-Math.cos(pos*Math.PI)/4+Math.random()/2; 6074 }; 6075 MochiKit.Visual.Transitions.wobble=function(pos){ 6076 return 0.5-Math.cos(9*pos*Math.PI)/2; 6077 }; 6078 MochiKit.Visual.Transitions.pulse=function(pos,_646){ 6079 if(_646){ 6080 pos*=2*_646; 6081 }else{ 6082 pos*=10; 6083 } 6084 var _647=pos-Math.floor(pos); 6085 return (Math.floor(pos)%2==0)?_647:1-_647; 6086 }; 6087 MochiKit.Visual.Transitions.parabolic=function(pos){ 6088 return pos*pos; 6089 }; 6090 MochiKit.Visual.Transitions.none=function(pos){ 6091 return 0; 6092 }; 6093 MochiKit.Visual.Transitions.full=function(pos){ 6094 return 1; 6095 }; 6096 MochiKit.Visual.ScopedQueue=function(){ 6097 var cls=arguments.callee; 6098 if(!(this instanceof cls)){ 6099 return new cls(); 6100 } 6101 this.__init__(); 6102 }; 6103 MochiKit.Base.update(MochiKit.Visual.ScopedQueue.prototype,{__init__:function(){ 6104 this.effects=[]; 6105 this.interval=null; 6106 },add:function(_64c){ 6107 var _64d=new Date().getTime(); 6108 var _64e=(typeof (_64c.options.queue)=="string")?_64c.options.queue:_64c.options.queue.position; 6109 var ma=MochiKit.Base.map; 6110 switch(_64e){ 6111 case "front": 6112 ma(function(e){ 6113 if(e.state=="idle"){ 6114 e.startOn+=_64c.finishOn; 6115 e.finishOn+=_64c.finishOn; 6116 } 6117 },this.effects); 6118 break; 6119 case "end": 6120 var _651; 6121 ma(function(e){ 6122 var i=e.finishOn; 6123 if(i>=(_651||i)){ 6124 _651=i; 6125 } 6126 },this.effects); 6127 _64d=_651||_64d; 6128 break; 6129 case "break": 6130 ma(function(e){ 6131 e.finalize(); 6132 },this.effects); 6133 break; 6134 } 6135 _64c.startOn+=_64d; 6136 _64c.finishOn+=_64d; 6137 if(!_64c.options.queue.limit||this.effects.length<_64c.options.queue.limit){ 6138 this.effects.push(_64c); 6139 } 6140 if(!this.interval){ 6141 this.interval=this.startLoop(MochiKit.Base.bind(this.loop,this),40); 6142 } 6143 },startLoop:function(func,_656){ 6144 return setInterval(func,_656); 6145 },remove:function(_657){ 6146 this.effects=MochiKit.Base.filter(function(e){ 6147 return e!=_657; 6148 },this.effects); 6149 if(!this.effects.length){ 6150 this.stopLoop(this.interval); 6151 this.interval=null; 6152 } 6153 },stopLoop:function(_659){ 6154 clearInterval(_659); 6155 },loop:function(){ 6156 var _65a=new Date().getTime(); 6157 MochiKit.Base.map(function(_65b){ 6158 _65b.loop(_65a); 6159 },this.effects); 6160 }}); 6161 MochiKit.Visual.Queues={instances:{},get:function(_65c){ 6162 if(typeof (_65c)!="string"){ 6163 return _65c; 6164 } 6165 if(!this.instances[_65c]){ 6166 this.instances[_65c]=new MochiKit.Visual.ScopedQueue(); 6167 } 6168 return this.instances[_65c]; 6169 }}; 6170 MochiKit.Visual.Queue=MochiKit.Visual.Queues.get("global"); 6171 MochiKit.Visual.DefaultOptions={transition:MochiKit.Visual.Transitions.sinoidal,duration:1,fps:25,sync:false,from:0,to:1,delay:0,queue:"parallel"}; 6172 MochiKit.Visual.Base=function(){ 6173 }; 6174 MochiKit.Visual.Base.prototype={__class__:MochiKit.Visual.Base,start:function(_65d){ 6175 var v=MochiKit.Visual; 6176 this.options=MochiKit.Base.setdefault(_65d,v.DefaultOptions); 6177 this.currentFrame=0; 6178 this.state="idle"; 6179 this.startOn=this.options.delay*1000; 6180 this.finishOn=this.startOn+(this.options.duration*1000); 6181 this.event("beforeStart"); 6182 if(!this.options.sync){ 6183 v.Queues.get(typeof (this.options.queue)=="string"?"global":this.options.queue.scope).add(this); 6184 } 6185 },loop:function(_65f){ 6186 if(_65f>=this.startOn){ 6187 if(_65f>=this.finishOn){ 6188 return this.finalize(); 6189 } 6190 var pos=(_65f-this.startOn)/(this.finishOn-this.startOn); 6191 var _661=Math.round(pos*this.options.fps*this.options.duration); 6192 if(_661>this.currentFrame){ 6193 this.render(pos); 6194 this.currentFrame=_661; 6195 } 6196 } 6197 },render:function(pos){ 6198 if(this.state=="idle"){ 6199 this.state="running"; 6200 this.event("beforeSetup"); 6201 this.setup(); 6202 this.event("afterSetup"); 6203 } 6204 if(this.state=="running"){ 6205 if(this.options.transition){ 6206 pos=this.options.transition(pos); 6207 } 6208 pos*=(this.options.to-this.options.from); 6209 pos+=this.options.from; 6210 this.event("beforeUpdate"); 6211 this.update(pos); 6212 this.event("afterUpdate"); 6213 } 6214 },cancel:function(){ 6215 if(!this.options.sync){ 6216 MochiKit.Visual.Queues.get(typeof (this.options.queue)=="string"?"global":this.options.queue.scope).remove(this); 6217 } 6218 this.state="finished"; 6219 },finalize:function(){ 6220 this.render(1); 6221 this.cancel(); 6222 this.event("beforeFinish"); 6223 this.finish(); 6224 this.event("afterFinish"); 6225 },setup:function(){ 6226 },finish:function(){ 6227 },update:function(_663){ 6228 },event:function(_664){ 6229 if(this.options[_664+"Internal"]){ 6230 this.options[_664+"Internal"](this); 6231 } 6232 if(this.options[_664]){ 6233 this.options[_664](this); 6234 } 6235 },repr:function(){ 6236 return "["+this.__class__.NAME+", options:"+MochiKit.Base.repr(this.options)+"]"; 6237 }}; 6238 MochiKit.Visual.Parallel=function(_665,_666){ 6239 var cls=arguments.callee; 6240 if(!(this instanceof cls)){ 6241 return new cls(_665,_666); 6242 } 6243 this.__init__(_665,_666); 6244 }; 6245 MochiKit.Visual.Parallel.prototype=new MochiKit.Visual.Base(); 6246 MochiKit.Base.update(MochiKit.Visual.Parallel.prototype,{__class__:MochiKit.Visual.Parallel,__init__:function(_668,_669){ 6247 this.effects=_668||[]; 6248 this.start(_669); 6249 },update:function(_66a){ 6250 MochiKit.Base.map(function(_66b){ 6251 _66b.render(_66a); 6252 },this.effects); 6253 },finish:function(){ 6254 MochiKit.Base.map(function(_66c){ 6255 _66c.finalize(); 6256 },this.effects); 6257 }}); 6258 MochiKit.Visual.Sequence=function(_66d,_66e){ 6259 var cls=arguments.callee; 6260 if(!(this instanceof cls)){ 6261 return new cls(_66d,_66e); 6262 } 6263 this.__init__(_66d,_66e); 6264 }; 6265 MochiKit.Visual.Sequence.prototype=new MochiKit.Visual.Base(); 6266 MochiKit.Base.update(MochiKit.Visual.Sequence.prototype,{__class__:MochiKit.Visual.Sequence,__init__:function(_670,_671){ 6267 var defs={transition:MochiKit.Visual.Transitions.linear,duration:0}; 6268 this.effects=_670||[]; 6269 MochiKit.Base.map(function(_673){ 6270 defs.duration+=_673.options.duration; 6271 },this.effects); 6272 MochiKit.Base.setdefault(_671,defs); 6273 this.start(_671); 6274 },update:function(_674){ 6275 var time=_674*this.options.duration; 6276 for(var i=0;i<this.effects.length;i++){ 6277 var _677=this.effects[i]; 6278 if(time<=_677.options.duration){ 6279 _677.render(time/_677.options.duration); 6280 break; 6281 }else{ 6282 time-=_677.options.duration; 6283 } 6284 } 6285 },finish:function(){ 6286 MochiKit.Base.map(function(_678){ 6287 _678.finalize(); 6288 },this.effects); 6289 }}); 6290 MochiKit.Visual.Opacity=function(_679,_67a){ 6291 var cls=arguments.callee; 6292 if(!(this instanceof cls)){ 6293 return new cls(_679,_67a); 6294 } 6295 this.__init__(_679,_67a); 6296 }; 6297 MochiKit.Visual.Opacity.prototype=new MochiKit.Visual.Base(); 6298 MochiKit.Base.update(MochiKit.Visual.Opacity.prototype,{__class__:MochiKit.Visual.Opacity,__init__:function(_67c,_67d){ 6299 var b=MochiKit.Base; 6300 var s=MochiKit.Style; 6301 this.element=MochiKit.DOM.getElement(_67c); 6302 if(this.element.currentStyle&&(!this.element.currentStyle.hasLayout)){ 6303 s.setStyle(this.element,{zoom:1}); 6304 } 6305 _67d=b.update({from:s.getStyle(this.element,"opacity")||0,to:1},_67d); 6306 this.start(_67d); 6307 },update:function(_680){ 6308 MochiKit.Style.setStyle(this.element,{"opacity":_680}); 6309 }}); 6310 MochiKit.Visual.Move=function(_681,_682){ 6311 var cls=arguments.callee; 6312 if(!(this instanceof cls)){ 6313 return new cls(_681,_682); 6314 } 6315 this.__init__(_681,_682); 6316 }; 6317 MochiKit.Visual.Move.prototype=new MochiKit.Visual.Base(); 6318 MochiKit.Base.update(MochiKit.Visual.Move.prototype,{__class__:MochiKit.Visual.Move,__init__:function(_684,_685){ 6319 this.element=MochiKit.DOM.getElement(_684); 6320 _685=MochiKit.Base.update({x:0,y:0,mode:"relative"},_685); 6321 this.start(_685); 6322 },setup:function(){ 6323 MochiKit.Style.makePositioned(this.element); 6324 var s=this.element.style; 6325 var _687=s.visibility; 6326 var _688=s.display; 6327 if(_688=="none"){ 6328 s.visibility="hidden"; 6329 s.display=""; 6330 } 6331 this.originalLeft=parseFloat(MochiKit.Style.getStyle(this.element,"left")||"0"); 6332 this.originalTop=parseFloat(MochiKit.Style.getStyle(this.element,"top")||"0"); 6333 if(this.options.mode=="absolute"){ 6334 this.options.x-=this.originalLeft; 6335 this.options.y-=this.originalTop; 6336 } 6337 if(_688=="none"){ 6338 s.visibility=_687; 6339 s.display=_688; 6340 } 6341 },update:function(_689){ 6342 MochiKit.Style.setStyle(this.element,{left:Math.round(this.options.x*_689+this.originalLeft)+"px",top:Math.round(this.options.y*_689+this.originalTop)+"px"}); 6343 }}); 6344 MochiKit.Visual.Scale=function(_68a,_68b,_68c){ 6345 var cls=arguments.callee; 6346 if(!(this instanceof cls)){ 6347 return new cls(_68a,_68b,_68c); 6348 } 6349 this.__init__(_68a,_68b,_68c); 6350 }; 6351 MochiKit.Visual.Scale.prototype=new MochiKit.Visual.Base(); 6352 MochiKit.Base.update(MochiKit.Visual.Scale.prototype,{__class__:MochiKit.Visual.Scale,__init__:function(_68e,_68f,_690){ 6353 this.element=MochiKit.DOM.getElement(_68e); 6354 _690=MochiKit.Base.update({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:_68f},_690); 6355 this.start(_690); 6356 },setup:function(){ 6357 this.restoreAfterFinish=this.options.restoreAfterFinish||false; 6358 this.elementPositioning=MochiKit.Style.getStyle(this.element,"position"); 6359 var ma=MochiKit.Base.map; 6360 var b=MochiKit.Base.bind; 6361 this.originalStyle={}; 6362 ma(b(function(k){ 6363 this.originalStyle[k]=this.element.style[k]; 6364 },this),["top","left","width","height","fontSize"]); 6365 this.originalTop=this.element.offsetTop; 6366 this.originalLeft=this.element.offsetLeft; 6367 var _694=MochiKit.Style.getStyle(this.element,"font-size")||"100%"; 6368 ma(b(function(_695){ 6369 if(_694.indexOf(_695)>0){ 6370 this.fontSize=parseFloat(_694); 6371 this.fontSizeType=_695; 6372 } 6373 },this),["em","px","%"]); 6374 this.factor=(this.options.scaleTo-this.options.scaleFrom)/100; 6375 if(/^content/.test(this.options.scaleMode)){ 6376 this.dims=[this.element.scrollHeight,this.element.scrollWidth]; 6377 }else{ 6378 if(this.options.scaleMode=="box"){ 6379 this.dims=[this.element.offsetHeight,this.element.offsetWidth]; 6380 }else{ 6381 this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]; 6382 } 6383 } 6384 },update:function(_696){ 6385 var _697=(this.options.scaleFrom/100)+(this.factor*_696); 6386 if(this.options.scaleContent&&this.fontSize){ 6387 MochiKit.Style.setStyle(this.element,{fontSize:this.fontSize*_697+this.fontSizeType}); 6388 } 6389 this.setDimensions(this.dims[0]*_697,this.dims[1]*_697); 6390 },finish:function(){ 6391 if(this.restoreAfterFinish){ 6392 MochiKit.Style.setStyle(this.element,this.originalStyle); 6393 } 6394 },setDimensions:function(_698,_699){ 6395 var d={}; 6396 var r=Math.round; 6397 if(/MSIE/.test(navigator.userAgent)){ 6398 r=Math.ceil; 6399 } 6400 if(this.options.scaleX){ 6401 d.width=r(_699)+"px"; 6402 } 6403 if(this.options.scaleY){ 6404 d.height=r(_698)+"px"; 6405 } 6406 if(this.options.scaleFromCenter){ 6407 var topd=(_698-this.dims[0])/2; 6408 var _69d=(_699-this.dims[1])/2; 6409 if(this.elementPositioning=="absolute"){ 6410 if(this.options.scaleY){ 6411 d.top=this.originalTop-topd+"px"; 6412 } 6413 if(this.options.scaleX){ 6414 d.left=this.originalLeft-_69d+"px"; 6415 } 6416 }else{ 6417 if(this.options.scaleY){ 6418 d.top=-topd+"px"; 6419 } 6420 if(this.options.scaleX){ 6421 d.left=-_69d+"px"; 6422 } 6423 } 6424 } 6425 MochiKit.Style.setStyle(this.element,d); 6426 }}); 6427 MochiKit.Visual.Highlight=function(_69e,_69f){ 6428 var cls=arguments.callee; 6429 if(!(this instanceof cls)){ 6430 return new cls(_69e,_69f); 6431 } 6432 this.__init__(_69e,_69f); 6433 }; 6434 MochiKit.Visual.Highlight.prototype=new MochiKit.Visual.Base(); 6435 MochiKit.Base.update(MochiKit.Visual.Highlight.prototype,{__class__:MochiKit.Visual.Highlight,__init__:function(_6a1,_6a2){ 6436 this.element=MochiKit.DOM.getElement(_6a1); 6437 _6a2=MochiKit.Base.update({startcolor:"#ffff99"},_6a2); 6438 this.start(_6a2); 6439 },setup:function(){ 6440 var b=MochiKit.Base; 6441 var s=MochiKit.Style; 6442 if(s.getStyle(this.element,"display")=="none"){ 6443 this.cancel(); 6444 return; 6445 } 6446 this.oldStyle={backgroundImage:s.getStyle(this.element,"background-image")}; 6447 s.setStyle(this.element,{backgroundImage:"none"}); 6448 if(!this.options.endcolor){ 6449 this.options.endcolor=MochiKit.Color.Color.fromBackground(this.element).toHexString(); 6450 } 6451 if(b.isUndefinedOrNull(this.options.restorecolor)){ 6452 this.options.restorecolor=s.getStyle(this.element,"background-color"); 6453 } 6454 this._base=b.map(b.bind(function(i){ 6455 return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16); 6456 },this),[0,1,2]); 6457 this._delta=b.map(b.bind(function(i){ 6458 return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]; 6459 },this),[0,1,2]); 6460 },update:function(_6a7){ 6461 var m="#"; 6462 MochiKit.Base.map(MochiKit.Base.bind(function(i){ 6463 m+=MochiKit.Color.toColorPart(Math.round(this._base[i]+this._delta[i]*_6a7)); 6464 },this),[0,1,2]); 6465 MochiKit.Style.setStyle(this.element,{backgroundColor:m}); 6466 },finish:function(){ 6467 MochiKit.Style.setStyle(this.element,MochiKit.Base.update(this.oldStyle,{backgroundColor:this.options.restorecolor})); 6468 }}); 6469 MochiKit.Visual.ScrollTo=function(_6aa,_6ab){ 6470 var cls=arguments.callee; 6471 if(!(this instanceof cls)){ 6472 return new cls(_6aa,_6ab); 6473 } 6474 this.__init__(_6aa,_6ab); 6475 }; 6476 MochiKit.Visual.ScrollTo.prototype=new MochiKit.Visual.Base(); 6477 MochiKit.Base.update(MochiKit.Visual.ScrollTo.prototype,{__class__:MochiKit.Visual.ScrollTo,__init__:function(_6ad,_6ae){ 6478 this.element=MochiKit.DOM.getElement(_6ad); 6479 this.start(_6ae); 6480 },setup:function(){ 6481 var p=MochiKit.Position; 6482 p.prepare(); 6483 var _6b0=p.cumulativeOffset(this.element); 6484 if(this.options.offset){ 6485 _6b0.y+=this.options.offset; 6486 } 6487 var max; 6488 if(window.innerHeight){ 6489 max=window.innerHeight-window.height; 6490 }else{ 6491 if(document.documentElement&&document.documentElement.clientHeight){ 6492 max=document.documentElement.clientHeight-document.body.scrollHeight; 6493 }else{ 6494 if(document.body){ 6495 max=document.body.clientHeight-document.body.scrollHeight; 6496 } 6497 } 6498 } 6499 this.scrollStart=p.windowOffset.y; 6500 this.delta=(_6b0.y>max?max:_6b0.y)-this.scrollStart; 6501 },update:function(_6b2){ 6502 var p=MochiKit.Position; 6503 p.prepare(); 6504 window.scrollTo(p.windowOffset.x,this.scrollStart+(_6b2*this.delta)); 6505 }}); 6506 MochiKit.Visual.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/; 6507 MochiKit.Visual.Morph=function(_6b4,_6b5){ 6508 var cls=arguments.callee; 6509 if(!(this instanceof cls)){ 6510 return new cls(_6b4,_6b5); 6511 } 6512 this.__init__(_6b4,_6b5); 6513 }; 6514 MochiKit.Visual.Morph.prototype=new MochiKit.Visual.Base(); 6515 MochiKit.Base.update(MochiKit.Visual.Morph.prototype,{__class__:MochiKit.Visual.Morph,__init__:function(_6b7,_6b8){ 6516 this.element=MochiKit.DOM.getElement(_6b7); 6517 this.start(_6b8); 6518 },setup:function(){ 6519 var b=MochiKit.Base; 6520 var _6ba=this.options.style; 6521 this.styleStart={}; 6522 this.styleEnd={}; 6523 this.units={}; 6524 var _6bb,unit; 6525 for(var s in _6ba){ 6526 _6bb=_6ba[s]; 6527 s=b.camelize(s); 6528 if(MochiKit.Visual.CSS_LENGTH.test(_6bb)){ 6529 var _6be=_6bb.match(/^([\+\-]?[0-9\.]+)(.*)$/); 6530 _6bb=parseFloat(_6be[1]); 6531 unit=(_6be.length==3)?_6be[2]:null; 6532 this.styleEnd[s]=_6bb; 6533 this.units[s]=unit; 6534 _6bb=MochiKit.Style.getStyle(this.element,s); 6535 _6be=_6bb.match(/^([\+\-]?[0-9\.]+)(.*)$/); 6536 _6bb=parseFloat(_6be[1]); 6537 this.styleStart[s]=_6bb; 6538 }else{ 6539 if(/[Cc]olor$/.test(s)){ 6540 var c=MochiKit.Color.Color; 6541 _6bb=c.fromString(_6bb); 6542 if(_6bb){ 6543 this.units[s]="color"; 6544 this.styleEnd[s]=_6bb.toHexString(); 6545 _6bb=MochiKit.Style.getStyle(this.element,s); 6546 this.styleStart[s]=c.fromString(_6bb).toHexString(); 6547 this.styleStart[s]=b.map(b.bind(function(i){ 6548 return parseInt(this.styleStart[s].slice(i*2+1,i*2+3),16); 6549 },this),[0,1,2]); 6550 this.styleEnd[s]=b.map(b.bind(function(i){ 6551 return parseInt(this.styleEnd[s].slice(i*2+1,i*2+3),16); 6552 },this),[0,1,2]); 6553 } 6554 }else{ 6555 this.element.style[s]=_6bb; 6556 } 6557 } 6558 } 6559 },update:function(_6c2){ 6560 var _6c3; 6561 for(var s in this.styleStart){ 6562 if(this.units[s]=="color"){ 6563 var m="#"; 6564 var _6c6=this.styleStart[s]; 6565 var end=this.styleEnd[s]; 6566 MochiKit.Base.map(MochiKit.Base.bind(function(i){ 6567 m+=MochiKit.Color.toColorPart(Math.round(_6c6[i]+(end[i]-_6c6[i])*_6c2)); 6568 },this),[0,1,2]); 6569 this.element.style[s]=m; 6570 }else{ 6571 _6c3=this.styleStart[s]+Math.round((this.styleEnd[s]-this.styleStart[s])*_6c2*1000)/1000+this.units[s]; 6572 this.element.style[s]=_6c3; 6573 } 6574 } 6575 }}); 6576 MochiKit.Visual.fade=function(_6c9,_6ca){ 6577 var s=MochiKit.Style; 6578 var _6cc=s.getStyle(_6c9,"opacity"); 6579 _6ca=MochiKit.Base.update({from:s.getStyle(_6c9,"opacity")||1,to:0,afterFinishInternal:function(_6cd){ 6580 if(_6cd.options.to!==0){ 6581 return; 6582 } 6583 s.hideElement(_6cd.element); 6584 s.setStyle(_6cd.element,{"opacity":_6cc}); 6585 }},_6ca); 6586 return new MochiKit.Visual.Opacity(_6c9,_6ca); 6587 }; 6588 MochiKit.Visual.appear=function(_6ce,_6cf){ 6589 var s=MochiKit.Style; 6590 var v=MochiKit.Visual; 6591 _6cf=MochiKit.Base.update({from:(s.getStyle(_6ce,"display")=="none"?0:s.getStyle(_6ce,"opacity")||0),to:1,afterFinishInternal:function(_6d2){ 6592 v.forceRerendering(_6d2.element); 6593 },beforeSetupInternal:function(_6d3){ 6594 s.setStyle(_6d3.element,{"opacity":_6d3.options.from}); 6595 s.showElement(_6d3.element); 6596 }},_6cf); 6597 return new v.Opacity(_6ce,_6cf); 6598 }; 6599 MochiKit.Visual.puff=function(_6d4,_6d5){ 6600 var s=MochiKit.Style; 6601 var v=MochiKit.Visual; 6602 _6d4=MochiKit.DOM.getElement(_6d4); 6603 var _6d8=MochiKit.Style.getElementDimensions(_6d4,true); 6604 var _6d9={position:s.getStyle(_6d4,"position"),top:_6d4.style.top,left:_6d4.style.left,width:_6d4.style.width,height:_6d4.style.height,opacity:s.getStyle(_6d4,"opacity")}; 6605 _6d5=MochiKit.Base.update({beforeSetupInternal:function(_6da){ 6606 MochiKit.Position.absolutize(_6da.effects[0].element); 6607 },afterFinishInternal:function(_6db){ 6608 s.hideElement(_6db.effects[0].element); 6609 s.setStyle(_6db.effects[0].element,_6d9); 6610 },scaleContent:true,scaleFromCenter:true},_6d5); 6611 return new v.Parallel([new v.Scale(_6d4,200,{sync:true,scaleFromCenter:_6d5.scaleFromCenter,scaleMode:{originalHeight:_6d8.h,originalWidth:_6d8.w},scaleContent:_6d5.scaleContent,restoreAfterFinish:true}),new v.Opacity(_6d4,{sync:true,to:0})],_6d5); 6612 }; 6613 MochiKit.Visual.blindUp=function(_6dc,_6dd){ 6614 var d=MochiKit.DOM; 6615 var s=MochiKit.Style; 6616 _6dc=d.getElement(_6dc); 6617 var _6e0=s.getElementDimensions(_6dc,true); 6618 var _6e1=s.makeClipping(_6dc); 6619 _6dd=MochiKit.Base.update({scaleContent:false,scaleX:false,scaleMode:{originalHeight:_6e0.h,originalWidth:_6e0.w},restoreAfterFinish:true,afterFinishInternal:function(_6e2){ 6620 s.hideElement(_6e2.element); 6621 s.undoClipping(_6e2.element,_6e1); 6622 }},_6dd); 6623 return new MochiKit.Visual.Scale(_6dc,0,_6dd); 6624 }; 6625 MochiKit.Visual.blindDown=function(_6e3,_6e4){ 6626 var d=MochiKit.DOM; 6627 var s=MochiKit.Style; 6628 _6e3=d.getElement(_6e3); 6629 var _6e7=s.getElementDimensions(_6e3,true); 6630 var _6e8; 6631 _6e4=MochiKit.Base.update({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:_6e7.h,originalWidth:_6e7.w},restoreAfterFinish:true,afterSetupInternal:function(_6e9){ 6632 _6e8=s.makeClipping(_6e9.element); 6633 s.setStyle(_6e9.element,{height:"0px"}); 6634 s.showElement(_6e9.element); 6635 },afterFinishInternal:function(_6ea){ 6636 s.undoClipping(_6ea.element,_6e8); 6637 }},_6e4); 6638 return new MochiKit.Visual.Scale(_6e3,100,_6e4); 6639 }; 6640 MochiKit.Visual.switchOff=function(_6eb,_6ec){ 6641 var d=MochiKit.DOM; 6642 var s=MochiKit.Style; 6643 _6eb=d.getElement(_6eb); 6644 var _6ef=s.getElementDimensions(_6eb,true); 6645 var _6f0=s.getStyle(_6eb,"opacity"); 6646 var _6f1; 6647 _6ec=MochiKit.Base.update({duration:0.7,restoreAfterFinish:true,beforeSetupInternal:function(_6f2){ 6648 s.makePositioned(_6eb); 6649 _6f1=s.makeClipping(_6eb); 6650 },afterFinishInternal:function(_6f3){ 6651 s.hideElement(_6eb); 6652 s.undoClipping(_6eb,_6f1); 6653 s.undoPositioned(_6eb); 6654 s.setStyle(_6eb,{"opacity":_6f0}); 6655 }},_6ec); 6656 var v=MochiKit.Visual; 6657 return new v.Sequence([new v.appear(_6eb,{sync:true,duration:0.57*_6ec.duration,from:0,transition:v.Transitions.flicker}),new v.Scale(_6eb,1,{sync:true,duration:0.43*_6ec.duration,scaleFromCenter:true,scaleX:false,scaleMode:{originalHeight:_6ef.h,originalWidth:_6ef.w},scaleContent:false,restoreAfterFinish:true})],_6ec); 6658 }; 6659 MochiKit.Visual.dropOut=function(_6f5,_6f6){ 6660 var d=MochiKit.DOM; 6661 var s=MochiKit.Style; 6662 _6f5=d.getElement(_6f5); 6663 var _6f9={top:s.getStyle(_6f5,"top"),left:s.getStyle(_6f5,"left"),opacity:s.getStyle(_6f5,"opacity")}; 6664 _6f6=MochiKit.Base.update({duration:0.5,distance:100,beforeSetupInternal:function(_6fa){ 6665 s.makePositioned(_6fa.effects[0].element); 6666 },afterFinishInternal:function(_6fb){ 6667 s.hideElement(_6fb.effects[0].element); 6668 s.undoPositioned(_6fb.effects[0].element); 6669 s.setStyle(_6fb.effects[0].element,_6f9); 6670 }},_6f6); 6671 var v=MochiKit.Visual; 6672 return new v.Parallel([new v.Move(_6f5,{x:0,y:_6f6.distance,sync:true}),new v.Opacity(_6f5,{sync:true,to:0})],_6f6); 6673 }; 6674 MochiKit.Visual.shake=function(_6fd,_6fe){ 6675 var d=MochiKit.DOM; 6676 var v=MochiKit.Visual; 6677 var s=MochiKit.Style; 6678 _6fd=d.getElement(_6fd); 6679 var _702={top:s.getStyle(_6fd,"top"),left:s.getStyle(_6fd,"left")}; 6680 _6fe=MochiKit.Base.update({duration:0.5,afterFinishInternal:function(_703){ 6681 s.undoPositioned(_6fd); 6682 s.setStyle(_6fd,_702); 6683 }},_6fe); 6684 return new v.Sequence([new v.Move(_6fd,{sync:true,duration:0.1*_6fe.duration,x:20,y:0}),new v.Move(_6fd,{sync:true,duration:0.2*_6fe.duration,x:-40,y:0}),new v.Move(_6fd,{sync:true,duration:0.2*_6fe.duration,x:40,y:0}),new v.Move(_6fd,{sync:true,duration:0.2*_6fe.duration,x:-40,y:0}),new v.Move(_6fd,{sync:true,duration:0.2*_6fe.duration,x:40,y:0}),new v.Move(_6fd,{sync:true,duration:0.1*_6fe.duration,x:-20,y:0})],_6fe); 6685 }; 6686 MochiKit.Visual.slideDown=function(_704,_705){ 6687 var d=MochiKit.DOM; 6688 var b=MochiKit.Base; 6689 var s=MochiKit.Style; 6690 _704=d.getElement(_704); 6691 if(!_704.firstChild){ 6692 throw new Error("MochiKit.Visual.slideDown must be used on a element with a child"); 6693 } 6694 d.removeEmptyTextNodes(_704); 6695 var _709=s.getStyle(_704.firstChild,"bottom")||0; 6696 var _70a=s.getElementDimensions(_704,true); 6697 var _70b; 6698 _705=b.update({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:_70a.h,originalWidth:_70a.w},restoreAfterFinish:true,afterSetupInternal:function(_70c){ 6699 s.makePositioned(_70c.element); 6700 s.makePositioned(_70c.element.firstChild); 6701 if(/Opera/.test(navigator.userAgent)){ 6702 s.setStyle(_70c.element,{top:""}); 6703 } 6704 _70b=s.makeClipping(_70c.element); 6705 s.setStyle(_70c.element,{height:"0px"}); 6706 s.showElement(_70c.element); 6707 },afterUpdateInternal:function(_70d){ 6708 var _70e=s.getElementDimensions(_70d.element,true); 6709 s.setStyle(_70d.element.firstChild,{bottom:(_70d.dims[0]-_70e.h)+"px"}); 6710 },afterFinishInternal:function(_70f){ 6711 s.undoClipping(_70f.element,_70b); 6712 if(/MSIE/.test(navigator.userAgent)){ 6713 s.undoPositioned(_70f.element); 6714 s.undoPositioned(_70f.element.firstChild); 6715 }else{ 6716 s.undoPositioned(_70f.element.firstChild); 6717 s.undoPositioned(_70f.element); 6718 } 6719 s.setStyle(_70f.element.firstChild,{bottom:_709}); 6720 }},_705); 6721 return new MochiKit.Visual.Scale(_704,100,_705); 6722 }; 6723 MochiKit.Visual.slideUp=function(_710,_711){ 6724 var d=MochiKit.DOM; 6725 var b=MochiKit.Base; 6726 var s=MochiKit.Style; 6727 _710=d.getElement(_710); 6728 if(!_710.firstChild){ 6729 throw new Error("MochiKit.Visual.slideUp must be used on a element with a child"); 6730 } 6731 d.removeEmptyTextNodes(_710); 6732 var _715=s.getStyle(_710.firstChild,"bottom"); 6733 var _716=s.getElementDimensions(_710,true); 6734 var _717; 6735 _711=b.update({scaleContent:false,scaleX:false,scaleMode:{originalHeight:_716.h,originalWidth:_716.w},scaleFrom:100,restoreAfterFinish:true,beforeStartInternal:function(_718){ 6736 s.makePositioned(_718.element); 6737 s.makePositioned(_718.element.firstChild); 6738 if(/Opera/.test(navigator.userAgent)){ 6739 s.setStyle(_718.element,{top:""}); 6740 } 6741 _717=s.makeClipping(_718.element); 6742 s.showElement(_718.element); 6743 },afterUpdateInternal:function(_719){ 6744 var _71a=s.getElementDimensions(_719.element,true); 6745 s.setStyle(_719.element.firstChild,{bottom:(_719.dims[0]-_71a.h)+"px"}); 6746 },afterFinishInternal:function(_71b){ 6747 s.hideElement(_71b.element); 6748 s.undoClipping(_71b.element,_717); 6749 s.undoPositioned(_71b.element.firstChild); 6750 s.undoPositioned(_71b.element); 6751 s.setStyle(_71b.element.firstChild,{bottom:_715}); 6752 }},_711); 6753 return new MochiKit.Visual.Scale(_710,0,_711); 6754 }; 6755 MochiKit.Visual.squish=function(_71c,_71d){ 6756 var d=MochiKit.DOM; 6757 var b=MochiKit.Base; 6758 var s=MochiKit.Style; 6759 var _721=s.getElementDimensions(_71c,true); 6760 var _722; 6761 _71d=b.update({restoreAfterFinish:true,scaleMode:{originalHeight:_721.w,originalWidth:_721.h},beforeSetupInternal:function(_723){ 6762 _722=s.makeClipping(_723.element); 6763 },afterFinishInternal:function(_724){ 6764 s.hideElement(_724.element); 6765 s.undoClipping(_724.element,_722); 6766 }},_71d); 6767 return new MochiKit.Visual.Scale(_71c,/Opera/.test(navigator.userAgent)?1:0,_71d); 6768 }; 6769 MochiKit.Visual.grow=function(_725,_726){ 6770 var d=MochiKit.DOM; 6771 var v=MochiKit.Visual; 6772 var s=MochiKit.Style; 6773 _725=d.getElement(_725); 6774 _726=MochiKit.Base.update({direction:"center",moveTransition:v.Transitions.sinoidal,scaleTransition:v.Transitions.sinoidal,opacityTransition:v.Transitions.full,scaleContent:true,scaleFromCenter:false},_726); 6775 var _72a={top:_725.style.top,left:_725.style.left,height:_725.style.height,width:_725.style.width,opacity:s.getStyle(_725,"opacity")}; 6776 var dims=s.getElementDimensions(_725,true); 6777 var _72c,_72d; 6778 var _72e,_72f; 6779 switch(_726.direction){ 6780 case "top-left": 6781 _72c=_72d=_72e=_72f=0; 6782 break; 6783 case "top-right": 6784 _72c=dims.w; 6785 _72d=_72f=0; 6786 _72e=-dims.w; 6787 break; 6788 case "bottom-left": 6789 _72c=_72e=0; 6790 _72d=dims.h; 6791 _72f=-dims.h; 6792 break; 6793 case "bottom-right": 6794 _72c=dims.w; 6795 _72d=dims.h; 6796 _72e=-dims.w; 6797 _72f=-dims.h; 6798 break; 6799 case "center": 6800 _72c=dims.w/2; 6801 _72d=dims.h/2; 6802 _72e=-dims.w/2; 6803 _72f=-dims.h/2; 6804 break; 6805 } 6806 var _730=MochiKit.Base.update({beforeSetupInternal:function(_731){ 6807 s.setStyle(_731.effects[0].element,{height:"0px"}); 6808 s.showElement(_731.effects[0].element); 6809 },afterFinishInternal:function(_732){ 6810 s.undoClipping(_732.effects[0].element); 6811 s.undoPositioned(_732.effects[0].element); 6812 s.setStyle(_732.effects[0].element,_72a); 6813 }},_726); 6814 return new v.Move(_725,{x:_72c,y:_72d,duration:0.01,beforeSetupInternal:function(_733){ 6815 s.hideElement(_733.element); 6816 s.makeClipping(_733.element); 6817 s.makePositioned(_733.element); 6818 },afterFinishInternal:function(_734){ 6819 new v.Parallel([new v.Opacity(_734.element,{sync:true,to:1,from:0,transition:_726.opacityTransition}),new v.Move(_734.element,{x:_72e,y:_72f,sync:true,transition:_726.moveTransition}),new v.Scale(_734.element,100,{scaleMode:{originalHeight:dims.h,originalWidth:dims.w},sync:true,scaleFrom:/Opera/.test(navigator.userAgent)?1:0,transition:_726.scaleTransition,scaleContent:_726.scaleContent,scaleFromCenter:_726.scaleFromCenter,restoreAfterFinish:true})],_730); 6820 }}); 6821 }; 6822 MochiKit.Visual.shrink=function(_735,_736){ 6823 var d=MochiKit.DOM; 6824 var v=MochiKit.Visual; 6825 var s=MochiKit.Style; 6826 _735=d.getElement(_735); 6827 _736=MochiKit.Base.update({direction:"center",moveTransition:v.Transitions.sinoidal,scaleTransition:v.Transitions.sinoidal,opacityTransition:v.Transitions.none,scaleContent:true,scaleFromCenter:false},_736); 6828 var _73a={top:_735.style.top,left:_735.style.left,height:_735.style.height,width:_735.style.width,opacity:s.getStyle(_735,"opacity")}; 6829 var dims=s.getElementDimensions(_735,true); 6830 var _73c,_73d; 6831 switch(_736.direction){ 6832 case "top-left": 6833 _73c=_73d=0; 6834 break; 6835 case "top-right": 6836 _73c=dims.w; 6837 _73d=0; 6838 break; 6839 case "bottom-left": 6840 _73c=0; 6841 _73d=dims.h; 6842 break; 6843 case "bottom-right": 6844 _73c=dims.w; 6845 _73d=dims.h; 6846 break; 6847 case "center": 6848 _73c=dims.w/2; 6849 _73d=dims.h/2; 6850 break; 6851 } 6852 var _73e; 6853 var _73f=MochiKit.Base.update({beforeStartInternal:function(_740){ 6854 s.makePositioned(_740.effects[0].element); 6855 _73e=s.makeClipping(_740.effects[0].element); 6856 },afterFinishInternal:function(_741){ 6857 s.hideElement(_741.effects[0].element); 6858 s.undoClipping(_741.effects[0].element,_73e); 6859 s.undoPositioned(_741.effects[0].element); 6860 s.setStyle(_741.effects[0].element,_73a); 6861 }},_736); 6862 return new v.Parallel([new v.Opacity(_735,{sync:true,to:0,from:1,transition:_736.opacityTransition}),new v.Scale(_735,/Opera/.test(navigator.userAgent)?1:0,{scaleMode:{originalHeight:dims.h,originalWidth:dims.w},sync:true,transition:_736.scaleTransition,scaleContent:_736.scaleContent,scaleFromCenter:_736.scaleFromCenter,restoreAfterFinish:true}),new v.Move(_735,{x:_73c,y:_73d,sync:true,transition:_736.moveTransition})],_73f); 6863 }; 6864 MochiKit.Visual.pulsate=function(_742,_743){ 6865 var d=MochiKit.DOM; 6866 var v=MochiKit.Visual; 6867 var b=MochiKit.Base; 6868 var _747=MochiKit.Style.getStyle(_742,"opacity"); 6869 _743=b.update({duration:3,from:0,afterFinishInternal:function(_748){ 6870 MochiKit.Style.setStyle(_748.element,{"opacity":_747}); 6871 }},_743); 6872 var _749=_743.transition||v.Transitions.sinoidal; 6873 _743.transition=function(pos){ 6874 return _749(1-v.Transitions.pulse(pos,_743.pulses)); 6875 }; 6876 return new v.Opacity(_742,_743); 6877 }; 6878 MochiKit.Visual.fold=function(_74b,_74c){ 6879 var d=MochiKit.DOM; 6880 var v=MochiKit.Visual; 6881 var s=MochiKit.Style; 6882 _74b=d.getElement(_74b); 6883 var _750=s.getElementDimensions(_74b,true); 6884 var _751={top:_74b.style.top,left:_74b.style.left,width:_74b.style.width,height:_74b.style.height}; 6885 var _752=s.makeClipping(_74b); 6886 _74c=MochiKit.Base.update({scaleContent:false,scaleX:false,scaleMode:{originalHeight:_750.h,originalWidth:_750.w},afterFinishInternal:function(_753){ 6887 new v.Scale(_74b,1,{scaleContent:false,scaleY:false,scaleMode:{originalHeight:_750.h,originalWidth:_750.w},afterFinishInternal:function(_754){ 6888 s.hideElement(_754.element); 6889 s.undoClipping(_754.element,_752); 6890 s.setStyle(_754.element,_751); 6891 }}); 6892 }},_74c); 6893 return new v.Scale(_74b,5,_74c); 6894 }; 6895 MochiKit.Visual.Color=MochiKit.Color.Color; 6896 MochiKit.Visual.getElementsComputedStyle=MochiKit.DOM.computedStyle; 6897 MochiKit.Visual.__new__=function(){ 6898 var m=MochiKit.Base; 6899 m.nameFunctions(this); 6900 this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)}; 6901 }; 6902 MochiKit.Visual.EXPORT=["roundElement","roundClass","tagifyText","multiple","toggle","Parallel","Sequence","Opacity","Move","Scale","Highlight","ScrollTo","Morph","fade","appear","puff","blindUp","blindDown","switchOff","dropOut","shake","slideDown","slideUp","squish","grow","shrink","pulsate","fold"]; 6903 MochiKit.Visual.EXPORT_OK=["Base","PAIRS"]; 6904 MochiKit.Visual.__new__(); 6905 MochiKit.Base._exportSymbols(this,MochiKit.Visual); 6906 MochiKit.Base._deps("DragAndDrop",["Base","Iter","DOM","Signal","Visual","Position"]); 6907 MochiKit.DragAndDrop.NAME="MochiKit.DragAndDrop"; 6908 MochiKit.DragAndDrop.VERSION="1.4.2"; 6909 MochiKit.DragAndDrop.__repr__=function(){ 6910 return "["+this.NAME+" "+this.VERSION+"]"; 6911 }; 6912 MochiKit.DragAndDrop.toString=function(){ 6913 return this.__repr__(); 6914 }; 6915 MochiKit.DragAndDrop.EXPORT=["Droppable","Draggable"]; 6916 MochiKit.DragAndDrop.EXPORT_OK=["Droppables","Draggables"]; 6917 MochiKit.DragAndDrop.Droppables={drops:[],remove:function(_756){ 6918 this.drops=MochiKit.Base.filter(function(d){ 6919 return d.element!=MochiKit.DOM.getElement(_756); 6920 },this.drops); 6921 },register:function(drop){ 6922 this.drops.push(drop); 6923 },unregister:function(drop){ 6924 this.drops=MochiKit.Base.filter(function(d){ 6925 return d!=drop; 6926 },this.drops); 6927 },prepare:function(_75b){ 6928 MochiKit.Base.map(function(drop){ 6929 if(drop.isAccepted(_75b)){ 6930 if(drop.options.activeclass){ 6931 MochiKit.DOM.addElementClass(drop.element,drop.options.activeclass); 6932 } 6933 drop.options.onactive(drop.element,_75b); 6934 } 6935 },this.drops); 6936 },findDeepestChild:function(_75d){ 6937 deepest=_75d[0]; 6938 for(i=1;i<_75d.length;++i){ 6939 if(MochiKit.DOM.isChildNode(_75d[i].element,deepest.element)){ 6940 deepest=_75d[i]; 6941 } 6942 } 6943 return deepest; 6944 },show:function(_75e,_75f){ 6945 if(!this.drops.length){ 6946 return; 6947 } 6948 var _760=[]; 6949 if(this.last_active){ 6950 this.last_active.deactivate(); 6951 } 6952 MochiKit.Iter.forEach(this.drops,function(drop){ 6953 if(drop.isAffected(_75e,_75f)){ 6954 _760.push(drop); 6955 } 6956 }); 6957 if(_760.length>0){ 6958 drop=this.findDeepestChild(_760); 6959 MochiKit.Position.within(drop.element,_75e.page.x,_75e.page.y); 6960 drop.options.onhover(_75f,drop.element,MochiKit.Position.overlap(drop.options.overlap,drop.element)); 6961 drop.activate(); 6962 } 6963 },fire:function(_762,_763){ 6964 if(!this.last_active){ 6965 return; 6966 } 6967 MochiKit.Position.prepare(); 6968 if(this.last_active.isAffected(_762.mouse(),_763)){ 6969 this.last_active.options.ondrop(_763,this.last_active.element,_762); 6970 } 6971 },reset:function(_764){ 6972 MochiKit.Base.map(function(drop){ 6973 if(drop.options.activeclass){ 6974 MochiKit.DOM.removeElementClass(drop.element,drop.options.activeclass); 6975 } 6976 drop.options.ondesactive(drop.element,_764); 6977 },this.drops); 6978 if(this.last_active){ 6979 this.last_active.deactivate(); 6980 } 6981 }}; 6982 MochiKit.DragAndDrop.Droppable=function(_766,_767){ 6983 var cls=arguments.callee; 6984 if(!(this instanceof cls)){ 6985 return new cls(_766,_767); 6986 } 6987 this.__init__(_766,_767); 6988 }; 6989 MochiKit.DragAndDrop.Droppable.prototype={__class__:MochiKit.DragAndDrop.Droppable,__init__:function(_769,_76a){ 6990 var d=MochiKit.DOM; 6991 var b=MochiKit.Base; 6992 this.element=d.getElement(_769); 6993 this.options=b.update({greedy:true,hoverclass:null,activeclass:null,hoverfunc:b.noop,accept:null,onactive:b.noop,ondesactive:b.noop,onhover:b.noop,ondrop:b.noop,containment:[],tree:false},_76a); 6994 this.options._containers=[]; 6995 b.map(MochiKit.Base.bind(function(c){ 6996 this.options._containers.push(d.getElement(c)); 6997 },this),this.options.containment); 6998 MochiKit.Style.makePositioned(this.element); 6999 MochiKit.DragAndDrop.Droppables.register(this); 7000 },isContained:function(_76e){ 7001 if(this.options._containers.length){ 7002 var _76f; 7003 if(this.options.tree){ 7004 _76f=_76e.treeNode; 7005 }else{ 7006 _76f=_76e.parentNode; 7007 } 7008 return MochiKit.Iter.some(this.options._containers,function(c){ 7009 return _76f==c; 7010 }); 7011 }else{ 7012 return true; 7013 } 7014 },isAccepted:function(_771){ 7015 return ((!this.options.accept)||MochiKit.Iter.some(this.options.accept,function(c){ 7016 return MochiKit.DOM.hasElementClass(_771,c); 7017 })); 7018 },isAffected:function(_773,_774){ 7019 return ((this.element!=_774)&&this.isContained(_774)&&this.isAccepted(_774)&&MochiKit.Position.within(this.element,_773.page.x,_773.page.y)); 7020 },deactivate:function(){ 7021 if(this.options.hoverclass){ 7022 MochiKit.DOM.removeElementClass(this.element,this.options.hoverclass); 7023 } 7024 this.options.hoverfunc(this.element,false); 7025 MochiKit.DragAndDrop.Droppables.last_active=null; 7026 },activate:function(){ 7027 if(this.options.hoverclass){ 7028 MochiKit.DOM.addElementClass(this.element,this.options.hoverclass); 7029 } 7030 this.options.hoverfunc(this.element,true); 7031 MochiKit.DragAndDrop.Droppables.last_active=this; 7032 },destroy:function(){ 7033 MochiKit.DragAndDrop.Droppables.unregister(this); 7034 },repr:function(){ 7035 return "["+this.__class__.NAME+", options:"+MochiKit.Base.repr(this.options)+"]"; 7036 }}; 7037 MochiKit.DragAndDrop.Draggables={drags:[],register:function(_775){ 7038 if(this.drags.length===0){ 7039 var conn=MochiKit.Signal.connect; 7040 this.eventMouseUp=conn(document,"onmouseup",this,this.endDrag); 7041 this.eventMouseMove=conn(document,"onmousemove",this,this.updateDrag); 7042 this.eventKeypress=conn(document,"onkeypress",this,this.keyPress); 7043 } 7044 this.drags.push(_775); 7045 },unregister:function(_777){ 7046 this.drags=MochiKit.Base.filter(function(d){ 7047 return d!=_777; 7048 },this.drags); 7049 if(this.drags.length===0){ 7050 var disc=MochiKit.Signal.disconnect; 7051 disc(this.eventMouseUp); 7052 disc(this.eventMouseMove); 7053 disc(this.eventKeypress); 7054 } 7055 },activate:function(_77a){ 7056 window.focus(); 7057 this.activeDraggable=_77a; 7058 },deactivate:function(){ 7059 this.activeDraggable=null; 7060 },updateDrag:function(_77b){ 7061 if(!this.activeDraggable){ 7062 return; 7063 } 7064 var _77c=_77b.mouse(); 7065 if(this._lastPointer&&(MochiKit.Base.repr(this._lastPointer.page)==MochiKit.Base.repr(_77c.page))){ 7066 return; 7067 } 7068 this._lastPointer=_77c; 7069 this.activeDraggable.updateDrag(_77b,_77c); 7070 },endDrag:function(_77d){ 7071 if(!this.activeDraggable){ 7072 return; 7073 } 7074 this._lastPointer=null; 7075 this.activeDraggable.endDrag(_77d); 7076 this.activeDraggable=null; 7077 },keyPress:function(_77e){ 7078 if(this.activeDraggable){ 7079 this.activeDraggable.keyPress(_77e); 7080 } 7081 },notify:function(_77f,_780,_781){ 7082 MochiKit.Signal.signal(this,_77f,_780,_781); 7083 }}; 7084 MochiKit.DragAndDrop.Draggable=function(_782,_783){ 7085 var cls=arguments.callee; 7086 if(!(this instanceof cls)){ 7087 return new cls(_782,_783); 7088 } 7089 this.__init__(_782,_783); 7090 }; 7091 MochiKit.DragAndDrop.Draggable.prototype={__class__:MochiKit.DragAndDrop.Draggable,__init__:function(_785,_786){ 7092 var v=MochiKit.Visual; 7093 var b=MochiKit.Base; 7094 _786=b.update({handle:false,starteffect:function(_789){ 7095 this._savedOpacity=MochiKit.Style.getStyle(_789,"opacity")||1; 7096 new v.Opacity(_789,{duration:0.2,from:this._savedOpacity,to:0.7}); 7097 },reverteffect:function(_78a,_78b,_78c){ 7098 var dur=Math.sqrt(Math.abs(_78b^2)+Math.abs(_78c^2))*0.02; 7099 return new v.Move(_78a,{x:-_78c,y:-_78b,duration:dur}); 7100 },endeffect:function(_78e){ 7101 new v.Opacity(_78e,{duration:0.2,from:0.7,to:this._savedOpacity}); 7102 },onchange:b.noop,zindex:1000,revert:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false},_786); 7103 var d=MochiKit.DOM; 7104 this.element=d.getElement(_785); 7105 if(_786.handle&&(typeof (_786.handle)=="string")){ 7106 this.handle=d.getFirstElementByTagAndClassName(null,_786.handle,this.element); 7107 } 7108 if(!this.handle){ 7109 this.handle=d.getElement(_786.handle); 7110 } 7111 if(!this.handle){ 7112 this.handle=this.element; 7113 } 7114 if(_786.scroll&&!_786.scroll.scrollTo&&!_786.scroll.outerHTML){ 7115 _786.scroll=d.getElement(_786.scroll); 7116 this._isScrollChild=MochiKit.DOM.isChildNode(this.element,_786.scroll); 7117 } 7118 MochiKit.Style.makePositioned(this.element); 7119 this.delta=this.currentDelta(); 7120 this.options=_786; 7121 this.dragging=false; 7122 this.eventMouseDown=MochiKit.Signal.connect(this.handle,"onmousedown",this,this.initDrag); 7123 MochiKit.DragAndDrop.Draggables.register(this); 7124 },destroy:function(){ 7125 MochiKit.Signal.disconnect(this.eventMouseDown); 7126 MochiKit.DragAndDrop.Draggables.unregister(this); 7127 },currentDelta:function(){ 7128 var s=MochiKit.Style.getStyle; 7129 return [parseInt(s(this.element,"left")||"0"),parseInt(s(this.element,"top")||"0")]; 7130 },initDrag:function(_791){ 7131 if(!_791.mouse().button.left){ 7132 return; 7133 } 7134 var src=_791.target(); 7135 var _793=(src.tagName||"").toUpperCase(); 7136 if(_793==="INPUT"||_793==="SELECT"||_793==="OPTION"||_793==="BUTTON"||_793==="TEXTAREA"){ 7137 return; 7138 } 7139 if(this._revert){ 7140 this._revert.cancel(); 7141 this._revert=null; 7142 } 7143 var _794=_791.mouse(); 7144 var pos=MochiKit.Position.cumulativeOffset(this.element); 7145 this.offset=[_794.page.x-pos.x,_794.page.y-pos.y]; 7146 MochiKit.DragAndDrop.Draggables.activate(this); 7147 _791.stop(); 7148 },startDrag:function(_796){ 7149 this.dragging=true; 7150 if(this.options.selectclass){ 7151 MochiKit.DOM.addElementClass(this.element,this.options.selectclass); 7152 } 7153 if(this.options.zindex){ 7154 this.originalZ=parseInt(MochiKit.Style.getStyle(this.element,"z-index")||"0"); 7155 this.element.style.zIndex=this.options.zindex; 7156 } 7157 if(this.options.ghosting){ 7158 this._clone=this.element.cloneNode(true); 7159 this.ghostPosition=MochiKit.Position.absolutize(this.element); 7160 this.element.parentNode.insertBefore(this._clone,this.element); 7161 } 7162 if(this.options.scroll){ 7163 if(this.options.scroll==window){ 7164 var _797=this._getWindowScroll(this.options.scroll); 7165 this.originalScrollLeft=_797.left; 7166 this.originalScrollTop=_797.top; 7167 }else{ 7168 this.originalScrollLeft=this.options.scroll.scrollLeft; 7169 this.originalScrollTop=this.options.scroll.scrollTop; 7170 } 7171 } 7172 MochiKit.DragAndDrop.Droppables.prepare(this.element); 7173 MochiKit.DragAndDrop.Draggables.notify("start",this,_796); 7174 if(this.options.starteffect){ 7175 this.options.starteffect(this.element); 7176 } 7177 },updateDrag:function(_798,_799){ 7178 if(!this.dragging){ 7179 this.startDrag(_798); 7180 } 7181 MochiKit.Position.prepare(); 7182 MochiKit.DragAndDrop.Droppables.show(_799,this.element); 7183 MochiKit.DragAndDrop.Draggables.notify("drag",this,_798); 7184 this.draw(_799); 7185 this.options.onchange(this); 7186 if(this.options.scroll){ 7187 this.stopScrolling(); 7188 var p,q; 7189 if(this.options.scroll==window){ 7190 var s=this._getWindowScroll(this.options.scroll); 7191 p=new MochiKit.Style.Coordinates(s.left,s.top); 7192 q=new MochiKit.Style.Coordinates(s.left+s.width,s.top+s.height); 7193 }else{ 7194 p=MochiKit.Position.page(this.options.scroll); 7195 p.x+=this.options.scroll.scrollLeft; 7196 p.y+=this.options.scroll.scrollTop; 7197 p.x+=(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0); 7198 p.y+=(window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0); 7199 q=new MochiKit.Style.Coordinates(p.x+this.options.scroll.offsetWidth,p.y+this.options.scroll.offsetHeight); 7200 } 7201 var _79d=[0,0]; 7202 if(_799.page.x>(q.x-this.options.scrollSensitivity)){ 7203 _79d[0]=_799.page.x-(q.x-this.options.scrollSensitivity); 7204 }else{ 7205 if(_799.page.x<(p.x+this.options.scrollSensitivity)){ 7206 _79d[0]=_799.page.x-(p.x+this.options.scrollSensitivity); 7207 } 7208 } 7209 if(_799.page.y>(q.y-this.options.scrollSensitivity)){ 7210 _79d[1]=_799.page.y-(q.y-this.options.scrollSensitivity); 7211 }else{ 7212 if(_799.page.y<(p.y+this.options.scrollSensitivity)){ 7213 _79d[1]=_799.page.y-(p.y+this.options.scrollSensitivity); 7214 } 7215 } 7216 this.startScrolling(_79d); 7217 } 7218 if(/AppleWebKit/.test(navigator.appVersion)){ 7219 window.scrollBy(0,0); 7220 } 7221 _798.stop(); 7222 },finishDrag:function(_79e,_79f){ 7223 var dr=MochiKit.DragAndDrop; 7224 this.dragging=false; 7225 if(this.options.selectclass){ 7226 MochiKit.DOM.removeElementClass(this.element,this.options.selectclass); 7227 } 7228 if(this.options.ghosting){ 7229 MochiKit.Position.relativize(this.element,this.ghostPosition); 7230 MochiKit.DOM.removeElement(this._clone); 7231 this._clone=null; 7232 } 7233 if(_79f){ 7234 dr.Droppables.fire(_79e,this.element); 7235 } 7236 dr.Draggables.notify("end",this,_79e); 7237 var _7a1=this.options.revert; 7238 if(_7a1&&typeof (_7a1)=="function"){ 7239 _7a1=_7a1(this.element); 7240 } 7241 var d=this.currentDelta(); 7242 if(_7a1&&this.options.reverteffect){ 7243 this._revert=this.options.reverteffect(this.element,d[1]-this.delta[1],d[0]-this.delta[0]); 7244 }else{ 7245 this.delta=d; 7246 } 7247 if(this.options.zindex){ 7248 this.element.style.zIndex=this.originalZ; 7249 } 7250 if(this.options.endeffect){ 7251 this.options.endeffect(this.element); 7252 } 7253 dr.Draggables.deactivate(); 7254 dr.Droppables.reset(this.element); 7255 },keyPress:function(_7a3){ 7256 if(_7a3.key().string!="KEY_ESCAPE"){ 7257 return; 7258 } 7259 this.finishDrag(_7a3,false); 7260 _7a3.stop(); 7261 },endDrag:function(_7a4){ 7262 if(!this.dragging){ 7263 return; 7264 } 7265 this.stopScrolling(); 7266 this.finishDrag(_7a4,true); 7267 _7a4.stop(); 7268 },draw:function(_7a5){ 7269 var pos=MochiKit.Position.cumulativeOffset(this.element); 7270 var d=this.currentDelta(); 7271 pos.x-=d[0]; 7272 pos.y-=d[1]; 7273 if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){ 7274 pos.x-=this.options.scroll.scrollLeft-this.originalScrollLeft; 7275 pos.y-=this.options.scroll.scrollTop-this.originalScrollTop; 7276 } 7277 var p=[_7a5.page.x-pos.x-this.offset[0],_7a5.page.y-pos.y-this.offset[1]]; 7278 if(this.options.snap){ 7279 if(typeof (this.options.snap)=="function"){ 7280 p=this.options.snap(p[0],p[1]); 7281 }else{ 7282 if(this.options.snap instanceof Array){ 7283 var i=-1; 7284 p=MochiKit.Base.map(MochiKit.Base.bind(function(v){ 7285 i+=1; 7286 return Math.round(v/this.options.snap[i])*this.options.snap[i]; 7287 },this),p); 7288 }else{ 7289 p=MochiKit.Base.map(MochiKit.Base.bind(function(v){ 7290 return Math.round(v/this.options.snap)*this.options.snap; 7291 },this),p); 7292 } 7293 } 7294 } 7295 var _7ac=this.element.style; 7296 if((!this.options.constraint)||(this.options.constraint=="horizontal")){ 7297 _7ac.left=p[0]+"px"; 7298 } 7299 if((!this.options.constraint)||(this.options.constraint=="vertical")){ 7300 _7ac.top=p[1]+"px"; 7301 } 7302 if(_7ac.visibility=="hidden"){ 7303 _7ac.visibility=""; 7304 } 7305 },stopScrolling:function(){ 7306 if(this.scrollInterval){ 7307 clearInterval(this.scrollInterval); 7308 this.scrollInterval=null; 7309 MochiKit.DragAndDrop.Draggables._lastScrollPointer=null; 7310 } 7311 },startScrolling:function(_7ad){ 7312 if(!_7ad[0]&&!_7ad[1]){ 7313 return; 7314 } 7315 this.scrollSpeed=[_7ad[0]*this.options.scrollSpeed,_7ad[1]*this.options.scrollSpeed]; 7316 this.lastScrolled=new Date(); 7317 this.scrollInterval=setInterval(MochiKit.Base.bind(this.scroll,this),10); 7318 },scroll:function(){ 7319 var _7ae=new Date(); 7320 var _7af=_7ae-this.lastScrolled; 7321 this.lastScrolled=_7ae; 7322 if(this.options.scroll==window){ 7323 var s=this._getWindowScroll(this.options.scroll); 7324 if(this.scrollSpeed[0]||this.scrollSpeed[1]){ 7325 var dm=_7af/1000; 7326 this.options.scroll.scrollTo(s.left+dm*this.scrollSpeed[0],s.top+dm*this.scrollSpeed[1]); 7327 } 7328 }else{ 7329 this.options.scroll.scrollLeft+=this.scrollSpeed[0]*_7af/1000; 7330 this.options.scroll.scrollTop+=this.scrollSpeed[1]*_7af/1000; 7331 } 7332 var d=MochiKit.DragAndDrop; 7333 MochiKit.Position.prepare(); 7334 d.Droppables.show(d.Draggables._lastPointer,this.element); 7335 d.Draggables.notify("drag",this); 7336 if(this._isScrollChild){ 7337 d.Draggables._lastScrollPointer=d.Draggables._lastScrollPointer||d.Draggables._lastPointer; 7338 d.Draggables._lastScrollPointer.x+=this.scrollSpeed[0]*_7af/1000; 7339 d.Draggables._lastScrollPointer.y+=this.scrollSpeed[1]*_7af/1000; 7340 if(d.Draggables._lastScrollPointer.x<0){ 7341 d.Draggables._lastScrollPointer.x=0; 7342 } 7343 if(d.Draggables._lastScrollPointer.y<0){ 7344 d.Draggables._lastScrollPointer.y=0; 7345 } 7346 this.draw(d.Draggables._lastScrollPointer); 7347 } 7348 this.options.onchange(this); 7349 },_getWindowScroll:function(win){ 7350 var vp,w,h; 7351 MochiKit.DOM.withWindow(win,function(){ 7352 vp=MochiKit.Style.getViewportPosition(win.document); 7353 }); 7354 if(win.innerWidth){ 7355 w=win.innerWidth; 7356 h=win.innerHeight; 7357 }else{ 7358 if(win.document.documentElement&&win.document.documentElement.clientWidth){ 7359 w=win.document.documentElement.clientWidth; 7360 h=win.document.documentElement.clientHeight; 7361 }else{ 7362 w=win.document.body.offsetWidth; 7363 h=win.document.body.offsetHeight; 7364 } 7365 } 7366 return {top:vp.y,left:vp.x,width:w,height:h}; 7367 },repr:function(){ 7368 return "["+this.__class__.NAME+", options:"+MochiKit.Base.repr(this.options)+"]"; 7369 }}; 7370 MochiKit.DragAndDrop.__new__=function(){ 7371 MochiKit.Base.nameFunctions(this); 7372 this.EXPORT_TAGS={":common":this.EXPORT,":all":MochiKit.Base.concat(this.EXPORT,this.EXPORT_OK)}; 7373 }; 7374 MochiKit.DragAndDrop.__new__(); 7375 MochiKit.Base._exportSymbols(this,MochiKit.DragAndDrop); 7376 MochiKit.Base._deps("Sortable",["Base","Iter","DOM","Position","DragAndDrop"]); 7377 MochiKit.Sortable.NAME="MochiKit.Sortable"; 7378 MochiKit.Sortable.VERSION="1.4.2"; 7379 MochiKit.Sortable.__repr__=function(){ 7380 return "["+this.NAME+" "+this.VERSION+"]"; 7381 }; 7382 MochiKit.Sortable.toString=function(){ 7383 return this.__repr__(); 7384 }; 7385 MochiKit.Sortable.EXPORT=[]; 7386 MochiKit.Sortable.EXPORT_OK=[]; 7387 MochiKit.Base.update(MochiKit.Sortable,{sortables:{},_findRootElement:function(_7b7){ 7388 while(_7b7.tagName.toUpperCase()!="BODY"){ 7389 if(_7b7.id&&MochiKit.Sortable.sortables[_7b7.id]){ 7390 return _7b7; 7391 } 7392 _7b7=_7b7.parentNode; 7393 } 7394 },_createElementId:function(_7b8){ 7395 if(_7b8.id==null||_7b8.id==""){ 7396 var d=MochiKit.DOM; 7397 var id; 7398 var _7bb=1; 7399 while(d.getElement(id="sortable"+_7bb)!=null){ 7400 _7bb+=1; 7401 } 7402 d.setNodeAttribute(_7b8,"id",id); 7403 } 7404 },options:function(_7bc){ 7405 _7bc=MochiKit.Sortable._findRootElement(MochiKit.DOM.getElement(_7bc)); 7406 if(!_7bc){ 7407 return; 7408 } 7409 return MochiKit.Sortable.sortables[_7bc.id]; 7410 },destroy:function(_7bd){ 7411 var s=MochiKit.Sortable.options(_7bd); 7412 var b=MochiKit.Base; 7413 var d=MochiKit.DragAndDrop; 7414 if(s){ 7415 MochiKit.Signal.disconnect(s.startHandle); 7416 MochiKit.Signal.disconnect(s.endHandle); 7417 b.map(function(dr){ 7418 d.Droppables.remove(dr); 7419 },s.droppables); 7420 b.map(function(dr){ 7421 dr.destroy(); 7422 },s.draggables); 7423 delete MochiKit.Sortable.sortables[s.element.id]; 7424 } 7425 },create:function(_7c3,_7c4){ 7426 _7c3=MochiKit.DOM.getElement(_7c3); 7427 var self=MochiKit.Sortable; 7428 self._createElementId(_7c3); 7429 _7c4=MochiKit.Base.update({element:_7c3,tag:"li",dropOnEmpty:false,tree:false,treeTag:"ul",overlap:"vertical",constraint:"vertical",containment:[_7c3],handle:false,only:false,hoverclass:null,ghosting:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:/^[^_]*_(.*)$/,onChange:MochiKit.Base.noop,onUpdate:MochiKit.Base.noop,accept:null},_7c4); 7430 self.destroy(_7c3); 7431 var _7c6={revert:true,ghosting:_7c4.ghosting,scroll:_7c4.scroll,scrollSensitivity:_7c4.scrollSensitivity,scrollSpeed:_7c4.scrollSpeed,constraint:_7c4.constraint,handle:_7c4.handle}; 7432 if(_7c4.starteffect){ 7433 _7c6.starteffect=_7c4.starteffect; 7434 } 7435 if(_7c4.reverteffect){ 7436 _7c6.reverteffect=_7c4.reverteffect; 7437 }else{ 7438 if(_7c4.ghosting){ 7439 _7c6.reverteffect=function(_7c7){ 7440 _7c7.style.top=0; 7441 _7c7.style.left=0; 7442 }; 7443 } 7444 } 7445 if(_7c4.endeffect){ 7446 _7c6.endeffect=_7c4.endeffect; 7447 } 7448 if(_7c4.zindex){ 7449 _7c6.zindex=_7c4.zindex; 7450 } 7451 var _7c8={overlap:_7c4.overlap,containment:_7c4.containment,hoverclass:_7c4.hoverclass,onhover:self.onHover,tree:_7c4.tree,accept:_7c4.accept}; 7452 var _7c9={onhover:self.onEmptyHover,overlap:_7c4.overlap,containment:_7c4.containment,hoverclass:_7c4.hoverclass,accept:_7c4.accept}; 7453 MochiKit.DOM.removeEmptyTextNodes(_7c3); 7454 _7c4.draggables=[]; 7455 _7c4.droppables=[]; 7456 if(_7c4.dropOnEmpty||_7c4.tree){ 7457 new MochiKit.DragAndDrop.Droppable(_7c3,_7c9); 7458 _7c4.droppables.push(_7c3); 7459 } 7460 MochiKit.Base.map(function(e){ 7461 var _7cb=_7c4.handle?MochiKit.DOM.getFirstElementByTagAndClassName(null,_7c4.handle,e):e; 7462 _7c4.draggables.push(new MochiKit.DragAndDrop.Draggable(e,MochiKit.Base.update(_7c6,{handle:_7cb}))); 7463 new MochiKit.DragAndDrop.Droppable(e,_7c8); 7464 if(_7c4.tree){ 7465 e.treeNode=_7c3; 7466 } 7467 _7c4.droppables.push(e); 7468 },(self.findElements(_7c3,_7c4)||[])); 7469 if(_7c4.tree){ 7470 MochiKit.Base.map(function(e){ 7471 new MochiKit.DragAndDrop.Droppable(e,_7c9); 7472 e.treeNode=_7c3; 7473 _7c4.droppables.push(e); 7474 },(self.findTreeElements(_7c3,_7c4)||[])); 7475 } 7476 self.sortables[_7c3.id]=_7c4; 7477 _7c4.lastValue=self.serialize(_7c3); 7478 _7c4.startHandle=MochiKit.Signal.connect(MochiKit.DragAndDrop.Draggables,"start",MochiKit.Base.partial(self.onStart,_7c3)); 7479 _7c4.endHandle=MochiKit.Signal.connect(MochiKit.DragAndDrop.Draggables,"end",MochiKit.Base.partial(self.onEnd,_7c3)); 7480 },onStart:function(_7cd,_7ce){ 7481 var self=MochiKit.Sortable; 7482 var _7d0=self.options(_7cd); 7483 _7d0.lastValue=self.serialize(_7d0.element); 7484 },onEnd:function(_7d1,_7d2){ 7485 var self=MochiKit.Sortable; 7486 self.unmark(); 7487 var _7d4=self.options(_7d1); 7488 if(_7d4.lastValue!=self.serialize(_7d4.element)){ 7489 _7d4.onUpdate(_7d4.element); 7490 } 7491 },findElements:function(_7d5,_7d6){ 7492 return MochiKit.Sortable.findChildren(_7d5,_7d6.only,_7d6.tree,_7d6.tag); 7493 },findTreeElements:function(_7d7,_7d8){ 7494 return MochiKit.Sortable.findChildren(_7d7,_7d8.only,_7d8.tree?true:false,_7d8.treeTag); 7495 },findChildren:function(_7d9,only,_7db,_7dc){ 7496 if(!_7d9.hasChildNodes()){ 7497 return null; 7498 } 7499 _7dc=_7dc.toUpperCase(); 7500 if(only){ 7501 only=MochiKit.Base.flattenArray([only]); 7502 } 7503 var _7dd=[]; 7504 MochiKit.Base.map(function(e){ 7505 if(e.tagName&&e.tagName.toUpperCase()==_7dc&&(!only||MochiKit.Iter.some(only,function(c){ 7506 return MochiKit.DOM.hasElementClass(e,c); 7507 }))){ 7508 _7dd.push(e); 7509 } 7510 if(_7db){ 7511 var _7e0=MochiKit.Sortable.findChildren(e,only,_7db,_7dc); 7512 if(_7e0&&_7e0.length>0){ 7513 _7dd=_7dd.concat(_7e0); 7514 } 7515 } 7516 },_7d9.childNodes); 7517 return _7dd; 7518 },onHover:function(_7e1,_7e2,_7e3){ 7519 if(MochiKit.DOM.isChildNode(_7e2,_7e1)){ 7520 return; 7521 } 7522 var self=MochiKit.Sortable; 7523 if(_7e3>0.33&&_7e3<0.66&&self.options(_7e2).tree){ 7524 return; 7525 }else{ 7526 if(_7e3>0.5){ 7527 self.mark(_7e2,"before"); 7528 if(_7e2.previousSibling!=_7e1){ 7529 var _7e5=_7e1.parentNode; 7530 _7e1.style.visibility="hidden"; 7531 _7e2.parentNode.insertBefore(_7e1,_7e2); 7532 if(_7e2.parentNode!=_7e5){ 7533 self.options(_7e5).onChange(_7e1); 7534 } 7535 self.options(_7e2.parentNode).onChange(_7e1); 7536 } 7537 }else{ 7538 self.mark(_7e2,"after"); 7539 var _7e6=_7e2.nextSibling||null; 7540 if(_7e6!=_7e1){ 7541 var _7e5=_7e1.parentNode; 7542 _7e1.style.visibility="hidden"; 7543 _7e2.parentNode.insertBefore(_7e1,_7e6); 7544 if(_7e2.parentNode!=_7e5){ 7545 self.options(_7e5).onChange(_7e1); 7546 } 7547 self.options(_7e2.parentNode).onChange(_7e1); 7548 } 7549 } 7550 } 7551 },_offsetSize:function(_7e7,type){ 7552 if(type=="vertical"||type=="height"){ 7553 return _7e7.offsetHeight; 7554 }else{ 7555 return _7e7.offsetWidth; 7556 } 7557 },onEmptyHover:function(_7e9,_7ea,_7eb){ 7558 var _7ec=_7e9.parentNode; 7559 var self=MochiKit.Sortable; 7560 var _7ee=self.options(_7ea); 7561 if(!MochiKit.DOM.isChildNode(_7ea,_7e9)){ 7562 var _7ef; 7563 var _7f0=self.findElements(_7ea,{tag:_7ee.tag,only:_7ee.only}); 7564 var _7f1=null; 7565 if(_7f0){ 7566 var _7f2=self._offsetSize(_7ea,_7ee.overlap)*(1-_7eb); 7567 for(_7ef=0;_7ef<_7f0.length;_7ef+=1){ 7568 if(_7f2-self._offsetSize(_7f0[_7ef],_7ee.overlap)>=0){ 7569 _7f2-=self._offsetSize(_7f0[_7ef],_7ee.overlap); 7570 }else{ 7571 if(_7f2-(self._offsetSize(_7f0[_7ef],_7ee.overlap)/2)>=0){ 7572 _7f1=_7ef+1<_7f0.length?_7f0[_7ef+1]:null; 7573 break; 7574 }else{ 7575 _7f1=_7f0[_7ef]; 7576 break; 7577 } 7578 } 7579 } 7580 } 7581 _7ea.insertBefore(_7e9,_7f1); 7582 self.options(_7ec).onChange(_7e9); 7583 _7ee.onChange(_7e9); 7584 } 7585 },unmark:function(){ 7586 var m=MochiKit.Sortable._marker; 7587 if(m){ 7588 MochiKit.Style.hideElement(m); 7589 } 7590 },mark:function(_7f4,_7f5){ 7591 var d=MochiKit.DOM; 7592 var self=MochiKit.Sortable; 7593 var _7f8=self.options(_7f4.parentNode); 7594 if(_7f8&&!_7f8.ghosting){ 7595 return; 7596 } 7597 if(!self._marker){ 7598 self._marker=d.getElement("dropmarker")||document.createElement("DIV"); 7599 MochiKit.Style.hideElement(self._marker); 7600 d.addElementClass(self._marker,"dropmarker"); 7601 self._marker.style.position="absolute"; 7602 document.getElementsByTagName("body").item(0).appendChild(self._marker); 7603 } 7604 var _7f9=MochiKit.Position.cumulativeOffset(_7f4); 7605 self._marker.style.left=_7f9.x+"px"; 7606 self._marker.style.top=_7f9.y+"px"; 7607 if(_7f5=="after"){ 7608 if(_7f8.overlap=="horizontal"){ 7609 self._marker.style.left=(_7f9.x+_7f4.clientWidth)+"px"; 7610 }else{ 7611 self._marker.style.top=(_7f9.y+_7f4.clientHeight)+"px"; 7612 } 7613 } 7614 MochiKit.Style.showElement(self._marker); 7615 },_tree:function(_7fa,_7fb,_7fc){ 7616 var self=MochiKit.Sortable; 7617 var _7fe=self.findElements(_7fa,_7fb)||[]; 7618 for(var i=0;i<_7fe.length;++i){ 7619 var _800=_7fe[i].id.match(_7fb.format); 7620 if(!_800){ 7621 continue; 7622 } 7623 var _801={id:encodeURIComponent(_800?_800[1]:null),element:_7fa,parent:_7fc,children:[],position:_7fc.children.length,container:self._findChildrenElement(_7fe[i],_7fb.treeTag.toUpperCase())}; 7624 if(_801.container){ 7625 self._tree(_801.container,_7fb,_801); 7626 } 7627 _7fc.children.push(_801); 7628 } 7629 return _7fc; 7630 },_findChildrenElement:function(_802,_803){ 7631 if(_802&&_802.hasChildNodes){ 7632 _803=_803.toUpperCase(); 7633 for(var i=0;i<_802.childNodes.length;++i){ 7634 if(_802.childNodes[i].tagName.toUpperCase()==_803){ 7635 return _802.childNodes[i]; 7636 } 7637 } 7638 } 7639 return null; 7640 },tree:function(_805,_806){ 7641 _805=MochiKit.DOM.getElement(_805); 7642 var _807=MochiKit.Sortable.options(_805); 7643 _806=MochiKit.Base.update({tag:_807.tag,treeTag:_807.treeTag,only:_807.only,name:_805.id,format:_807.format},_806||{}); 7644 var root={id:null,parent:null,children:new Array,container:_805,position:0}; 7645 return MochiKit.Sortable._tree(_805,_806,root); 7646 },setSequence:function(_809,_80a,_80b){ 7647 var self=MochiKit.Sortable; 7648 var b=MochiKit.Base; 7649 _809=MochiKit.DOM.getElement(_809); 7650 _80b=b.update(self.options(_809),_80b||{}); 7651 var _80e={}; 7652 b.map(function(n){ 7653 var m=n.id.match(_80b.format); 7654 if(m){ 7655 _80e[m[1]]=[n,n.parentNode]; 7656 } 7657 n.parentNode.removeChild(n); 7658 },self.findElements(_809,_80b)); 7659 b.map(function(_811){ 7660 var n=_80e[_811]; 7661 if(n){ 7662 n[1].appendChild(n[0]); 7663 delete _80e[_811]; 7664 } 7665 },_80a); 7666 },_constructIndex:function(node){ 7667 var _814=""; 7668 do{ 7669 if(node.id){ 7670 _814="["+node.position+"]"+_814; 7671 } 7672 }while((node=node.parent)!=null); 7673 return _814; 7674 },sequence:function(_815,_816){ 7675 _815=MochiKit.DOM.getElement(_815); 7676 var self=MochiKit.Sortable; 7677 var _816=MochiKit.Base.update(self.options(_815),_816||{}); 7678 return MochiKit.Base.map(function(item){ 7679 return item.id.match(_816.format)?item.id.match(_816.format)[1]:""; 7680 },MochiKit.DOM.getElement(self.findElements(_815,_816)||[])); 7681 },serialize:function(_819,_81a){ 7682 _819=MochiKit.DOM.getElement(_819); 7683 var self=MochiKit.Sortable; 7684 _81a=MochiKit.Base.update(self.options(_819),_81a||{}); 7685 var name=encodeURIComponent(_81a.name||_819.id); 7686 if(_81a.tree){ 7687 return MochiKit.Base.flattenArray(MochiKit.Base.map(function(item){ 7688 return [name+self._constructIndex(item)+"[id]="+encodeURIComponent(item.id)].concat(item.children.map(arguments.callee)); 7689 },self.tree(_819,_81a).children)).join("&"); 7690 }else{ 7691 return MochiKit.Base.map(function(item){ 7692 return name+"[]="+encodeURIComponent(item); 7693 },self.sequence(_819,_81a)).join("&"); 7694 } 7695 }}); 7696 MochiKit.Sortable.Sortable=MochiKit.Sortable; 7697 MochiKit.Sortable.__new__=function(){ 7698 MochiKit.Base.nameFunctions(this); 7699 this.EXPORT_TAGS={":common":this.EXPORT,":all":MochiKit.Base.concat(this.EXPORT,this.EXPORT_OK)}; 7700 }; 7701 MochiKit.Sortable.__new__(); 7702 MochiKit.Base._exportSymbols(this,MochiKit.Sortable); 7703 if(typeof (MochiKit)=="undefined"){ 7704 MochiKit={}; 7705 } 7706 if(typeof (MochiKit.MochiKit)=="undefined"){ 7707 MochiKit.MochiKit={}; 7708 } 7709 MochiKit.MochiKit.NAME="MochiKit.MochiKit"; 7710 MochiKit.MochiKit.VERSION="1.4.2"; 7711 MochiKit.MochiKit.__repr__=function(){ 7712 return "["+this.NAME+" "+this.VERSION+"]"; 7713 }; 7714 MochiKit.MochiKit.toString=function(){ 7715 return this.__repr__(); 7716 }; 7717 MochiKit.MochiKit.SUBMODULES=["Base","Iter","Logging","DateTime","Format","Async","DOM","Selector","Style","LoggingPane","Color","Signal","Position","Visual","DragAndDrop","Sortable"]; 7718 if(typeof (JSAN)!="undefined"||typeof (dojo)!="undefined"){ 7719 if(typeof (dojo)!="undefined"){ 7720 dojo.provide("MochiKit.MochiKit"); 7721 (function(lst){ 7722 for(var i=0;i<lst.length;i++){ 7723 dojo.require("MochiKit."+lst[i]); 7724 } 7725 })(MochiKit.MochiKit.SUBMODULES); 7726 } 7727 if(typeof (JSAN)!="undefined"){ 7728 (function(lst){ 7729 for(var i=0;i<lst.length;i++){ 7730 JSAN.use("MochiKit."+lst[i],[]); 7731 } 7732 })(MochiKit.MochiKit.SUBMODULES); 7733 } 7734 (function(){ 7735 var _823=MochiKit.Base.extend; 7736 var self=MochiKit.MochiKit; 7737 var _825=self.SUBMODULES; 7738 var _826=[]; 7739 var _827=[]; 7740 var _828={}; 7741 var i,k,m,all; 7742 for(i=0;i<_825.length;i++){ 7743 m=MochiKit[_825[i]]; 7744 _823(_826,m.EXPORT); 7745 _823(_827,m.EXPORT_OK); 7746 for(k in m.EXPORT_TAGS){ 7747 _828[k]=_823(_828[k],m.EXPORT_TAGS[k]); 7748 } 7749 all=m.EXPORT_TAGS[":all"]; 7750 if(!all){ 7751 all=_823(null,m.EXPORT,m.EXPORT_OK); 7752 } 7753 var j; 7754 for(j=0;j<all.length;j++){ 7755 k=all[j]; 7756 self[k]=m[k]; 7757 } 7758 } 7759 self.EXPORT=_826; 7760 self.EXPORT_OK=_827; 7761 self.EXPORT_TAGS=_828; 7762 }()); 7763 }else{ 7764 if(typeof (MochiKit.__compat__)=="undefined"){ 7765 MochiKit.__compat__=true; 7766 } 7767 (function(){ 7768 if(typeof (document)=="undefined"){ 7769 return; 7770 } 7771 var _82e=document.getElementsByTagName("script"); 7772 var _82f="http://www.w3.org/1999/xhtml"; 7773 var _830="http://www.w3.org/2000/svg"; 7774 var _831="http://www.w3.org/1999/xlink"; 7775 var _832="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; 7776 var base=null; 7777 var _834=null; 7778 var _835={}; 7779 var i; 7780 var src; 7781 for(i=0;i<_82e.length;i++){ 7782 src=null; 7783 switch(_82e[i].namespaceURI){ 7784 case _830: 7785 src=_82e[i].getAttributeNS(_831,"href"); 7786 break; 7787 default: 7788 src=_82e[i].getAttribute("src"); 7789 break; 7790 } 7791 if(!src){ 7792 continue; 7793 } 7794 _835[src]=true; 7795 if(src.match(/MochiKit.js(\?.*)?$/)){ 7796 base=src.substring(0,src.lastIndexOf("MochiKit.js")); 7797 _834=_82e[i]; 7798 } 7799 } 7800 if(base===null){ 7801 return; 7802 } 7803 var _838=MochiKit.MochiKit.SUBMODULES; 7804 for(var i=0;i<_838.length;i++){ 7805 if(MochiKit[_838[i]]){ 7806 continue; 7807 } 7808 var uri=base+_838[i]+".js"; 7809 if(uri in _835){ 7810 continue; 7811 } 7812 if(_834.namespaceURI==_830||_834.namespaceURI==_832){ 7813 var s=document.createElementNS(_834.namespaceURI,"script"); 7814 s.setAttribute("id","MochiKit_"+base+_838[i]); 7815 if(_834.namespaceURI==_830){ 7816 s.setAttributeNS(_831,"href",uri); 7817 }else{ 7818 s.setAttribute("src",uri); 7819 } 7820 s.setAttribute("type","application/x-javascript"); 7821 _834.parentNode.appendChild(s); 7822 }else{ 7823 document.write("<"+_834.nodeName+" src=\""+uri+"\" type=\"text/javascript\"></script>"); 7824 } 7825 } 7826 })(); 7827 } 7828 7829 7830