]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
if interval is false, do not autocycle the carousel
authorJacob Thornton <jacobthornton@gmail.com>
Mon, 19 Mar 2012 22:48:57 +0000 (15:48 -0700)
committerJacob Thornton <jacobthornton@gmail.com>
Mon, 19 Mar 2012 22:48:57 +0000 (15:48 -0700)
docs/assets/bootstrap.zip
docs/assets/js/bootstrap-carousel.js
docs/assets/js/bootstrap-typeahead.js
docs/javascript.html
docs/templates/pages/javascript.mustache
js/bootstrap-carousel.js

index ff029ffdd3b60596abcacff0274ba4f40ff52090..1a07056b6c05c2398af988b5af035b98291cea0c 100644 (file)
Binary files a/docs/assets/bootstrap.zip and b/docs/assets/bootstrap.zip differ
index 8c0723d280736bbd4ada906e67d8caae6cbe7e0c..287519900506390796418083343213e0a6354e43 100644 (file)
@@ -27,7 +27,7 @@
 
   var Carousel = function (element, options) {
     this.$element = $(element)
-    this.options = $.extend({}, $.fn.carousel.defaults, options)
+    this.options = options
     this.options.slide && this.slide(this.options.slide)
     this.options.pause == 'hover' && this.$element
       .on('mouseenter', $.proxy(this.pause, this))
@@ -37,7 +37,8 @@
   Carousel.prototype = {
 
     cycle: function () {
-      this.interval = setInterval($.proxy(this.next, this), this.options.interval)
+      this.options.interval
+        && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
       return this
     }
 
     return this.each(function () {
       var $this = $(this)
         , data = $this.data('carousel')
-        , options = typeof option == 'object' && option
+        , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
       if (!data) $this.data('carousel', (data = new Carousel(this, options)))
       if (typeof option == 'number') data.to(option)
       else if (typeof option == 'string' || (option = options.slide)) data[option]()
-      else data.cycle()
+      else if (options.interval) data.cycle()
     })
   }
 
index dc2f88221861d17460e895b00566ab3cf079a0ba..804e60dc446cbb65ccd00798625c739c4e0bc2ea 100644 (file)
     }
 
   , highlighter: function (item) {
-      return item.replace(new RegExp('(' + this.query + ')', 'ig'), function ($1, match) {
+      var query = this.query.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
+      return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
         return '<strong>' + match + '</strong>'
       })
     }
index a90562767e32186d12605d2cbbf83a552348a128..54177b56648d110cc3763ef989e20aa6e42baeaa 100644 (file)
@@ -1308,7 +1308,7 @@ $('#myCollapsible').on('hidden', function () {
                <td>interval</td>
                <td>number</td>
                <td>5000</td>
-               <td>The amount of time to delay between automatically cycling an item.</td>
+               <td>The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle.</td>
              </tr>
              <tr>
                <td>pause</td>
index 7fd4c98d0211f26c2f579d8621dc15dee29db879..007974183199873cc17daf3870065dddafec7054 100644 (file)
@@ -1232,7 +1232,7 @@ $('#myCollapsible').on('hidden', function () {
                <td>{{_i}}interval{{/i}}</td>
                <td>{{_i}}number{{/i}}</td>
                <td>5000</td>
-               <td>{{_i}}The amount of time to delay between automatically cycling an item.{{/i}}</td>
+               <td>{{_i}}The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle.{{/i}}</td>
              </tr>
              <tr>
                <td>{{_i}}pause{{/i}}</td>
index 8c0723d280736bbd4ada906e67d8caae6cbe7e0c..287519900506390796418083343213e0a6354e43 100644 (file)
@@ -27,7 +27,7 @@
 
   var Carousel = function (element, options) {
     this.$element = $(element)
-    this.options = $.extend({}, $.fn.carousel.defaults, options)
+    this.options = options
     this.options.slide && this.slide(this.options.slide)
     this.options.pause == 'hover' && this.$element
       .on('mouseenter', $.proxy(this.pause, this))
@@ -37,7 +37,8 @@
   Carousel.prototype = {
 
     cycle: function () {
-      this.interval = setInterval($.proxy(this.next, this), this.options.interval)
+      this.options.interval
+        && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
       return this
     }
 
     return this.each(function () {
       var $this = $(this)
         , data = $this.data('carousel')
-        , options = typeof option == 'object' && option
+        , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
       if (!data) $this.data('carousel', (data = new Carousel(this, options)))
       if (typeof option == 'number') data.to(option)
       else if (typeof option == 'string' || (option = options.slide)) data[option]()
-      else data.cycle()
+      else if (options.interval) data.cycle()
     })
   }