| 
									
										
										
										
											2013-05-22 10:30:33 +08:00
										 |  |  | /* ======================================================================== | 
					
						
							| 
									
										
										
										
											2013-05-17 02:06:30 +08:00
										 |  |  |  * Bootstrap: tab.js v3.0.0 | 
					
						
							| 
									
										
										
										
											2013-07-26 03:24:13 +08:00
										 |  |  |  * http://twbs.github.com/bootstrap/javascript.html#tabs
 | 
					
						
							| 
									
										
										
										
											2013-05-22 10:30:33 +08:00
										 |  |  |  * ======================================================================== | 
					
						
							| 
									
										
										
										
											2012-01-15 15:28:48 +08:00
										 |  |  |  * Copyright 2012 Twitter, Inc. | 
					
						
							| 
									
										
										
										
											2011-11-28 09:04:55 +08:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Licensed under the Apache License, Version 2.0 (the "License"); | 
					
						
							|  |  |  |  * you may not use this file except in compliance with the License. | 
					
						
							|  |  |  |  * You may obtain a copy of the License at | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * http://www.apache.org/licenses/LICENSE-2.0
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Unless required by applicable law or agreed to in writing, software | 
					
						
							|  |  |  |  * distributed under the License is distributed on an "AS IS" BASIS, | 
					
						
							|  |  |  |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
					
						
							|  |  |  |  * See the License for the specific language governing permissions and | 
					
						
							|  |  |  |  * limitations under the License. | 
					
						
							| 
									
										
										
										
											2013-05-22 10:30:33 +08:00
										 |  |  |  * ======================================================================== */ | 
					
						
							| 
									
										
										
										
											2011-11-28 09:04:55 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-22 10:30:33 +08:00
										 |  |  | +function ($) { "use strict"; | 
					
						
							| 
									
										
										
										
											2012-04-15 07:29:53 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  |   // TAB CLASS DEFINITION
 | 
					
						
							|  |  |  |   // ====================
 | 
					
						
							| 
									
										
										
										
											2011-11-28 09:04:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-23 09:28:39 +08:00
										 |  |  |   var Tab = function (element) { | 
					
						
							| 
									
										
										
										
											2011-11-28 09:04:55 +08:00
										 |  |  |     this.element = $(element) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  |   Tab.prototype.show = function () { | 
					
						
							|  |  |  |     var $this    = this.element | 
					
						
							|  |  |  |     var $ul      = $this.closest('ul:not(.dropdown-menu)') | 
					
						
							|  |  |  |     var selector = $this.attr('data-target') | 
					
						
							| 
									
										
										
										
											2011-11-28 09:04:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  |     if (!selector) { | 
					
						
							|  |  |  |       selector = $this.attr('href') | 
					
						
							|  |  |  |       selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
 | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-11-28 09:04:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  |     if ($this.parent('li').hasClass('active')) return | 
					
						
							| 
									
										
										
										
											2011-11-28 09:04:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  |     var previous = $ul.find('.active:last a')[0] | 
					
						
							| 
									
										
										
										
											2013-05-17 11:19:51 +08:00
										 |  |  |     var e        = $.Event('show.bs.tab', { | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  |       relatedTarget: previous | 
					
						
							|  |  |  |     }) | 
					
						
							| 
									
										
										
										
											2011-11-28 09:04:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  |     $this.trigger(e) | 
					
						
							| 
									
										
										
										
											2012-03-25 09:20:09 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  |     if (e.isDefaultPrevented()) return | 
					
						
							| 
									
										
										
										
											2012-03-25 09:20:09 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  |     var $target = $(selector) | 
					
						
							| 
									
										
										
										
											2011-11-28 09:04:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  |     this.activate($this.parent('li'), $ul) | 
					
						
							|  |  |  |     this.activate($target, $target.parent(), function () { | 
					
						
							|  |  |  |       $this.trigger({ | 
					
						
							| 
									
										
										
										
											2013-05-17 11:19:51 +08:00
										 |  |  |         type: 'shown.bs.tab' | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  |       , relatedTarget: previous | 
					
						
							| 
									
										
										
										
											2011-11-28 09:04:55 +08:00
										 |  |  |       }) | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  |     }) | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2011-12-21 11:37:41 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  |   Tab.prototype.activate = function (element, container, callback) { | 
					
						
							|  |  |  |     var $active    = container.find('> .active') | 
					
						
							|  |  |  |     var transition = callback | 
					
						
							|  |  |  |       && $.support.transition | 
					
						
							|  |  |  |       && $active.hasClass('fade') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     function next() { | 
					
						
							|  |  |  |       $active | 
					
						
							|  |  |  |         .removeClass('active') | 
					
						
							|  |  |  |         .find('> .dropdown-menu > .active') | 
					
						
							|  |  |  |         .removeClass('active') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       element.addClass('active') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (transition) { | 
					
						
							|  |  |  |         element[0].offsetWidth // reflow for transition
 | 
					
						
							|  |  |  |         element.addClass('in') | 
					
						
							|  |  |  |       } else { | 
					
						
							|  |  |  |         element.removeClass('fade') | 
					
						
							| 
									
										
										
										
											2011-11-28 09:04:55 +08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2011-12-21 11:37:41 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  |       if (element.parent('.dropdown-menu')) { | 
					
						
							|  |  |  |         element.closest('li.dropdown').addClass('active') | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2011-12-21 11:37:41 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  |       callback && callback() | 
					
						
							| 
									
										
										
										
											2011-11-28 09:04:55 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     transition ? | 
					
						
							| 
									
										
										
										
											2013-07-24 09:44:08 +08:00
										 |  |  |       $active | 
					
						
							|  |  |  |         .one($.support.transition.end, next) | 
					
						
							|  |  |  |         .emulateTransitionEnd(150) : | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  |       next() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $active.removeClass('in') | 
					
						
							| 
									
										
										
										
											2011-11-28 09:04:55 +08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  |   // TAB PLUGIN DEFINITION
 | 
					
						
							|  |  |  |   // =====================
 | 
					
						
							| 
									
										
										
										
											2011-11-28 09:04:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-08 06:06:01 +08:00
										 |  |  |   var old = $.fn.tab | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-21 10:02:47 +08:00
										 |  |  |   $.fn.tab = function ( option ) { | 
					
						
							| 
									
										
										
										
											2011-11-28 09:04:55 +08:00
										 |  |  |     return this.each(function () { | 
					
						
							|  |  |  |       var $this = $(this) | 
					
						
							| 
									
										
										
										
											2013-05-17 11:19:51 +08:00
										 |  |  |       var data  = $this.data('bs.tab') | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 11:19:51 +08:00
										 |  |  |       if (!data) $this.data('bs.tab', (data = new Tab(this))) | 
					
						
							| 
									
										
										
										
											2011-11-28 09:04:55 +08:00
										 |  |  |       if (typeof option == 'string') data[option]() | 
					
						
							|  |  |  |     }) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-21 15:28:48 +08:00
										 |  |  |   $.fn.tab.Constructor = Tab | 
					
						
							| 
									
										
										
										
											2011-11-28 09:04:55 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  |   // TAB NO CONFLICT
 | 
					
						
							|  |  |  |   // ===============
 | 
					
						
							| 
									
										
										
										
											2012-12-08 06:06:01 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   $.fn.tab.noConflict = function () { | 
					
						
							|  |  |  |     $.fn.tab = old | 
					
						
							|  |  |  |     return this | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 08:18:15 +08:00
										 |  |  |   // TAB DATA-API
 | 
					
						
							|  |  |  |   // ============
 | 
					
						
							| 
									
										
										
										
											2011-11-28 09:04:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-17 11:19:51 +08:00
										 |  |  |   $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { | 
					
						
							| 
									
										
										
										
											2012-09-28 06:00:02 +08:00
										 |  |  |     e.preventDefault() | 
					
						
							|  |  |  |     $(this).tab('show') | 
					
						
							| 
									
										
										
										
											2011-11-28 09:04:55 +08:00
										 |  |  |   }) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-23 15:34:27 +08:00
										 |  |  | }(window.jQuery); |