Changeset 5919 for spinelz

Show
Ignore:
Timestamp:
08/21/08 15:56:22 (3 months ago)
Author:
kinoshita
Message:

4945

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • spinelz/trunk/compress/javascripts/spinelz/spinelz_for_rubricks.js

    r5916 r5919  
    46594659} 
    46604660},getTabText:function(_20){ 
    4661 return Element.collectTextNodes(_20).escapeHTML().replace(/"/g,""").replace(/[\r\n\t\v]/g,"").replace(/(^(\s)*) | ((\s)*$)/g,""); 
    4662 },chopTabText:function(_21){ 
    4663 _21=_21.unescapeHTML(); 
    4664 var _22=this.options.titleLength; 
    4665 if(_22&&!isNaN(_22)&&(_21.length>_22)){ 
    4666 _21=_21.truncate(_22+3); 
    4667 
    4668 return _21.escapeHTML(); 
    4669 },buildPanel:function(_23,i,_25){ 
    4670 _25=_25||i; 
     4661var _21=null; 
     4662if(Element.isTextNode(_20)){ 
     4663_21=_20.nodeValue; 
     4664}else{ 
     4665if(Element.isElementNode(_20)){ 
     4666_21=Element.collectTextNodes(_20); 
     4667}else{ 
     4668_21=""; 
     4669
     4670
     4671return _21.escapeHTML().replace(/"/g,""").replace(/[\r\n\t\v]/g,"").replace(/(^(\s)*) | ((\s)*$)/g,""); 
     4672},chopTabText:function(_22){ 
     4673_22=_22.unescapeHTML(); 
     4674var _23=this.options.titleLength; 
     4675if(_23&&!isNaN(_23)&&(_22.length>_23)){ 
     4676_22=_22.truncate(_23+3); 
     4677
     4678return _22.escapeHTML(); 
     4679},buildPanel:function(_24,i,_26){ 
     4680_26=_26||i; 
    46714681var id=this.panelId+i; 
    4672 this.panelList[_25]=id; 
     4682this.panelList[_26]=id; 
    46734683return "<div id='"+id+"' style='display: none;'></div>"; 
    4674 },holdElements:function(tab,_28,_29){ 
    4675 this.holder.push({number:_29,tab:tab,content:_28}); 
    4676 var _2a=document.createDocumentFragment(); 
    4677 _2a.appendChild(tab); 
    4678 _2a.appendChild(_28); 
     4684},holdElements:function(tab,_29,_2a){ 
     4685this.holder.push({number:_2a,tab:tab,content:_29}); 
     4686var _2b=document.createDocumentFragment(); 
     4687_2b.appendChild(tab); 
     4688_2b.appendChild(_29); 
    46794689},selectTab:function(e){ 
    46804690if(!e){ 
     
    46864696return; 
    46874697} 
    4688 var _2c=this.getCurrentPanel(); 
    4689 var _2d=this.getCurrentTab(); 
    4690 var _2e=null; 
     4698var _2d=this.getCurrentPanel(); 
     4699var _2e=this.getCurrentTab(); 
     4700var _2f=null; 
    46914701if(e.nodeType){ 
    4692 _2e=e; 
    4693 }else{ 
    4694 _2e=Event.element(e); 
    4695 
    4696 var _2f=this.getTargetIndex(_2e); 
    4697 if(_2f==this.selected){ 
    4698 return; 
    4699 
    4700 var _30=this.panelList[_2f]; 
    4701 var _31=this.tabs[_2f]; 
    4702 if(this._callBeforeSelect(_30)){ 
     4702_2f=e; 
     4703}else{ 
     4704_2f=Event.element(e); 
     4705
     4706var _30=this.getTargetIndex(_2f); 
     4707if(_30==this.selected){ 
     4708return; 
     4709
     4710var _31=this.panelList[_30]; 
     4711var _32=this.tabs[_30]; 
     4712if(this._callBeforeSelect(_31)){ 
     4713if(_2e){ 
     4714this.setTabInactive(_2e); 
     4715
     4716this.setTabActive(_32); 
    47034717if(_2d){ 
    4704 this.setTabInactive(_2d); 
    4705 
    4706 this.setTabActive(_31); 
    4707 if(_2c){ 
    4708 Element.hide(_2c); 
    4709 
    4710 Element.show(_30); 
    4711 this.selected=_2f; 
    4712 this._callAfterSelect(_30,_2c); 
    4713 if(!_30.selected){ 
    4714 this._callAfterSelectOnce(_30); 
    4715 _30.selected=true; 
     4718Element.hide(_2d); 
     4719
     4720Element.show(_31); 
     4721this.selected=_30; 
     4722this._callAfterSelect(_31,_2d); 
     4723if(!_31.selected){ 
     4724this._callAfterSelectOnce(_31); 
     4725_31.selected=true; 
    47164726} 
    47174727} 
     
    47204730return; 
    47214731} 
    4722 var _33=$(tab).immediateDescendants(); 
    4723 this.css.refreshClassNames(_33[0],"tabLeftActive"); 
    4724 this.css.refreshClassNames(_33[1],"tabMiddleActive"); 
    4725 this.css.refreshClassNames(_33[2],"tabRightActive"); 
     4732var _34=$(tab).immediateDescendants(); 
     4733this.css.refreshClassNames(_34[0],"tabLeftActive"); 
     4734this.css.refreshClassNames(_34[1],"tabMiddleActive"); 
     4735this.css.refreshClassNames(_34[2],"tabRightActive"); 
    47264736},setTabInactive:function(tab){ 
    47274737if(!$(tab)){ 
    47284738return; 
    47294739} 
    4730 var _35=$(tab).immediateDescendants(); 
    4731 this.css.refreshClassNames(_35[0],"tabLeftInactive"); 
    4732 this.css.refreshClassNames(_35[1],"tabMiddleInactive"); 
    4733 this.css.refreshClassNames(_35[2],"tabRightInactive"); 
    4734 },getTargetIndex:function(_36){ 
    4735 while(_36){ 
    4736 if(_36.id&&_36.id.indexOf(this.tabId,0)>=0){ 
    4737 var _37=_36.id.substring(this.tabId.length); 
    4738 if(!isNaN(_37)){ 
    4739 return this.tabs.indexOf(_36); 
    4740 } 
    4741 } 
    4742 _36=_36.parentNode; 
    4743 } 
    4744 },onRemove:function(_38){ 
    4745 Event.stop(_38); 
    4746 var _39=Event.element(_38); 
    4747 var _3a=this.getTargetIndex(_39); 
    4748 var tab=this.tabs[_3a]; 
     4740var _36=$(tab).immediateDescendants(); 
     4741this.css.refreshClassNames(_36[0],"tabLeftInactive"); 
     4742this.css.refreshClassNames(_36[1],"tabMiddleInactive"); 
     4743this.css.refreshClassNames(_36[2],"tabRightInactive"); 
     4744},getTargetIndex:function(_37){ 
     4745while(_37){ 
     4746if(_37.id&&_37.id.indexOf(this.tabId,0)>=0){ 
     4747var _38=_37.id.substring(this.tabId.length); 
     4748if(!isNaN(_38)){ 
     4749return this.tabs.indexOf(_37); 
     4750} 
     4751} 
     4752_37=_37.parentNode; 
     4753} 
     4754},onRemove:function(_39){ 
     4755Event.stop(_39); 
     4756var _3a=Event.element(_39); 
     4757var _3b=this.getTargetIndex(_3a); 
     4758var tab=this.tabs[_3b]; 
    47494759if(r=this.options.onRemove(tab)){ 
    47504760this.remove(tab); 
     
    47524762},remove:function(tab){ 
    47534763if(tab){ 
    4754 var _3d=tab.parentNode; 
    4755 var _3e=this.getTargetIndex(tab); 
    4756 var _3f=this.getNextTab(); 
    4757 if(!_3f){ 
    4758 _3f=this.getPreviousTab(); 
    4759 } 
    4760 var _40=this.tabs[this.selected]; 
     4764var _3e=tab.parentNode; 
     4765var _3f=this.getTargetIndex(tab); 
     4766var _40=this.getNextTab(); 
     4767if(!_40){ 
     4768_40=this.getPreviousTab(); 
     4769} 
     4770var _41=this.tabs[this.selected]; 
    47614771Element.remove(tab); 
    4762 Element.remove(this.panelList[_3e]); 
    4763 this.tabs[_3e]=null; 
    4764 this.panelList[_3e]=null; 
     4772Element.remove(this.panelList[_3f]); 
     4773this.tabs[_3f]=null; 
     4774this.panelList[_3f]=null; 
    47654775this.tabs=this.tabs.select(function(t){ 
    47664776return t; 
     
    47694779return t; 
    47704780}); 
    4771 if(_3e==this.selected){ 
    4772 if(_3f){ 
    4773 this.selectTab(_3f); 
    4774 } 
    4775 }else{ 
    4776 this.selected=this.getTargetIndex(_40); 
     4781if(_3f==this.selected){ 
     4782if(_40){ 
     4783this.selectTab(_40); 
     4784} 
     4785}else{ 
     4786this.selected=this.getTargetIndex(_41); 
    47774787} 
    47784788this._setBrTag(); 
    47794789} 
    4780 },addByElement:function(_43){ 
     4790},addByElement:function(_44){ 
    47814791this.holder=[]; 
    47824792this.ids=[]; 
    47834793this.contents=[]; 
    4784 var _44=0; 
    4785 var _45=this.getLastTab(); 
    4786 if(_45){ 
    4787 _44=parseInt(_45.id.match(/[0-9]+$/)[0],10).succ(); 
    4788 } 
    4789 var _46=this.buildTabSet($(_43),_44,this.tabs.length); 
    4790 var _47=_46.tab.toElements(); 
    4791 this.tabContainer.appendChild(_47[0]); 
    4792 if(_47[1]){ 
    4793 this.tabContainer.appendChild(_47[1]); 
    4794 } 
    4795 this.panelContainer.appendChild(_46.panel.toElement()); 
     4794var _45=0; 
     4795var _46=this.getLastTab(); 
     4796if(_46){ 
     4797_45=parseInt(_46.id.match(/[0-9]+$/)[0],10).succ(); 
     4798} 
     4799var _47=this.buildTabSet($(_44),_45,this.tabs.length); 
     4800var _48=_47.tab.toElements(); 
     4801this.tabContainer.appendChild(_48[0]); 
     4802if(_48[1]){ 
     4803this.tabContainer.appendChild(_48[1]); 
     4804} 
     4805this.panelContainer.appendChild(_47.panel.toElement()); 
    47964806this.tabs[this.tabs.length-1]=$(this.tabs.last()); 
    47974807this.panelList[this.panelList.length-1]=$(this.panelList.last()); 
     
    48014811this.setDrag(); 
    48024812} 
    4803 },add:function(_48,_49){ 
    4804 var _4a=[]; 
    4805 var _4b=Builder.node("div"); 
    4806 _4b.innerHTML=_48
    4807 _4a.push(_4b); 
    4808 _4b=Builder.node("div"); 
    4809 _4b.innerHTML=_49
    4810 _4a.push(_4b); 
    4811 this.addByElement(Builder.node("div",_4a)); 
    4812 },lazyLoad:function(_4c){ 
     4813},add:function(_49,_4a){ 
     4814var _4b=[]; 
     4815var _4c=Builder.node("div"); 
     4816_4c.innerHTML=_49
     4817_4b.push(_4c); 
     4818_4c=Builder.node("div"); 
     4819_4c.innerHTML=_4a
     4820_4b.push(_4c); 
     4821this.addByElement(Builder.node("div",_4b)); 
     4822},lazyLoad:function(_4d){ 
    48134823this.errorCount=0; 
    48144824this.loadedList=[]; 
    4815 this.load(_4c); 
    4816 },load:function(_4d){ 
    4817 var _4e=this.panelList[_4d]; 
    4818 var url=this.options.lazyLoadUrl[_4d]; 
    4819 var _50=this; 
    4820 if(_4e&&url){ 
    4821 new Ajax.Updater({success:_4e},url,{onSuccess:function(){ 
    4822 _50.setLoaded(_4d); 
    4823 _50.options.onLazyLoad(_4e,_50); 
    4824 _50.load(++_4d); 
    4825 if(_50.isFinishLazyLoad()){ 
    4826 _50.options.afterLazyLoad(_50); 
     4825this.load(_4d); 
     4826},load:function(_4e){ 
     4827var _4f=this.panelList[_4e]; 
     4828var url=this.options.lazyLoadUrl[_4e]; 
     4829var _51=this; 
     4830if(_4f&&url){ 
     4831new Ajax.Updater({success:_4f},url,{onSuccess:function(){ 
     4832_51.setLoaded(_4e); 
     4833_51.options.onLazyLoad(_4f,_51); 
     4834_51.load(++_4e); 
     4835if(_51.isFinishLazyLoad()){ 
     4836_51.options.afterLazyLoad(_51); 
    48274837} 
    48284838},onFailure:function(){ 
    4829 _50.errorCount++; 
    4830 _50.options.lazyLoadFailure(_4e,_50); 
    4831 if(_50.errorCount<=_50.options.failureLimit){ 
    4832 _50.load(_4d); 
    4833 }else{ 
    4834 _50.options.failureLimitOver(_50); 
     4839_51.errorCount++; 
     4840_51.options.lazyLoadFailure(_4f,_51); 
     4841if(_51.errorCount<=_51.options.failureLimit){ 
     4842_51.load(_4e); 
     4843}else{ 
     4844_51.options.failureLimitOver(_51); 
    48354845} 
    48364846},asynchronous:true,evalScripts:true}); 
     
    48404850},setLoaded:function(i){ 
    48414851this.loadedList.push(i); 
    4842 },onMouseOver:function(_52){ 
    4843 var _53=Event.element(_52); 
    4844 var _54=this.getTargetIndex(_53); 
    4845 if(_54!=this.selected){ 
    4846 var _55=this.tabs[_54]; 
    4847 this.setTabActive(_55); 
    4848 } 
    4849 },onMouseOut:function(_56){ 
    4850 var _57=Event.element(_56); 
    4851 var _58=this.getTargetIndex(_57); 
    4852 if(_58!=this.selected){ 
    4853 var _59=this.tabs[_58]; 
    4854 this.setTabInactive(_59); 
     4852},onMouseOver:function(_53){ 
     4853var _54=Event.element(_53); 
     4854var _55=this.getTargetIndex(_54); 
     4855if(_55!=this.selected){ 
     4856var _56=this.tabs[_55]; 
     4857this.setTabActive(_56); 
     4858} 
     4859},onMouseOut:function(_57){ 
     4860var _58=Event.element(_57); 
     4861var _59=this.getTargetIndex(_58); 
     4862if(_59!=this.selected){ 
     4863var _5a=this.tabs[_59]; 
     4864this.setTabInactive(_5a); 
    48554865} 
    48564866},hasNextTab:function(){ 
     
    48764886},getLastTab:function(){ 
    48774887return this.tabs.last(); 
    4878 },_callBeforeSelect:function(_5c){ 
    4879 var _5d=this._findCallback(this.options.beforeSelect,_5c); 
    4880 return (_5d)?_5d():true; 
    4881 },_callAfterSelect:function(_5e,_5f){ 
    4882 var _60=this._findCallback(this.options.afterSelect,_5e); 
    4883 if(_60){ 
    4884 _60(_5e,_5f); 
    4885 } 
    4886 },_callAfterSelectOnce:function(_61){ 
    4887 var _62=this._findCallback(this.options.afterSelectOnce,_61); 
    4888 if(_62){ 
    4889 _62(_61); 
    4890 } 
    4891 },_findCallback:function(_63,_64){ 
    4892 if(!_63){ 
    4893 return; 
    4894 } 
    4895 if(_63.constructor!=Function){ 
    4896 if(_63.constructor==Array){ 
    4897 _63=_63[this.panelList.indexOf(_64)]; 
    4898 }else{ 
    4899 _63=_63[this.panelList.indexOf(_64).succ()]; 
    4900 } 
    4901 } 
    4902 return _63
     4888},_callBeforeSelect:function(_5d){ 
     4889var _5e=this._findCallback(this.options.beforeSelect,_5d); 
     4890return (_5e)?_5e():true; 
     4891},_callAfterSelect:function(_5f,_60){ 
     4892var _61=this._findCallback(this.options.afterSelect,_5f); 
     4893if(_61){ 
     4894_61(_5f,_60); 
     4895} 
     4896},_callAfterSelectOnce:function(_62){ 
     4897var _63=this._findCallback(this.options.afterSelectOnce,_62); 
     4898if(_63){ 
     4899_63(_62); 
     4900} 
     4901},_findCallback:function(_64,_65){ 
     4902if(!_64){ 
     4903return; 
     4904} 
     4905if(_64.constructor!=Function){ 
     4906if(_64.constructor==Array){ 
     4907_64=_64[this.panelList.indexOf(_65)]; 
     4908}else{ 
     4909_64=_64[this.panelList.indexOf(_65).succ()]; 
     4910} 
     4911} 
     4912return _64
    49034913},_setBrTag:function(){ 
    49044914if(this.options.tabRow){ 
    4905 var _65=this.tabContainer; 
    4906 var _66=[]; 
     4915var _66=this.tabContainer; 
     4916var _67=[]; 
    49074917var brs=[]; 
    4908 Element.getTagNodes(_65).each(function(n){ 
    4909 ((n.tagName.toLowerCase()=="div")?_66:brs).push(n); 
    4910 }); 
    4911 _66.each(function(t,i){ 
     4918Element.getTagNodes(_66).each(function(n){ 
     4919((n.tagName.toLowerCase()=="div")?_67:brs).push(n); 
     4920}); 
     4921_67.each(function(t,i){ 
    49124922if((i.succ()%this.options.tabRow)==0){ 
    49134923if(brs[0]){ 
    4914 _65.insertBefore(brs[0],t.nextSibling); 
     4924_66.insertBefore(brs[0],t.nextSibling); 
    49154925brs.shift(); 
    49164926}else{ 
    4917 _65.insertBefore(Builder.node("br",{style:"clear: both"}),t.nextSibling); 
     4927_66.insertBefore(Builder.node("br",{style:"clear: both"}),t.nextSibling); 
    49184928} 
    49194929} 
  • spinelz/trunk/compress/javascripts/spinelz/tabBox.js

    r5907 r5919  
    126126} 
    127127},getTabText:function(_20){ 
    128 return Element.collectTextNodes(_20).escapeHTML().replace(/"/g,"&quot;").replace(/[\r\n\t\v]/g,"").replace(/(^(\s)*) | ((\s)*$)/g,""); 
    129 },chopTabText:function(_21){ 
    130 _21=_21.unescapeHTML(); 
    131 var _22=this.options.titleLength; 
    132 if(_22&&!isNaN(_22)&&(_21.length>_22)){ 
    133 _21=_21.truncate(_22+3); 
    134 
    135 return _21.escapeHTML(); 
    136 },buildPanel:function(_23,i,_25){ 
    137 _25=_25||i; 
     128var _21=null; 
     129if(Element.isTextNode(_20)){ 
     130_21=_20.nodeValue; 
     131}else{ 
     132if(Element.isElementNode(_20)){ 
     133_21=Element.collectTextNodes(_20); 
     134}else{ 
     135_21=""; 
     136
     137
     138return _21.escapeHTML().replace(/"/g,"&quot;").replace(/[\r\n\t\v]/g,"").replace(/(^(\s)*) | ((\s)*$)/g,""); 
     139},chopTabText:function(_22){ 
     140_22=_22.unescapeHTML(); 
     141var _23=this.options.titleLength; 
     142if(_23&&!isNaN(_23)&&(_22.length>_23)){ 
     143_22=_22.truncate(_23+3); 
     144
     145return _22.escapeHTML(); 
     146},buildPanel:function(_24,i,_26){ 
     147_26=_26||i; 
    138148var id=this.panelId+i; 
    139 this.panelList[_25]=id; 
     149this.panelList[_26]=id; 
    140150return "<div id='"+id+"' style='display: none;'></div>"; 
    141 },holdElements:function(tab,_28,_29){ 
    142 this.holder.push({number:_29,tab:tab,content:_28}); 
    143 var _2a=document.createDocumentFragment(); 
    144 _2a.appendChild(tab); 
    145 _2a.appendChild(_28); 
     151},holdElements:function(tab,_29,_2a){ 
     152this.holder.push({number:_2a,tab:tab,content:_29}); 
     153var _2b=document.createDocumentFragment(); 
     154_2b.appendChild(tab); 
     155_2b.appendChild(_29); 
    146156},selectTab:function(e){ 
    147157if(!e){ 
     
    153163return; 
    154164} 
    155 var _2c=this.getCurrentPanel(); 
    156 var _2d=this.getCurrentTab(); 
    157 var _2e=null; 
     165var _2d=this.getCurrentPanel(); 
     166var _2e=this.getCurrentTab(); 
     167var _2f=null; 
    158168if(e.nodeType){ 
    159 _2e=e; 
    160 }else{ 
    161 _2e=Event.element(e); 
    162 
    163 var _2f=this.getTargetIndex(_2e); 
    164 if(_2f==this.selected){ 
    165 return; 
    166 
    167 var _30=this.panelList[_2f]; 
    168 var _31=this.tabs[_2f]; 
    169 if(this._callBeforeSelect(_30)){ 
     169_2f=e; 
     170}else{ 
     171_2f=Event.element(e); 
     172
     173var _30=this.getTargetIndex(_2f); 
     174if(_30==this.selected){ 
     175return; 
     176
     177var _31=this.panelList[_30]; 
     178var _32=this.tabs[_30]; 
     179if(this._callBeforeSelect(_31)){ 
     180if(_2e){ 
     181this.setTabInactive(_2e); 
     182
     183this.setTabActive(_32); 
    170184if(_2d){ 
    171 this.setTabInactive(_2d); 
    172 
    173 this.setTabActive(_31); 
    174 if(_2c){ 
    175 Element.hide(_2c); 
    176 
    177 Element.show(_30); 
    178 this.selected=_2f; 
    179 this._callAfterSelect(_30,_2c); 
    180 if(!_30.selected){ 
    181 this._callAfterSelectOnce(_30); 
    182 _30.selected=true; 
     185Element.hide(_2d); 
     186
     187Element.show(_31); 
     188this.selected=_30; 
     189this._callAfterSelect(_31,_2d); 
     190if(!_31.selected){ 
     191this._callAfterSelectOnce(_31); 
     192_31.selected=true; 
    183193} 
    184194} 
     
    187197return; 
    188198} 
    189 var _33=$(tab).immediateDescendants(); 
    190 this.css.refreshClassNames(_33[0],"tabLeftActive"); 
    191 this.css.refreshClassNames(_33[1],"tabMiddleActive"); 
    192 this.css.refreshClassNames(_33[2],"tabRightActive"); 
     199var _34=$(tab).immediateDescendants(); 
     200this.css.refreshClassNames(_34[0],"tabLeftActive"); 
     201this.css.refreshClassNames(_34[1],"tabMiddleActive"); 
     202this.css.refreshClassNames(_34[2],"tabRightActive"); 
    193203},setTabInactive:function(tab){ 
    194204if(!$(tab)){ 
    195205return; 
    196206} 
    197 var _35=$(tab).immediateDescendants(); 
    198 this.css.refreshClassNames(_35[0],"tabLeftInactive"); 
    199 this.css.refreshClassNames(_35[1],"tabMiddleInactive"); 
    200 this.css.refreshClassNames(_35[2],"tabRightInactive"); 
    201 },getTargetIndex:function(_36){ 
    202 while(_36){ 
    203 if(_36.id&&_36.id.indexOf(this.tabId,0)>=0){ 
    204 var _37=_36.id.substring(this.tabId.length); 
    205 if(!isNaN(_37)){ 
    206 return this.tabs.indexOf(_36); 
    207 } 
    208 } 
    209 _36=_36.parentNode; 
    210 } 
    211 },onRemove:function(_38){ 
    212 Event.stop(_38); 
    213 var _39=Event.element(_38); 
    214 var _3a=this.getTargetIndex(_39); 
    215 var tab=this.tabs[_3a]; 
     207var _36=$(tab).immediateDescendants(); 
     208this.css.refreshClassNames(_36[0],"tabLeftInactive"); 
     209this.css.refreshClassNames(_36[1],"tabMiddleInactive"); 
     210this.css.refreshClassNames(_36[2],"tabRightInactive"); 
     211},getTargetIndex:function(_37){ 
     212while(_37){ 
     213if(_37.id&&_37.id.indexOf(this.tabId,0)>=0){ 
     214var _38=_37.id.substring(this.tabId.length); 
     215if(!isNaN(_38)){ 
     216return this.tabs.indexOf(_37); 
     217} 
     218} 
     219_37=_37.parentNode; 
     220} 
     221},onRemove:function(_39){ 
     222Event.stop(_39); 
     223var _3a=Event.element(_39); 
     224var _3b=this.getTargetIndex(_3a); 
     225var tab=this.tabs[_3b]; 
    216226if(r=this.options.onRemove(tab)){ 
    217227this.remove(tab); 
     
    219229},remove:function(tab){ 
    220230if(tab){ 
    221 var _3d=tab.parentNode; 
    222 var _3e=this.getTargetIndex(tab); 
    223 var _3f=this.getNextTab(); 
    224 if(!_3f){ 
    225 _3f=this.getPreviousTab(); 
    226 } 
    227 var _40=this.tabs[this.selected]; 
     231var _3e=tab.parentNode; 
     232var _3f=this.getTargetIndex(tab); 
     233var _40=this.getNextTab(); 
     234if(!_40){ 
     235_40=this.getPreviousTab(); 
     236} 
     237var _41=this.tabs[this.selected]; 
    228238Element.remove(tab); 
    229 Element.remove(this.panelList[_3e]); 
    230 this.tabs[_3e]=null; 
    231 this.panelList[_3e]=null; 
     239Element.remove(this.panelList[_3f]); 
     240this.tabs[_3f]=null; 
     241this.panelList[_3f]=null; 
    232242this.tabs=this.tabs.select(function(t){ 
    233243return t; 
     
    236246return t; 
    237247}); 
    238 if(_3e==this.selected){ 
    239 if(_3f){ 
    240 this.selectTab(_3f); 
    241 } 
    242 }else{ 
    243 this.selected=this.getTargetIndex(_40); 
     248if(_3f==this.selected){ 
     249if(_40){ 
     250this.selectTab(_40); 
     251} 
     252}else{ 
     253this.selected=this.getTargetIndex(_41); 
    244254} 
    245255this._setBrTag(); 
    246256} 
    247 },addByElement:function(_43){ 
     257},addByElement:function(_44){ 
    248258this.holder=[]; 
    249259this.ids=[]; 
    250260this.contents=[]; 
    251 var _44=0; 
    252 var _45=this.getLastTab(); 
    253 if(_45){ 
    254 _44=parseInt(_45.id.match(/[0-9]+$/)[0],10).succ(); 
    255 } 
    256 var _46=this.buildTabSet($(_43),_44,this.tabs.length); 
    257 var _47=_46.tab.toElements(); 
    258 this.tabContainer.appendChild(_47[0]); 
    259 if(_47[1]){ 
    260 this.tabContainer.appendChild(_47[1]); 
    261 } 
    262 this.panelContainer.appendChild(_46.panel.toElement()); 
     261var _45=0; 
     262var _46=this.getLastTab(); 
     263if(_46){ 
     264_45=parseInt(_46.id.match(/[0-9]+$/)[0],10).succ(); 
     265} 
     266var _47=this.buildTabSet($(_44),_45,this.tabs.length); 
     267var _48=_47.tab.toElements(); 
     268this.tabContainer.appendChild(_48[0]); 
     269if(_48[1]){ 
     270this.tabContainer.appendChild(_48[1]); 
     271} 
     272this.panelContainer.appendChild(_47.panel.toElement()); 
    263273this.tabs[this.tabs.length-1]=$(this.tabs.last()); 
    264274this.panelList[this.panelList.length-1]=$(this.panelList.last()); 
     
    268278this.setDrag(); 
    269279} 
    270 },add:function(_48,_49){ 
    271 var _4a=[]; 
    272 var _4b=Builder.node("div"); 
    273 _4b.innerHTML=_48
    274 _4a.push(_4b); 
    275 _4b=Builder.node("div"); 
    276 _4b.innerHTML=_49
    277 _4a.push(_4b); 
    278 this.addByElement(Builder.node("div",_4a)); 
    279 },lazyLoad:function(_4c){ 
     280},add:function(_49,_4a){ 
     281var _4b=[]; 
     282var _4c=Builder.node("div"); 
     283_4c.innerHTML=_49
     284_4b.push(_4c); 
     285_4c=Builder.node("div"); 
     286_4c.innerHTML=_4a
     287_4b.push(_4c); 
     288this.addByElement(Builder.node("div",_4b)); 
     289},lazyLoad:function(_4d){ 
    280290this.errorCount=0; 
    281291this.loadedList=[]; 
    282 this.load(_4c); 
    283 },load:function(_4d){ 
    284 var _4e=this.panelList[_4d]; 
    285 var url=this.options.lazyLoadUrl[_4d]; 
    286 var _50=this; 
    287 if(_4e&&url){ 
    288 new Ajax.Updater({success:_4e},url,{onSuccess:function(){ 
    289 _50.setLoaded(_4d); 
    290 _50.options.onLazyLoad(_4e,_50); 
    291 _50.load(++_4d); 
    292 if(_50.isFinishLazyLoad()){ 
    293 _50.options.afterLazyLoad(_50); 
     292this.load(_4d); 
     293},load:function(_4e){ 
     294var _4f=this.panelList[_4e]; 
     295var url=this.options.lazyLoadUrl[_4e]; 
     296var _51=this; 
     297if(_4f&&url){ 
     298new Ajax.Updater({success:_4f},url,{onSuccess:function(){ 
     299_51.setLoaded(_4e); 
     300_51.options.onLazyLoad(_4f,_51); 
     301_51.load(++_4e); 
     302if(_51.isFinishLazyLoad()){ 
     303_51.options.afterLazyLoad(_51); 
    294304} 
    295305},onFailure:function(){ 
    296 _50.errorCount++; 
    297 _50.options.lazyLoadFailure(_4e,_50); 
    298 if(_50.errorCount<=_50.options.failureLimit){ 
    299 _50.load(_4d); 
    300 }else{ 
    301 _50.options.failureLimitOver(_50); 
     306_51.errorCount++; 
     307_51.options.lazyLoadFailure(_4f,_51); 
     308if(_51.errorCount<=_51.options.failureLimit){ 
     309_51.load(_4e); 
     310}else{ 
     311_51.options.failureLimitOver(_51); 
    302312} 
    303313},asynchronous:true,evalScripts:true}); 
     
    307317},setLoaded:function(i){ 
    308318this.loadedList.push(i); 
    309 },onMouseOver:function(_52){ 
    310 var _53=Event.element(_52); 
    311 var _54=this.getTargetIndex(_53); 
    312 if(_54!=this.selected){ 
    313 var _55=this.tabs[_54]; 
    314 this.setTabActive(_55); 
    315 } 
    316 },onMouseOut:function(_56){ 
    317 var _57=Event.element(_56); 
    318 var _58=this.getTargetIndex(_57); 
    319 if(_58!=this.selected){ 
    320 var _59=this.tabs[_58]; 
    321 this.setTabInactive(_59); 
     319},onMouseOver:function(_53){ 
     320var _54=Event.element(_53); 
     321var _55=this.getTargetIndex(_54); 
     322if(_55!=this.selected){ 
     323var _56=this.tabs[_55]; 
     324this.setTabActive(_56); 
     325} 
     326},onMouseOut:function(_57){ 
     327var _58=Event.element(_57); 
     328var _59=this.getTargetIndex(_58); 
     329if(_59!=this.selected){ 
     330var _5a=this.tabs[_59]; 
     331this.setTabInactive(_5a); 
    322332} 
    323333},hasNextTab:function(){ 
     
    343353},getLastTab:function(){ 
    344354return this.tabs.last(); 
    345 },_callBeforeSelect:function(_5c){ 
    346 var _5d=this._findCallback(this.options.beforeSelect,_5c); 
    347 return (_5d)?_5d():true; 
    348 },_callAfterSelect:function(_5e,_5f){ 
    349 var _60=this._findCallback(this.options.afterSelect,_5e); 
    350 if(_60){ 
    351 _60(_5e,_5f); 
    352 } 
    353 },_callAfterSelectOnce:function(_61){ 
    354 var _62=this._findCallback(this.options.afterSelectOnce,_61); 
    355 if(_62){ 
    356 _62(_61); 
    357 } 
    358 },_findCallback:function(_63,_64){ 
    359 if(!_63){ 
    360 return; 
    361 } 
    362 if(_63.constructor!=Function){ 
    363 if(_63.constructor==Array){ 
    364 _63=_63[this.panelList.indexOf(_64)]; 
    365 }else{ 
    366 _63=_63[this.panelList.indexOf(_64).succ()]; 
    367 } 
    368 } 
    369 return _63
     355},_callBeforeSelect:function(_5d){ 
     356var _5e=this._findCallback(this.options.beforeSelect,_5d); 
     357return (_5e)?_5e():true; 
     358},_callAfterSelect:function(_5f,_60){ 
     359var _61=this._findCallback(this.options.afterSelect,_5f); 
     360if(_61){ 
     361_61(_5f,_60); 
     362} 
     363},_callAfterSelectOnce:function(_62){ 
     364var _63=this._findCallback(this.options.afterSelectOnce,_62); 
     365if(_63){ 
     366_63(_62); 
     367} 
     368},_findCallback:function(_64,_65){ 
     369if(!_64){ 
     370return; 
     371} 
     372if(_64.constructor!=Function){ 
     373if(_64.constructor==Array){ 
     374_64=_64[this.panelList.indexOf(_65)]; 
     375}else{ 
     376_64=_64[this.panelList.indexOf(_65).succ()]; 
     377} 
     378} 
     379return _64
    370380},_setBrTag:function(){ 
    371381if(this.options.tabRow){ 
    372 var _65=this.tabContainer; 
    373 var _66=[]; 
     382var _66=this.tabContainer; 
     383var _67=[]; 
    374384var brs=[]; 
    375 Element.getTagNodes(_65).each(function(n){ 
    376 ((n.tagName.toLowerCase()=="div")?_66:brs).push(n); 
    377 }); 
    378 _66.each(function(t,i){ 
     385Element.getTagNodes(_66).each(function(n){ 
     386((n.tagName.toLowerCase()=="div")?_67:brs).push(n); 
     387}); 
     388_67.each(function(t,i){ 
    379389if((i.succ()%this.options.tabRow)==0){ 
    380390if(brs[0]){ 
    381 _65.insertBefore(brs[0],t.nextSibling); 
     391_66.insertBefore(brs[0],t.nextSibling); 
    382392brs.shift(); 
    383393}else{ 
    384 _65.insertBefore(Builder.node("br",{style:"clear: both"}),t.nextSibling); 
     394_66.insertBefore(Builder.node("br",{style:"clear: both"}),t.nextSibling); 
    385395} 
    386396} 
  • spinelz/trunk/src/javascripts/spinelz/tabBox.js

    r5907 r5919  
    223223 
    224224  getTabText: function(element) { 
    225     return Element.collectTextNodes(element).escapeHTML().replace(/"/g, '&quot;'). 
    226       replace(/[\r\n\t\v]/g, '').replace(/(^(\s)*) | ((\s)*$)/g, ''); 
     225    var text = null; 
     226    if (Element.isTextNode(element)) { 
     227      text = element.nodeValue; 
     228    } else if (Element.isElementNode(element)) { 
     229      text = Element.collectTextNodes(element); 
     230    } else { 
     231      text = ''; 
     232    } 
     233    return text.escapeHTML().replace(/"/g, '&quot;').replace(/[\r\n\t\v]/g, '').replace(/(^(\s)*) | ((\s)*$)/g, ''); 
    227234  }, 
    228235