- Timestamp:
- 08/21/08 15:56:22 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
spinelz/trunk/compress/javascripts/spinelz/spinelz_for_rubricks.js
r5916 r5919 4659 4659 } 4660 4660 },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; 4661 var _21=null; 4662 if(Element.isTextNode(_20)){ 4663 _21=_20.nodeValue; 4664 }else{ 4665 if(Element.isElementNode(_20)){ 4666 _21=Element.collectTextNodes(_20); 4667 }else{ 4668 _21=""; 4669 } 4670 } 4671 return _21.escapeHTML().replace(/"/g,""").replace(/[\r\n\t\v]/g,"").replace(/(^(\s)*) | ((\s)*$)/g,""); 4672 },chopTabText:function(_22){ 4673 _22=_22.unescapeHTML(); 4674 var _23=this.options.titleLength; 4675 if(_23&&!isNaN(_23)&&(_22.length>_23)){ 4676 _22=_22.truncate(_23+3); 4677 } 4678 return _22.escapeHTML(); 4679 },buildPanel:function(_24,i,_26){ 4680 _26=_26||i; 4671 4681 var id=this.panelId+i; 4672 this.panelList[_2 5]=id;4682 this.panelList[_26]=id; 4673 4683 return "<div id='"+id+"' style='display: none;'></div>"; 4674 },holdElements:function(tab,_2 8,_29){4675 this.holder.push({number:_2 9,tab:tab,content:_28});4676 var _2 a=document.createDocumentFragment();4677 _2 a.appendChild(tab);4678 _2 a.appendChild(_28);4684 },holdElements:function(tab,_29,_2a){ 4685 this.holder.push({number:_2a,tab:tab,content:_29}); 4686 var _2b=document.createDocumentFragment(); 4687 _2b.appendChild(tab); 4688 _2b.appendChild(_29); 4679 4689 },selectTab:function(e){ 4680 4690 if(!e){ … … 4686 4696 return; 4687 4697 } 4688 var _2 c=this.getCurrentPanel();4689 var _2 d=this.getCurrentTab();4690 var _2 e=null;4698 var _2d=this.getCurrentPanel(); 4699 var _2e=this.getCurrentTab(); 4700 var _2f=null; 4691 4701 if(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 } 4706 var _30=this.getTargetIndex(_2f); 4707 if(_30==this.selected){ 4708 return; 4709 } 4710 var _31=this.panelList[_30]; 4711 var _32=this.tabs[_30]; 4712 if(this._callBeforeSelect(_31)){ 4713 if(_2e){ 4714 this.setTabInactive(_2e); 4715 } 4716 this.setTabActive(_32); 4703 4717 if(_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; 4718 Element.hide(_2d); 4719 } 4720 Element.show(_31); 4721 this.selected=_30; 4722 this._callAfterSelect(_31,_2d); 4723 if(!_31.selected){ 4724 this._callAfterSelectOnce(_31); 4725 _31.selected=true; 4716 4726 } 4717 4727 } … … 4720 4730 return; 4721 4731 } 4722 var _3 3=$(tab).immediateDescendants();4723 this.css.refreshClassNames(_3 3[0],"tabLeftActive");4724 this.css.refreshClassNames(_3 3[1],"tabMiddleActive");4725 this.css.refreshClassNames(_3 3[2],"tabRightActive");4732 var _34=$(tab).immediateDescendants(); 4733 this.css.refreshClassNames(_34[0],"tabLeftActive"); 4734 this.css.refreshClassNames(_34[1],"tabMiddleActive"); 4735 this.css.refreshClassNames(_34[2],"tabRightActive"); 4726 4736 },setTabInactive:function(tab){ 4727 4737 if(!$(tab)){ 4728 4738 return; 4729 4739 } 4730 var _3 5=$(tab).immediateDescendants();4731 this.css.refreshClassNames(_3 5[0],"tabLeftInactive");4732 this.css.refreshClassNames(_3 5[1],"tabMiddleInactive");4733 this.css.refreshClassNames(_3 5[2],"tabRightInactive");4734 },getTargetIndex:function(_3 6){4735 while(_3 6){4736 if(_3 6.id&&_36.id.indexOf(this.tabId,0)>=0){4737 var _3 7=_36.id.substring(this.tabId.length);4738 if(!isNaN(_3 7)){4739 return this.tabs.indexOf(_3 6);4740 } 4741 } 4742 _3 6=_36.parentNode;4743 } 4744 },onRemove:function(_3 8){4745 Event.stop(_3 8);4746 var _3 9=Event.element(_38);4747 var _3 a=this.getTargetIndex(_39);4748 var tab=this.tabs[_3 a];4740 var _36=$(tab).immediateDescendants(); 4741 this.css.refreshClassNames(_36[0],"tabLeftInactive"); 4742 this.css.refreshClassNames(_36[1],"tabMiddleInactive"); 4743 this.css.refreshClassNames(_36[2],"tabRightInactive"); 4744 },getTargetIndex:function(_37){ 4745 while(_37){ 4746 if(_37.id&&_37.id.indexOf(this.tabId,0)>=0){ 4747 var _38=_37.id.substring(this.tabId.length); 4748 if(!isNaN(_38)){ 4749 return this.tabs.indexOf(_37); 4750 } 4751 } 4752 _37=_37.parentNode; 4753 } 4754 },onRemove:function(_39){ 4755 Event.stop(_39); 4756 var _3a=Event.element(_39); 4757 var _3b=this.getTargetIndex(_3a); 4758 var tab=this.tabs[_3b]; 4749 4759 if(r=this.options.onRemove(tab)){ 4750 4760 this.remove(tab); … … 4752 4762 },remove:function(tab){ 4753 4763 if(tab){ 4754 var _3 d=tab.parentNode;4755 var _3 e=this.getTargetIndex(tab);4756 var _ 3f=this.getNextTab();4757 if(!_ 3f){4758 _ 3f=this.getPreviousTab();4759 } 4760 var _4 0=this.tabs[this.selected];4764 var _3e=tab.parentNode; 4765 var _3f=this.getTargetIndex(tab); 4766 var _40=this.getNextTab(); 4767 if(!_40){ 4768 _40=this.getPreviousTab(); 4769 } 4770 var _41=this.tabs[this.selected]; 4761 4771 Element.remove(tab); 4762 Element.remove(this.panelList[_3 e]);4763 this.tabs[_3 e]=null;4764 this.panelList[_3 e]=null;4772 Element.remove(this.panelList[_3f]); 4773 this.tabs[_3f]=null; 4774 this.panelList[_3f]=null; 4765 4775 this.tabs=this.tabs.select(function(t){ 4766 4776 return t; … … 4769 4779 return t; 4770 4780 }); 4771 if(_3 e==this.selected){4772 if(_ 3f){4773 this.selectTab(_ 3f);4774 } 4775 }else{ 4776 this.selected=this.getTargetIndex(_4 0);4781 if(_3f==this.selected){ 4782 if(_40){ 4783 this.selectTab(_40); 4784 } 4785 }else{ 4786 this.selected=this.getTargetIndex(_41); 4777 4787 } 4778 4788 this._setBrTag(); 4779 4789 } 4780 },addByElement:function(_4 3){4790 },addByElement:function(_44){ 4781 4791 this.holder=[]; 4782 4792 this.ids=[]; 4783 4793 this.contents=[]; 4784 var _4 4=0;4785 var _4 5=this.getLastTab();4786 if(_4 5){4787 _4 4=parseInt(_45.id.match(/[0-9]+$/)[0],10).succ();4788 } 4789 var _4 6=this.buildTabSet($(_43),_44,this.tabs.length);4790 var _4 7=_46.tab.toElements();4791 this.tabContainer.appendChild(_4 7[0]);4792 if(_4 7[1]){4793 this.tabContainer.appendChild(_4 7[1]);4794 } 4795 this.panelContainer.appendChild(_4 6.panel.toElement());4794 var _45=0; 4795 var _46=this.getLastTab(); 4796 if(_46){ 4797 _45=parseInt(_46.id.match(/[0-9]+$/)[0],10).succ(); 4798 } 4799 var _47=this.buildTabSet($(_44),_45,this.tabs.length); 4800 var _48=_47.tab.toElements(); 4801 this.tabContainer.appendChild(_48[0]); 4802 if(_48[1]){ 4803 this.tabContainer.appendChild(_48[1]); 4804 } 4805 this.panelContainer.appendChild(_47.panel.toElement()); 4796 4806 this.tabs[this.tabs.length-1]=$(this.tabs.last()); 4797 4807 this.panelList[this.panelList.length-1]=$(this.panelList.last()); … … 4801 4811 this.setDrag(); 4802 4812 } 4803 },add:function(_4 8,_49){4804 var _4 a=[];4805 var _4 b=Builder.node("div");4806 _4 b.innerHTML=_48;4807 _4 a.push(_4b);4808 _4 b=Builder.node("div");4809 _4 b.innerHTML=_49;4810 _4 a.push(_4b);4811 this.addByElement(Builder.node("div",_4 a));4812 },lazyLoad:function(_4 c){4813 },add:function(_49,_4a){ 4814 var _4b=[]; 4815 var _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); 4821 this.addByElement(Builder.node("div",_4b)); 4822 },lazyLoad:function(_4d){ 4813 4823 this.errorCount=0; 4814 4824 this.loadedList=[]; 4815 this.load(_4 c);4816 },load:function(_4 d){4817 var _4 e=this.panelList[_4d];4818 var url=this.options.lazyLoadUrl[_4 d];4819 var _5 0=this;4820 if(_4 e&&url){4821 new Ajax.Updater({success:_4 e},url,{onSuccess:function(){4822 _5 0.setLoaded(_4d);4823 _5 0.options.onLazyLoad(_4e,_50);4824 _5 0.load(++_4d);4825 if(_5 0.isFinishLazyLoad()){4826 _5 0.options.afterLazyLoad(_50);4825 this.load(_4d); 4826 },load:function(_4e){ 4827 var _4f=this.panelList[_4e]; 4828 var url=this.options.lazyLoadUrl[_4e]; 4829 var _51=this; 4830 if(_4f&&url){ 4831 new Ajax.Updater({success:_4f},url,{onSuccess:function(){ 4832 _51.setLoaded(_4e); 4833 _51.options.onLazyLoad(_4f,_51); 4834 _51.load(++_4e); 4835 if(_51.isFinishLazyLoad()){ 4836 _51.options.afterLazyLoad(_51); 4827 4837 } 4828 4838 },onFailure:function(){ 4829 _5 0.errorCount++;4830 _5 0.options.lazyLoadFailure(_4e,_50);4831 if(_5 0.errorCount<=_50.options.failureLimit){4832 _5 0.load(_4d);4833 }else{ 4834 _5 0.options.failureLimitOver(_50);4839 _51.errorCount++; 4840 _51.options.lazyLoadFailure(_4f,_51); 4841 if(_51.errorCount<=_51.options.failureLimit){ 4842 _51.load(_4e); 4843 }else{ 4844 _51.options.failureLimitOver(_51); 4835 4845 } 4836 4846 },asynchronous:true,evalScripts:true}); … … 4840 4850 },setLoaded:function(i){ 4841 4851 this.loadedList.push(i); 4842 },onMouseOver:function(_5 2){4843 var _5 3=Event.element(_52);4844 var _5 4=this.getTargetIndex(_53);4845 if(_5 4!=this.selected){4846 var _5 5=this.tabs[_54];4847 this.setTabActive(_5 5);4848 } 4849 },onMouseOut:function(_5 6){4850 var _5 7=Event.element(_56);4851 var _5 8=this.getTargetIndex(_57);4852 if(_5 8!=this.selected){4853 var _5 9=this.tabs[_58];4854 this.setTabInactive(_5 9);4852 },onMouseOver:function(_53){ 4853 var _54=Event.element(_53); 4854 var _55=this.getTargetIndex(_54); 4855 if(_55!=this.selected){ 4856 var _56=this.tabs[_55]; 4857 this.setTabActive(_56); 4858 } 4859 },onMouseOut:function(_57){ 4860 var _58=Event.element(_57); 4861 var _59=this.getTargetIndex(_58); 4862 if(_59!=this.selected){ 4863 var _5a=this.tabs[_59]; 4864 this.setTabInactive(_5a); 4855 4865 } 4856 4866 },hasNextTab:function(){ … … 4876 4886 },getLastTab:function(){ 4877 4887 return this.tabs.last(); 4878 },_callBeforeSelect:function(_5 c){4879 var _5 d=this._findCallback(this.options.beforeSelect,_5c);4880 return (_5 d)?_5d():true;4881 },_callAfterSelect:function(_5 e,_5f){4882 var _6 0=this._findCallback(this.options.afterSelect,_5e);4883 if(_6 0){4884 _6 0(_5e,_5f);4885 } 4886 },_callAfterSelectOnce:function(_6 1){4887 var _6 2=this._findCallback(this.options.afterSelectOnce,_61);4888 if(_6 2){4889 _6 2(_61);4890 } 4891 },_findCallback:function(_6 3,_64){4892 if(!_6 3){4893 return; 4894 } 4895 if(_6 3.constructor!=Function){4896 if(_6 3.constructor==Array){4897 _6 3=_63[this.panelList.indexOf(_64)];4898 }else{ 4899 _6 3=_63[this.panelList.indexOf(_64).succ()];4900 } 4901 } 4902 return _6 3;4888 },_callBeforeSelect:function(_5d){ 4889 var _5e=this._findCallback(this.options.beforeSelect,_5d); 4890 return (_5e)?_5e():true; 4891 },_callAfterSelect:function(_5f,_60){ 4892 var _61=this._findCallback(this.options.afterSelect,_5f); 4893 if(_61){ 4894 _61(_5f,_60); 4895 } 4896 },_callAfterSelectOnce:function(_62){ 4897 var _63=this._findCallback(this.options.afterSelectOnce,_62); 4898 if(_63){ 4899 _63(_62); 4900 } 4901 },_findCallback:function(_64,_65){ 4902 if(!_64){ 4903 return; 4904 } 4905 if(_64.constructor!=Function){ 4906 if(_64.constructor==Array){ 4907 _64=_64[this.panelList.indexOf(_65)]; 4908 }else{ 4909 _64=_64[this.panelList.indexOf(_65).succ()]; 4910 } 4911 } 4912 return _64; 4903 4913 },_setBrTag:function(){ 4904 4914 if(this.options.tabRow){ 4905 var _6 5=this.tabContainer;4906 var _6 6=[];4915 var _66=this.tabContainer; 4916 var _67=[]; 4907 4917 var brs=[]; 4908 Element.getTagNodes(_6 5).each(function(n){4909 ((n.tagName.toLowerCase()=="div")?_6 6:brs).push(n);4910 }); 4911 _6 6.each(function(t,i){4918 Element.getTagNodes(_66).each(function(n){ 4919 ((n.tagName.toLowerCase()=="div")?_67:brs).push(n); 4920 }); 4921 _67.each(function(t,i){ 4912 4922 if((i.succ()%this.options.tabRow)==0){ 4913 4923 if(brs[0]){ 4914 _6 5.insertBefore(brs[0],t.nextSibling);4924 _66.insertBefore(brs[0],t.nextSibling); 4915 4925 brs.shift(); 4916 4926 }else{ 4917 _6 5.insertBefore(Builder.node("br",{style:"clear: both"}),t.nextSibling);4927 _66.insertBefore(Builder.node("br",{style:"clear: both"}),t.nextSibling); 4918 4928 } 4919 4929 } spinelz/trunk/compress/javascripts/spinelz/tabBox.js
r5907 r5919 126 126 } 127 127 },getTabText:function(_20){ 128 return Element.collectTextNodes(_20).escapeHTML().replace(/"/g,""").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; 128 var _21=null; 129 if(Element.isTextNode(_20)){ 130 _21=_20.nodeValue; 131 }else{ 132 if(Element.isElementNode(_20)){ 133 _21=Element.collectTextNodes(_20); 134 }else{ 135 _21=""; 136 } 137 } 138 return _21.escapeHTML().replace(/"/g,""").replace(/[\r\n\t\v]/g,"").replace(/(^(\s)*) | ((\s)*$)/g,""); 139 },chopTabText:function(_22){ 140 _22=_22.unescapeHTML(); 141 var _23=this.options.titleLength; 142 if(_23&&!isNaN(_23)&&(_22.length>_23)){ 143 _22=_22.truncate(_23+3); 144 } 145 return _22.escapeHTML(); 146 },buildPanel:function(_24,i,_26){ 147 _26=_26||i; 138 148 var id=this.panelId+i; 139 this.panelList[_2 5]=id;149 this.panelList[_26]=id; 140 150 return "<div id='"+id+"' style='display: none;'></div>"; 141 },holdElements:function(tab,_2 8,_29){142 this.holder.push({number:_2 9,tab:tab,content:_28});143 var _2 a=document.createDocumentFragment();144 _2 a.appendChild(tab);145 _2 a.appendChild(_28);151 },holdElements:function(tab,_29,_2a){ 152 this.holder.push({number:_2a,tab:tab,content:_29}); 153 var _2b=document.createDocumentFragment(); 154 _2b.appendChild(tab); 155 _2b.appendChild(_29); 146 156 },selectTab:function(e){ 147 157 if(!e){ … … 153 163 return; 154 164 } 155 var _2 c=this.getCurrentPanel();156 var _2 d=this.getCurrentTab();157 var _2 e=null;165 var _2d=this.getCurrentPanel(); 166 var _2e=this.getCurrentTab(); 167 var _2f=null; 158 168 if(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 } 173 var _30=this.getTargetIndex(_2f); 174 if(_30==this.selected){ 175 return; 176 } 177 var _31=this.panelList[_30]; 178 var _32=this.tabs[_30]; 179 if(this._callBeforeSelect(_31)){ 180 if(_2e){ 181 this.setTabInactive(_2e); 182 } 183 this.setTabActive(_32); 170 184 if(_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; 185 Element.hide(_2d); 186 } 187 Element.show(_31); 188 this.selected=_30; 189 this._callAfterSelect(_31,_2d); 190 if(!_31.selected){ 191 this._callAfterSelectOnce(_31); 192 _31.selected=true; 183 193 } 184 194 } … … 187 197 return; 188 198 } 189 var _3 3=$(tab).immediateDescendants();190 this.css.refreshClassNames(_3 3[0],"tabLeftActive");191 this.css.refreshClassNames(_3 3[1],"tabMiddleActive");192 this.css.refreshClassNames(_3 3[2],"tabRightActive");199 var _34=$(tab).immediateDescendants(); 200 this.css.refreshClassNames(_34[0],"tabLeftActive"); 201 this.css.refreshClassNames(_34[1],"tabMiddleActive"); 202 this.css.refreshClassNames(_34[2],"tabRightActive"); 193 203 },setTabInactive:function(tab){ 194 204 if(!$(tab)){ 195 205 return; 196 206 } 197 var _3 5=$(tab).immediateDescendants();198 this.css.refreshClassNames(_3 5[0],"tabLeftInactive");199 this.css.refreshClassNames(_3 5[1],"tabMiddleInactive");200 this.css.refreshClassNames(_3 5[2],"tabRightInactive");201 },getTargetIndex:function(_3 6){202 while(_3 6){203 if(_3 6.id&&_36.id.indexOf(this.tabId,0)>=0){204 var _3 7=_36.id.substring(this.tabId.length);205 if(!isNaN(_3 7)){206 return this.tabs.indexOf(_3 6);207 } 208 } 209 _3 6=_36.parentNode;210 } 211 },onRemove:function(_3 8){212 Event.stop(_3 8);213 var _3 9=Event.element(_38);214 var _3 a=this.getTargetIndex(_39);215 var tab=this.tabs[_3 a];207 var _36=$(tab).immediateDescendants(); 208 this.css.refreshClassNames(_36[0],"tabLeftInactive"); 209 this.css.refreshClassNames(_36[1],"tabMiddleInactive"); 210 this.css.refreshClassNames(_36[2],"tabRightInactive"); 211 },getTargetIndex:function(_37){ 212 while(_37){ 213 if(_37.id&&_37.id.indexOf(this.tabId,0)>=0){ 214 var _38=_37.id.substring(this.tabId.length); 215 if(!isNaN(_38)){ 216 return this.tabs.indexOf(_37); 217 } 218 } 219 _37=_37.parentNode; 220 } 221 },onRemove:function(_39){ 222 Event.stop(_39); 223 var _3a=Event.element(_39); 224 var _3b=this.getTargetIndex(_3a); 225 var tab=this.tabs[_3b]; 216 226 if(r=this.options.onRemove(tab)){ 217 227 this.remove(tab); … … 219 229 },remove:function(tab){ 220 230 if(tab){ 221 var _3 d=tab.parentNode;222 var _3 e=this.getTargetIndex(tab);223 var _ 3f=this.getNextTab();224 if(!_ 3f){225 _ 3f=this.getPreviousTab();226 } 227 var _4 0=this.tabs[this.selected];231 var _3e=tab.parentNode; 232 var _3f=this.getTargetIndex(tab); 233 var _40=this.getNextTab(); 234 if(!_40){ 235 _40=this.getPreviousTab(); 236 } 237 var _41=this.tabs[this.selected]; 228 238 Element.remove(tab); 229 Element.remove(this.panelList[_3 e]);230 this.tabs[_3 e]=null;231 this.panelList[_3 e]=null;239 Element.remove(this.panelList[_3f]); 240 this.tabs[_3f]=null; 241 this.panelList[_3f]=null; 232 242 this.tabs=this.tabs.select(function(t){ 233 243 return t; … … 236 246 return t; 237 247 }); 238 if(_3 e==this.selected){239 if(_ 3f){240 this.selectTab(_ 3f);241 } 242 }else{ 243 this.selected=this.getTargetIndex(_4 0);248 if(_3f==this.selected){ 249 if(_40){ 250 this.selectTab(_40); 251 } 252 }else{ 253 this.selected=this.getTargetIndex(_41); 244 254 } 245 255 this._setBrTag(); 246 256 } 247 },addByElement:function(_4 3){257 },addByElement:function(_44){ 248 258 this.holder=[]; 249 259 this.ids=[]; 250 260 this.contents=[]; 251 var _4 4=0;252 var _4 5=this.getLastTab();253 if(_4 5){254 _4 4=parseInt(_45.id.match(/[0-9]+$/)[0],10).succ();255 } 256 var _4 6=this.buildTabSet($(_43),_44,this.tabs.length);257 var _4 7=_46.tab.toElements();258 this.tabContainer.appendChild(_4 7[0]);259 if(_4 7[1]){260 this.tabContainer.appendChild(_4 7[1]);261 } 262 this.panelContainer.appendChild(_4 6.panel.toElement());261 var _45=0; 262 var _46=this.getLastTab(); 263 if(_46){ 264 _45=parseInt(_46.id.match(/[0-9]+$/)[0],10).succ(); 265 } 266 var _47=this.buildTabSet($(_44),_45,this.tabs.length); 267 var _48=_47.tab.toElements(); 268 this.tabContainer.appendChild(_48[0]); 269 if(_48[1]){ 270 this.tabContainer.appendChild(_48[1]); 271 } 272 this.panelContainer.appendChild(_47.panel.toElement()); 263 273 this.tabs[this.tabs.length-1]=$(this.tabs.last()); 264 274 this.panelList[this.panelList.length-1]=$(this.panelList.last()); … … 268 278 this.setDrag(); 269 279 } 270 },add:function(_4 8,_49){271 var _4 a=[];272 var _4 b=Builder.node("div");273 _4 b.innerHTML=_48;274 _4 a.push(_4b);275 _4 b=Builder.node("div");276 _4 b.innerHTML=_49;277 _4 a.push(_4b);278 this.addByElement(Builder.node("div",_4 a));279 },lazyLoad:function(_4 c){280 },add:function(_49,_4a){ 281 var _4b=[]; 282 var _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); 288 this.addByElement(Builder.node("div",_4b)); 289 },lazyLoad:function(_4d){ 280 290 this.errorCount=0; 281 291 this.loadedList=[]; 282 this.load(_4 c);283 },load:function(_4 d){284 var _4 e=this.panelList[_4d];285 var url=this.options.lazyLoadUrl[_4 d];286 var _5 0=this;287 if(_4 e&&url){288 new Ajax.Updater({success:_4 e},url,{onSuccess:function(){289 _5 0.setLoaded(_4d);290 _5 0.options.onLazyLoad(_4e,_50);291 _5 0.load(++_4d);292 if(_5 0.isFinishLazyLoad()){293 _5 0.options.afterLazyLoad(_50);292 this.load(_4d); 293 },load:function(_4e){ 294 var _4f=this.panelList[_4e]; 295 var url=this.options.lazyLoadUrl[_4e]; 296 var _51=this; 297 if(_4f&&url){ 298 new Ajax.Updater({success:_4f},url,{onSuccess:function(){ 299 _51.setLoaded(_4e); 300 _51.options.onLazyLoad(_4f,_51); 301 _51.load(++_4e); 302 if(_51.isFinishLazyLoad()){ 303 _51.options.afterLazyLoad(_51); 294 304 } 295 305 },onFailure:function(){ 296 _5 0.errorCount++;297 _5 0.options.lazyLoadFailure(_4e,_50);298 if(_5 0.errorCount<=_50.options.failureLimit){299 _5 0.load(_4d);300 }else{ 301 _5 0.options.failureLimitOver(_50);306 _51.errorCount++; 307 _51.options.lazyLoadFailure(_4f,_51); 308 if(_51.errorCount<=_51.options.failureLimit){ 309 _51.load(_4e); 310 }else{ 311 _51.options.failureLimitOver(_51); 302 312 } 303 313 },asynchronous:true,evalScripts:true}); … … 307 317 },setLoaded:function(i){ 308 318 this.loadedList.push(i); 309 },onMouseOver:function(_5 2){310 var _5 3=Event.element(_52);311 var _5 4=this.getTargetIndex(_53);312 if(_5 4!=this.selected){313 var _5 5=this.tabs[_54];314 this.setTabActive(_5 5);315 } 316 },onMouseOut:function(_5 6){317 var _5 7=Event.element(_56);318 var _5 8=this.getTargetIndex(_57);319 if(_5 8!=this.selected){320 var _5 9=this.tabs[_58];321 this.setTabInactive(_5 9);319 },onMouseOver:function(_53){ 320 var _54=Event.element(_53); 321 var _55=this.getTargetIndex(_54); 322 if(_55!=this.selected){ 323 var _56=this.tabs[_55]; 324 this.setTabActive(_56); 325 } 326 },onMouseOut:function(_57){ 327 var _58=Event.element(_57); 328 var _59=this.getTargetIndex(_58); 329 if(_59!=this.selected){ 330 var _5a=this.tabs[_59]; 331 this.setTabInactive(_5a); 322 332 } 323 333 },hasNextTab:function(){ … … 343 353 },getLastTab:function(){ 344 354 return this.tabs.last(); 345 },_callBeforeSelect:function(_5 c){346 var _5 d=this._findCallback(this.options.beforeSelect,_5c);347 return (_5 d)?_5d():true;348 },_callAfterSelect:function(_5 e,_5f){349 var _6 0=this._findCallback(this.options.afterSelect,_5e);350 if(_6 0){351 _6 0(_5e,_5f);352 } 353 },_callAfterSelectOnce:function(_6 1){354 var _6 2=this._findCallback(this.options.afterSelectOnce,_61);355 if(_6 2){356 _6 2(_61);357 } 358 },_findCallback:function(_6 3,_64){359 if(!_6 3){360 return; 361 } 362 if(_6 3.constructor!=Function){363 if(_6 3.constructor==Array){364 _6 3=_63[this.panelList.indexOf(_64)];365 }else{ 366 _6 3=_63[this.panelList.indexOf(_64).succ()];367 } 368 } 369 return _6 3;355 },_callBeforeSelect:function(_5d){ 356 var _5e=this._findCallback(this.options.beforeSelect,_5d); 357 return (_5e)?_5e():true; 358 },_callAfterSelect:function(_5f,_60){ 359 var _61=this._findCallback(this.options.afterSelect,_5f); 360 if(_61){ 361 _61(_5f,_60); 362 } 363 },_callAfterSelectOnce:function(_62){ 364 var _63=this._findCallback(this.options.afterSelectOnce,_62); 365 if(_63){ 366 _63(_62); 367 } 368 },_findCallback:function(_64,_65){ 369 if(!_64){ 370 return; 371 } 372 if(_64.constructor!=Function){ 373 if(_64.constructor==Array){ 374 _64=_64[this.panelList.indexOf(_65)]; 375 }else{ 376 _64=_64[this.panelList.indexOf(_65).succ()]; 377 } 378 } 379 return _64; 370 380 },_setBrTag:function(){ 371 381 if(this.options.tabRow){ 372 var _6 5=this.tabContainer;373 var _6 6=[];382 var _66=this.tabContainer; 383 var _67=[]; 374 384 var brs=[]; 375 Element.getTagNodes(_6 5).each(function(n){376 ((n.tagName.toLowerCase()=="div")?_6 6:brs).push(n);377 }); 378 _6 6.each(function(t,i){385 Element.getTagNodes(_66).each(function(n){ 386 ((n.tagName.toLowerCase()=="div")?_67:brs).push(n); 387 }); 388 _67.each(function(t,i){ 379 389 if((i.succ()%this.options.tabRow)==0){ 380 390 if(brs[0]){ 381 _6 5.insertBefore(brs[0],t.nextSibling);391 _66.insertBefore(brs[0],t.nextSibling); 382 392 brs.shift(); 383 393 }else{ 384 _6 5.insertBefore(Builder.node("br",{style:"clear: both"}),t.nextSibling);394 _66.insertBefore(Builder.node("br",{style:"clear: both"}),t.nextSibling); 385 395 } 386 396 } spinelz/trunk/src/javascripts/spinelz/tabBox.js
r5907 r5919 223 223 224 224 getTabText: function(element) { 225 return Element.collectTextNodes(element).escapeHTML().replace(/"/g, '"'). 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, '"').replace(/[\r\n\t\v]/g, '').replace(/(^(\s)*) | ((\s)*$)/g, ''); 227 234 }, 228 235
