From a91a407bd60a266f928b5fea70d3c4332394b3c8 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Tue, 4 Oct 2011 21:48:53 -0700 Subject: start updating to data- driven js --- js/bootstrap-tabs.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'js/bootstrap-tabs.js') diff --git a/js/bootstrap-tabs.js b/js/bootstrap-tabs.js index 807b366a3..b94adfc25 100644 --- a/js/bootstrap-tabs.js +++ b/js/bootstrap-tabs.js @@ -18,30 +18,36 @@ * ======================================================== */ -(function( $ ){ +!function( $ ){ function activate ( element, container ) { - container.find('.active').removeClass('active') + container.find('> .active').removeClass('active') element.addClass('active') } function tab( e ) { var $this = $(this) + , $ul = $this.closest('ul') , href = $this.attr('href') - , $ul = $(e.liveFired) - , $controlled + , previous if (/^#\w+/.test(href)) { e.preventDefault() - if ($this.hasClass('active')) { + if ($this.parent('li').hasClass('active')) { return } + previous = $ul.find('.active a')[0] $href = $(href) activate($this.parent('li'), $ul) activate($href, $href.parent()) + + $this.trigger({ + type: 'change' + , relatedTarget: previous + }) } } @@ -59,4 +65,4 @@ $('body').tabs('ul[data-tabs] li > a, ul[data-pills] > li > a') }) -})( window.jQuery || window.ender ) \ No newline at end of file +}( window.jQuery || window.ender ); \ No newline at end of file -- cgit v1.2.3 From 8545fe97877dc275df40ab98d408f21ce9a362cf Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Wed, 19 Oct 2011 21:56:06 -0700 Subject: greatly simply js plugins - remove js api where reasonable --- js/bootstrap-tabs.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'js/bootstrap-tabs.js') diff --git a/js/bootstrap-tabs.js b/js/bootstrap-tabs.js index b94adfc25..6ee80429c 100644 --- a/js/bootstrap-tabs.js +++ b/js/bootstrap-tabs.js @@ -55,14 +55,8 @@ /* TABS/PILLS PLUGIN DEFINITION * ============================ */ - $.fn.tabs = $.fn.pills = function ( selector ) { - return this.each(function () { - $(this).delegate(selector || '.tabs li > a, .pills > li > a', 'click', tab) - }) - } - - $(document).ready(function () { - $('body').tabs('ul[data-tabs] li > a, ul[data-pills] > li > a') + $(function () { + $('body').delegate('ul[data-tabs] > li > a, ul[data-pills] > li > a', 'click', tab) }) }( window.jQuery || window.ender ); \ No newline at end of file -- cgit v1.2.3 From 523e02f7df3bb706654b43cf604e61c9396212e1 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Wed, 19 Oct 2011 23:12:50 -0700 Subject: fix scrollspy simplify stuff more - break everything. --- js/bootstrap-tabs.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'js/bootstrap-tabs.js') diff --git a/js/bootstrap-tabs.js b/js/bootstrap-tabs.js index 6ee80429c..86bd4784f 100644 --- a/js/bootstrap-tabs.js +++ b/js/bootstrap-tabs.js @@ -1,5 +1,5 @@ /* ======================================================== - * bootstrap-tabs.js v1.3.0 + * bootstrap-tabs.js v2.0.0 * http://twitter.github.com/bootstrap/javascript.html#tabs * ======================================================== * Copyright 2011 Twitter, Inc. @@ -21,24 +21,33 @@ !function( $ ){ function activate ( element, container ) { - container.find('> .active').removeClass('active') + container + .find('> .active') + .removeClass('active') + .find('> .dropdown-menu > .active') + .removeClass('active') + element.addClass('active') + + if ( element.parent('.dropdown-menu') ) { + element.closest('li.dropdown').addClass('active') + } } function tab( e ) { var $this = $(this) - , $ul = $this.closest('ul') + , $ul = $this.closest('ul:not(.dropdown-menu)') , href = $this.attr('href') , previous - if (/^#\w+/.test(href)) { + if ( /^#\w+/.test(href) ) { e.preventDefault() - if ($this.parent('li').hasClass('active')) { + if ( $this.parent('li').hasClass('active') ) { return } - previous = $ul.find('.active a')[0] + previous = $ul.find('.active a').last()[0] $href = $(href) activate($this.parent('li'), $ul) -- cgit v1.2.3 From 0b1d5d9189ea82cde5e848e5a8771a8f4850e21f Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sun, 20 Nov 2011 18:19:50 -0800 Subject: revert all js stuff back to 1.4 :/ --- js/bootstrap-tabs.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'js/bootstrap-tabs.js') diff --git a/js/bootstrap-tabs.js b/js/bootstrap-tabs.js index 86bd4784f..790180ca2 100644 --- a/js/bootstrap-tabs.js +++ b/js/bootstrap-tabs.js @@ -1,5 +1,5 @@ /* ======================================================== - * bootstrap-tabs.js v2.0.0 + * bootstrap-tabs.js v1.4.0 * http://twitter.github.com/bootstrap/javascript.html#tabs * ======================================================== * Copyright 2011 Twitter, Inc. @@ -20,6 +20,8 @@ !function( $ ){ + "use strict" + function activate ( element, container ) { container .find('> .active') @@ -39,6 +41,7 @@ , $ul = $this.closest('ul:not(.dropdown-menu)') , href = $this.attr('href') , previous + , $href if ( /^#\w+/.test(href) ) { e.preventDefault() @@ -64,8 +67,14 @@ /* TABS/PILLS PLUGIN DEFINITION * ============================ */ - $(function () { - $('body').delegate('ul[data-tabs] > li > a, ul[data-pills] > li > a', 'click', tab) + $.fn.tabs = $.fn.pills = function ( selector ) { + return this.each(function () { + $(this).delegate(selector || '.tabs li > a, .pills > li > a', 'click', tab) + }) + } + + $(document).ready(function () { + $('body').tabs('ul[data-tabs] li > a, ul[data-pills] > li > a') }) }( window.jQuery || window.ender ); \ No newline at end of file -- cgit v1.2.3 From bc65b58551575c9dfb2e4d9f4f7af97009e39432 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sun, 20 Nov 2011 20:58:04 -0800 Subject: merge in js from 1.4... start working through js docs --- js/bootstrap-tabs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/bootstrap-tabs.js') diff --git a/js/bootstrap-tabs.js b/js/bootstrap-tabs.js index 790180ca2..35418fd44 100644 --- a/js/bootstrap-tabs.js +++ b/js/bootstrap-tabs.js @@ -1,5 +1,5 @@ /* ======================================================== - * bootstrap-tabs.js v1.4.0 + * bootstrap-tabs.js v2.0.0 * http://twitter.github.com/bootstrap/javascript.html#tabs * ======================================================== * Copyright 2011 Twitter, Inc. -- cgit v1.2.3 From 3925ea9986e70f5a87883563c47c8ecd3d631c02 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sun, 27 Nov 2011 16:01:26 -0800 Subject: remove trailing semicolons - we'll be hosting minified files with semicolons - no reason to make the dev source ugly --- js/bootstrap-tabs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/bootstrap-tabs.js') diff --git a/js/bootstrap-tabs.js b/js/bootstrap-tabs.js index 35418fd44..bd49e130f 100644 --- a/js/bootstrap-tabs.js +++ b/js/bootstrap-tabs.js @@ -77,4 +77,4 @@ $('body').tabs('ul[data-tabs] li > a, ul[data-pills] > li > a') }) -}( window.jQuery || window.ender ); \ No newline at end of file +}( window.jQuery || window.ender ) \ No newline at end of file -- cgit v1.2.3 From 46fe38386afce7149810b1feb534726735ce28b2 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Sun, 27 Nov 2011 17:04:55 -0800 Subject: rename tabs to tab - clean up lots of api stuff make href acceptable target val --- js/bootstrap-tabs.js | 80 ---------------------------------------------------- 1 file changed, 80 deletions(-) delete mode 100644 js/bootstrap-tabs.js (limited to 'js/bootstrap-tabs.js') diff --git a/js/bootstrap-tabs.js b/js/bootstrap-tabs.js deleted file mode 100644 index bd49e130f..000000000 --- a/js/bootstrap-tabs.js +++ /dev/null @@ -1,80 +0,0 @@ -/* ======================================================== - * bootstrap-tabs.js v2.0.0 - * http://twitter.github.com/bootstrap/javascript.html#tabs - * ======================================================== - * Copyright 2011 Twitter, Inc. - * - * 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. - * ======================================================== */ - - -!function( $ ){ - - "use strict" - - function activate ( element, container ) { - container - .find('> .active') - .removeClass('active') - .find('> .dropdown-menu > .active') - .removeClass('active') - - element.addClass('active') - - if ( element.parent('.dropdown-menu') ) { - element.closest('li.dropdown').addClass('active') - } - } - - function tab( e ) { - var $this = $(this) - , $ul = $this.closest('ul:not(.dropdown-menu)') - , href = $this.attr('href') - , previous - , $href - - if ( /^#\w+/.test(href) ) { - e.preventDefault() - - if ( $this.parent('li').hasClass('active') ) { - return - } - - previous = $ul.find('.active a').last()[0] - $href = $(href) - - activate($this.parent('li'), $ul) - activate($href, $href.parent()) - - $this.trigger({ - type: 'change' - , relatedTarget: previous - }) - } - } - - - /* TABS/PILLS PLUGIN DEFINITION - * ============================ */ - - $.fn.tabs = $.fn.pills = function ( selector ) { - return this.each(function () { - $(this).delegate(selector || '.tabs li > a, .pills > li > a', 'click', tab) - }) - } - - $(document).ready(function () { - $('body').tabs('ul[data-tabs] li > a, ul[data-pills] > li > a') - }) - -}( window.jQuery || window.ender ) \ No newline at end of file -- cgit v1.2.3