From 6948dd4e8d38b6591acd2c04398c066664a9dac0 Mon Sep 17 00:00:00 2001 From: joshaber Date: Thu, 7 Jan 2016 17:13:56 -0500 Subject: [PATCH] Linter was mad about these now. --- src/tooltip.js | 30 +++++++++++++++--------------- static/index.js | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/tooltip.js b/src/tooltip.js index 0a4616aaa..4ea952a64 100644 --- a/src/tooltip.js +++ b/src/tooltip.js @@ -85,9 +85,9 @@ Tooltip.prototype.init = function (element, options) { } } - this.options.selector ? - (this._options = extend({}, this.options, { trigger: 'manual', selector: '' })) : - this.fixTitle() + this.options.selector + ? (this._options = extend({}, this.options, { trigger: 'manual', selector: '' })) + : this.fixTitle() } Tooltip.prototype.getDefaults = function () { @@ -190,9 +190,9 @@ Tooltip.prototype.show = function () { if (this.options.animation) tip.classList.add('fade') - var placement = typeof this.options.placement === 'function' ? - this.options.placement.call(this, tip, this.element) : - this.options.placement + var placement = typeof this.options.placement === 'function' + ? this.options.placement.call(this, tip, this.element) + : this.options.placement var autoToken = /\s?auto?\s?/i var autoPlace = autoToken.test(placement) @@ -214,11 +214,11 @@ Tooltip.prototype.show = function () { var orgPlacement = placement var viewportDim = this.viewport.getBoundingClientRect() - placement = placement === 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' : - placement === 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' : - placement === 'right' && pos.right + actualWidth > viewportDim.width ? 'left' : - placement === 'left' && pos.left - actualWidth < viewportDim.left ? 'right' : - placement + placement = placement === 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' + : placement === 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' + : placement === 'right' && pos.right + actualWidth > viewportDim.width ? 'left' + : placement === 'left' && pos.left - actualWidth < viewportDim.left ? 'right' + : placement tip.classList.remove(orgPlacement) tip.classList.add(placement) @@ -330,10 +330,10 @@ Tooltip.prototype.hasContent = function () { } Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { - return placement === 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : - placement === 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : - placement === 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : - /* placement === 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } + return placement === 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } + : placement === 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } + : placement === 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } + :/* placement === 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } } Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) { diff --git a/static/index.js b/static/index.js index 8a7761198..6d65d3c52 100644 --- a/static/index.js +++ b/static/index.js @@ -103,7 +103,7 @@ if (!metadata._deprecatedPackages) { try { metadata._deprecatedPackages = require('../build/deprecated-packages.json') - } catch(requireError) { + } catch (requireError) { console.error('Failed to setup deprecated packages list', requireError.stack) } }