jquery-qtip2-rails 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,10 +3,18 @@
3
3
  margin: 0 auto;
4
4
  overflow: hidden;
5
5
  z-index: 10;
6
+
6
7
  }
7
8
 
9
+ /* Opera bug #357 - Incorrect tip position
10
+ https://github.com/Craga89/qTip2/issues/367 */
11
+ x:-o-prefocus, .qtip .qtip-tip{
12
+ visibility: hidden;
13
+ }
14
+
8
15
  .qtip .qtip-tip,
9
- .qtip .qtip-tip .qtip-vml{
16
+ .qtip .qtip-tip .qtip-vml,
17
+ .qtip .qtip-tip canvas{
10
18
  position: absolute;
11
19
 
12
20
  color: #123456;
@@ -1,3 +1,7 @@
1
+ var TIP,
2
+ TIPNS = '.qtip-tip',
3
+ HASCANVAS = !!document.createElement('canvas').getContext;
4
+
1
5
  // Tip coordinates calculator
2
6
  function calculateTip(corner, width, height)
3
7
  {
@@ -36,8 +40,6 @@ function Tip(qTip, command)
36
40
  },
37
41
  color = { },
38
42
  border = opts.border || 0,
39
- namespace = '.qtip-tip',
40
- hasCanvas = !!($('<canvas />')[0] || {}).getContext,
41
43
  tiphtml;
42
44
 
43
45
  self.corner = NULL;
@@ -139,7 +141,7 @@ function Tip(qTip, command)
139
141
  // Viewport "shift" specific adjustments
140
142
  if(shift.left = (horizontal === SHIFT && !!adjust.left)) {
141
143
  if(newCorner.x === CENTER) {
142
- css['margin-left'] = shift.x = offset['margin-left'];
144
+ css['margin-left'] = shift.x = offset['margin-left'] - adjust.left;
143
145
  }
144
146
  else {
145
147
  props = offset.right !== undefined ?
@@ -155,7 +157,7 @@ function Tip(qTip, command)
155
157
  }
156
158
  if(shift.top = (vertical === SHIFT && !!adjust.top)) {
157
159
  if(newCorner.y === CENTER) {
158
- css['margin-top'] = shift.y = offset['margin-top'];
160
+ css['margin-top'] = shift.y = offset['margin-top'] - adjust.top;
159
161
  }
160
162
  else {
161
163
  props = offset.bottom !== undefined ?
@@ -234,15 +236,16 @@ function Tip(qTip, command)
234
236
  function parseRadius(corner) {
235
237
  var isTitleTop = elems.titlebar && corner.y === TOP,
236
238
  elem = isTitleTop ? elems.titlebar : elems.content,
237
- moz = $.browser.mozilla,
238
- prefix = moz ? '-moz-' : $.browser.webkit ? '-webkit-' : '',
239
+ mozPrefix = '-moz-', webkitPrefix = '-webkit-',
239
240
  nonStandard = 'border-radius-' + corner.y + corner.x,
240
241
  standard = 'border-' + corner.y + '-' + corner.x + '-radius',
241
242
  css = function(c) { return parseInt(elem.css(c), 10) || parseInt(tooltip.css(c), 10); },
242
243
  val;
243
244
 
244
245
  whileVisible(function() {
245
- val = css(standard) || css(prefix + standard) || css(prefix + nonStandard) || css(nonStandard) || 0;
246
+ val = css(standard) || css(nonStandard) ||
247
+ css(mozPrefix + standard) || css(mozPrefix + nonStandard) ||
248
+ css(webkitPrefix + standard) || css(webkitPrefix + nonStandard) || 0;
246
249
  });
247
250
  return val;
248
251
  }
@@ -315,7 +318,7 @@ function Tip(qTip, command)
315
318
  $.extend(self, {
316
319
  init: function()
317
320
  {
318
- var enabled = parseCorner() && (hasCanvas || $.browser.msie);
321
+ var enabled = parseCorner() && (HASCANVAS || PLUGINS.ie);
319
322
 
320
323
  // Determine tip corner and type
321
324
  if(enabled) {
@@ -324,7 +327,7 @@ function Tip(qTip, command)
324
327
  self.update();
325
328
 
326
329
  // Bind update events
327
- tooltip.unbind(namespace).bind('tooltipmove'+namespace, reposition);
330
+ tooltip.unbind(TIPNS).bind('tooltipmove'+TIPNS, reposition);
328
331
  }
329
332
 
330
333
  return enabled;
@@ -343,7 +346,7 @@ function Tip(qTip, command)
343
346
  elems.tip = $('<div />', { 'class': 'qtip-tip' }).css({ width: width, height: height }).prependTo(tooltip);
344
347
 
345
348
  // Create tip drawing element(s)
346
- if(hasCanvas) {
349
+ if(HASCANVAS) {
347
350
  // save() as soon as we create the canvas element so FF2 doesn't bork on our first restore()!
348
351
  $('<canvas />').appendTo(elems.tip)[0].getContext('2d').save();
349
352
  }
@@ -352,7 +355,7 @@ function Tip(qTip, command)
352
355
  elems.tip.html(vml + vml);
353
356
 
354
357
  // Prevent mousing down on the tip since it causes problems with .live() handling in IE due to VML
355
- $('*', elems.tip).bind('click mousedown', function(event) { event.stopPropagation(); });
358
+ $('*', elems.tip).bind('click'+TIPNS+' mousedown'+TIPNS, function(event) { event.stopPropagation(); });
356
359
  }
357
360
  },
358
361
 
@@ -435,7 +438,7 @@ function Tip(qTip, command)
435
438
  }
436
439
 
437
440
  // Canvas drawing implementation
438
- if(hasCanvas) {
441
+ if(HASCANVAS) {
439
442
  // Set the canvas size using calculated size
440
443
  inner.attr(newSize);
441
444
 
@@ -482,8 +485,8 @@ function Tip(qTip, command)
482
485
  ',' + coords[1][1] + ' ' + coords[2][0] + ',' + coords[2][1] + ' xe';
483
486
 
484
487
  // Setup VML-specific offset for pixel-perfection
485
- translate[2] = border && /^(r|b)/i.test(corner.string()) ?
486
- parseFloat($.browser.version, 10) === 8 ? 2 : 1 : 0;
488
+ translate[2] = border && /^(r|b)/i.test(corner.string()) ?
489
+ PLUGINS.ie === 8 ? 2 : 1 : 0;
487
490
 
488
491
  // Set initial CSS
489
492
  inner.css({
@@ -516,8 +519,18 @@ function Tip(qTip, command)
516
519
  });
517
520
  }
518
521
 
522
+ // Opera bug #357 - Incorrect tip position
523
+ // https://github.com/Craga89/qTip2/issues/367
524
+ setTimeout(function() {
525
+ elems.tip.css({
526
+ display: 'inline-block',
527
+ visibility: 'visible'
528
+ });
529
+ }, 1);
530
+
519
531
  // Position if needed
520
532
  if(position !== FALSE) { self.position(corner); }
533
+
521
534
  },
522
535
 
523
536
  // Tip positioning method
@@ -570,19 +583,26 @@ function Tip(qTip, command)
570
583
 
571
584
  destroy: function()
572
585
  {
573
- // Remove the tip element
574
- if(elems.tip) { elems.tip.remove(); }
575
- elems.tip = false;
576
-
577
586
  // Unbind events
578
- tooltip.unbind(namespace);
587
+ tooltip.unbind(TIPNS);
588
+
589
+ // Remove the tip element(s)
590
+ if(elems.tip) {
591
+ elems.tip.find('*').remove()
592
+ .end().remove();
593
+ }
594
+
595
+ // Delete references
596
+ delete self.corner;
597
+ delete self.mimic;
598
+ delete self.size;
579
599
  }
580
600
  });
581
601
 
582
602
  self.init();
583
603
  }
584
604
 
585
- PLUGINS.tip = function(api)
605
+ TIP = PLUGINS.tip = function(api)
586
606
  {
587
607
  var self = api.plugins.tip;
588
608
 
@@ -590,16 +610,16 @@ PLUGINS.tip = function(api)
590
610
  };
591
611
 
592
612
  // Initialize tip on render
593
- PLUGINS.tip.initialize = 'render';
613
+ TIP.initialize = 'render';
594
614
 
595
615
  // Setup plugin sanitization options
596
- PLUGINS.tip.sanitize = function(options)
616
+ TIP.sanitize = function(options)
597
617
  {
598
618
  var style = options.style, opts;
599
619
  if(style && 'tip' in style) {
600
620
  opts = options.style.tip;
601
621
  if(typeof opts !== 'object'){ options.style.tip = { corner: opts }; }
602
- if(!(/string|boolean/i).test(typeof opts['corner'])) { opts['corner'] = TRUE; }
622
+ if(!(/string|boolean/i).test(typeof opts.corner)) { opts.corner = TRUE; }
603
623
  if(typeof opts.width !== 'number'){ delete opts.width; }
604
624
  if(typeof opts.height !== 'number'){ delete opts.height; }
605
625
  if(typeof opts.border !== 'number' && opts.border !== TRUE){ delete opts.border; }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery-qtip2-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-14 00:00:00.000000000 Z
12
+ date: 2013-02-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -59,6 +59,22 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: uglifier
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
62
78
  description: qTip2 jQuery plugin
63
79
  email:
64
80
  - tkrotoff@gmail.com