Changeset 5427
- Timestamp:
- 01/29/08 17:48:36 (10 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
spinelz/trunk/compress/javascripts/spinelz_lib/spinelz_util.js
r5420 r5427 476 476 },unmask:function(){ 477 477 this._unmask(); 478 },addMaskCallback:function(_a3){ 478 },unmaskAll:function(){ 479 var max=10; 480 var _a4=0; 481 while(this._isMasked()&&(_a4<max)){ 482 this._unmask(); 483 _a4++; 484 } 485 },addMaskCallback:function(_a5){ 479 486 if(!this.maskCallbacks.any(function(c){ 480 return c==_a 3;487 return c==_a5; 481 488 })){ 482 this.maskCallbacks.push(_a 3);483 } 484 },removeMaskCallback:function(_a 5){489 this.maskCallbacks.push(_a5); 490 } 491 },removeMaskCallback:function(_a7){ 485 492 this.maskCallbacks=this.maskCallbacks.reject(function(c){ 486 return c==_a 5;493 return c==_a7; 487 494 }); 488 495 },clearMaskCallback:function(){ 489 496 this.maskCallbacks=[]; 490 },addUnmaskCallback:function(_a 7){497 },addUnmaskCallback:function(_a9){ 491 498 if(!this.unmaskCallbacks.any(function(c){ 492 return c==_a 7;499 return c==_a9; 493 500 })){ 494 this.unmaskCallbacks.push(_a 7);495 } 496 },removeUnmaskCallback:function(_a 9){501 this.unmaskCallbacks.push(_a9); 502 } 503 },removeUnmaskCallback:function(_ab){ 497 504 this.unmaskCallbacks=this.unmaskCallbacks.reject(function(c){ 498 return c==_a 9;505 return c==_ab; 499 506 }); 500 507 },clearUnmaskCallback:function(){ 501 508 this.unmaskCallbacks=[]; 502 },_mask:function(_a b){503 var _a c=Object.extend({cssPrefix:"custom_",zIndex:null},arguments[1]||{});509 },_mask:function(_ad){ 510 var _ae=Object.extend({cssPrefix:"custom_",zIndex:null},arguments[1]||{}); 504 511 if(Modal.element){ 505 Modal._snap(_a b);512 Modal._snap(_ad); 506 513 Modal._rebuildMask(); 507 514 }else{ 508 515 Modal.snaps=[]; 509 516 Modal.excepteds=[]; 510 Modal._buildMask(_a c.cssPrefix);517 Modal._buildMask(_ae.cssPrefix); 511 518 Modal.cover=new IECover(Modal.element,{transparent:true}); 512 519 } 513 Modal._setZindex(_a b,_ac.zIndex);520 Modal._setZindex(_ad,_ae.zIndex); 514 521 Modal._setFullSize(); 515 if(!Modal.hasExcepted(_a b)){516 Modal.excepteds.push(_a b);522 if(!Modal.hasExcepted(_ad)){ 523 Modal.excepteds.push(_ad); 517 524 } 518 525 this.count++; 519 this.maskCallbacks.each(function(_a d){520 _a d(_ab);526 this.maskCallbacks.each(function(_af){ 527 _af(_ad); 521 528 }); 522 529 },_unmask:function(){ … … 534 541 } 535 542 this.count++; 536 this.unmaskCallbacks.each(function(_ ae){537 _ ae();543 this.unmaskCallbacks.each(function(_b0){ 544 _b0(); 538 545 }); 539 546 },_addEvent:function(){ … … 549 556 },_isMasked:function(){ 550 557 return Modal.element&&Element.visible(Modal.element); 551 },_snap:function(_ af){552 var _b 0=Element.getStyle(Modal.element,"zIndex");553 if(_b 0&&Modal._isMasked()&&!Modal.hasExcepted(_af)){554 Modal.snaps.push(_b 0);555 } 556 },_setZindex:function(_b 1,_b2){557 _b 2=ZindexManager.getIndex(_b2);558 Element.setStyle(Modal.element,{zIndex:_b 2});559 _b 1=Element.makePositioned($(_b1));560 Element.setStyle(_b 1,{zIndex:++_b2});558 },_snap:function(_b1){ 559 var _b2=Element.getStyle(Modal.element,"zIndex"); 560 if(_b2&&Modal._isMasked()&&!Modal.hasExcepted(_b1)){ 561 Modal.snaps.push(_b2); 562 } 563 },_setZindex:function(_b3,_b4){ 564 _b4=ZindexManager.getIndex(_b4); 565 Element.setStyle(Modal.element,{zIndex:_b4}); 566 _b3=Element.makePositioned($(_b3)); 567 Element.setStyle(_b3,{zIndex:++_b4}); 561 568 },_setFullSize:function(){ 562 569 Modal.element.setStyle({width:Element.getWindowWidth()+"px",height:Element.getWindowHeight()+"px"}); … … 564 571 Modal.cover.resetSize(); 565 572 } 566 },_buildMask:function(_b 3){567 var _b 4=Builder.node("div",{id:Modal.maskId});568 Modal._setClassNames(_b 4,_b3);569 document.body.appendChild(_b 4);570 Modal.element=_b 4;573 },_buildMask:function(_b5){ 574 var _b6=Builder.node("div",{id:Modal.maskId}); 575 Modal._setClassNames(_b6,_b5); 576 document.body.appendChild(_b6); 577 Modal.element=_b6; 571 578 Modal._addEvent(); 572 },_setClassNames:function(_b 5,_b6){573 var _b 7=(UserAgent.isIE())?Modal.maskClassIE:Modal.maskClass;574 Element.addClassName(_b 5,_b7);575 Element.addClassName(_b 5,_b6+_b7);579 },_setClassNames:function(_b7,_b8){ 580 var _b9=(UserAgent.isIE())?Modal.maskClassIE:Modal.maskClass; 581 Element.addClassName(_b7,_b9); 582 Element.addClassName(_b7,_b8+_b9); 576 583 },_rebuildMask:function(){ 577 584 document.body.appendChild(Modal.element); … … 584 591 return src.spinelzMaskResult; 585 592 } 586 var _b 9=false;587 var _b a=this.excepteds.last();588 var _b b=src;589 if(_b a&&Element.descendantOf(src,_ba)){590 _b 9=true;591 }else{ 592 var _b c=Element.getStyle(Modal.element,"zIndex");593 var _b d=null;593 var _bb=false; 594 var _bc=this.excepteds.last(); 595 var _bd=src; 596 if(_bc&&Element.descendantOf(src,_bc)){ 597 _bb=true; 598 }else{ 599 var _be=Element.getStyle(Modal.element,"zIndex"); 600 var _bf=null; 594 601 while((src=src.parentNode)&&src!=document.body){ 595 if(src.style&&(_b d=Element.getStyle(src,"zIndex"))){596 _b 9=(_bd>_bc);602 if(src.style&&(_bf=Element.getStyle(src,"zIndex"))){ 603 _bb=(_bf>_be); 597 604 break; 598 605 } 599 606 } 600 607 } 601 _b b.spinelzMaskCount=this.count;602 _b b.spinelzMaskResult=_b9;603 return _b 9;604 },_handleEvent:function(_ be){605 var src=Event.element(_ be);606 if(!(Modal._isOutOfModal(src)||(_ be.keyCode&&(_be.keyCode==this.tabKey)))){607 Event.stop(_ be);608 } 609 },_onResize:function(_c 0){608 _bd.spinelzMaskCount=this.count; 609 _bd.spinelzMaskResult=_bb; 610 return _bb; 611 },_handleEvent:function(_c0){ 612 var src=Event.element(_c0); 613 if(!(Modal._isOutOfModal(src)||(_c0.keyCode&&(_c0.keyCode==this.tabKey)))){ 614 Event.stop(_c0); 615 } 616 },_onResize:function(_c2){ 610 617 Modal._setFullSize(); 611 },hasExcepted:function(_c 1){612 return (Modal.excepteds||[]).any(function(_c 2){613 return _c 2.id==_c1.id;618 },hasExcepted:function(_c3){ 619 return (Modal.excepteds||[]).any(function(_c4){ 620 return _c4.id==_c3.id; 614 621 }); 615 622 }}; 616 623 var IECover=Class.create(); 617 624 IECover.src="javascript:false;"; 618 IECover.prototype={idSuffix:"iecover",initialize:function(_c 3){625 IECover.prototype={idSuffix:"iecover",initialize:function(_c5){ 619 626 this.options=Object.extend({transparent:false,padding:0},arguments[1]||{}); 620 627 if(document.all){ 621 _c 3=$(_c3);622 this.id=_c 3.id.appendSuffix(this.idSuffix);623 this._build(_c 3);628 _c5=$(_c5); 629 this.id=_c5.id.appendSuffix(this.idSuffix); 630 this._build(_c5); 624 631 this.resetSize(); 625 632 } 626 633 },resetSize:function(){ 627 634 if(this.element){ 628 var _c 4=this.element.parentNode;629 var _c 5=this.options.padding;630 this.element.width=_c 4.offsetWidth-_c5+"px";631 this.element.height=Element.getHeight(_c 4)-_c5+"px";632 } 633 },_build:function(_c 6){634 var _c 7=this.options.padding/2;635 var _c 8={position:"absolute",top:_c7+"px",left:_c7+"px"};635 var _c6=this.element.parentNode; 636 var _c7=this.options.padding; 637 this.element.width=_c6.offsetWidth-_c7+"px"; 638 this.element.height=Element.getHeight(_c6)-_c7+"px"; 639 } 640 },_build:function(_c8){ 641 var _c9=this.options.padding/2; 642 var _ca={position:"absolute",top:_c9+"px",left:_c9+"px"}; 636 643 if(this.options.transparent){ 637 _c 8.filter="alpha(opacity=0)";638 } 639 if(_c 6.buildedIECover&&$(this.id)){644 _ca.filter="alpha(opacity=0)"; 645 } 646 if(_c8.buildedIECover&&$(this.id)){ 640 647 this.element=$(this.id); 641 648 }else{ 642 649 this.element=Builder.node("iframe",{src:IECover.src,id:this.id,frameborder:0}); 643 650 } 644 Element.setStyle(this.element,_c 8);645 var _c 9=Element.down(_c6,0);646 if(_c 9){647 Element.makePositioned(_c 9);648 } 649 _c 6.insertBefore(this.element,_c6.firstChild);650 _c 6.buildedIECover=true;651 Element.setStyle(this.element,_ca); 652 var _cb=Element.down(_c8,0); 653 if(_cb){ 654 Element.makePositioned(_cb); 655 } 656 _c8.insertBefore(this.element,_c8.firstChild); 657 _c8.buildedIECover=true; 651 658 }}; 652 659 var UserAgent={getUserAgent:function(){ … … 663 670 var ShortcutManager=Class.create(); 664 671 ShortcutManager.prototype={initialize:function(){ 665 var _c a={detectKeyup:false,initialStarted:true,preventDefault:true};666 this.options=Object.extend(_c a,arguments[0]||{});672 var _cc={detectKeyup:false,initialStarted:true,preventDefault:true}; 673 this.options=Object.extend(_cc,arguments[0]||{}); 667 674 this.keydownListener=this.eventKeydown.bindAsEventListener(this); 668 675 if(this.options.detectKeyup){ … … 690 697 Event.observe(document,"keyup",this.keyupListener); 691 698 } 692 },add:function(c1,c2,_c d){699 },add:function(c1,c2,_cf){ 693 700 if(c1.constructor==Array){ 694 var _ ce=this;695 c1.each(function(_ cf){696 _ ce._add_or_remove_function(_cf[0],_cf[1],_cd);697 }); 698 }else{ 699 this._add_or_remove_function(c1,c2,_c d);701 var _d0=this; 702 c1.each(function(_d1){ 703 _d0._add_or_remove_function(_d1[0],_d1[1],_cf); 704 }); 705 }else{ 706 this._add_or_remove_function(c1,c2,_cf); 700 707 } 701 708 },destroy:function(){ … … 704 711 Event.stopObserving(document,"keyup",this.keyupListener); 705 712 } 706 },eventKeydown:function(_d 0){713 },eventKeydown:function(_d2){ 707 714 if(this.executable){ 708 var _d 1;715 var _d3; 709 716 var key=""; 710 _d 0=_d0||window.event;711 if(_d 0.keyCode){712 if(_d 0.altKey){717 _d2=_d2||window.event; 718 if(_d2.keyCode){ 719 if(_d2.altKey){ 713 720 key+="a"; 714 721 } 715 if(_d 0.ctrlKey){722 if(_d2.ctrlKey){ 716 723 key+="c"; 717 724 } 718 if(_d 0.shiftKey){725 if(_d2.shiftKey){ 719 726 key+="s"; 720 727 } … … 722 729 key="n"; 723 730 } 724 _d 1=this._mergeNumKey(_d0.keyCode);725 if(this.keydownFunc[key][_d 1]){726 this.keydownFunc[key][_d 1]();731 _d3=this._mergeNumKey(_d2.keyCode); 732 if(this.keydownFunc[key][_d3]){ 733 this.keydownFunc[key][_d3](); 727 734 if(this.options.preventDefault){ 728 Event.stop(_d 0);729 } 730 } 731 } 732 } 733 },eventKeyup:function(_d 3){735 Event.stop(_d2); 736 } 737 } 738 } 739 } 740 },eventKeyup:function(_d5){ 734 741 if(this.executable){ 735 var _d 4;736 _d 3=_d3||window.event;737 if(_d 3.keyCode){738 _d 4=this._mergeNumKey(_d3.keyCode);739 if(this.keyupFunc[_d 4]){740 this.keyupFunc[_d 4]();742 var _d6; 743 _d5=_d5||window.event; 744 if(_d5.keyCode){ 745 _d6=this._mergeNumKey(_d5.keyCode); 746 if(this.keyupFunc[_d6]){ 747 this.keyupFunc[_d6](); 741 748 if(this.options.preventDefault){ 742 Event.stop(_d 3);743 } 744 } 745 } 746 } 747 },remove:function(_d 5){748 this._add_or_remove_function(_d 5);749 Event.stop(_d5); 750 } 751 } 752 } 753 } 754 },remove:function(_d7){ 755 this._add_or_remove_function(_d7); 749 756 },start:function(){ 750 757 this.executable=true; 751 758 },stop:function(){ 752 759 this.executable=false; 753 },_add_or_remove_function:function(_d 6,_d7,_d8){754 var _d 9;755 var _d a=new Array();756 var _d b=this;757 $A(_d 6.toLowerCase().split("+")).each(function(key){760 },_add_or_remove_function:function(_d8,_d9,_da){ 761 var _db; 762 var _dc=new Array(); 763 var _dd=this; 764 $A(_d8.toLowerCase().split("+")).each(function(key){ 758 765 if(key=="alt"){ 759 _d a.push("a");766 _dc.push("a"); 760 767 }else{ 761 768 if(key=="ctrl"){ 762 _d a.push("c");769 _dc.push("c"); 763 770 }else{ 764 771 if(key=="shift"){ 765 _d a.push("s");766 }else{ 767 _d 9=_db.keyCode[key];768 } 769 } 770 } 771 }); 772 var key=_d a.sortBy(function(_de,_df){773 return _ de;772 _dc.push("s"); 773 }else{ 774 _db=_dd.keyCode[key]; 775 } 776 } 777 } 778 }); 779 var key=_dc.sortBy(function(_e0,_e1){ 780 return _e0; 774 781 }).join(""); 775 782 if(key==""){ 776 783 key="n"; 777 784 } 778 if(_d 7){779 if(_d 8){780 this.keyupFunc[_d 9]=_d7;781 }else{ 782 this.keydownFunc[key][_d 9]=_d7;783 } 784 }else{ 785 if(_d 8){786 this.keyupFunc[_d 9]=null;787 }else{ 788 this.keydownFunc[key][_d 9]=null;789 } 790 } 791 },_mergeNumKey:function(_e 0){792 return (this.numKeys[_e 0])?this.numKeys[_e0]:_e0;785 if(_d9){ 786 if(_da){ 787 this.keyupFunc[_db]=_d9; 788 }else{ 789 this.keydownFunc[key][_db]=_d9; 790 } 791 }else{ 792 if(_da){ 793 this.keyupFunc[_db]=null; 794 }else{ 795 this.keydownFunc[key][_db]=null; 796 } 797 } 798 },_mergeNumKey:function(_e2){ 799 return (this.numKeys[_e2])?this.numKeys[_e2]:_e2; 793 800 }}; 794 801 Function.prototype.callAfterLoading=function(){ 795 var _e 1=$A(arguments);796 var _e 2=this;797 var _e 3=_e1.shift()||this;802 var _e3=$A(arguments); 803 var _e4=this; 804 var _e5=_e3.shift()||this; 798 805 if(UserAgent.isIE()&&(document.readyState!="complete")){ 799 806 Event.observe(window,"load",function(){ 800 _e 2.apply(_e3,_e1);801 }); 802 }else{ 803 this.apply(_e 3,_e1);807 _e4.apply(_e5,_e3); 808 }); 809 }else{ 810 this.apply(_e5,_e3); 804 811 } 805 812 }; … … 810 817 document.body.focus(); 811 818 } 812 },concat:function(_e 4,_e5){813 var _e 6={};814 _e 5.each(function(_e7){815 _e 6[_e7]=_e4.appendSuffix(_e7);816 }); 817 return _e 6;818 },getId:function(_e 8){819 _e 8=_e8||"";820 return _e 8.appendSuffix(++SpinelzUtil.idCount);821 },toAttriteString:function(_e 9,_ea){822 var _e b=_e9.map(function(_ec){823 return _e c.key+"='"+_ec.value+"'";819 },concat:function(_e6,_e7){ 820 var _e8={}; 821 _e7.each(function(_e9){ 822 _e8[_e9]=_e6.appendSuffix(_e9); 823 }); 824 return _e8; 825 },getId:function(_ea){ 826 _ea=_ea||""; 827 return _ea.appendSuffix(++SpinelzUtil.idCount); 828 },toAttriteString:function(_eb,_ec){ 829 var _ed=_eb.map(function(_ee){ 830 return _ee.key+"='"+_ee.value+"'"; 824 831 }).join(" "); 825 if(_e a&&(_eb.length>0)){826 _e b=" "+_eb;827 } 828 return _e b;829 },_redrawForIE:function(_e d){832 if(_ec&&(_ed.length>0)){ 833 _ed=" "+_ed; 834 } 835 return _ed; 836 },_redrawForIE:function(_ef){ 830 837 if(UserAgent.isIE()){ 831 _e d=$(_ed);832 if(_e d){838 _ef=$(_ef); 839 if(_ef){ 833 840 setTimeout(function(){ 834 Element.classNames(_e d).set("dummy");841 Element.classNames(_ef).set("dummy"); 835 842 },200); 836 843 } … … 843 850 }); 844 851 } 845 var $A=Array.from=function(_ ee){846 if(!_ ee){852 var $A=Array.from=function(_f0){ 853 if(!_f0){ 847 854 return []; 848 855 } 849 if(_ ee.toArray){850 return _ ee.toArray();851 }else{ 852 var _ ef=[];853 for(var i=0,len=_ ee.length;i<len;i++){854 _ ef.push(_ee[i]);855 } 856 return _ ef;856 if(_f0.toArray){ 857 return _f0.toArray(); 858 }else{ 859 var _f1=[]; 860 for(var i=0,len=_f0.length;i<len;i++){ 861 _f1.push(_f0[i]); 862 } 863 return _f1; 857 864 } 858 865 }; 859 866 var Color=Class.create(); 860 Color.prototype={initialize:function(_f 2){861 this.color=this.parse(_f 2);862 },toHex:function(_f 3){863 _f 3=_f3||this.color;864 return _f 3.invoke("toColorPart");867 Color.prototype={initialize:function(_f4){ 868 this.color=this.parse(_f4); 869 },toHex:function(_f5){ 870 _f5=_f5||this.color; 871 return _f5.invoke("toColorPart"); 865 872 },invert:function(){ 866 873 return this.toCssStyle(this.color.map(function(c){ 867 874 return 255-c; 868 875 })); 869 },toCssStyle:function(_f 5){870 _f 5=_f5||this.color;871 return "#"+this.toHex(_f 5).join("");872 },parse:function(_f 6){873 _f 6=_f6||this.color;874 if(_f 6.match(/rgb\(\d+,\s*\d+,\s*\d+\)/)){875 return _f 6.match(/\d+/g).map(function(c){876 },toCssStyle:function(_f7){ 877 _f7=_f7||this.color; 878 return "#"+this.toHex(_f7).join(""); 879 },parse:function(_f8){ 880 _f8=_f8||this.color; 881 if(_f8.match(/rgb\(\d+,\s*\d+,\s*\d+\)/)){ 882 return _f8.match(/\d+/g).map(function(c){ 876 883 return parseInt(c,10); 877 884 }); 878 885 }else{ 879 if(_f 6.match(/#[a-fA-F0-9]{6}/)){880 return _f 6.match(/([a-fA-F0-9]){2}/g).map(function(c){886 if(_f8.match(/#[a-fA-F0-9]{6}/)){ 887 return _f8.match(/([a-fA-F0-9]){2}/g).map(function(c){ 881 888 return parseInt(c,16); 882 889 }); 883 890 } 884 891 } 885 throw "parse error: "+_f 6;892 throw "parse error: "+_f8; 886 893 }}; 887 894 var DebugConsole={_active:false,_basetime:null,_messages:null,activate:function(){ 888 895 this._active=true; 889 },dump:function(_f 9){890 _f 9=_f9||{};891 switch(_f 9.type){896 },dump:function(_fb){ 897 _fb=_fb||{}; 898 switch(_fb.type){ 892 899 case "alert": 893 900 this._dump_alert(); … … 900 907 break; 901 908 case "update": 902 this._dump_update(_f 9.target);909 this._dump_update(_fb.target); 903 910 break; 904 911 default: … … 919 926 this._messages=[]; 920 927 } 921 },log:function(_f a){928 },log:function(_fc){ 922 929 if(this._active){ 923 var _f b=("00000000"+(new Date()-this._basetime)).slice(-8);924 this._messages.push(_f b+" : "+_fa);930 var _fd=("00000000"+(new Date()-this._basetime)).slice(-8); 931 this._messages.push(_fd+" : "+_fc); 925 932 } 926 933 },_dump_alert:function(){ 927 this._messages.each(function(_f c){928 alert(_f c);934 this._messages.each(function(_fe){ 935 alert(_fe); 929 936 }); 930 937 },_dump_clipboard:function(){ 931 var _f d="";932 this._messages.each(function(_ fe){933 _f d+=_fe+"\n";934 }); 935 clipboardData.setData("Text",_f d);938 var _ff=""; 939 this._messages.each(function(_100){ 940 _ff+=_100+"\n"; 941 }); 942 clipboardData.setData("Text",_ff); 936 943 },_dump_console:function(){ 937 this._messages.each(function(_ ff){938 console.log(_ ff);939 }); 940 },_dump_update:function(_10 0){944 this._messages.each(function(_101){ 945 console.log(_101); 946 }); 947 },_dump_update:function(_102){ 941 948 var html=""; 942 this._messages.each(function(_10 2){943 html+="<p>"+_10 2+"</p>";944 }); 945 Element.update(_10 0,html);949 this._messages.each(function(_104){ 950 html+="<p>"+_104+"</p>"; 951 }); 952 Element.update(_102,html); 946 953 }}; 947 954 spinelz/trunk/compress/javascripts/spinelz_lib/spinelz_util_for_rubricks.js
r5420 r5427 5142 5142 },unmask:function(){ 5143 5143 this._unmask(); 5144 },addMaskCallback:function(_a3){ 5144 },unmaskAll:function(){ 5145 var max=10; 5146 var _a4=0; 5147 while(this._isMasked()&&(_a4<max)){ 5148 this._unmask(); 5149 _a4++; 5150 } 5151 },addMaskCallback:function(_a5){ 5145 5152 if(!this.maskCallbacks.any(function(c){ 5146 return c==_a 3;5153 return c==_a5; 5147 5154 })){ 5148 this.maskCallbacks.push(_a 3);5149 } 5150 },removeMaskCallback:function(_a 5){5155 this.maskCallbacks.push(_a5); 5156 } 5157 },removeMaskCallback:function(_a7){ 5151 5158 this.maskCallbacks=this.maskCallbacks.reject(function(c){ 5152 return c==_a 5;5159 return c==_a7; 5153 5160 }); 5154 5161 },clearMaskCallback:function(){ 5155 5162 this.maskCallbacks=[]; 5156 },addUnmaskCallback:function(_a 7){5163 },addUnmaskCallback:function(_a9){ 5157 5164 if(!this.unmaskCallbacks.any(function(c){ 5158 return c==_a 7;5165 return c==_a9; 5159 5166 })){ 5160 this.unmaskCallbacks.push(_a 7);5161 } 5162 },removeUnmaskCallback:function(_a 9){5167 this.unmaskCallbacks.push(_a9); 5168 } 5169 },removeUnmaskCallback:function(_ab){ 5163 5170 this.unmaskCallbacks=this.unmaskCallbacks.reject(function(c){ 5164 return c==_a 9;5171 return c==_ab; 5165 5172 }); 5166 5173 },clearUnmaskCallback:function(){ 5167 5174 this.unmaskCallbacks=[]; 5168 },_mask:function(_a b){5169 var _a c=Object.extend({cssPrefix:"custom_",zIndex:null},arguments[1]||{});5175 },_mask:function(_ad){ 5176 var _ae=Object.extend({cssPrefix:"custom_",zIndex:null},arguments[1]||{}); 5170 5177 if(Modal.element){ 5171 Modal._snap(_a b);5178 Modal._snap(_ad); 5172 5179 Modal._rebuildMask(); 5173 5180 }else{ 5174 5181 Modal.snaps=[]; 5175 5182 Modal.excepteds=[]; 5176 Modal._buildMask(_a c.cssPrefix);5183 Modal._buildMask(_ae.cssPrefix); 5177 5184 Modal.cover=new IECover(Modal.element,{transparent:true}); 5178 5185 } 5179 Modal._setZindex(_a b,_ac.zIndex);5186 Modal._setZindex(_ad,_ae.zIndex); 5180 5187 Modal._setFullSize(); 5181 if(!Modal.hasExcepted(_a b)){5182 Modal.excepteds.push(_a b);5188 if(!Modal.hasExcepted(_ad)){ 5189 Modal.excepteds.push(_ad); 5183 5190 } 5184 5191 this.count++; 5185 this.maskCallbacks.each(function(_a d){5186 _a d(_ab);5192 this.maskCallbacks.each(function(_af){ 5193 _af(_ad); 5187 5194 }); 5188 5195 },_unmask:function(){ … … 5200 5207 } 5201 5208 this.count++; 5202 this.unmaskCallbacks.each(function(_ ae){5203 _ ae();5209 this.unmaskCallbacks.each(function(_b0){ 5210 _b0(); 5204 5211 }); 5205 5212 },_addEvent:function(){ … … 5215 5222 },_isMasked:function(){ 5216 5223 return Modal.element&&Element.visible(Modal.element); 5217 },_snap:function(_ af){5218 var _b 0=Element.getStyle(Modal.element,"zIndex");5219 if(_b 0&&Modal._isMasked()&&!Modal.hasExcepted(_af)){5220 Modal.snaps.push(_b 0);5221 } 5222 },_setZindex:function(_b 1,_b2){5223 _b 2=ZindexManager.getIndex(_b2);5224 Element.setStyle(Modal.element,{zIndex:_b 2});5225 _b 1=Element.makePositioned($(_b1));5226 Element.setStyle(_b 1,{zIndex:++_b2});5224 },_snap:function(_b1){ 5225 var _b2=Element.getStyle(Modal.element,"zIndex"); 5226 if(_b2&&Modal._isMasked()&&!Modal.hasExcepted(_b1)){ 5227 Modal.snaps.push(_b2); 5228 } 5229 },_setZindex:function(_b3,_b4){ 5230 _b4=ZindexManager.getIndex(_b4); 5231 Element.setStyle(Modal.element,{zIndex:_b4}); 5232 _b3=Element.makePositioned($(_b3)); 5233 Element.setStyle(_b3,{zIndex:++_b4}); 5227 5234 },_setFullSize:function(){ 5228 5235 Modal.element.setStyle({width:Element.getWindowWidth()+"px",height:Element.getWindowHeight()+"px"}); … … 5230 5237 Modal.cover.resetSize(); 5231 5238 } 5232 },_buildMask:function(_b 3){5233 var _b 4=Builder.node("div",{id:Modal.maskId});5234 Modal._setClassNames(_b 4,_b3);5235 document.body.appendChild(_b 4);5236 Modal.element=_b 4;5239 },_buildMask:function(_b5){ 5240 var _b6=Builder.node("div",{id:Modal.maskId}); 5241 Modal._setClassNames(_b6,_b5); 5242 document.body.appendChild(_b6); 5243 Modal.element=_b6; 5237 5244 Modal._addEvent(); 5238 },_setClassNames:function(_b 5,_b6){5239 var _b 7=(UserAgent.isIE())?Modal.maskClassIE:Modal.maskClass;5240 Element.addClassName(_b 5,_b7);5241 Element.addClassName(_b 5,_b6+_b7);5245 },_setClassNames:function(_b7,_b8){ 5246 var _b9=(UserAgent.isIE())?Modal.maskClassIE:Modal.maskClass; 5247 Element.addClassName(_b7,_b9); 5248 Element.addClassName(_b7,_b8+_b9); 5242 5249 },_rebuildMask:function(){ 5243 5250 document.body.appendChild(Modal.element); … … 5250 5257 return src.spinelzMaskResult; 5251 5258 } 5252 var _b 9=false;5253 var _b a=this.excepteds.last();5254 var _b b=src;5255 if(_b a&&Element.descendantOf(src,_ba)){5256 _b 9=true;5257 }else{ 5258 var _b c=Element.getStyle(Modal.element,"zIndex");5259 var _b d=null;5259 var _bb=false; 5260 var _bc=this.excepteds.last(); 5261 var _bd=src; 5262 if(_bc&&Element.descendantOf(src,_bc)){ 5263 _bb=true; 5264 }else{ 5265 var _be=Element.getStyle(Modal.element,"zIndex"); 5266 var _bf=null; 5260 5267 while((src=src.parentNode)&&src!=document.body){ 5261 if(src.style&&(_b d=Element.getStyle(src,"zIndex"))){5262 _b 9=(_bd>_bc);5268 if(src.style&&(_bf=Element.getStyle(src,"zIndex"))){ 5269 _bb=(_bf>_be); 5263 5270 break; 5264 5271 } 5265 5272 } 5266 5273 } 5267 _b b.spinelzMaskCount=this.count;5268 _b b.spinelzMaskResult=_b9;5269 return _b 9;5270 },_handleEvent:function(_ be){5271 var src=Event.element(_ be);5272 if(!(Modal._isOutOfModal(src)||(_ be.keyCode&&(_be.keyCode==this.tabKey)))){5273 Event.stop(_ be);5274 } 5275 },_onResize:function(_c 0){5274 _bd.spinelzMaskCount=this.count; 5275 _bd.spinelzMaskResult=_bb; 5276 return _bb; 5277 },_handleEvent:function(_c0){ 5278 var src=Event.element(_c0); 5279 if(!(Modal._isOutOfModal(src)||(_c0.keyCode&&(_c0.keyCode==this.tabKey)))){ 5280 Event.stop(_c0); 5281 } 5282 },_onResize:function(_c2){ 5276 5283 Modal._setFullSize(); 5277 },hasExcepted:function(_c 1){5278 return (Modal.excepteds||[]).any(function(_c 2){5279 return _c 2.id==_c1.id;5284 },hasExcepted:function(_c3){ 5285 return (Modal.excepteds||[]).any(function(_c4){ 5286 return _c4.id==_c3.id; 5280 5287 }); 5281 5288 }}; 5282 5289 var IECover=Class.create(); 5283 5290 IECover.src="javascript:false;"; 5284 IECover.prototype={idSuffix:"iecover",initialize:function(_c 3){5291 IECover.prototype={idSuffix:"iecover",initialize:function(_c5){ 5285 5292 this.options=Object.extend({transparent:false,padding:0},arguments[1]||{}); 5286 5293 if(document.all){ 5287 _c 3=$(_c3);5288 this.id=_c 3.id.appendSuffix(this.idSuffix);5289 this._build(_c 3);5294 _c5=$(_c5); 5295 this.id=_c5.id.appendSuffix(this.idSuffix); 5296 this._build(_c5); 5290 5297 this.resetSize(); 5291 5298 } 5292 5299 },resetSize:function(){ 5293 5300 if(this.element){ 5294 var _c 4=this.element.parentNode;5295 var _c 5=this.options.padding;5296 this.element.width=_c 4.offsetWidth-_c5+"px";5297 this.element.height=Element.getHeight(_c 4)-_c5+"px";5298 } 5299 },_build:function(_c 6){5300 var _c 7=this.options.padding/2;5301 var _c 8={position:"absolute",top:_c7+"px",left:_c7+"px"};5301 var _c6=this.element.parentNode; 5302 var _c7=this.options.padding; 5303 this.element.width=_c6.offsetWidth-_c7+"px"; 5304 this.element.height=Element.getHeight(_c6)-_c7+"px"; 5305 } 5306 },_build:function(_c8){ 5307 var _c9=this.options.padding/2; 5308 var _ca={position:"absolute",top:_c9+"px",left:_c9+"px"}; 5302 5309 if(this.options.transparent){ 5303 _c 8.filter="alpha(opacity=0)";5304 } 5305 if(_c 6.buildedIECover&&$(this.id)){5310 _ca.filter="alpha(opacity=0)"; 5311 } 5312 if(_c8.buildedIECover&&$(this.id)){ 5306 5313 this.element=$(this.id); 5307 5314 }else{ 5308 5315 this.element=Builder.node("iframe",{src:IECover.src,id:this.id,frameborder:0}); 5309 5316 } 5310 Element.setStyle(this.element,_c 8);5311 var _c 9=Element.down(_c6,0);5312 if(_c 9){5313 Element.makePositioned(_c 9);5314 } 5315 _c 6.insertBefore(this.element,_c6.firstChild);5316 _c 6.buildedIECover=true;5317 Element.setStyle(this.element,_ca); 5318 var _cb=Element.down(_c8,0); 5319 if(_cb){ 5320 Element.makePositioned(_cb); 5321 } 5322 _c8.insertBefore(this.element,_c8.firstChild); 5323 _c8.buildedIECover=true; 5317 5324 }}; 5318 5325 var UserAgent={getUserAgent:function(){ … … 5329 5336 var ShortcutManager=Class.create(); 5330 5337 ShortcutManager.prototype={initialize:function(){ 5331 var _c a={detectKeyup:false,initialStarted:true,preventDefault:true};5332 this.options=Object.extend(_c a,arguments[0]||{});5338 var _cc={detectKeyup:false,initialStarted:true,preventDefault:true}; 5339 this.options=Object.extend(_cc,arguments[0]||{}); 5333 5340 this.keydownListener=this.eventKeydown.bindAsEventListener(this); 5334 5341 if(this.options.detectKeyup){ … … 5356 5363 Event.observe(document,"keyup",this.keyupListener); 5357 5364 } 5358 },add:function(c1,c2,_c d){5365 },add:function(c1,c2,_cf){ 5359 5366 if(c1.constructor==Array){ 5360 var _ ce=this;5361 c1.each(function(_ cf){5362 _ ce._add_or_remove_function(_cf[0],_cf[1],_cd);5363 }); 5364 }else{ 5365 this._add_or_remove_function(c1,c2,_c d);5367 var _d0=this; 5368 c1.each(function(_d1){ 5369 _d0._add_or_remove_function(_d1[0],_d1[1],_cf); 5370 }); 5371 }else{ 5372 this._add_or_remove_function(c1,c2,_cf); 5366 5373 } 5367 5374 },destroy:function(){ … … 5370 5377 Event.stopObserving(document,"keyup",this.keyupListener); 5371 5378 } 5372 },eventKeydown:function(_d 0){5379 },eventKeydown:function(_d2){ 5373 5380 if(this.executable){ 5374 var _d 1;5381 var _d3; 5375 5382 var key=""; 5376 _d 0=_d0||window.event;5377 if(_d 0.keyCode){5378 if(_d 0.altKey){5383 _d2=_d2||window.event; 5384 if(_d2.keyCode){ 5385 if(_d2.altKey){ 5379 5386 key+="a"; 5380 5387 } 5381 if(_d 0.ctrlKey){5388 if(_d2.ctrlKey){ 5382 5389 key+="c"; 5383 5390 } 5384 if(_d 0.shiftKey){5391 if(_d2.shiftKey){ 5385 5392 key+="s"; 5386 5393 } … … 5388 5395 key="n"; 5389 5396 } 5390 _d 1=this._mergeNumKey(_d0.keyCode);5391 if(this.keydownFunc[key][_d 1]){5392 this.keydownFunc[key][_d 1]();5397 _d3=this._mergeNumKey(_d2.keyCode); 5398 if(this.keydownFunc[key][_d3]){ 5399 this.keydownFunc[key][_d3](); 5393 5400 if(this.options.preventDefault){ 5394 Event.stop(_d 0);5395 } 5396 } 5397 } 5398 } 5399 },eventKeyup:function(_d 3){5401 Event.stop(_d2); 5402 } 5403 } 5404 } 5405 } 5406 },eventKeyup:function(_d5){ 5400 5407 if(this.executable){ 5401 var _d 4;5402 _d 3=_d3||window.event;5403 if(_d 3.keyCode){5404 _d 4=this._mergeNumKey(_d3.keyCode);5405 if(this.keyupFunc[_d 4]){5406 this.keyupFunc[_d 4]();5408 var _d6; 5409 _d5=_d5||window.event; 5410 if(_d5.keyCode){ 5411 _d6=this._mergeNumKey(_d5.keyCode); 5412 if(this.keyupFunc[_d6]){ 5413 this.keyupFunc[_d6](); 5407 5414 if(this.options.preventDefault){ 5408 Event.stop(_d 3);5409 } 5410 } 5411 } 5412 } 5413 },remove:function(_d 5){5414 this._add_or_remove_function(_d 5);5415 Event.stop(_d5); 5416 } 5417 } 5418 } 5419 } 5420 },remove:function(_d7){ 5421 this._add_or_remove_function(_d7); 5415 5422 },start:function(){ 5416 5423 this.executable=true; 5417 5424 },stop:function(){ 5418 5425 this.executable=false; 5419 },_add_or_remove_function:function(_d 6,_d7,_d8){5420 var _d 9;5421 var _d a=new Array();5422 var _d b=this;5423 $A(_d 6.toLowerCase().split("+")).each(function(key){5426 },_add_or_remove_function:function(_d8,_d9,_da){ 5427 var _db; 5428 var _dc=new Array(); 5429 var _dd=this; 5430 $A(_d8.toLowerCase().split("+")).each(function(key){ 5424 5431 if(key=="alt"){ 5425 _d a.push("a");5432 _dc.push("a"); 5426 5433 }else{ 5427 5434 if(key=="ctrl"){ 5428 _d a.push("c");5435 _dc.push("c"); 5429 5436 }else{ 5430 5437 if(key=="shift"){ 5431 _d a.push("s");5432 }else{ 5433 _d 9=_db.keyCode[key];5434 } 5435 } 5436 } 5437 }); 5438 var key=_d a.sortBy(function(_de,_df){5439 return _ de;5438 _dc.push("s"); 5439 }else{ 5440 _db=_dd.keyCode[key]; 5441 } 5442 } 5443 } 5444 }); 5445 var key=_dc.sortBy(function(_e0,_e1){ 5446 return _e0; 5440 5447 }).join(""); 5441 5448 if(key==""){ 5442 5449 key="n"; 5443 5450 } 5444 if(_d 7){5445 if(_d 8){5446 this.keyupFunc[_d 9]=_d7;5447 }else{ 5448 this.keydownFunc[key][_d 9]=_d7;5449 } 5450 }else{ 5451 if(_d 8){5452 this.keyupFunc[_d 9]=null;5453 }else{ 5454 this.keydownFunc[key][_d 9]=null;5455 } 5456 } 5457 },_mergeNumKey:function(_e 0){5458 return (this.numKeys[_e 0])?this.numKeys[_e0]:_e0;5451 if(_d9){ 5452 if(_da){ 5453 this.keyupFunc[_db]=_d9; 5454 }else{ 5455 this.keydownFunc[key][_db]=_d9; 5456 } 5457 }else{ 5458 if(_da){ 5459 this.keyupFunc[_db]=null; 5460 }else{ 5461 this.keydownFunc[key][_db]=null; 5462 } 5463 } 5464 },_mergeNumKey:function(_e2){ 5465 return (this.numKeys[_e2])?this.numKeys[_e2]:_e2; 5459 5466 }}; 5460 5467 Function.prototype.callAfterLoading=function(){ 5461 var _e 1=$A(arguments);5462 var _e 2=this;5463 var _e 3=_e1.shift()||this;5468 var _e3=$A(arguments); 5469 var _e4=this; 5470 var _e5=_e3.shift()||this; 5464 5471 if(UserAgent.isIE()&&(document.readyState!="complete")){ 5465 5472 Event.observe(window,"load",function(){ 5466 _e 2.apply(_e3,_e1);5467 }); 5468 }else{ 5469 this.apply(_e 3,_e1);5473 _e4.apply(_e5,_e3); 5474 }); 5475 }else{ 5476 this.apply(_e5,_e3); 5470 5477 } 5471 5478 }; … … 5476 5483 document.body.focus(); 5477 5484 } 5478 },concat:function(_e 4,_e5){5479 var _e 6={};5480 _e 5.each(function(_e7){5481 _e 6[_e7]=_e4.appendSuffix(_e7);5482 }); 5483 return _e 6;5484 },getId:function(_e 8){5485 _e 8=_e8||"";5486 return _e 8.appendSuffix(++SpinelzUtil.idCount);5487 },toAttriteString:function(_e 9,_ea){5488 var _e b=_e9.map(function(_ec){5489 return _e c.key+"='"+_ec.value+"'";5485 },concat:function(_e6,_e7){ 5486 var _e8={}; 5487 _e7.each(function(_e9){ 5488 _e8[_e9]=_e6.appendSuffix(_e9); 5489 }); 5490 return _e8; 5491 },getId:function(_ea){ 5492 _ea=_ea||""; 5493 return _ea.appendSuffix(++SpinelzUtil.idCount); 5494 },toAttriteString:function(_eb,_ec){ 5495 var _ed=_eb.map(function(_ee){ 5496 return _ee.key+"='"+_ee.value+"'"; 5490 5497 }).join(" "); 5491 if(_e a&&(_eb.length>0)){5492 _e b=" "+_eb;5493 } 5494 return _e b;5495 },_redrawForIE:function(_e d){5498 if(_ec&&(_ed.length>0)){ 5499 _ed=" "+_ed; 5500 } 5501 return _ed; 5502 },_redrawForIE:function(_ef){ 5496 5503 if(UserAgent.isIE()){ 5497 _e d=$(_ed);5498 if(_e d){5504 _ef=$(_ef); 5505 if(_ef){ 5499 5506 setTimeout(function(){ 5500 Element.classNames(_e d).set("dummy");5507 Element.classNames(_ef).set("dummy"); 5501 5508 },200); 5502 5509 } … … 5509 5516 }); 5510 5517 } 5511 var $A=Array.from=function(_ ee){5512 if(!_ ee){5518 var $A=Array.from=function(_f0){ 5519 if(!_f0){ 5513 5520 return []; 5514 5521 } 5515 if(_ ee.toArray){5516 return _ ee.toArray();5517 }else{ 5518 var _ ef=[];5519 for(var i=0,len=_ ee.length;i<len;i++){5520 _ ef.push(_ee[i]);5521 } 5522 return _ ef;5522 if(_f0.toArray){ 5523 return _f0.toArray(); 5524 }else{ 5525 var _f1=[]; 5526 for(var i=0,len=_f0.length;i<len;i++){ 5527 _f1.push(_f0[i]); 5528 } 5529 return _f1; 5523 5530 } 5524 5531 }; 5525 5532 var Color=Class.create(); 5526 Color.prototype={initialize:function(_f 2){5527 this.color=this.parse(_f 2);5528 },toHex:function(_f 3){5529 _f 3=_f3||this.color;5530 return _f 3.invoke("toColorPart");5533 Color.prototype={initialize:function(_f4){ 5534 this.color=this.parse(_f4); 5535 },toHex:function(_f5){ 5536 _f5=_f5||this.color; 5537 return _f5.invoke("toColorPart"); 5531 5538 },invert:function(){ 5532 5539 return this.toCssStyle(this.color.map(function(c){ 5533 5540 return 255-c; 5534 5541 })); 5535 },toCssStyle:function(_f 5){5536 _f 5=_f5||this.color;5537 return "#"+this.toHex(_f 5).join("");5538 },parse:function(_f 6){5539 _f 6=_f6||this.color;5540 if(_f 6.match(/rgb\(\d+,\s*\d+,\s*\d+\)/)){5541 return _f 6.match(/\d+/g).map(function(c){5542 },toCssStyle:function(_f7){ 5543 _f7=_f7||this.color; 5544 return "#"+this.toHex(_f7).join(""); 5545 },parse:function(_f8){ 5546 _f8=_f8||this.color; 5547 if(_f8.match(/rgb\(\d+,\s*\d+,\s*\d+\)/)){ 5548 return _f8.match(/\d+/g).map(function(c){ 5542 5549 return parseInt(c,10); 5543 5550 }); 5544 5551 }else{ 5545 if(_f 6.match(/#[a-fA-F0-9]{6}/)){5546 return _f 6.match(/([a-fA-F0-9]){2}/g).map(function(c){5552 if(_f8.match(/#[a-fA-F0-9]{6}/)){ 5553 return _f8.match(/([a-fA-F0-9]){2}/g).map(function(c){ 5547 5554 return parseInt(c,16); 5548 5555 }); 5549 5556 } 5550 5557 } 5551 throw "parse error: "+_f 6;5558 throw "parse error: "+_f8; 5552 5559 }}; 5553 5560 var DebugConsole={_active:false,_basetime:null,_messages:null,activate:function(){ 5554 5561 this._active=true; 5555 },dump:function(_f 9){5556 _f 9=_f9||{};5557 switch(_f 9.type){5562 },dump:function(_fb){ 5563 _fb=_fb||{}; 5564 switch(_fb.type){ 5558 5565 case "alert": 5559 5566 this._dump_alert(); <
