1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/js/bootstrap-tab.js Fri Jul 04 16:42:41 2014 +0400
1.3 @@ -0,0 +1,144 @@
1.4 +/* ========================================================
1.5 + * bootstrap-tab.js v2.3.1
1.6 + * http://twitter.github.com/bootstrap/javascript.html#tabs
1.7 + * ========================================================
1.8 + * Copyright 2012 Twitter, Inc.
1.9 + *
1.10 + * Licensed under the Apache License, Version 2.0 (the "License");
1.11 + * you may not use this file except in compliance with the License.
1.12 + * You may obtain a copy of the License at
1.13 + *
1.14 + * http://www.apache.org/licenses/LICENSE-2.0
1.15 + *
1.16 + * Unless required by applicable law or agreed to in writing, software
1.17 + * distributed under the License is distributed on an "AS IS" BASIS,
1.18 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1.19 + * See the License for the specific language governing permissions and
1.20 + * limitations under the License.
1.21 + * ======================================================== */
1.22 +
1.23 +
1.24 +!function ($) {
1.25 +
1.26 + "use strict"; // jshint ;_;
1.27 +
1.28 +
1.29 + /* TAB CLASS DEFINITION
1.30 + * ==================== */
1.31 +
1.32 + var Tab = function (element) {
1.33 + this.element = $(element)
1.34 + }
1.35 +
1.36 + Tab.prototype = {
1.37 +
1.38 + constructor: Tab
1.39 +
1.40 + , show: function () {
1.41 + var $this = this.element
1.42 + , $ul = $this.closest('ul:not(.dropdown-menu)')
1.43 + , selector = $this.attr('data-target')
1.44 + , previous
1.45 + , $target
1.46 + , e
1.47 +
1.48 + if (!selector) {
1.49 + selector = $this.attr('href')
1.50 + selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
1.51 + }
1.52 +
1.53 + if ( $this.parent('li').hasClass('active') ) return
1.54 +
1.55 + previous = $ul.find('.active:last a')[0]
1.56 +
1.57 + e = $.Event('show', {
1.58 + relatedTarget: previous
1.59 + })
1.60 +
1.61 + $this.trigger(e)
1.62 +
1.63 + if (e.isDefaultPrevented()) return
1.64 +
1.65 + $target = $(selector)
1.66 +
1.67 + this.activate($this.parent('li'), $ul)
1.68 + this.activate($target, $target.parent(), function () {
1.69 + $this.trigger({
1.70 + type: 'shown'
1.71 + , relatedTarget: previous
1.72 + })
1.73 + })
1.74 + }
1.75 +
1.76 + , activate: function ( element, container, callback) {
1.77 + var $active = container.find('> .active')
1.78 + , transition = callback
1.79 + && $.support.transition
1.80 + && $active.hasClass('fade')
1.81 +
1.82 + function next() {
1.83 + $active
1.84 + .removeClass('active')
1.85 + .find('> .dropdown-menu > .active')
1.86 + .removeClass('active')
1.87 +
1.88 + element.addClass('active')
1.89 +
1.90 + if (transition) {
1.91 + element[0].offsetWidth // reflow for transition
1.92 + element.addClass('in')
1.93 + } else {
1.94 + element.removeClass('fade')
1.95 + }
1.96 +
1.97 + if ( element.parent('.dropdown-menu') ) {
1.98 + element.closest('li.dropdown').addClass('active')
1.99 + }
1.100 +
1.101 + callback && callback()
1.102 + }
1.103 +
1.104 + transition ?
1.105 + $active.one($.support.transition.end, next) :
1.106 + next()
1.107 +
1.108 + $active.removeClass('in')
1.109 + }
1.110 + }
1.111 +
1.112 +
1.113 + /* TAB PLUGIN DEFINITION
1.114 + * ===================== */
1.115 +
1.116 + var old = $.fn.tab
1.117 +
1.118 + $.fn.tab = function ( option ) {
1.119 + return this.each(function () {
1.120 + var $this = $(this)
1.121 + , data = $this.data('tab')
1.122 + if (!data) $this.data('tab', (data = new Tab(this)))
1.123 + if (typeof option == 'string') data[option]()
1.124 + })
1.125 + }
1.126 +
1.127 + $.fn.tab.Constructor = Tab
1.128 +
1.129 +
1.130 + /* TAB NO CONFLICT
1.131 + * =============== */
1.132 +
1.133 + $.fn.tab.noConflict = function () {
1.134 + $.fn.tab = old
1.135 + return this
1.136 + }
1.137 +
1.138 +
1.139 + /* TAB DATA-API
1.140 + * ============ */
1.141 +
1.142 + $(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
1.143 + e.preventDefault()
1.144 + $(this).tab('show')
1.145 + })
1.146 +
1.147 +}(window.jQuery);
1.148 \ No newline at end of file