| @@ -1,13 +1,13 @@ | ||
| 1 | 1 | /* |
| 2 | - * qTip2 - Pretty powerful tooltips - v3.0.3 | |
| 2 | + * qTip2 - Pretty powerful tooltips - v2.2.1 | |
| 3 | 3 | * http://qtip2.com |
| 4 | 4 | * |
| 5 | - * Copyright (c) 2017 | |
| 5 | + * Copyright (c) 2014 | |
| 6 | 6 | * Released under the MIT licenses |
| 7 | 7 | * http://jquery.org/license |
| 8 | 8 | * |
| 9 | - * Date: Tue Aug 29 2017 08:12 EDT-0400 | |
| 9 | + * Date: Sat Sep 6 2014 06:25 EDT-0400 | |
| 10 | 10 | * Plugins: tips viewport imagemap svg modal ie6 |
| 11 | 11 | * Styles: core basic css3 |
| 12 | 12 | */ |
| 13 | 13 | /*global window: false, jQuery: false, console: false, define: false */ |
| @@ -76,19 +76,16 @@ | ||
| 76 | 76 | * |
| 77 | 77 | * Adapted from: http://ajaxian.com/archives/attack-of-the-ie-conditional-comment |
| 78 | 78 | * Credit to James Padolsey for the original implemntation! |
| 79 | 79 | */ |
| 80 | - ie: (function() { | |
| 81 | - /* eslint-disable no-empty */ | |
| 82 | - var v, i; | |
| 80 | + ie: (function(){ | |
| 83 | 81 | for ( |
| 84 | - v = 4, i = document.createElement('div'); | |
| 85 | - (i.innerHTML = '<!--[if gt IE ' + v + ']><i></i><![endif]-->') && i.getElementsByTagName('i')[0]; | |
| 82 | + var v = 4, i = document.createElement("div"); | |
| 83 | + (i.innerHTML = "<!--[if gt IE " + v + "]><i></i><![endif]-->") && i.getElementsByTagName("i")[0]; | |
| 86 | 84 | v+=1 |
| 87 | 85 | ) {} |
| 88 | 86 | return v > 4 ? v : NaN; |
| 89 | - /* eslint-enable no-empty */ | |
| 90 | - })(), | |
| 87 | + }()), | |
| 91 | 88 | |
| 92 | 89 | /* |
| 93 | 90 | * iOS version detection |
| 94 | 91 | */ |
| @@ -96,222 +93,219 @@ | ||
| 96 | 93 | ('' + (/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent) || [0,''])[1]) |
| 97 | 94 | .replace('undefined', '3_2').replace('_', '.').replace('_', '') |
| 98 | 95 | ) || FALSE |
| 99 | 96 | }; |
| 100 | -;function QTip(target, options, id, attr) { | |
| 101 | - // Elements and ID | |
| 102 | - this.id = id; | |
| 103 | - this.target = target; | |
| 104 | - this.tooltip = NULL; | |
| 105 | - this.elements = { target: target }; | |
| 106 | - | |
| 107 | - // Internal constructs | |
| 108 | - this._id = NAMESPACE + '-' + id; | |
| 109 | - this.timers = { img: {} }; | |
| 110 | - this.options = options; | |
| 111 | - this.plugins = {}; | |
| 112 | - | |
| 113 | - // Cache object | |
| 114 | - this.cache = { | |
| 115 | - event: {}, | |
| 116 | - target: $(), | |
| 117 | - disabled: FALSE, | |
| 118 | - attr: attr, | |
| 119 | - onTooltip: FALSE, | |
| 120 | - lastClass: '' | |
| 121 | - }; | |
| 122 | - | |
| 123 | - // Set the initial flags | |
| 124 | - this.rendered = this.destroyed = this.disabled = this.waiting = | |
| 125 | - this.hiddenDuringWait = this.positioning = this.triggering = FALSE; | |
| 126 | -} | |
| 127 | -PROTOTYPE = QTip.prototype; | |
| 128 | - | |
| 129 | -PROTOTYPE._when = function(deferreds) { | |
| 130 | - return $.when.apply($, deferreds); | |
| 131 | -}; | |
| 132 | - | |
| 133 | -PROTOTYPE.render = function(show) { | |
| 134 | - if(this.rendered || this.destroyed) { return this; } // If tooltip has already been rendered, exit | |
| 135 | - | |
| 136 | - var self = this, | |
| 137 | - options = this.options, | |
| 138 | - cache = this.cache, | |
| 139 | - elements = this.elements, | |
| 140 | - text = options.content.text, | |
| 141 | - title = options.content.title, | |
| 142 | - button = options.content.button, | |
| 143 | - posOptions = options.position, | |
| 144 | - deferreds = []; | |
| 145 | - | |
| 146 | - // Add ARIA attributes to target | |
| 147 | - $.attr(this.target[0], 'aria-describedby', this._id); | |
| 148 | - | |
| 149 | - // Create public position object that tracks current position corners | |
| 150 | - cache.posClass = this._createPosClass( | |
| 151 | - (this.position = { my: posOptions.my, at: posOptions.at }).my | |
| 152 | - ); | |
| 153 | - | |
| 154 | - // Create tooltip element | |
| 155 | - this.tooltip = elements.tooltip = $('<div/>', { | |
| 156 | - 'id': this._id, | |
| 157 | - 'class': [ NAMESPACE, CLASS_DEFAULT, options.style.classes, cache.posClass ].join(' '), | |
| 158 | - 'width': options.style.width || '', | |
| 159 | - 'height': options.style.height || '', | |
| 160 | - 'tracking': posOptions.target === 'mouse' && posOptions.adjust.mouse, | |
| 161 | - | |
| 162 | - /* ARIA specific attributes */ | |
| 163 | - 'role': 'alert', | |
| 164 | - 'aria-live': 'polite', | |
| 165 | - 'aria-atomic': FALSE, | |
| 166 | - 'aria-describedby': this._id + '-content', | |
| 167 | - 'aria-hidden': TRUE | |
| 168 | - }) | |
| 169 | - .toggleClass(CLASS_DISABLED, this.disabled) | |
| 170 | - .attr(ATTR_ID, this.id) | |
| 171 | - .data(NAMESPACE, this) | |
| 172 | - .appendTo(posOptions.container) | |
| 173 | - .append( | |
| 174 | - // Create content element | |
| 175 | - elements.content = $('<div />', { | |
| 176 | - 'class': NAMESPACE + '-content', | |
| 177 | - 'id': this._id + '-content', | |
| 178 | - 'aria-atomic': TRUE | |
| 179 | - }) | |
| 180 | - ); | |
| 181 | - | |
| 182 | - // Set rendered flag and prevent redundant reposition calls for now | |
| 183 | - this.rendered = -1; | |
| 184 | - this.positioning = TRUE; | |
| 185 | - | |
| 186 | - // Create title... | |
| 187 | - if(title) { | |
| 188 | - this._createTitle(); | |
| 189 | - | |
| 190 | - // Update title only if its not a callback (called in toggle if so) | |
| 191 | - if(!$.isFunction(title)) { | |
| 192 | - deferreds.push( this._updateTitle(title, FALSE) ); | |
| 193 | - } | |
| 194 | - } | |
| 195 | - | |
| 196 | - // Create button | |
| 197 | - if(button) { this._createButton(); } | |
| 198 | - | |
| 199 | - // Set proper rendered flag and update content if not a callback function (called in toggle) | |
| 200 | - if(!$.isFunction(text)) { | |
| 201 | - deferreds.push( this._updateContent(text, FALSE) ); | |
| 202 | - } | |
| 203 | - this.rendered = TRUE; | |
| 204 | - | |
| 205 | - // Setup widget classes | |
| 206 | - this._setWidget(); | |
| 207 | - | |
| 208 | - // Initialize 'render' plugins | |
| 209 | - $.each(PLUGINS, function(name) { | |
| 210 | - var instance; | |
| 211 | - if(this.initialize === 'render' && (instance = this(self))) { | |
| 212 | - self.plugins[name] = instance; | |
| 213 | - } | |
| 214 | - }); | |
| 215 | - | |
| 216 | - // Unassign initial events and assign proper events | |
| 217 | - this._unassignEvents(); | |
| 218 | - this._assignEvents(); | |
| 219 | - | |
| 220 | - // When deferreds have completed | |
| 221 | - this._when(deferreds).then(function() { | |
| 222 | - // tooltiprender event | |
| 223 | - self._trigger('render'); | |
| 224 | - | |
| 225 | - // Reset flags | |
| 226 | - self.positioning = FALSE; | |
| 227 | - | |
| 228 | - // Show tooltip if not hidden during wait period | |
| 229 | - if(!self.hiddenDuringWait && (options.show.ready || show)) { | |
| 230 | - self.toggle(TRUE, cache.event, FALSE); | |
| 231 | - } | |
| 232 | - self.hiddenDuringWait = FALSE; | |
| 233 | - }); | |
| 234 | - | |
| 235 | - // Expose API | |
| 236 | - QTIP.api[this.id] = this; | |
| 237 | - | |
| 238 | - return this; | |
| 239 | -}; | |
| 240 | - | |
| 241 | -PROTOTYPE.destroy = function(immediate) { | |
| 242 | - // Set flag the signify destroy is taking place to plugins | |
| 243 | - // and ensure it only gets destroyed once! | |
| 244 | - if(this.destroyed) { return this.target; } | |
| 245 | - | |
| 246 | - function process() { | |
| 247 | - if(this.destroyed) { return; } | |
| 248 | - this.destroyed = TRUE; | |
| 249 | - | |
| 250 | - var target = this.target, | |
| 251 | - title = target.attr(oldtitle), | |
| 252 | - timer; | |
| 253 | - | |
| 254 | - // Destroy tooltip if rendered | |
| 255 | - if(this.rendered) { | |
| 256 | - this.tooltip.stop(1,0).find('*').remove().end().remove(); | |
| 257 | - } | |
| 258 | - | |
| 259 | - // Destroy all plugins | |
| 260 | - $.each(this.plugins, function() { | |
| 261 | - this.destroy && this.destroy(); | |
| 262 | - }); | |
| 263 | - | |
| 264 | - // Clear timers | |
| 265 | - for (timer in this.timers) { | |
| 266 | - if (this.timers.hasOwnProperty(timer)) { | |
| 267 | - clearTimeout(this.timers[timer]); | |
| 268 | - } | |
| 269 | - } | |
| 270 | - | |
| 271 | - // Remove api object and ARIA attributes | |
| 272 | - target.removeData(NAMESPACE) | |
| 273 | - .removeAttr(ATTR_ID) | |
| 274 | - .removeAttr(ATTR_HAS) | |
| 275 | - .removeAttr('aria-describedby'); | |
| 276 | - | |
| 277 | - // Reset old title attribute if removed | |
| 278 | - if(this.options.suppress && title) { | |
| 279 | - target.attr('title', title).removeAttr(oldtitle); | |
| 280 | - } | |
| 281 | - | |
| 282 | - // Remove qTip events associated with this API | |
| 283 | - this._unassignEvents(); | |
| 284 | - | |
| 285 | - // Remove ID from used id objects, and delete object references | |
| 286 | - // for better garbage collection and leak protection | |
| 287 | - this.options = this.elements = this.cache = this.timers = | |
| 288 | - this.plugins = this.mouse = NULL; | |
| 289 | - | |
| 290 | - // Delete epoxsed API object | |
| 291 | - delete QTIP.api[this.id]; | |
| 292 | - } | |
| 293 | - | |
| 294 | - // If an immediate destroy is needed | |
| 295 | - if((immediate !== TRUE || this.triggering === 'hide') && this.rendered) { | |
| 296 | - this.tooltip.one('tooltiphidden', $.proxy(process, this)); | |
| 297 | - !this.triggering && this.hide(); | |
| 298 | - } | |
| 299 | - | |
| 300 | - // If we're not in the process of hiding... process | |
| 301 | - else { process.call(this); } | |
| 302 | - | |
| 303 | - return this.target; | |
| 304 | -}; | |
| 97 | +;function QTip(target, options, id, attr) { | |
| 98 | + // Elements and ID | |
| 99 | + this.id = id; | |
| 100 | + this.target = target; | |
| 101 | + this.tooltip = NULL; | |
| 102 | + this.elements = { target: target }; | |
| 103 | + | |
| 104 | + // Internal constructs | |
| 105 | + this._id = NAMESPACE + '-' + id; | |
| 106 | + this.timers = { img: {} }; | |
| 107 | + this.options = options; | |
| 108 | + this.plugins = {}; | |
| 109 | + | |
| 110 | + // Cache object | |
| 111 | + this.cache = { | |
| 112 | + event: {}, | |
| 113 | + target: $(), | |
| 114 | + disabled: FALSE, | |
| 115 | + attr: attr, | |
| 116 | + onTooltip: FALSE, | |
| 117 | + lastClass: '' | |
| 118 | + }; | |
| 119 | + | |
| 120 | + // Set the initial flags | |
| 121 | + this.rendered = this.destroyed = this.disabled = this.waiting = | |
| 122 | + this.hiddenDuringWait = this.positioning = this.triggering = FALSE; | |
| 123 | +} | |
| 124 | +PROTOTYPE = QTip.prototype; | |
| 125 | + | |
| 126 | +PROTOTYPE._when = function(deferreds) { | |
| 127 | + return $.when.apply($, deferreds); | |
| 128 | +}; | |
| 129 | + | |
| 130 | +PROTOTYPE.render = function(show) { | |
| 131 | + if(this.rendered || this.destroyed) { return this; } // If tooltip has already been rendered, exit | |
| 132 | + | |
| 133 | + var self = this, | |
| 134 | + options = this.options, | |
| 135 | + cache = this.cache, | |
| 136 | + elements = this.elements, | |
| 137 | + text = options.content.text, | |
| 138 | + title = options.content.title, | |
| 139 | + button = options.content.button, | |
| 140 | + posOptions = options.position, | |
| 141 | + namespace = '.'+this._id+' ', | |
| 142 | + deferreds = [], | |
| 143 | + tooltip; | |
| 144 | + | |
| 145 | + // Add ARIA attributes to target | |
| 146 | + $.attr(this.target[0], 'aria-describedby', this._id); | |
| 147 | + | |
| 148 | + // Create public position object that tracks current position corners | |
| 149 | + cache.posClass = this._createPosClass( | |
| 150 | + (this.position = { my: posOptions.my, at: posOptions.at }).my | |
| 151 | + ); | |
| 152 | + | |
| 153 | + // Create tooltip element | |
| 154 | + this.tooltip = elements.tooltip = tooltip = $('<div/>', { | |
| 155 | + 'id': this._id, | |
| 156 | + 'class': [ NAMESPACE, CLASS_DEFAULT, options.style.classes, cache.posClass ].join(' '), | |
| 157 | + 'width': options.style.width || '', | |
| 158 | + 'height': options.style.height || '', | |
| 159 | + 'tracking': posOptions.target === 'mouse' && posOptions.adjust.mouse, | |
| 160 | + | |
| 161 | + /* ARIA specific attributes */ | |
| 162 | + 'role': 'alert', | |
| 163 | + 'aria-live': 'polite', | |
| 164 | + 'aria-atomic': FALSE, | |
| 165 | + 'aria-describedby': this._id + '-content', | |
| 166 | + 'aria-hidden': TRUE | |
| 167 | + }) | |
| 168 | + .toggleClass(CLASS_DISABLED, this.disabled) | |
| 169 | + .attr(ATTR_ID, this.id) | |
| 170 | + .data(NAMESPACE, this) | |
| 171 | + .appendTo(posOptions.container) | |
| 172 | + .append( | |
| 173 | + // Create content element | |
| 174 | + elements.content = $('<div />', { | |
| 175 | + 'class': NAMESPACE + '-content', | |
| 176 | + 'id': this._id + '-content', | |
| 177 | + 'aria-atomic': TRUE | |
| 178 | + }) | |
| 179 | + ); | |
| 180 | + | |
| 181 | + // Set rendered flag and prevent redundant reposition calls for now | |
| 182 | + this.rendered = -1; | |
| 183 | + this.positioning = TRUE; | |
| 184 | + | |
| 185 | + // Create title... | |
| 186 | + if(title) { | |
| 187 | + this._createTitle(); | |
| 188 | + | |
| 189 | + // Update title only if its not a callback (called in toggle if so) | |
| 190 | + if(!$.isFunction(title)) { | |
| 191 | + deferreds.push( this._updateTitle(title, FALSE) ); | |
| 192 | + } | |
| 193 | + } | |
| 194 | + | |
| 195 | + // Create button | |
| 196 | + if(button) { this._createButton(); } | |
| 197 | + | |
| 198 | + // Set proper rendered flag and update content if not a callback function (called in toggle) | |
| 199 | + if(!$.isFunction(text)) { | |
| 200 | + deferreds.push( this._updateContent(text, FALSE) ); | |
| 201 | + } | |
| 202 | + this.rendered = TRUE; | |
| 203 | + | |
| 204 | + // Setup widget classes | |
| 205 | + this._setWidget(); | |
| 206 | + | |
| 207 | + // Initialize 'render' plugins | |
| 208 | + $.each(PLUGINS, function(name) { | |
| 209 | + var instance; | |
| 210 | + if(this.initialize === 'render' && (instance = this(self))) { | |
| 211 | + self.plugins[name] = instance; | |
| 212 | + } | |
| 213 | + }); | |
| 214 | + | |
| 215 | + // Unassign initial events and assign proper events | |
| 216 | + this._unassignEvents(); | |
| 217 | + this._assignEvents(); | |
| 218 | + | |
| 219 | + // When deferreds have completed | |
| 220 | + this._when(deferreds).then(function() { | |
| 221 | + // tooltiprender event | |
| 222 | + self._trigger('render'); | |
| 223 | + | |
| 224 | + // Reset flags | |
| 225 | + self.positioning = FALSE; | |
| 226 | + | |
| 227 | + // Show tooltip if not hidden during wait period | |
| 228 | + if(!self.hiddenDuringWait && (options.show.ready || show)) { | |
| 229 | + self.toggle(TRUE, cache.event, FALSE); | |
| 230 | + } | |
| 231 | + self.hiddenDuringWait = FALSE; | |
| 232 | + }); | |
| 233 | + | |
| 234 | + // Expose API | |
| 235 | + QTIP.api[this.id] = this; | |
| 236 | + | |
| 237 | + return this; | |
| 238 | +}; | |
| 239 | + | |
| 240 | +PROTOTYPE.destroy = function(immediate) { | |
| 241 | + // Set flag the signify destroy is taking place to plugins | |
| 242 | + // and ensure it only gets destroyed once! | |
| 243 | + if(this.destroyed) { return this.target; } | |
| 244 | + | |
| 245 | + function process() { | |
| 246 | + if(this.destroyed) { return; } | |
| 247 | + this.destroyed = TRUE; | |
| 248 | + | |
| 249 | + var target = this.target, | |
| 250 | + title = target.attr(oldtitle), | |
| 251 | + timer; | |
| 252 | + | |
| 253 | + // Destroy tooltip if rendered | |
| 254 | + if(this.rendered) { | |
| 255 | + this.tooltip.stop(1,0).find('*').remove().end().remove(); | |
| 256 | + } | |
| 257 | + | |
| 258 | + // Destroy all plugins | |
| 259 | + $.each(this.plugins, function(name) { | |
| 260 | + this.destroy && this.destroy(); | |
| 261 | + }); | |
| 262 | + | |
| 263 | + // Clear timers | |
| 264 | + for(timer in this.timers) { | |
| 265 | + clearTimeout(this.timers[timer]); | |
| 266 | + } | |
| 267 | + | |
| 268 | + // Remove api object and ARIA attributes | |
| 269 | + target.removeData(NAMESPACE) | |
| 270 | + .removeAttr(ATTR_ID) | |
| 271 | + .removeAttr(ATTR_HAS) | |
| 272 | + .removeAttr('aria-describedby'); | |
| 273 | + | |
| 274 | + // Reset old title attribute if removed | |
| 275 | + if(this.options.suppress && title) { | |
| 276 | + target.attr('title', title).removeAttr(oldtitle); | |
| 277 | + } | |
| 278 | + | |
| 279 | + // Remove qTip events associated with this API | |
| 280 | + this._unassignEvents(); | |
| 281 | + | |
| 282 | + // Remove ID from used id objects, and delete object references | |
| 283 | + // for better garbage collection and leak protection | |
| 284 | + this.options = this.elements = this.cache = this.timers = | |
| 285 | + this.plugins = this.mouse = NULL; | |
| 286 | + | |
| 287 | + // Delete epoxsed API object | |
| 288 | + delete QTIP.api[this.id]; | |
| 289 | + } | |
| 290 | + | |
| 291 | + // If an immediate destory is needed | |
| 292 | + if((immediate !== TRUE || this.triggering === 'hide') && this.rendered) { | |
| 293 | + this.tooltip.one('tooltiphidden', $.proxy(process, this)); | |
| 294 | + !this.triggering && this.hide(); | |
| 295 | + } | |
| 296 | + | |
| 297 | + // If we're not in the process of hiding... process | |
| 298 | + else { process.call(this); } | |
| 299 | + | |
| 300 | + return this.target; | |
| 301 | +}; | |
| 305 | 302 | ;function invalidOpt(a) { |
| 306 | 303 | return a === NULL || $.type(a) !== 'object'; |
| 307 | 304 | } |
| 308 | 305 | |
| 309 | 306 | function invalidContent(c) { |
| 310 | - return !($.isFunction(c) || | |
| 311 | - c && c.attr || | |
| 312 | - c.length || | |
| 313 | - $.type(c) === 'object' && (c.jquery || c.then)); | |
| 307 | + return !( $.isFunction(c) || (c && c.attr) || c.length || ($.type(c) === 'object' && (c.jquery || c.then) )); | |
| 314 | 308 | } |
| 315 | 309 | |
| 316 | 310 | // Option object sanitizer |
| 317 | 311 | function sanitizeOptions(opts) { |
| @@ -326,11 +320,10 @@ | ||
| 326 | 320 | if('content' in opts) { |
| 327 | 321 | content = opts.content; |
| 328 | 322 | |
| 329 | 323 | if(invalidOpt(content) || content.jquery || content.done) { |
| 330 | - text = invalidContent(content) ? FALSE : content; | |
| 331 | 324 | content = opts.content = { |
| 332 | - text: text | |
| 325 | + text: (text = invalidContent(content) ? FALSE : content) | |
| 333 | 326 | }; |
| 334 | 327 | } |
| 335 | 328 | else { text = content.text; } |
| 336 | 329 | |
| @@ -347,11 +340,11 @@ | ||
| 347 | 340 | deferred = $.ajax( |
| 348 | 341 | $.extend({}, ajax, { context: api }) |
| 349 | 342 | ) |
| 350 | 343 | .then(ajax.success, NULL, ajax.error) |
| 351 | - .then(function(newContent) { | |
| 352 | - if(newContent && once) { api.set('content.text', newContent); } | |
| 353 | - return newContent; | |
| 344 | + .then(function(content) { | |
| 345 | + if(content && once) { api.set('content.text', content); } | |
| 346 | + return content; | |
| 354 | 347 | }, |
| 355 | 348 | function(xhr, status, error) { |
| 356 | 349 | if(api.destroyed || xhr.status === 0) { return; } |
| 357 | 350 | api.set('content.text', status + ': ' + error); |
| @@ -403,12 +396,12 @@ | ||
| 403 | 396 | builtin: { |
| 404 | 397 | // Core checks |
| 405 | 398 | '^id$': function(obj, o, v, prev) { |
| 406 | 399 | var id = v === TRUE ? QTIP.nextid : v, |
| 407 | - newId = NAMESPACE + '-' + id; | |
| 400 | + new_id = NAMESPACE + '-' + id; | |
| 408 | 401 | |
| 409 | - if(id !== FALSE && id.length > 0 && !$('#'+newId).length) { | |
| 410 | - this._id = newId; | |
| 402 | + if(id !== FALSE && id.length > 0 && !$('#'+new_id).length) { | |
| 403 | + this._id = new_id; | |
| 411 | 404 | |
| 412 | 405 | if(this.rendered) { |
| 413 | 406 | this.tooltip[0].id = this._id; |
| 414 | 407 | this.elements.content[0].id = this._id + '-content'; |
| @@ -446,11 +439,9 @@ | ||
| 446 | 439 | }, |
| 447 | 440 | |
| 448 | 441 | // Position checks |
| 449 | 442 | '^position.(my|at)$': function(obj, o, v){ |
| 450 | - if('string' === typeof v) { | |
| 451 | - this.position[o] = obj[o] = new CORNER(v, o === 'at'); | |
| 452 | - } | |
| 443 | + 'string' === typeof v && (this.position[o] = obj[o] = new CORNER(v, o === 'at')); | |
| 453 | 444 | }, |
| 454 | 445 | '^position.container$': function(obj, o, v){ |
| 455 | 446 | this.rendered && this.tooltip.appendTo(v); |
| 456 | 447 | }, |
| @@ -501,9 +492,9 @@ | ||
| 501 | 492 | // Split notation into array |
| 502 | 493 | levels = notation.split('.'); |
| 503 | 494 | |
| 504 | 495 | // Loop through |
| 505 | - while(option = option[ levels[i++] ]) { | |
| 496 | + while( option = option[ levels[i++] ] ) { | |
| 506 | 497 | if(i < levels.length) { obj = option; } |
| 507 | 498 | } |
| 508 | 499 | |
| 509 | 500 | return [obj || options, levels.pop()]; |
| @@ -521,13 +512,9 @@ | ||
| 521 | 512 | function setCallback(notation, args) { |
| 522 | 513 | var category, rule, match; |
| 523 | 514 | |
| 524 | 515 | for(category in this.checks) { |
| 525 | - if (!this.checks.hasOwnProperty(category)) { continue; } | |
| 526 | - | |
| 527 | 516 | for(rule in this.checks[category]) { |
| 528 | - if (!this.checks[category].hasOwnProperty(rule)) { continue; } | |
| 529 | - | |
| 530 | 517 | if(match = (new RegExp(rule, 'i')).exec(notation)) { |
| 531 | 518 | args.push(match); |
| 532 | 519 | |
| 533 | 520 | if(category === 'builtin' || this.plugins[category]) { |
| @@ -548,8 +535,9 @@ | ||
| 548 | 535 | |
| 549 | 536 | var rendered = this.rendered, |
| 550 | 537 | reposition = FALSE, |
| 551 | 538 | options = this.options, |
| 539 | + checks = this.checks, | |
| 552 | 540 | name; |
| 553 | 541 | |
| 554 | 542 | // Convert singular option/value pair into object form |
| 555 | 543 | if('string' === typeof option) { |
| @@ -557,9 +545,9 @@ | ||
| 557 | 545 | } |
| 558 | 546 | else { option = $.extend({}, option); } |
| 559 | 547 | |
| 560 | 548 | // Set all of the defined options to their new values |
| 561 | - $.each(option, function(notation, val) { | |
| 549 | + $.each(option, function(notation, value) { | |
| 562 | 550 | if(rendered && rrender.test(notation)) { |
| 563 | 551 | delete option[notation]; return; |
| 564 | 552 | } |
| 565 | 553 | |
| @@ -565,15 +553,15 @@ | ||
| 565 | 553 | |
| 566 | 554 | // Set new obj value |
| 567 | 555 | var obj = convertNotation(options, notation.toLowerCase()), previous; |
| 568 | 556 | previous = obj[0][ obj[1] ]; |
| 569 | - obj[0][ obj[1] ] = val && val.nodeType ? $(val) : val; | |
| 557 | + obj[0][ obj[1] ] = value && value.nodeType ? $(value) : value; | |
| 570 | 558 | |
| 571 | 559 | // Also check if we need to reposition |
| 572 | 560 | reposition = rmove.test(notation) || reposition; |
| 573 | 561 | |
| 574 | 562 | // Set the new params for the callback |
| 575 | - option[notation] = [obj[0], obj[1], val, previous]; | |
| 563 | + option[notation] = [obj[0], obj[1], value, previous]; | |
| 576 | 564 | }); |
| 577 | 565 | |
| 578 | 566 | // Re-sanitize options |
| 579 | 567 | sanitizeOptions(options); |
| @@ -592,9 +580,9 @@ | ||
| 592 | 580 | } |
| 593 | 581 | |
| 594 | 582 | return this; |
| 595 | 583 | }; |
| 596 | -;PROTOTYPE._update = function(content, element) { | |
| 584 | +;PROTOTYPE._update = function(content, element, reposition) { | |
| 597 | 585 | var self = this, |
| 598 | 586 | cache = this.cache; |
| 599 | 587 | |
| 600 | 588 | // Make sure tooltip is rendered and content is defined. If not return |
| @@ -616,9 +604,9 @@ | ||
| 616 | 604 | }); |
| 617 | 605 | } |
| 618 | 606 | |
| 619 | 607 | // If content is null... return false |
| 620 | - if(content === FALSE || !content && content !== '') { return FALSE; } | |
| 608 | + if(content === FALSE || (!content && content !== '')) { return FALSE; } | |
| 621 | 609 | |
| 622 | 610 | // Append new content if its a DOM array and show it if hidden |
| 623 | 611 | if(content.jquery && content.length > 0) { |
| 624 | 612 | element.empty().append( |
| @@ -643,9 +631,9 @@ | ||
| 643 | 631 | // Set flag |
| 644 | 632 | cache.waiting = TRUE; |
| 645 | 633 | |
| 646 | 634 | // If imagesLoaded is included, ensure images have loaded and return promise |
| 647 | - return ( $.fn.imagesLoaded ? element.imagesLoaded() : new $.Deferred().resolve([]) ) | |
| 635 | + return ( $.fn.imagesLoaded ? element.imagesLoaded() : $.Deferred().resolve([]) ) | |
| 648 | 636 | .done(function() { cache.waiting = FALSE; }) |
| 649 | 637 | .promise(); |
| 650 | 638 | }; |
| 651 | 639 | |
| @@ -754,9 +742,9 @@ | ||
| 754 | 742 | event = cache.origin; |
| 755 | 743 | } |
| 756 | 744 | |
| 757 | 745 | // Use cached event for resize/scroll events |
| 758 | - else if(!event || event && (event.type === 'resize' || event.type === 'scroll')) { | |
| 746 | + else if(!event || (event && (event.type === 'resize' || event.type === 'scroll'))) { | |
| 759 | 747 | event = cache.event; |
| 760 | 748 | } |
| 761 | 749 | |
| 762 | 750 | // Otherwise, use the cached mouse coordinates if available |
| @@ -844,11 +832,11 @@ | ||
| 844 | 832 | // Adjust position to take into account offset parents |
| 845 | 833 | position = this.reposition.offset(target, position, container); |
| 846 | 834 | |
| 847 | 835 | // Adjust for position.fixed tooltips (and also iOS scroll bug in v3.2-4.0 & v4.3-4.3.2) |
| 848 | - if(BROWSER.iOS > 3.1 && BROWSER.iOS < 4.1 || | |
| 849 | - BROWSER.iOS >= 4.3 && BROWSER.iOS < 4.33 || | |
| 850 | - !BROWSER.iOS && type === 'fixed' | |
| 836 | + if((BROWSER.iOS > 3.1 && BROWSER.iOS < 4.1) || | |
| 837 | + (BROWSER.iOS >= 4.3 && BROWSER.iOS < 4.33) || | |
| 838 | + (!BROWSER.iOS && type === 'fixed') | |
| 851 | 839 | ){ |
| 852 | 840 | position.left -= win.scrollLeft(); |
| 853 | 841 | position.top -= win.scrollTop(); |
| 854 | 842 | } |
| @@ -853,9 +841,9 @@ | ||
| 853 | 841 | position.top -= win.scrollTop(); |
| 854 | 842 | } |
| 855 | 843 | |
| 856 | 844 | // Adjust position relative to target |
| 857 | - if(!pluginCalculations || pluginCalculations && pluginCalculations.adjustable !== FALSE) { | |
| 845 | + if(!pluginCalculations || (pluginCalculations && pluginCalculations.adjustable !== FALSE)) { | |
| 858 | 846 | position.left += at.x === RIGHT ? targetWidth : at.x === CENTER ? targetWidth / 2 : 0; |
| 859 | 847 | position.top += at.y === BOTTOM ? targetHeight : at.y === CENTER ? targetHeight / 2 : 0; |
| 860 | 848 | } |
| 861 | 849 | } |
| @@ -882,10 +870,9 @@ | ||
| 882 | 870 | else { position.adjusted = { left: 0, top: 0 }; } |
| 883 | 871 | |
| 884 | 872 | // Set tooltip position class if it's changed |
| 885 | 873 | if(cache.posClass !== (newClass = this._createPosClass(this.position.my))) { |
| 886 | - cache.posClass = newClass; | |
| 887 | - tooltip.removeClass(cache.posClass).addClass(newClass); | |
| 874 | + tooltip.removeClass(cache.posClass).addClass( (cache.posClass = newClass) ); | |
| 888 | 875 | } |
| 889 | 876 | |
| 890 | 877 | // tooltipmove event |
| 891 | 878 | if(!this._trigger('move', [position, viewport.elem || viewport], event)) { return this; } |
| @@ -936,10 +923,10 @@ | ||
| 936 | 923 | scroll(ownerDocument, -1); |
| 937 | 924 | } |
| 938 | 925 | else { |
| 939 | 926 | parentOffset = $(parent).position(); |
| 940 | - parentOffset.left += parseFloat($.css(parent, 'borderLeftWidth')) || 0; | |
| 941 | - parentOffset.top += parseFloat($.css(parent, 'borderTopWidth')) || 0; | |
| 927 | + parentOffset.left += (parseFloat($.css(parent, 'borderLeftWidth')) || 0); | |
| 928 | + parentOffset.top += (parseFloat($.css(parent, 'borderTopWidth')) || 0); | |
| 942 | 929 | } |
| 943 | 930 | |
| 944 | 931 | pos.left -= parentOffset.left + (parseFloat($.css(parent, 'marginLeft')) || 0); |
| 945 | 932 | pos.top -= parentOffset.top + (parseFloat($.css(parent, 'marginTop')) || 0); |
| @@ -947,9 +934,9 @@ | ||
| 947 | 934 | // If this is the first parent element with an overflow of "scroll" or "auto", store it |
| 948 | 935 | if(!scrolled && (overflow = $.css(parent, 'overflow')) !== 'hidden' && overflow !== 'visible') { scrolled = $(parent); } |
| 949 | 936 | } |
| 950 | 937 | } |
| 951 | - while(parent = parent.offsetParent); | |
| 938 | + while((parent = parent.offsetParent)); | |
| 952 | 939 | |
| 953 | 940 | // Compensate for containers scroll if it also has an offsetParent (or in IE quirks mode) |
| 954 | 941 | if(scrolled && (scrolled[0] !== ownerDocument[0] || quirks)) { |
| 955 | 942 | scroll(scrolled, 1); |
| @@ -965,9 +952,9 @@ | ||
| 965 | 952 | this.y = (corner.match(/top|bottom|center/i) || ['inherit'])[0].toLowerCase(); |
| 966 | 953 | this.forceY = !!forceY; |
| 967 | 954 | |
| 968 | 955 | var f = corner.charAt(0); |
| 969 | - this.precedance = f === 't' || f === 'b' ? Y : X; | |
| 956 | + this.precedance = (f === 't' || f === 'b' ? Y : X); | |
| 970 | 957 | }).prototype; |
| 971 | 958 | |
| 972 | 959 | C.invert = function(z, center) { |
| 973 | 960 | this[z] = this[z] === LEFT ? RIGHT : this[z] === RIGHT ? LEFT : center || this[z]; |
| @@ -976,12 +963,12 @@ | ||
| 976 | 963 | C.string = function(join) { |
| 977 | 964 | var x = this.x, y = this.y; |
| 978 | 965 | |
| 979 | 966 | var result = x !== y ? |
| 980 | - x === 'center' || y !== 'center' && (this.precedance === Y || this.forceY) ? | |
| 981 | - [y,x] : | |
| 982 | - [x,y] : | |
| 983 | - [x]; | |
| 967 | + (x === 'center' || y !== 'center' && (this.precedance === Y || this.forceY) ? | |
| 968 | + [y,x] : [x,y] | |
| 969 | + ) : | |
| 970 | + [x]; | |
| 984 | 971 | |
| 985 | 972 | return join !== false ? result.join(' ') : result; |
| 986 | 973 | }; |
| 987 | 974 | |
| @@ -1020,8 +1007,9 @@ | ||
| 1020 | 1007 | else if(this.destroyed || this.disabled) { return this; } |
| 1021 | 1008 | |
| 1022 | 1009 | var type = state ? 'show' : 'hide', |
| 1023 | 1010 | opts = this.options[type], |
| 1011 | + otherOpts = this.options[ !state ? 'show' : 'hide' ], | |
| 1024 | 1012 | posOptions = this.options.position, |
| 1025 | 1013 | contentOptions = this.options.content, |
| 1026 | 1014 | width = this.tooltip.css('width'), |
| 1027 | 1015 | visible = this.tooltip.is(':visible'), |
| @@ -1026,9 +1014,9 @@ | ||
| 1026 | 1014 | width = this.tooltip.css('width'), |
| 1027 | 1015 | visible = this.tooltip.is(':visible'), |
| 1028 | 1016 | animate = state || opts.target.length === 1, |
| 1029 | 1017 | sameTarget = !event || opts.target.length < 2 || cache.target[0] === event.target, |
| 1030 | - identicalState, allow, after; | |
| 1018 | + identicalState, allow, showEvent, delay, after; | |
| 1031 | 1019 | |
| 1032 | 1020 | // Detect state if valid one isn't provided |
| 1033 | 1021 | if((typeof state).search('boolean|number')) { state = !visible; } |
| 1034 | 1022 | |
| @@ -1072,9 +1060,9 @@ | ||
| 1072 | 1060 | |
| 1073 | 1061 | // Hide other tooltips if tooltip is solo |
| 1074 | 1062 | if(!!opts.solo) { |
| 1075 | 1063 | (typeof opts.solo === 'string' ? $(opts.solo) : $(SELECTOR, opts.solo)) |
| 1076 | - .not(tooltip).not(opts.target).qtip('hide', new $.Event('tooltipsolo')); | |
| 1064 | + .not(tooltip).not(opts.target).qtip('hide', $.Event('tooltipsolo')); | |
| 1077 | 1065 | } |
| 1078 | 1066 | } |
| 1079 | 1067 | else { |
| 1080 | 1068 | // Clear show timer if we're hiding |
| @@ -1157,9 +1145,10 @@ | ||
| 1157 | 1145 | |
| 1158 | 1146 | var qtips = $(SELECTOR), |
| 1159 | 1147 | tooltip = this.tooltip, |
| 1160 | 1148 | curIndex = parseInt(tooltip[0].style.zIndex, 10), |
| 1161 | - newIndex = QTIP.zindex + qtips.length; | |
| 1149 | + newIndex = QTIP.zindex + qtips.length, | |
| 1150 | + focusedElem; | |
| 1162 | 1151 | |
| 1163 | 1152 | // Only update the z-index if it has changed and tooltip is not already focused |
| 1164 | 1153 | if(!tooltip.hasClass(CLASS_FOCUS)) { |
| 1165 | 1154 | // tooltipfocus event |
| @@ -1335,18 +1324,16 @@ | ||
| 1335 | 1324 | // Prevent hiding if tooltip is fixed and event target is the tooltip. |
| 1336 | 1325 | // Or if mouse positioning is enabled and cursor momentarily overlaps |
| 1337 | 1326 | if(this !== relatedTarget[0] && |
| 1338 | 1327 | (this.options.position.target === 'mouse' && ontoTooltip) || |
| 1339 | - this.options.hide.fixed && ( | |
| 1328 | + (this.options.hide.fixed && ( | |
| 1340 | 1329 | (/mouse(out|leave|move)/).test(event.type) && (ontoTooltip || ontoTarget)) |
| 1341 | - ) | |
| 1330 | + )) | |
| 1342 | 1331 | { |
| 1343 | - /* eslint-disable no-empty */ | |
| 1344 | 1332 | try { |
| 1345 | 1333 | event.preventDefault(); |
| 1346 | 1334 | event.stopImmediatePropagation(); |
| 1347 | 1335 | } catch(e) {} |
| 1348 | - /* eslint-enable no-empty */ | |
| 1349 | 1336 | |
| 1350 | 1337 | return; |
| 1351 | 1338 | } |
| 1352 | 1339 | |
| @@ -1406,10 +1393,10 @@ | ||
| 1406 | 1393 | ); |
| 1407 | 1394 | } |
| 1408 | 1395 | // Event trigger |
| 1409 | 1396 | PROTOTYPE._trigger = function(type, args, event) { |
| 1410 | - var callback = new $.Event('tooltip'+type); | |
| 1411 | - callback.originalEvent = event && $.extend({}, event) || this.cache.event || NULL; | |
| 1397 | + var callback = $.Event('tooltip'+type); | |
| 1398 | + callback.originalEvent = (event && $.extend({}, event)) || this.cache.event || NULL; | |
| 1412 | 1399 | |
| 1413 | 1400 | this.triggering = type; |
| 1414 | 1401 | this.tooltip.trigger(callback, [this].concat(args || [])); |
| 1415 | 1402 | this.triggering = FALSE; |
| @@ -1416,9 +1403,9 @@ | ||
| 1416 | 1403 | |
| 1417 | 1404 | return !callback.isDefaultPrevented(); |
| 1418 | 1405 | }; |
| 1419 | 1406 | |
| 1420 | -PROTOTYPE._bindEvents = function(showEvents, hideEvents, showTargets, hideTargets, showCallback, hideCallback) { | |
| 1407 | +PROTOTYPE._bindEvents = function(showEvents, hideEvents, showTargets, hideTargets, showMethod, hideMethod) { | |
| 1421 | 1408 | // Get tasrgets that lye within both |
| 1422 | 1409 | var similarTargets = showTargets.filter( hideTargets ).add( hideTargets.filter(showTargets) ), |
| 1423 | 1410 | toggleEvents = []; |
| 1424 | 1411 | |
| @@ -1438,9 +1425,9 @@ | ||
| 1438 | 1425 | if(toggleEvents.length) { |
| 1439 | 1426 | // Bind toggle events to the similar targets |
| 1440 | 1427 | this._bind(similarTargets, toggleEvents, function(event) { |
| 1441 | 1428 | var state = this.rendered ? this.tooltip[0].offsetWidth > 0 : false; |
| 1442 | - (state ? hideCallback : showCallback).call(this, event); | |
| 1429 | + (state ? hideMethod : showMethod).call(this, event); | |
| 1443 | 1430 | }); |
| 1444 | 1431 | |
| 1445 | 1432 | // Remove the similar targets from the regular show/hide bindings |
| 1446 | 1433 | showTargets = showTargets.not(similarTargets); |
| @@ -1448,10 +1435,10 @@ | ||
| 1448 | 1435 | } |
| 1449 | 1436 | } |
| 1450 | 1437 | |
| 1451 | 1438 | // Apply show/hide/toggle events |
| 1452 | - this._bind(showTargets, showEvents, showCallback); | |
| 1453 | - this._bind(hideTargets, hideEvents, hideCallback); | |
| 1439 | + this._bind(showTargets, showEvents, showMethod); | |
| 1440 | + this._bind(hideTargets, hideEvents, hideMethod); | |
| 1454 | 1441 | }; |
| 1455 | 1442 | |
| 1456 | 1443 | PROTOTYPE._assignInitialEvents = function(event) { |
| 1457 | 1444 | var options = this.options, |
| @@ -1460,9 +1447,9 @@ | ||
| 1460 | 1447 | showEvents = options.show.event ? $.trim('' + options.show.event).split(' ') : [], |
| 1461 | 1448 | hideEvents = options.hide.event ? $.trim('' + options.hide.event).split(' ') : []; |
| 1462 | 1449 | |
| 1463 | 1450 | // Catch remove/removeqtip events on target element to destroy redundant tooltips |
| 1464 | - this._bind(this.elements.target, ['remove', 'removeqtip'], function() { | |
| 1451 | + this._bind(this.elements.target, ['remove', 'removeqtip'], function(event) { | |
| 1465 | 1452 | this.destroy(true); |
| 1466 | 1453 | }, 'destroy'); |
| 1467 | 1454 | |
| 1468 | 1455 | /* |
| @@ -1477,26 +1464,26 @@ | ||
| 1477 | 1464 | * Also make sure initial mouse targetting works correctly by caching mousemove coords |
| 1478 | 1465 | * on show targets before the tooltip has rendered. Also set onTarget when triggered to |
| 1479 | 1466 | * keep mouse tracking working. |
| 1480 | 1467 | */ |
| 1481 | - this._bind(showTarget, 'mousemove', function(moveEvent) { | |
| 1482 | - this._storeMouse(moveEvent); | |
| 1468 | + this._bind(showTarget, 'mousemove', function(event) { | |
| 1469 | + this._storeMouse(event); | |
| 1483 | 1470 | this.cache.onTarget = TRUE; |
| 1484 | 1471 | }); |
| 1485 | 1472 | |
| 1486 | 1473 | // Define hoverIntent function |
| 1487 | - function hoverIntent(hoverEvent) { | |
| 1474 | + function hoverIntent(event) { | |
| 1488 | 1475 | // Only continue if tooltip isn't disabled |
| 1489 | 1476 | if(this.disabled || this.destroyed) { return FALSE; } |
| 1490 | 1477 | |
| 1491 | 1478 | // Cache the event data |
| 1492 | - this.cache.event = hoverEvent && $.event.fix(hoverEvent); | |
| 1493 | - this.cache.target = hoverEvent && $(hoverEvent.target); | |
| 1479 | + this.cache.event = event && $.event.fix(event); | |
| 1480 | + this.cache.target = event && $(event.target); | |
| 1494 | 1481 | |
| 1495 | 1482 | // Start the event sequence |
| 1496 | 1483 | clearTimeout(this.timers.show); |
| 1497 | 1484 | this.timers.show = delay.call(this, |
| 1498 | - function() { this.render(typeof hoverEvent === 'object' || options.show.ready); }, | |
| 1485 | + function() { this.render(typeof event === 'object' || options.show.ready); }, | |
| 1499 | 1486 | options.prerender ? 0 : options.show.delay |
| 1500 | 1487 | ); |
| 1501 | 1488 | } |
| 1502 | 1489 | |
| @@ -1521,8 +1508,9 @@ | ||
| 1521 | 1508 | hideTarget = options.hide.target, |
| 1522 | 1509 | containerTarget = posOptions.container, |
| 1523 | 1510 | viewportTarget = posOptions.viewport, |
| 1524 | 1511 | documentTarget = $(document), |
| 1512 | + bodyTarget = $(document.body), | |
| 1525 | 1513 | windowTarget = $(window), |
| 1526 | 1514 | |
| 1527 | 1515 | showEvents = options.show.event ? $.trim('' + options.show.event).split(' ') : [], |
| 1528 | 1516 | hideEvents = options.hide.event ? $.trim('' + options.hide.event).split(' ') : []; |
| @@ -1710,9 +1698,9 @@ | ||
| 1710 | 1698 | // Use document body instead of document element if needed |
| 1711 | 1699 | newTarget = elem[0] === document ? docBody : elem, |
| 1712 | 1700 | |
| 1713 | 1701 | // Grab metadata from element if plugin is present |
| 1714 | - metadata = elem.metadata ? elem.metadata(opts.metadata) : NULL, | |
| 1702 | + metadata = (elem.metadata) ? elem.metadata(opts.metadata) : NULL, | |
| 1715 | 1703 | |
| 1716 | 1704 | // If metadata type if HTML5, grab 'name' from the object instead, or use the regular data object otherwise |
| 1717 | 1705 | metadata5 = opts.metadata.type === 'html5' && metadata ? metadata[opts.metadata.name] : NULL, |
| 1718 | 1706 | |
| @@ -1719,12 +1707,9 @@ | ||
| 1719 | 1707 | // Grab data from metadata.name (or data-qtipopts as fallback) using .data() method, |
| 1720 | 1708 | html5 = elem.data(opts.metadata.name || 'qtipopts'); |
| 1721 | 1709 | |
| 1722 | 1710 | // If we don't get an object returned attempt to parse it manualyl without parseJSON |
| 1723 | - /* eslint-disable no-empty */ | |
| 1724 | - try { html5 = typeof html5 === 'string' ? $.parseJSON(html5) : html5; } | |
| 1725 | - catch(e) {} | |
| 1726 | - /* eslint-enable no-empty */ | |
| 1711 | + try { html5 = typeof html5 === 'string' ? $.parseJSON(html5) : html5; } catch(e) {} | |
| 1727 | 1712 | |
| 1728 | 1713 | // Merge in and sanitize metadata |
| 1729 | 1714 | config = $.extend(TRUE, {}, QTIP.defaults, opts, |
| 1730 | 1715 | typeof html5 === 'object' ? sanitizeOptions(html5) : NULL, |
| @@ -1795,9 +1780,9 @@ | ||
| 1795 | 1780 | event = args[args.length - 1], |
| 1796 | 1781 | opts = this[0] ? $.data(this[0], NAMESPACE) : NULL; |
| 1797 | 1782 | |
| 1798 | 1783 | // Check for API request |
| 1799 | - if(!arguments.length && opts || command === 'api') { | |
| 1784 | + if((!arguments.length && opts) || command === 'api') { | |
| 1800 | 1785 | return opts; |
| 1801 | 1786 | } |
| 1802 | 1787 | |
| 1803 | 1788 | // Execute API command if present |
| @@ -1869,9 +1854,9 @@ | ||
| 1869 | 1854 | var self = this[0], |
| 1870 | 1855 | title = 'title', |
| 1871 | 1856 | api = $.data(self, 'qtip'); |
| 1872 | 1857 | |
| 1873 | - if(attr === title && api && api.options && 'object' === typeof api && 'object' === typeof api.options && api.options.suppress) { | |
| 1858 | + if(attr === title && api && 'object' === typeof api && api.options.suppress) { | |
| 1874 | 1859 | if(arguments.length < 2) { |
| 1875 | 1860 | return $.attr(self, oldtitle); |
| 1876 | 1861 | } |
| 1877 | 1862 | |
| @@ -1889,10 +1874,12 @@ | ||
| 1889 | 1874 | }, |
| 1890 | 1875 | |
| 1891 | 1876 | /* Allow clone to correctly retrieve cached title attributes */ |
| 1892 | 1877 | clone: function(keepData) { |
| 1878 | + var titles = $([]), title = 'title', | |
| 1879 | + | |
| 1893 | 1880 | // Clone our element using the real clone method |
| 1894 | - var elems = $.fn['clone'+replaceSuffix].apply(this, arguments); | |
| 1881 | + elems = $.fn['clone'+replaceSuffix].apply(this, arguments); | |
| 1895 | 1882 | |
| 1896 | 1883 | // Grab all elements with an oldtitle set, and change it to regular title attribute, if keepData is false |
| 1897 | 1884 | if(!keepData) { |
| 1898 | 1885 | elems.filter('['+oldtitle+']').attr('title', function() { |
| @@ -1920,12 +1907,10 @@ | ||
| 1920 | 1907 | $['cleanData'+replaceSuffix] = $.cleanData; |
| 1921 | 1908 | $.cleanData = function( elems ) { |
| 1922 | 1909 | for(var i = 0, elem; (elem = $( elems[i] )).length; i++) { |
| 1923 | 1910 | if(elem.attr(ATTR_HAS)) { |
| 1924 | - /* eslint-disable no-empty */ | |
| 1925 | 1911 | try { elem.triggerHandler('removeqtip'); } |
| 1926 | 1912 | catch( e ) {} |
| 1927 | - /* eslint-enable no-empty */ | |
| 1928 | 1913 | } |
| 1929 | 1914 | } |
| 1930 | 1915 | $['cleanData'+replaceSuffix].apply(this, arguments); |
| 1931 | 1916 | }; |
| @@ -1930,9 +1915,9 @@ | ||
| 1930 | 1915 | $['cleanData'+replaceSuffix].apply(this, arguments); |
| 1931 | 1916 | }; |
| 1932 | 1917 | } |
| 1933 | 1918 | ;// qTip version |
| 1934 | -QTIP.version = '3.0.3'; | |
| 1919 | +QTIP.version = '2.2.1'; | |
| 1935 | 1920 | |
| 1936 | 1921 | // Base ID for all qTips |
| 1937 | 1922 | QTIP.nextid = 0; |
| 1938 | 1923 | |
| @@ -1966,9 +1951,9 @@ | ||
| 1966 | 1951 | scroll: TRUE, |
| 1967 | 1952 | resize: TRUE, |
| 1968 | 1953 | method: 'flipinvert flipinvert' |
| 1969 | 1954 | }, |
| 1970 | - effect: function(api, pos) { | |
| 1955 | + effect: function(api, pos, viewport) { | |
| 1971 | 1956 | $(this).animate(pos, { |
| 1972 | 1957 | duration: 200, |
| 1973 | 1958 | queue: FALSE |
| 1974 | 1959 | }); |
| @@ -2012,13 +1997,12 @@ | ||
| 2012 | 1997 | blur: NULL |
| 2013 | 1998 | } |
| 2014 | 1999 | }; |
| 2015 | 2000 | ;var TIP, |
| 2016 | -createVML, | |
| 2017 | -SCALE, | |
| 2018 | -PIXEL_RATIO, | |
| 2019 | -BACKING_STORE_RATIO, | |
| 2020 | 2001 | |
| 2002 | +// .bind()/.on() namespace | |
| 2003 | +TIPNS = '.qtip-tip', | |
| 2004 | + | |
| 2021 | 2005 | // Common CSS strings |
| 2022 | 2006 | MARGIN = 'margin', |
| 2023 | 2007 | BORDER = 'border', |
| 2024 | 2008 | COLOR = 'color', |
| @@ -2039,9 +2023,9 @@ | ||
| 2039 | 2023 | /* |
| 2040 | 2024 | * Modified from Modernizr's testPropsAll() |
| 2041 | 2025 | * http://modernizr.com/downloads/modernizr-latest.js |
| 2042 | 2026 | */ |
| 2043 | -var cssProps = {}, cssPrefixes = ['Webkit', 'O', 'Moz', 'ms']; | |
| 2027 | +var cssProps = {}, cssPrefixes = ["Webkit", "O", "Moz", "ms"]; | |
| 2044 | 2028 | function vendorCss(elem, prop) { |
| 2045 | 2029 | var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), |
| 2046 | 2030 | props = (prop + ' ' + cssPrefixes.join(ucProp + ' ') + ucProp).split(' '), |
| 2047 | 2031 | cur, val, i = 0; |
| @@ -2048,12 +2032,11 @@ | ||
| 2048 | 2032 | |
| 2049 | 2033 | // If the property has already been mapped... |
| 2050 | 2034 | if(cssProps[prop]) { return elem.css(cssProps[prop]); } |
| 2051 | 2035 | |
| 2052 | - while(cur = props[i++]) { | |
| 2036 | + while((cur = props[i++])) { | |
| 2053 | 2037 | if((val = elem.css(cur)) !== undefined) { |
| 2054 | - cssProps[prop] = cur; | |
| 2055 | - return val; | |
| 2038 | + return cssProps[prop] = cur, val; | |
| 2056 | 2039 | } |
| 2057 | 2040 | } |
| 2058 | 2041 | } |
| 2059 | 2042 | |
| @@ -2064,9 +2047,9 @@ | ||
| 2064 | 2047 | |
| 2065 | 2048 | |
| 2066 | 2049 | // VML creation (for IE only) |
| 2067 | 2050 | if(!HASCANVAS) { |
| 2068 | - createVML = function(tag, props, style) { | |
| 2051 | + var createVML = function(tag, props, style) { | |
| 2069 | 2052 | return '<qtipvml:'+tag+' xmlns="urn:schemas-microsoft.com:vml" class="qtip-vml" '+(props||'')+ |
| 2070 | 2053 | ' style="behavior: url(#default#VML); '+(style||'')+ '" />'; |
| 2071 | 2054 | }; |
| 2072 | 2055 | } |
| @@ -2072,15 +2055,15 @@ | ||
| 2072 | 2055 | } |
| 2073 | 2056 | |
| 2074 | 2057 | // Canvas only definitions |
| 2075 | 2058 | else { |
| 2076 | - PIXEL_RATIO = window.devicePixelRatio || 1; | |
| 2077 | - BACKING_STORE_RATIO = (function() { | |
| 2078 | - var context = document.createElement('canvas').getContext('2d'); | |
| 2079 | - return context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || | |
| 2080 | - context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || 1; | |
| 2081 | - })(); | |
| 2082 | - SCALE = PIXEL_RATIO / BACKING_STORE_RATIO; | |
| 2059 | + var PIXEL_RATIO = window.devicePixelRatio || 1, | |
| 2060 | + BACKING_STORE_RATIO = (function() { | |
| 2061 | + var context = document.createElement('canvas').getContext('2d'); | |
| 2062 | + return context.backingStorePixelRatio || context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || | |
| 2063 | + context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || 1; | |
| 2064 | + }()), | |
| 2065 | + SCALE = PIXEL_RATIO / BACKING_STORE_RATIO; | |
| 2083 | 2066 | } |
| 2084 | 2067 | |
| 2085 | 2068 | |
| 2086 | 2069 | function Tip(qtip, options) { |
| @@ -2089,10 +2072,9 @@ | ||
| 2089 | 2072 | this.offset = options.offset; |
| 2090 | 2073 | this.size = [ options.width, options.height ]; |
| 2091 | 2074 | |
| 2092 | 2075 | // Initialize |
| 2093 | - this.qtip = qtip; | |
| 2094 | - this.init(qtip); | |
| 2076 | + this.init( (this.qtip = qtip) ); | |
| 2095 | 2077 | } |
| 2096 | 2078 | |
| 2097 | 2079 | $.extend(Tip.prototype, { |
| 2098 | 2080 | init: function(qtip) { |
| @@ -2137,9 +2119,9 @@ | ||
| 2137 | 2119 | |
| 2138 | 2120 | _useTitle: function(corner) { |
| 2139 | 2121 | var titlebar = this.qtip.elements.titlebar; |
| 2140 | 2122 | return titlebar && ( |
| 2141 | - corner.y === TOP || corner.y === CENTER && this.element.position().top + this.size[1] / 2 + this.options.offset < titlebar.outerHeight(TRUE) | |
| 2123 | + corner.y === TOP || (corner.y === CENTER && this.element.position().top + (this.size[1] / 2) + this.options.offset < titlebar.outerHeight(TRUE)) | |
| 2142 | 2124 | ); |
| 2143 | 2125 | }, |
| 2144 | 2126 | |
| 2145 | 2127 | _parseCorner: function(corner) { |
| @@ -2163,13 +2145,13 @@ | ||
| 2163 | 2145 | _parseWidth: function(corner, side, use) { |
| 2164 | 2146 | var elements = this.qtip.elements, |
| 2165 | 2147 | prop = BORDER + camel(side) + 'Width'; |
| 2166 | 2148 | |
| 2167 | - return (use ? intCss(use, prop) : | |
| 2149 | + return (use ? intCss(use, prop) : ( | |
| 2168 | 2150 | intCss(elements.content, prop) || |
| 2169 | 2151 | intCss(this._useTitle(corner) && elements.titlebar || elements.content, prop) || |
| 2170 | 2152 | intCss(elements.tooltip, prop) |
| 2171 | - ) || 0; | |
| 2153 | + )) || 0; | |
| 2172 | 2154 | }, |
| 2173 | 2155 | |
| 2174 | 2156 | _parseRadius: function(corner) { |
| 2175 | 2157 | var elements = this.qtip.elements, |
| @@ -2181,9 +2163,9 @@ | ||
| 2181 | 2163 | }, |
| 2182 | 2164 | |
| 2183 | 2165 | _invalidColour: function(elem, prop, compare) { |
| 2184 | 2166 | var val = elem.css(prop); |
| 2185 | - return !val || compare && val === elem.css(compare) || INVALID.test(val) ? FALSE : val; | |
| 2167 | + return !val || (compare && val === elem.css(compare)) || INVALID.test(val) ? FALSE : val; | |
| 2186 | 2168 | }, |
| 2187 | 2169 | |
| 2188 | 2170 | _parseColours: function(corner) { |
| 2189 | 2171 | var elements = this.qtip.elements, |
| @@ -2207,10 +2189,10 @@ | ||
| 2207 | 2189 | }, |
| 2208 | 2190 | |
| 2209 | 2191 | _calculateSize: function(corner) { |
| 2210 | 2192 | var y = corner.precedance === Y, |
| 2211 | - width = this.options.width, | |
| 2212 | - height = this.options.height, | |
| 2193 | + width = this.options['width'], | |
| 2194 | + height = this.options['height'], | |
| 2213 | 2195 | isCenter = corner.abbrev() === 'c', |
| 2214 | 2196 | base = (y ? width: height) * (isCenter ? 0.5 : 1), |
| 2215 | 2197 | pow = Math.pow, |
| 2216 | 2198 | round = Math.round, |
| @@ -2216,12 +2198,9 @@ | ||
| 2216 | 2198 | round = Math.round, |
| 2217 | 2199 | bigHyp, ratio, result, |
| 2218 | 2200 | |
| 2219 | 2201 | smallHyp = Math.sqrt( pow(base, 2) + pow(height, 2) ), |
| 2220 | - hyp = [ | |
| 2221 | - this.border / base * smallHyp, | |
| 2222 | - this.border / height * smallHyp | |
| 2223 | - ]; | |
| 2202 | + hyp = [ (this.border / base) * smallHyp, (this.border / height) * smallHyp ]; | |
| 2224 | 2203 | |
| 2225 | 2204 | hyp[2] = Math.sqrt( pow(hyp[0], 2) - pow(this.border, 2) ); |
| 2226 | 2205 | hyp[3] = Math.sqrt( pow(hyp[1], 2) - pow(this.border, 2) ); |
| 2227 | 2206 | |
| @@ -2273,10 +2252,9 @@ | ||
| 2273 | 2252 | // Determine tip corner |
| 2274 | 2253 | var c = this.corner = (HASCANVAS || BROWSER.ie) && this._parseCorner(this.options.corner); |
| 2275 | 2254 | |
| 2276 | 2255 | // If we have a tip corner... |
| 2277 | - this.enabled = !!this.corner && this.corner.abbrev() !== 'c'; | |
| 2278 | - if(this.enabled) { | |
| 2256 | + if( (this.enabled = !!this.corner && this.corner.abbrev() !== 'c') ) { | |
| 2279 | 2257 | // Cache it |
| 2280 | 2258 | this.qtip.cache.corner = c.clone(); |
| 2281 | 2259 | |
| 2282 | 2260 | // Create it |
| @@ -2299,9 +2277,9 @@ | ||
| 2299 | 2277 | curSize = this.size, |
| 2300 | 2278 | mimic = options.mimic, |
| 2301 | 2279 | round = Math.round, |
| 2302 | 2280 | color, precedance, context, |
| 2303 | - coords, bigCoords, translate, newSize, border; | |
| 2281 | + coords, bigCoords, translate, newSize, border, BACKING_STORE_RATIO; | |
| 2304 | 2282 | |
| 2305 | 2283 | // Re-determine tip if not already set |
| 2306 | 2284 | if(!corner) { corner = this.qtip.cache.corner || this.corner; } |
| 2307 | 2285 | |
| @@ -2406,12 +2384,12 @@ | ||
| 2406 | 2384 | BROWSER.ie === 8 ? 2 : 1 : 0; |
| 2407 | 2385 | |
| 2408 | 2386 | // Set initial CSS |
| 2409 | 2387 | inner.css({ |
| 2410 | - coordsize: newSize[0]+border + ' ' + newSize[1]+border, | |
| 2388 | + coordsize: (newSize[0]+border) + ' ' + (newSize[1]+border), | |
| 2411 | 2389 | antialias: ''+(mimic.string().indexOf(CENTER) > -1), |
| 2412 | - left: translate[0] - translate[2] * Number(precedance === X), | |
| 2413 | - top: translate[1] - translate[2] * Number(precedance === Y), | |
| 2390 | + left: translate[0] - (translate[2] * Number(precedance === X)), | |
| 2391 | + top: translate[1] - (translate[2] * Number(precedance === Y)), | |
| 2414 | 2392 | width: newSize[0] + border, |
| 2415 | 2393 | height: newSize[1] + border |
| 2416 | 2394 | }) |
| 2417 | 2395 | .each(function(i) { |
| @@ -2418,9 +2396,9 @@ | ||
| 2418 | 2396 | var $this = $(this); |
| 2419 | 2397 | |
| 2420 | 2398 | // Set shape specific attributes |
| 2421 | 2399 | $this[ $this.prop ? 'prop' : 'attr' ]({ |
| 2422 | - coordsize: newSize[0]+border + ' ' + newSize[1]+border, | |
| 2400 | + coordsize: (newSize[0]+border) + ' ' + (newSize[1]+border), | |
| 2423 | 2401 | path: coords, |
| 2424 | 2402 | fillcolor: color[0], |
| 2425 | 2403 | filled: !!i, |
| 2426 | 2404 | stroked: !i |
| @@ -2428,9 +2406,9 @@ | ||
| 2428 | 2406 | .toggle(!!(border || i)); |
| 2429 | 2407 | |
| 2430 | 2408 | // Check if border is enabled and add stroke element |
| 2431 | 2409 | !i && $this.html( createVML( |
| 2432 | - 'stroke', 'weight="'+border*2+'px" color="'+color[1]+'" miterlimit="1000" joinstyle="miter"' | |
| 2410 | + 'stroke', 'weight="'+(border*2)+'px" color="'+color[1]+'" miterlimit="1000" joinstyle="miter"' | |
| 2433 | 2411 | ) ); |
| 2434 | 2412 | }); |
| 2435 | 2413 | } |
| 2436 | 2414 | |
| @@ -2453,9 +2431,10 @@ | ||
| 2453 | 2431 | var self = this, |
| 2454 | 2432 | elements = this.qtip.elements, |
| 2455 | 2433 | tip = this.element, |
| 2456 | 2434 | userOffset = this.options.offset, |
| 2457 | - position = {}, | |
| 2435 | + isWidget = elements.tooltip.hasClass('ui-widget'), | |
| 2436 | + position = { }, | |
| 2458 | 2437 | precedance, corners; |
| 2459 | 2438 | |
| 2460 | 2439 | // Inherit corner if not provided |
| 2461 | 2440 | corner = corner || this.corner; |
| @@ -2481,9 +2460,9 @@ | ||
| 2481 | 2460 | b = self._parseWidth(corner, side, elements.tooltip); |
| 2482 | 2461 | bc = self._parseWidth(corner, side, elements.content); |
| 2483 | 2462 | br = self._parseRadius(corner); |
| 2484 | 2463 | |
| 2485 | - position[ side ] = Math.max(-self.border, i ? bc : userOffset + (br > b ? br : -b)); | |
| 2464 | + position[ side ] = Math.max(-self.border, i ? bc : (userOffset + (br > b ? br : -b))); | |
| 2486 | 2465 | } |
| 2487 | 2466 | }); |
| 2488 | 2467 | |
| 2489 | 2468 | // Adjust for tip size |
| @@ -2493,9 +2472,9 @@ | ||
| 2493 | 2472 | tip.css({ margin: '', top: '', bottom: '', left: '', right: '' }).css(position); |
| 2494 | 2473 | return position; |
| 2495 | 2474 | }, |
| 2496 | 2475 | |
| 2497 | - reposition: function(event, api, pos) { | |
| 2476 | + reposition: function(event, api, pos, viewport) { | |
| 2498 | 2477 | if(!this.enabled) { return; } |
| 2499 | 2478 | |
| 2500 | 2479 | var cache = api.cache, |
| 2501 | 2480 | newCorner = this.corner.clone(), |
| @@ -2512,10 +2491,9 @@ | ||
| 2512 | 2491 | newCorner.precedance = newCorner.precedance === X ? Y : X; |
| 2513 | 2492 | } |
| 2514 | 2493 | else if(direction !== SHIFT && adjust[side]){ |
| 2515 | 2494 | newCorner[precedance] = newCorner[precedance] === CENTER ? |
| 2516 | - adjust[side] > 0 ? side : opposite : | |
| 2517 | - newCorner[precedance] === side ? opposite : side; | |
| 2495 | + (adjust[side] > 0 ? side : opposite) : (newCorner[precedance] === side ? opposite : side); | |
| 2518 | 2496 | } |
| 2519 | 2497 | } |
| 2520 | 2498 | |
| 2521 | 2499 | function shiftonly(xy, side, opposite) { |
| @@ -2555,16 +2533,10 @@ | ||
| 2555 | 2533 | if(offset.bottom !== undefined) { offset.top = -offset.bottom; } |
| 2556 | 2534 | offset.user = this.offset; |
| 2557 | 2535 | |
| 2558 | 2536 | // Perform shift adjustments |
| 2559 | - shift.left = horizontal === SHIFT && !!adjust.left; | |
| 2560 | - if(shift.left) { | |
| 2561 | - shiftonly(X, LEFT, RIGHT); | |
| 2562 | - } | |
| 2563 | - shift.top = vertical === SHIFT && !!adjust.top; | |
| 2564 | - if(shift.top) { | |
| 2565 | - shiftonly(Y, TOP, BOTTOM); | |
| 2566 | - } | |
| 2537 | + if(shift.left = (horizontal === SHIFT && !!adjust.left)) { shiftonly(X, LEFT, RIGHT); } | |
| 2538 | + if(shift.top = (vertical === SHIFT && !!adjust.top)) { shiftonly(Y, TOP, BOTTOM); } | |
| 2567 | 2539 | |
| 2568 | 2540 | /* |
| 2569 | 2541 | * If the tip is adjusted in both dimensions, or in a |
| 2570 | 2542 | * direction that would cause it to be anywhere but the |
| @@ -2570,9 +2542,9 @@ | ||
| 2570 | 2542 | * direction that would cause it to be anywhere but the |
| 2571 | 2543 | * outer border, hide it! |
| 2572 | 2544 | */ |
| 2573 | 2545 | this.element.css(css).toggle( |
| 2574 | - !(shift.x && shift.y || newCorner.x === CENTER && shift.y || newCorner.y === CENTER && shift.x) | |
| 2546 | + !((shift.x && shift.y) || (newCorner.x === CENTER && shift.y) || (newCorner.y === CENTER && shift.x)) | |
| 2575 | 2547 | ); |
| 2576 | 2548 | |
| 2577 | 2549 | // Adjust position to accomodate tip dimensions |
| 2578 | 2550 | pos.left -= offset.left.charAt ? offset.user : |
| @@ -2659,8 +2631,9 @@ | ||
| 2659 | 2631 | methodX = method[0], |
| 2660 | 2632 | methodY = method[1] || method[0], |
| 2661 | 2633 | viewport = posOptions.viewport, |
| 2662 | 2634 | container = posOptions.container, |
| 2635 | + cache = api.cache, | |
| 2663 | 2636 | adjusted = { left: 0, top: 0 }, |
| 2664 | 2637 | fixed, newMy, containerOffset, containerStatic, |
| 2665 | 2638 | viewportWidth, viewportHeight, viewportScroll, viewportOffset; |
| 2666 | 2639 | |
| @@ -2680,9 +2653,9 @@ | ||
| 2680 | 2653 | viewportScroll = { left: fixed ? 0 : viewport.scrollLeft(), top: fixed ? 0 : viewport.scrollTop() }; |
| 2681 | 2654 | viewportOffset = viewport.offset() || adjusted; |
| 2682 | 2655 | |
| 2683 | 2656 | // Generic calculation method |
| 2684 | - function calculate(side, otherSide, type, adjustment, side1, side2, lengthName, targetLength, elemLength) { | |
| 2657 | + function calculate(side, otherSide, type, adjust, side1, side2, lengthName, targetLength, elemLength) { | |
| 2685 | 2658 | var initialPos = position[side1], |
| 2686 | 2659 | mySide = my[side], |
| 2687 | 2660 | atSide = at[side], |
| 2688 | 2661 | isShift = type === SHIFT, |
| @@ -2718,24 +2691,24 @@ | ||
| 2718 | 2691 | |
| 2719 | 2692 | // flip/flipinvert |
| 2720 | 2693 | else { |
| 2721 | 2694 | // Update adjustment amount depending on if using flipinvert or flip |
| 2722 | - adjustment *= type === FLIPINVERT ? 2 : 0; | |
| 2695 | + adjust *= (type === FLIPINVERT ? 2 : 0); | |
| 2723 | 2696 | |
| 2724 | 2697 | // Check for overflow on the left/top |
| 2725 | 2698 | if(overflow1 > 0 && (mySide !== side1 || overflow2 > 0)) { |
| 2726 | - position[side1] -= offset + adjustment; | |
| 2699 | + position[side1] -= offset + adjust; | |
| 2727 | 2700 | newMy.invert(side, side1); |
| 2728 | 2701 | } |
| 2729 | 2702 | |
| 2730 | 2703 | // Check for overflow on the bottom/right |
| 2731 | 2704 | else if(overflow2 > 0 && (mySide !== side2 || overflow1 > 0) ) { |
| 2732 | - position[side1] -= (mySide === CENTER ? -offset : offset) + adjustment; | |
| 2705 | + position[side1] -= (mySide === CENTER ? -offset : offset) + adjust; | |
| 2733 | 2706 | newMy.invert(side, side2); |
| 2734 | 2707 | } |
| 2735 | 2708 | |
| 2736 | 2709 | // Make sure we haven't made things worse with the adjustment and reset if so |
| 2737 | - if(position[side1] < viewportScroll[side1] && -position[side1] > overflow2) { | |
| 2710 | + if(position[side1] < viewportScroll && -position[side1] > overflow2) { | |
| 2738 | 2711 | position[side1] = initialPos; newMy = my.clone(); |
| 2739 | 2712 | } |
| 2740 | 2713 | } |
| 2741 | 2714 | |
| @@ -2773,10 +2746,9 @@ | ||
| 2773 | 2746 | realX = 0, realY = 0, |
| 2774 | 2747 | newWidth, newHeight; |
| 2775 | 2748 | |
| 2776 | 2749 | // First pass, sanitize coords and determine outer edges |
| 2777 | - i = baseCoords.length; | |
| 2778 | - while(i--) { | |
| 2750 | + i = baseCoords.length; while(i--) { | |
| 2779 | 2751 | next = [ parseInt(baseCoords[--i], 10), parseInt(baseCoords[i+1], 10) ]; |
| 2780 | 2752 | |
| 2781 | 2753 | if(next[0] > result.position.right){ result.position.right = next[0]; } |
| 2782 | 2754 | if(next[0] < result.position.left){ result.position.left = next[0]; } |
| @@ -2792,10 +2764,10 @@ | ||
| 2792 | 2764 | |
| 2793 | 2765 | // If it's the center corner... |
| 2794 | 2766 | if(corner.abbrev() === 'c') { |
| 2795 | 2767 | result.position = { |
| 2796 | - left: result.position.left + result.width / 2, | |
| 2797 | - top: result.position.top + result.height / 2 | |
| 2768 | + left: result.position.left + (result.width / 2), | |
| 2769 | + top: result.position.top + (result.height / 2) | |
| 2798 | 2770 | }; |
| 2799 | 2771 | } |
| 2800 | 2772 | else { |
| 2801 | 2773 | // Second pass, use a binary search algorithm to locate most suitable coordinate |
| @@ -2811,10 +2783,9 @@ | ||
| 2811 | 2783 | if(corner.y === TOP){ compareY = newHeight; } |
| 2812 | 2784 | else if(corner.y === BOTTOM){ compareY = result.height - newHeight; } |
| 2813 | 2785 | else{ compareY += Math.floor(newHeight / 2); } |
| 2814 | 2786 | |
| 2815 | - i = coords.length; | |
| 2816 | - while(i--) | |
| 2787 | + i = coords.length; while(i--) | |
| 2817 | 2788 | { |
| 2818 | 2789 | if(coords.length < 2){ break; } |
| 2819 | 2790 | |
| 2820 | 2791 | realX = coords[i][0] - result.position.left; |
| @@ -2819,15 +2790,14 @@ | ||
| 2819 | 2790 | |
| 2820 | 2791 | realX = coords[i][0] - result.position.left; |
| 2821 | 2792 | realY = coords[i][1] - result.position.top; |
| 2822 | 2793 | |
| 2823 | - if( | |
| 2824 | - corner.x === LEFT && realX >= compareX || | |
| 2825 | - corner.x === RIGHT && realX <= compareX || | |
| 2826 | - corner.x === CENTER && (realX < compareX || realX > result.width - compareX) || | |
| 2827 | - corner.y === TOP && realY >= compareY || | |
| 2828 | - corner.y === BOTTOM && realY <= compareY || | |
| 2829 | - corner.y === CENTER && (realY < compareY || realY > result.height - compareY)) { | |
| 2794 | + if((corner.x === LEFT && realX >= compareX) || | |
| 2795 | + (corner.x === RIGHT && realX <= compareX) || | |
| 2796 | + (corner.x === CENTER && (realX < compareX || realX > (result.width - compareX))) || | |
| 2797 | + (corner.y === TOP && realY >= compareY) || | |
| 2798 | + (corner.y === BOTTOM && realY <= compareY) || | |
| 2799 | + (corner.y === CENTER && (realY < compareY || realY > (result.height - compareY)))) { | |
| 2830 | 2800 | coords.splice(i, 1); |
| 2831 | 2801 | } |
| 2832 | 2802 | } |
| 2833 | 2803 | } |
| @@ -2858,10 +2828,10 @@ | ||
| 2858 | 2828 | rxc = c === 0 ? 0 : rx * Math.cos( c * Math.PI ), |
| 2859 | 2829 | rys = ry * Math.sin( c * Math.PI ); |
| 2860 | 2830 | |
| 2861 | 2831 | return { |
| 2862 | - width: rx * 2 - Math.abs(rxc), | |
| 2863 | - height: ry * 2 - Math.abs(rys), | |
| 2832 | + width: (rx * 2) - Math.abs(rxc), | |
| 2833 | + height: (ry * 2) - Math.abs(rys), | |
| 2864 | 2834 | position: { |
| 2865 | 2835 | left: cx + rxc, |
| 2866 | 2836 | top: cy + rys |
| 2867 | 2837 | }, |
| @@ -2871,9 +2841,9 @@ | ||
| 2871 | 2841 | circle: function(cx, cy, r, corner) { |
| 2872 | 2842 | return PLUGINS.polys.ellipse(cx, cy, r, r, corner); |
| 2873 | 2843 | } |
| 2874 | 2844 | }; |
| 2875 | -;PLUGINS.imagemap = function(api, area, corner) | |
| 2845 | +;PLUGINS.imagemap = function(api, area, corner, adjustMethod) | |
| 2876 | 2846 | { |
| 2877 | 2847 | if(!area.jquery) { area = $(area); } |
| 2878 | 2848 | |
| 2879 | 2849 | var shape = (area.attr('shape') || 'rect').toLowerCase().replace('poly', 'polygon'), |
| @@ -2879,9 +2849,9 @@ | ||
| 2879 | 2849 | var shape = (area.attr('shape') || 'rect').toLowerCase().replace('poly', 'polygon'), |
| 2880 | 2850 | image = $('img[usemap="#'+area.parent('map').attr('name')+'"]'), |
| 2881 | 2851 | coordsString = $.trim(area.attr('coords')), |
| 2882 | 2852 | coordsArray = coordsString.replace(/,$/, '').split(','), |
| 2883 | - imageOffset, coords, i, result, len; | |
| 2853 | + imageOffset, coords, i, next, result, len; | |
| 2884 | 2854 | |
| 2885 | 2855 | // If we can't find the image using the map... |
| 2886 | 2856 | if(!image.length) { return FALSE; } |
| 2887 | 2857 | |
| @@ -2916,15 +2886,16 @@ | ||
| 2916 | 2886 | return result; |
| 2917 | 2887 | }; |
| 2918 | 2888 | ;PLUGINS.svg = function(api, svg, corner) |
| 2919 | 2889 | { |
| 2920 | - var elem = svg[0], | |
| 2890 | + var doc = $(document), | |
| 2891 | + elem = svg[0], | |
| 2921 | 2892 | root = $(elem.ownerSVGElement), |
| 2922 | 2893 | ownerDocument = elem.ownerDocument, |
| 2923 | 2894 | strokeWidth2 = (parseInt(svg.css('stroke-width'), 10) || 0) / 2, |
| 2924 | - frameOffset, mtx, transformed, | |
| 2895 | + frameOffset, mtx, transformed, viewBox, | |
| 2925 | 2896 | len, next, i, points, |
| 2926 | - result, position; | |
| 2897 | + result, position, dimensions; | |
| 2927 | 2898 | |
| 2928 | 2899 | // Ascend the parentNode chain until we find an element with getBBox() |
| 2929 | 2900 | while(!elem.getBBox) { elem = elem.parentNode; } |
| 2930 | 2901 | if(!elem.getBBox || !elem.parentNode) { return FALSE; } |
| @@ -3012,11 +2983,10 @@ | ||
| 3012 | 2983 | OVERLAY = function() |
| 3013 | 2984 | { |
| 3014 | 2985 | var self = this, |
| 3015 | 2986 | focusableElems = {}, |
| 3016 | - current, | |
| 3017 | - prevState, | |
| 3018 | - elem; | |
| 2987 | + current, onLast, | |
| 2988 | + prevState, elem; | |
| 3019 | 2989 | |
| 3020 | 2990 | // Modified code from jQuery UI 1.10.0 source |
| 3021 | 2991 | // http://code.jquery.com/ui/1.10.0/jquery-ui.js |
| 3022 | 2992 | function focusable(element) { |
| @@ -3035,15 +3005,14 @@ | ||
| 3035 | 3005 | } |
| 3036 | 3006 | img = $('img[usemap=#' + mapName + ']')[0]; |
| 3037 | 3007 | return !!img && img.is(':visible'); |
| 3038 | 3008 | } |
| 3039 | - | |
| 3040 | - return /input|select|textarea|button|object/.test( nodeName ) ? | |
| 3041 | - !element.disabled : | |
| 3042 | - 'a' === nodeName ? | |
| 3043 | - element.href || isTabIndexNotNaN : | |
| 3044 | - isTabIndexNotNaN | |
| 3045 | - ; | |
| 3009 | + return (/input|select|textarea|button|object/.test( nodeName ) ? | |
| 3010 | + !element.disabled : | |
| 3011 | + 'a' === nodeName ? | |
| 3012 | + element.href || isTabIndexNotNaN : | |
| 3013 | + isTabIndexNotNaN | |
| 3014 | + ); | |
| 3046 | 3015 | } |
| 3047 | 3016 | |
| 3048 | 3017 | // Focus inputs using cached focusable elements (see update()) |
| 3049 | 3018 | function focusInputs(blurElems) { |
| @@ -3064,9 +3033,9 @@ | ||
| 3064 | 3033 | targetOnTop; |
| 3065 | 3034 | |
| 3066 | 3035 | // Determine if input container target is above this |
| 3067 | 3036 | targetOnTop = container.length < 1 ? FALSE : |
| 3068 | - parseInt(container[0].style.zIndex, 10) > parseInt(tooltip[0].style.zIndex, 10); | |
| 3037 | + (parseInt(container[0].style.zIndex, 10) > parseInt(tooltip[0].style.zIndex, 10)); | |
| 3069 | 3038 | |
| 3070 | 3039 | // If we're showing a modal, but focus has landed on an input below |
| 3071 | 3040 | // this modal, divert focus to the first visible input in this modal |
| 3072 | 3041 | // or if we can't find one... the tooltip itself |
| @@ -3072,8 +3041,11 @@ | ||
| 3072 | 3041 | // or if we can't find one... the tooltip itself |
| 3073 | 3042 | if(!targetOnTop && target.closest(SELECTOR)[0] !== tooltip[0]) { |
| 3074 | 3043 | focusInputs(target); |
| 3075 | 3044 | } |
| 3045 | + | |
| 3046 | + // Detect when we leave the last focusable element... | |
| 3047 | + onLast = event.target === focusableElems[focusableElems.length - 1]; | |
| 3076 | 3048 | } |
| 3077 | 3049 | |
| 3078 | 3050 | $.extend(self, { |
| 3079 | 3051 | init: function() { |
| @@ -3118,14 +3090,16 @@ | ||
| 3118 | 3090 | else { focusableElems = []; } |
| 3119 | 3091 | }, |
| 3120 | 3092 | |
| 3121 | 3093 | toggle: function(api, state, duration) { |
| 3122 | - var tooltip = api.tooltip, | |
| 3094 | + var docBody = $(document.body), | |
| 3095 | + tooltip = api.tooltip, | |
| 3123 | 3096 | options = api.options.show.modal, |
| 3124 | 3097 | effect = options.effect, |
| 3125 | 3098 | type = state ? 'show': 'hide', |
| 3126 | 3099 | visible = elem.is(':visible'), |
| 3127 | - visibleModals = $(MODALSELECTOR).filter(':visible:not(:animated)').not(tooltip); | |
| 3100 | + visibleModals = $(MODALSELECTOR).filter(':visible:not(:animated)').not(tooltip), | |
| 3101 | + zindex; | |
| 3128 | 3102 | |
| 3129 | 3103 | // Set active tooltip API reference |
| 3130 | 3104 | self.update(api); |
| 3131 | 3105 | |
| @@ -3143,9 +3117,9 @@ | ||
| 3143 | 3117 | elem.appendTo(document.body); |
| 3144 | 3118 | } |
| 3145 | 3119 | |
| 3146 | 3120 | // Prevent modal from conflicting with show.solo, and don't hide backdrop is other modals are visible |
| 3147 | - if(elem.is(':animated') && visible === state && prevState !== FALSE || !state && visibleModals.length) { | |
| 3121 | + if((elem.is(':animated') && visible === state && prevState !== FALSE) || (!state && visibleModals.length)) { | |
| 3148 | 3122 | return self; |
| 3149 | 3123 | } |
| 3150 | 3124 | |
| 3151 | 3125 | // Stop all animations |
| @@ -3194,10 +3168,9 @@ | ||
| 3194 | 3168 | function Modal(api, options) { |
| 3195 | 3169 | this.options = options; |
| 3196 | 3170 | this._ns = '-modal'; |
| 3197 | 3171 | |
| 3198 | - this.qtip = api; | |
| 3199 | - this.init(api); | |
| 3172 | + this.init( (this.qtip = api) ); | |
| 3200 | 3173 | } |
| 3201 | 3174 | |
| 3202 | 3175 | $.extend(Modal.prototype, { |
| 3203 | 3176 | init: function(qtip) { |
| @@ -3218,14 +3191,11 @@ | ||
| 3218 | 3191 | |
| 3219 | 3192 | // Make sure mouseout doesn't trigger a hide when showing the modal and mousing onto backdrop |
| 3220 | 3193 | if(event.target === tooltip[0]) { |
| 3221 | 3194 | if(oEvent && event.type === 'tooltiphide' && /mouse(leave|enter)/.test(oEvent.type) && $(oEvent.relatedTarget).closest(OVERLAY.elem[0]).length) { |
| 3222 | - /* eslint-disable no-empty */ | |
| 3223 | - try { event.preventDefault(); } | |
| 3224 | - catch(e) {} | |
| 3225 | - /* eslint-enable no-empty */ | |
| 3195 | + try { event.preventDefault(); } catch(e) {} | |
| 3226 | 3196 | } |
| 3227 | - else if(!oEvent || oEvent && oEvent.type !== 'tooltipsolo') { | |
| 3197 | + else if(!oEvent || (oEvent && oEvent.type !== 'tooltipsolo')) { | |
| 3228 | 3198 | this.toggle(event, event.type === 'tooltipshow', duration); |
| 3229 | 3199 | } |
| 3230 | 3200 | } |
| 3231 | 3201 | }, this._ns, this); |
| @@ -3260,12 +3230,9 @@ | ||
| 3260 | 3230 | // Set current |
| 3261 | 3231 | OVERLAY.update(api); |
| 3262 | 3232 | |
| 3263 | 3233 | // Prevent default handling |
| 3264 | - /* eslint-disable no-empty */ | |
| 3265 | - try { event.preventDefault(); } | |
| 3266 | - catch(e) {} | |
| 3267 | - /* eslint-enable no-empty */ | |
| 3234 | + try { event.preventDefault(); } catch(e) {} | |
| 3268 | 3235 | }, this._ns, this); |
| 3269 | 3236 | |
| 3270 | 3237 | // Focus any other visible modals when this one hides |
| 3271 | 3238 | qtip._bind(tooltip, 'tooltiphide', function(event) { |
| @@ -3309,11 +3276,9 @@ | ||
| 3309 | 3276 | } |
| 3310 | 3277 | }; |
| 3311 | 3278 | |
| 3312 | 3279 | // Base z-index for all modal tooltips (use qTip core z-index as a base) |
| 3313 | -/* eslint-disable camelcase */ | |
| 3314 | 3280 | QTIP.modal_zindex = QTIP.zindex - 200; |
| 3315 | -/* eslint-enable camelcase */ | |
| 3316 | 3281 | |
| 3317 | 3282 | // Plugin needs to be initialized on render |
| 3318 | 3283 | MODAL.initialize = 'render'; |
| 3319 | 3284 | |
| @@ -3352,13 +3317,11 @@ | ||
| 3352 | 3317 | BGIFRAME = '<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:\'\';" ' + |
| 3353 | 3318 | ' style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=0); ' + |
| 3354 | 3319 | '-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";"></iframe>'; |
| 3355 | 3320 | |
| 3356 | -function Ie6(api) { | |
| 3321 | +function Ie6(api, qtip) { | |
| 3357 | 3322 | this._ns = 'ie6'; |
| 3358 | - | |
| 3359 | - this.qtip = api; | |
| 3360 | - this.init(api); | |
| 3323 | + this.init( (this.qtip = api) ); | |
| 3361 | 3324 | } |
| 3362 | 3325 | |
| 3363 | 3326 | $.extend(Ie6.prototype, { |
| 3364 | 3327 | _scroll : function() { |
| @@ -3366,9 +3329,10 @@ | ||
| 3366 | 3329 | overlay && (overlay[0].style.top = $(window).scrollTop() + 'px'); |
| 3367 | 3330 | }, |
| 3368 | 3331 | |
| 3369 | 3332 | init: function(qtip) { |
| 3370 | - var tooltip = qtip.tooltip; | |
| 3333 | + var tooltip = qtip.tooltip, | |
| 3334 | + scroll; | |
| 3371 | 3335 | |
| 3372 | 3336 | // Create the BGIFrame element if needed |
| 3373 | 3337 | if($('select, object').length < 1) { |
| 3374 | 3338 | this.bgiframe = qtip.elements.bgiframe = $(BGIFRAME).appendTo(tooltip); |
| @@ -3406,9 +3370,9 @@ | ||
| 3406 | 3370 | offset = { left: -offset, top: -offset }; |
| 3407 | 3371 | |
| 3408 | 3372 | // Adjust for tips plugin |
| 3409 | 3373 | if(plugin && tip) { |
| 3410 | - tipAdjust = plugin.corner.precedance === 'x' ? [WIDTH, LEFT] : [HEIGHT, TOP]; | |
| 3374 | + tipAdjust = (plugin.corner.precedance === 'x') ? [WIDTH, LEFT] : [HEIGHT, TOP]; | |
| 3411 | 3375 | offset[ tipAdjust[1] ] -= tip[ tipAdjust[0] ](); |
| 3412 | 3376 | } |
| 3413 | 3377 | |
| 3414 | 3378 | // Update bgiframe |
| @@ -3445,10 +3409,10 @@ | ||
| 3445 | 3409 | min = tooltip.css('minWidth') || ''; |
| 3446 | 3410 | |
| 3447 | 3411 | // Parse into proper pixel values |
| 3448 | 3412 | perc = (max + min).indexOf('%') > -1 ? container.width() / 100 : 0; |
| 3449 | - max = (max.indexOf('%') > -1 ? perc : 1 * parseInt(max, 10)) || width; | |
| 3450 | - min = (min.indexOf('%') > -1 ? perc : 1 * parseInt(min, 10)) || 0; | |
| 3413 | + max = ((max.indexOf('%') > -1 ? perc : 1) * parseInt(max, 10)) || width; | |
| 3414 | + min = ((min.indexOf('%') > -1 ? perc : 1) * parseInt(min, 10)) || 0; | |
| 3451 | 3415 | |
| 3452 | 3416 | // Determine new dimension size based on max/min/current values |
| 3453 | 3417 | width = max + min ? Math.min(Math.max(width, min), max) : width; |
| 3454 | 3418 | |