From 5bd8cdca91615dfb502131c276bfc6d8457c5f79 Mon Sep 17 00:00:00 2001 From: fat Date: Wed, 19 Dec 2012 21:36:50 -0800 Subject: =?UTF-8?q?remove=20inside=20support=20from=20tooltip=C2=A0+=20fix?= =?UTF-8?q?=20tooltip=20svg=20support=20+=20change=20makefile=20to=20rely?= =?UTF-8?q?=20on=20local=20npm=20install?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/bootstrap-tooltip.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'js') diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index e7e2d6b3c..3be4a4a82 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -97,7 +97,6 @@ , show: function () { var $tip - , inside , pos , actualWidth , actualHeight @@ -116,19 +115,17 @@ this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement - inside = /in/.test(placement) - $tip .detach() .css({ top: 0, left: 0, display: 'block' }) .insertAfter(this.$element) - pos = this.getPosition(inside) + pos = this.getPosition() actualWidth = $tip[0].offsetWidth actualHeight = $tip[0].offsetHeight - switch (inside ? placement.split(' ')[1] : placement) { + switch (placement) { case 'bottom': tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2} break @@ -193,11 +190,12 @@ return this.getTitle() } - , getPosition: function (inside) { - return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), { - width: this.$element[0].offsetWidth - , height: this.$element[0].offsetHeight - }) + , getPosition: function () { + var el = this.$element[0] + return $.extend(el.getBoundingClientRect ? el.getBoundingClientRect() : { + width: el.offsetWidth + , height: el.offsetHeight + }, this.$element.offset()) } , getTitle: function () { -- cgit v1.2.3 From dc4e80a655509dc1f68d45c950174e79da2f7f08 Mon Sep 17 00:00:00 2001 From: fat Date: Wed, 19 Dec 2012 21:55:23 -0800 Subject: fix ghetto ass timeout shit --- js/bootstrap-typeahead.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/bootstrap-typeahead.js b/js/bootstrap-typeahead.js index 8324e0664..8d31954b1 100644 --- a/js/bootstrap-typeahead.js +++ b/js/bootstrap-typeahead.js @@ -172,6 +172,7 @@ , listen: function () { this.$element + .on('focus', $.proxy(this.focus, this)) .on('blur', $.proxy(this.blur, this)) .on('keypress', $.proxy(this.keypress, this)) .on('keyup', $.proxy(this.keyup, this)) @@ -183,6 +184,7 @@ this.$menu .on('click', $.proxy(this.click, this)) .on('mouseenter', 'li', $.proxy(this.mouseenter, this)) + .on('mouseleave', 'li', $.proxy(this.mouseleave, this)) } , eventSupported: function(eventName) { @@ -256,9 +258,13 @@ e.preventDefault() } + , focus: function (e) { + this.focused = true + } + , blur: function (e) { - var that = this - setTimeout(function () { that.hide() }, 150) + this.focused = false + if (!this.mousedover && this.shown) this.hide() } , click: function (e) { @@ -268,10 +274,16 @@ } , mouseenter: function (e) { + this.mousedover = true this.$menu.find('.active').removeClass('active') $(e.currentTarget).addClass('active') } + , mouseleave: function (e) { + this.mousedover = false + if (!this.focused && this.shown) this.hide() + } + } -- cgit v1.2.3 From 219d275ae67e58f3a4c1d0a2b2daeff427adbaf6 Mon Sep 17 00:00:00 2001 From: fat Date: Wed, 19 Dec 2012 22:03:57 -0800 Subject: can't extend bounding box thingy --- js/bootstrap-tooltip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js') diff --git a/js/bootstrap-tooltip.js b/js/bootstrap-tooltip.js index 3be4a4a82..25bba1589 100644 --- a/js/bootstrap-tooltip.js +++ b/js/bootstrap-tooltip.js @@ -192,7 +192,7 @@ , getPosition: function () { var el = this.$element[0] - return $.extend(el.getBoundingClientRect ? el.getBoundingClientRect() : { + return $.extend({}, el.getBoundingClientRect ? el.getBoundingClientRect() : { width: el.offsetWidth , height: el.offsetHeight }, this.$element.offset()) -- cgit v1.2.3 From 96e5fa6143072db64f34482873c6f7d6b3ec4ffd Mon Sep 17 00:00:00 2001 From: fat Date: Wed, 19 Dec 2012 22:26:36 -0800 Subject: whitespace in tooltip + don't pass empty selector to $() in dropdown.js --- js/bootstrap-dropdown.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/bootstrap-dropdown.js b/js/bootstrap-dropdown.js index f97a81f35..914eabde7 100644 --- a/js/bootstrap-dropdown.js +++ b/js/bootstrap-dropdown.js @@ -115,8 +115,9 @@ selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } - $parent = $(selector) - $parent.length || ($parent = $this.parent()) + $parent = selector && $(selector) + + if (!$parent || !$parent.length) $parent = $this.parent() return $parent } -- cgit v1.2.3 From 7f9ff0ba5b679914defd8bdd45bcf930ee201286 Mon Sep 17 00:00:00 2001 From: fat Date: Wed, 19 Dec 2012 23:25:25 -0800 Subject: add js support for carousel indicators --- js/bootstrap-carousel.js | 25 +++++++++++++++++++------ js/bootstrap-modal.js | 3 +-- 2 files changed, 20 insertions(+), 8 deletions(-) (limited to 'js') diff --git a/js/bootstrap-carousel.js b/js/bootstrap-carousel.js index 71d71bde4..6a1b21f37 100644 --- a/js/bootstrap-carousel.js +++ b/js/bootstrap-carousel.js @@ -28,6 +28,7 @@ var Carousel = function (element, options) { this.$element = $(element) + this.$indicators = this.$element.find('.carousel-indicators') this.options = options this.options.pause == 'hover' && this.$element .on('mouseenter', $.proxy(this.pause, this)) @@ -44,13 +45,17 @@ return this } + , getActiveIndex: function () { + this.$active = this.$element.find('.item.active') + this.$items = this.$active.parent().children() + return this.$items.index(this.$active) + } + , to: function (pos) { - var $active = this.$element.find('.item.active') - , children = $active.parent().children() - , activePos = children.index($active) + var activeIndex = this.getActiveIndex() , that = this - if (pos > (children.length - 1) || pos < 0) return + if (pos > (this.$items.length - 1) || pos < 0) return if (this.sliding) { return this.$element.one('slid', function () { @@ -58,11 +63,11 @@ }) } - if (activePos == pos) { + if (activeIndex == pos) { return this.pause().cycle() } - return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos])) + return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])) } , pause: function (e) { @@ -107,6 +112,14 @@ if ($next.hasClass('active')) return + if (this.$indicators.length) { + this.$indicators.find('.active').removeClass('active') + this.$element.one('slid', function () { + var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()]) + $nextIndicator && $nextIndicator.addClass('active') + }) + } + if ($.support.transition && this.$element.hasClass('slide')) { this.$element.trigger(e) if (e.isDefaultPrevented()) return diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js index ed5648025..93c262223 100644 --- a/js/bootstrap-modal.js +++ b/js/bootstrap-modal.js @@ -60,8 +60,7 @@ that.$element.appendTo(document.body) //don't move modals dom position } - that.$element - .show() + that.$element.show() if (transition) { that.$element[0].offsetWidth // force reflow -- cgit v1.2.3