jquery-qtip2-rails 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/README.md +16 -13
  2. data/jquery-qtip2-rails.gemspec +7 -4
  3. data/lib/jquery-qtip2-rails/version.rb +1 -1
  4. data/test/dummy/README.rdoc +261 -0
  5. data/test/dummy/Rakefile +7 -0
  6. data/test/dummy/app/assets/javascripts/application.js +16 -0
  7. data/test/dummy/app/assets/javascripts/home.js +48 -0
  8. data/test/dummy/app/assets/stylesheets/application.css +14 -0
  9. data/test/dummy/app/assets/stylesheets/home.css +4 -0
  10. data/test/dummy/app/controllers/application_controller.rb +3 -0
  11. data/test/dummy/app/controllers/home_controller.rb +5 -0
  12. data/test/dummy/app/helpers/application_helper.rb +2 -0
  13. data/test/dummy/app/helpers/home_helper.rb +2 -0
  14. data/test/dummy/app/mailers/.gitkeep +0 -0
  15. data/test/dummy/app/models/.gitkeep +0 -0
  16. data/test/dummy/app/views/home/index.html.erb +14 -0
  17. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  18. data/test/dummy/config.ru +4 -0
  19. data/test/dummy/config/application.rb +68 -0
  20. data/test/dummy/config/boot.rb +10 -0
  21. data/test/dummy/config/environment.rb +5 -0
  22. data/test/dummy/config/environments/development.rb +31 -0
  23. data/test/dummy/config/environments/production.rb +64 -0
  24. data/test/dummy/config/environments/test.rb +35 -0
  25. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  26. data/test/dummy/config/initializers/inflections.rb +15 -0
  27. data/test/dummy/config/initializers/mime_types.rb +5 -0
  28. data/test/dummy/config/initializers/secret_token.rb +7 -0
  29. data/test/dummy/config/initializers/session_store.rb +8 -0
  30. data/test/dummy/config/initializers/wrap_parameters.rb +10 -0
  31. data/test/dummy/config/locales/en.yml +5 -0
  32. data/test/dummy/config/routes.rb +3 -0
  33. data/test/dummy/lib/assets/.gitkeep +0 -0
  34. data/test/dummy/log/.gitkeep +0 -0
  35. data/test/dummy/public/404.html +26 -0
  36. data/test/dummy/public/422.html +26 -0
  37. data/test/dummy/public/500.html +25 -0
  38. data/test/dummy/public/favicon.ico +0 -0
  39. data/test/dummy/script/rails +6 -0
  40. data/vendor/assets/jquery-qtip/jquery-qtip/src/ajax/ajax.js +3 -2
  41. data/vendor/assets/jquery-qtip/jquery-qtip/src/{styles.css → basic.css} +0 -0
  42. data/vendor/assets/jquery-qtip/jquery-qtip/src/core.css +27 -22
  43. data/vendor/assets/jquery-qtip/jquery-qtip/src/core.js +162 -315
  44. data/vendor/assets/jquery-qtip/jquery-qtip/src/{extra.css → css3.css} +70 -30
  45. data/vendor/assets/jquery-qtip/jquery-qtip/src/imagemap/imagemap.js +59 -45
  46. data/vendor/assets/jquery-qtip/jquery-qtip/src/intro.js +31 -29
  47. data/vendor/assets/jquery-qtip/jquery-qtip/src/modal/modal.js +7 -5
  48. data/vendor/assets/jquery-qtip/jquery-qtip/src/outro.js +2 -2
  49. data/vendor/assets/jquery-qtip/jquery-qtip/src/svg/svg.js +8 -8
  50. data/vendor/assets/jquery-qtip/jquery-qtip/src/tips/tips.css +7 -3
  51. data/vendor/assets/jquery-qtip/jquery-qtip/src/tips/tips.js +159 -147
  52. data/vendor/assets/jquery-qtip/jquery-qtip/src/viewport/viewport.js +112 -0
  53. data/vendor/assets/jquery-qtip/jquery.qtip.basic.css +5 -0
  54. data/vendor/assets/jquery-qtip/jquery.qtip.basic.js +0 -1
  55. data/vendor/assets/jquery-qtip/jquery.qtip.css +3 -4
  56. data/vendor/assets/jquery-qtip/jquery.qtip.js +5 -5
  57. metadata +103 -8
  58. data/vendor/assets/jquery-qtip/jquery-qtip/src/header.txt +0 -14
@@ -1,2 +1,2 @@
1
-
2
- }));
1
+ }));
2
+ }( window, document ));
@@ -1,10 +1,10 @@
1
- PLUGINS.svg = function(svg, corner)
1
+ PLUGINS.svg = function(api, svg, corner, adjustMethod)
2
2
  {
3
3
  var doc = $(document),
4
4
  elem = svg[0],
5
5
  result = {
6
6
  width: 0, height: 0,
7
- offset: { top: 1e10, left: 1e10 }
7
+ position: { top: 1e10, left: 1e10 }
8
8
  },
9
9
  box, mtx, root, point, tPoint;
10
10
 
@@ -27,19 +27,19 @@ PLUGINS.svg = function(svg, corner)
27
27
  point.x = box.x;
28
28
  point.y = box.y;
29
29
  tPoint = point.matrixTransform(mtx);
30
- result.offset.left = tPoint.x;
31
- result.offset.top = tPoint.y;
30
+ result.position.left = tPoint.x;
31
+ result.position.top = tPoint.y;
32
32
 
33
33
  // Adjust width and height
34
34
  point.x += box.width;
35
35
  point.y += box.height;
36
36
  tPoint = point.matrixTransform(mtx);
37
- result.width = tPoint.x - result.offset.left;
38
- result.height = tPoint.y - result.offset.top;
37
+ result.width = tPoint.x - result.position.left;
38
+ result.height = tPoint.y - result.position.top;
39
39
 
40
40
  // Adjust by scroll offset
41
- result.offset.left += doc.scrollLeft();
42
- result.offset.top += doc.scrollTop();
41
+ result.position.left += doc.scrollLeft();
42
+ result.position.top += doc.scrollTop();
43
43
  }
44
44
 
45
45
  return result;
@@ -6,7 +6,7 @@
6
6
  }
7
7
 
8
8
  .ui-tooltip .ui-tooltip-tip,
9
- .ui-tooltip .ui-tooltip-tip *{
9
+ .ui-tooltip .ui-tooltip-tip .qtip-vml{
10
10
  position: absolute;
11
11
 
12
12
  line-height: 0.1px !important;
@@ -14,9 +14,13 @@
14
14
  color: #123456;
15
15
 
16
16
  background: transparent;
17
- border: 0px dashed transparent;
17
+ border: 0 dashed transparent;
18
18
  }
19
19
 
20
20
  .ui-tooltip .ui-tooltip-tip canvas{ top: 0; left: 0; }
21
21
 
22
-
22
+ .ui-tooltip .ui-tooltip-tip .qtip-vml{
23
+ behavior: url(#default#VML);
24
+ display: inline-block;
25
+ visibility: visible;
26
+ }
@@ -37,7 +37,8 @@ function Tip(qTip, command)
37
37
  color = { },
38
38
  border = opts.border || 0,
39
39
  namespace = '.qtip-tip',
40
- hasCanvas = !!($('<canvas />')[0] || {}).getContext;
40
+ hasCanvas = !!($('<canvas />')[0] || {}).getContext,
41
+ tiphtml;
41
42
 
42
43
  self.corner = NULL;
43
44
  self.mimic = NULL;
@@ -75,10 +76,14 @@ function Tip(qTip, command)
75
76
  }
76
77
  };
77
78
 
79
+ function whileVisible(callback) {
80
+ var visible = tooltip.is(':visible');
81
+ tooltip.show(); callback(); tooltip.toggle(visible);
82
+ }
83
+
78
84
  function swapDimensions() {
79
- var temp = size.width;
80
- size.width = size.height;
81
- size.height = temp;
85
+ size.width = opts.height;
86
+ size.height = opts.width;
82
87
  }
83
88
 
84
89
  function resetDimensions() {
@@ -100,19 +105,19 @@ function Tip(qTip, command)
100
105
  // If our tip position isn't fixed e.g. doesn't adjust with viewport...
101
106
  if(self.corner.fixed !== TRUE) {
102
107
  // Horizontal - Shift or flip method
103
- if(horizontal === 'shift' && newCorner.precedance === 'x' && adjust.left && newCorner.y !== 'center') {
104
- newCorner.precedance = newCorner.precedance === 'x' ? 'y' : 'x';
108
+ if(horizontal === SHIFT && newCorner.precedance === X && adjust.left && newCorner.y !== CENTER) {
109
+ newCorner.precedance = newCorner.precedance === X ? Y : X;
105
110
  }
106
- else if(horizontal !== 'shift' && adjust.left){
107
- newCorner.x = newCorner.x === 'center' ? (adjust.left > 0 ? 'left' : 'right') : (newCorner.x === 'left' ? 'right' : 'left');
111
+ else if(horizontal !== SHIFT && adjust.left){
112
+ newCorner.x = newCorner.x === CENTER ? (adjust.left > 0 ? LEFT : RIGHT) : (newCorner.x === LEFT ? RIGHT : LEFT);
108
113
  }
109
114
 
110
115
  // Vertical - Shift or flip method
111
- if(vertical === 'shift' && newCorner.precedance === 'y' && adjust.top && newCorner.x !== 'center') {
112
- newCorner.precedance = newCorner.precedance === 'y' ? 'x' : 'y';
116
+ if(vertical === SHIFT && newCorner.precedance === Y && adjust.top && newCorner.x !== CENTER) {
117
+ newCorner.precedance = newCorner.precedance === Y ? X : Y;
113
118
  }
114
- else if(vertical !== 'shift' && adjust.top) {
115
- newCorner.y = newCorner.y === 'center' ? (adjust.top > 0 ? 'top' : 'bottom') : (newCorner.y === 'top' ? 'bottom' : 'top');
119
+ else if(vertical !== SHIFT && adjust.top) {
120
+ newCorner.y = newCorner.y === CENTER ? (adjust.top > 0 ? TOP : BOTTOM) : (newCorner.y === TOP ? BOTTOM : TOP);
116
121
  }
117
122
 
118
123
  // Update and redraw the tip if needed (check cached details of last drawn tip)
@@ -123,8 +128,8 @@ function Tip(qTip, command)
123
128
 
124
129
  // Setup tip offset properties
125
130
  offset = self.position(newCorner, adjust);
126
- offset[ newCorner.x ] += borderWidth(newCorner, newCorner.x, TRUE);
127
- offset[ newCorner.y ] += borderWidth(newCorner, newCorner.y, TRUE);
131
+ offset[ newCorner.x ] += parseWidth(newCorner, newCorner.x);
132
+ offset[ newCorner.y ] += parseWidth(newCorner, newCorner.y);
128
133
 
129
134
  // Readjust offset object to make it left/top
130
135
  if(offset.right !== undefined) { offset.left = -offset.right; }
@@ -132,8 +137,8 @@ function Tip(qTip, command)
132
137
  offset.user = Math.max(0, opts.offset);
133
138
 
134
139
  // Viewport "shift" specific adjustments
135
- if(shift.left = (horizontal === 'shift' && !!adjust.left)) {
136
- if(newCorner.x === 'center') {
140
+ if(shift.left = (horizontal === SHIFT && !!adjust.left)) {
141
+ if(newCorner.x === CENTER) {
137
142
  css['margin-left'] = shift.x = offset['margin-left'] - adjust.left;
138
143
  }
139
144
  else {
@@ -145,11 +150,11 @@ function Tip(qTip, command)
145
150
  shift.left = FALSE;
146
151
  }
147
152
 
148
- css[ offset.right !== undefined ? 'right' : 'left' ] = shift.x;
153
+ css[ offset.right !== undefined ? RIGHT : LEFT ] = shift.x;
149
154
  }
150
155
  }
151
- if(shift.top = (vertical === 'shift' && !!adjust.top)) {
152
- if(newCorner.y === 'center') {
156
+ if(shift.top = (vertical === SHIFT && !!adjust.top)) {
157
+ if(newCorner.y === CENTER) {
153
158
  css['margin-top'] = shift.y = offset['margin-top'] - adjust.top;
154
159
  }
155
160
  else {
@@ -161,63 +166,127 @@ function Tip(qTip, command)
161
166
  shift.top = FALSE;
162
167
  }
163
168
 
164
- css[ offset.bottom !== undefined ? 'bottom' : 'top' ] = shift.y;
169
+ css[ offset.bottom !== undefined ? BOTTOM : TOP ] = shift.y;
165
170
  }
166
171
  }
167
172
 
168
173
  /*
169
- * If the tip is adjusted in both dimensions, or in a
170
- * direction that would cause it to be anywhere but the
171
- * outer border, hide it!
172
- */
174
+ * If the tip is adjusted in both dimensions, or in a
175
+ * direction that would cause it to be anywhere but the
176
+ * outer border, hide it!
177
+ */
173
178
  elems.tip.css(css).toggle(
174
- !((shift.x && shift.y) || (newCorner.x === 'center' && shift.y) || (newCorner.y === 'center' && shift.x))
179
+ !((shift.x && shift.y) || (newCorner.x === CENTER && shift.y) || (newCorner.y === CENTER && shift.x))
175
180
  );
176
181
 
177
182
  // Adjust position to accomodate tip dimensions
178
- pos.left -= offset.left.charAt ? offset.user : horizontal !== 'shift' || shift.top || !shift.left && !shift.top ? offset.left : 0;
179
- pos.top -= offset.top.charAt ? offset.user : vertical !== 'shift' || shift.left || !shift.left && !shift.top ? offset.top : 0;
183
+ pos.left -= offset.left.charAt ? offset.user : horizontal !== SHIFT || shift.top || !shift.left && !shift.top ? offset.left : 0;
184
+ pos.top -= offset.top.charAt ? offset.user : vertical !== SHIFT || shift.left || !shift.left && !shift.top ? offset.top : 0;
180
185
 
181
186
  // Cache details
182
187
  cache.left = adjust.left; cache.top = adjust.top;
183
188
  cache.corner = newCorner.clone();
184
189
  }
185
190
 
191
+ function parseCorner() {
192
+ var corner = opts.corner,
193
+ posOptions = qTip.options.position,
194
+ at = posOptions.at,
195
+ my = posOptions.my.string ? posOptions.my.string() : posOptions.my;
196
+
197
+ // Detect corner and mimic properties
198
+ if(corner === FALSE || (my === FALSE && at === FALSE)) {
199
+ return FALSE;
200
+ }
201
+ else {
202
+ if(corner === TRUE) {
203
+ self.corner = new PLUGINS.Corner(my);
204
+ }
205
+ else if(!corner.string) {
206
+ self.corner = new PLUGINS.Corner(corner);
207
+ self.corner.fixed = TRUE;
208
+ }
209
+ }
210
+
211
+ // Cache it
212
+ cache.corner = new PLUGINS.Corner( self.corner.string() );
213
+
214
+ return self.corner.string() !== 'centercenter';
215
+ }
216
+
186
217
  /* border width calculator */
187
- function borderWidth(corner, side, backup) {
218
+ function parseWidth(corner, side, use) {
188
219
  side = !side ? corner[corner.precedance] : side;
189
220
 
190
- var isFluid = tooltip.hasClass(fluidClass),
191
- isTitleTop = elems.titlebar && corner.y === 'top',
192
- elem = isTitleTop ? elems.titlebar : elems.tooltip,
193
- css = 'border-' + side + '-width',
221
+ var isTitleTop = elems.titlebar && corner.y === TOP,
222
+ elem = isTitleTop ? elems.titlebar : tooltip,
223
+ borderSide = 'border-' + side + '-width',
224
+ css = function(elem) { return parseInt(elem.css(borderSide), 10); },
194
225
  val;
195
226
 
196
- // Grab the border-width value (add fluid class if needed)
197
- tooltip.addClass(fluidClass);
198
- val = parseInt(elem.css(css), 10);
199
- val = (backup ? val || parseInt(tooltip.css(css), 10) : val) || 0;
200
- tooltip.toggleClass(fluidClass, isFluid);
201
-
227
+ // Grab the border-width value (make tooltip visible first)
228
+ whileVisible(function() {
229
+ val = (use ? css(use) : (css(elems.content) || css(elem) || css(tooltip))) || 0;
230
+ });
202
231
  return val;
203
232
  }
204
233
 
205
- function borderRadius(corner) {
206
- var isTitleTop = elems.titlebar && corner.y === 'top',
234
+ function parseRadius(corner) {
235
+ var isTitleTop = elems.titlebar && corner.y === TOP,
207
236
  elem = isTitleTop ? elems.titlebar : elems.content,
208
237
  moz = $.browser.mozilla,
209
238
  prefix = moz ? '-moz-' : $.browser.webkit ? '-webkit-' : '',
210
- side = corner.y + (moz ? '' : '-') + corner.x,
211
- css = prefix + (moz ? 'border-radius-' + side : 'border-' + side + '-radius');
239
+ nonStandard = 'border-radius-' + corner.y + corner.x,
240
+ standard = 'border-' + corner.y + '-' + corner.x + '-radius',
241
+ css = function(c) { return parseInt(elem.css(c), 10) || parseInt(tooltip.css(c), 10); },
242
+ val;
212
243
 
213
- return parseInt(elem.css(css), 10) || parseInt(tooltip.css(css), 10) || 0;
244
+ whileVisible(function() {
245
+ val = css(standard) || css(prefix + standard) || css(prefix + nonStandard) || css(nonStandard) || 0;
246
+ });
247
+ return val;
248
+ }
249
+
250
+ function parseColours(actual) {
251
+ var i, fill, border,
252
+ tip = elems.tip.css('cssText', ''),
253
+ corner = actual || self.corner,
254
+ invalid = /rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i,
255
+ borderSide = 'border-' + corner[ corner.precedance ] + '-color',
256
+ bgColor = 'background-color',
257
+ transparent = 'transparent',
258
+ important = ' !important',
259
+
260
+ titlebar = elems.titlebar,
261
+ useTitle = titlebar && (corner.y === TOP || (corner.y === CENTER && tip.position().top + (size.height / 2) + opts.offset < titlebar.outerHeight(TRUE))),
262
+ colorElem = useTitle ? titlebar : elems.content;
263
+
264
+ function css(elem, prop, compare) {
265
+ var val = elem.css(prop) || transparent;
266
+ if(compare && val === elem.css(compare)) { return FALSE; }
267
+ else { return invalid.test(val) ? FALSE : val; }
268
+ }
269
+
270
+ // Ensure tooltip is visible then...
271
+ whileVisible(function() {
272
+ // Attempt to detect the background colour from various elements, left-to-right precedance
273
+ color.fill = css(tip, bgColor) || css(colorElem, bgColor) || css(elems.content, bgColor) ||
274
+ css(tooltip, bgColor) || tip.css(bgColor);
275
+
276
+ // Attempt to detect the correct border side colour from various elements, left-to-right precedance
277
+ color.border = css(tip, borderSide, 'color') || css(colorElem, borderSide, 'color') ||
278
+ css(elems.content, borderSide, 'color') || css(tooltip, borderSide, 'color') || tooltip.css(borderSide);
279
+
280
+ // Reset background and border colours
281
+ $('*', tip).add(tip).css('cssText', bgColor+':'+transparent+important+';border:0'+important+';');
282
+ });
214
283
  }
215
284
 
216
285
  function calculateSize(corner) {
217
- var y = corner.precedance === 'y',
218
- width = size [ y ? 'width' : 'height' ],
219
- height = size [ y ? 'height' : 'width' ],
220
- isCenter = corner.string().indexOf('center') > -1,
286
+ var y = corner.precedance === Y,
287
+ width = size [ y ? WIDTH : HEIGHT ],
288
+ height = size [ y ? HEIGHT : WIDTH ],
289
+ isCenter = corner.string().indexOf(CENTER) > -1,
221
290
  base = width * (isCenter ? 0.5 : 1),
222
291
  pow = Math.pow,
223
292
  round = Math.round,
@@ -238,10 +307,15 @@ function Tip(qTip, command)
238
307
  return { height: result[ y ? 0 : 1 ], width: result[ y ? 1 : 0 ] };
239
308
  }
240
309
 
310
+ function createVML(tag, props, style) {
311
+ return '<qvml:'+tag+' xmlns="urn:schemas-microsoft.com:vml" class="qtip-vml" '+(props||'')+
312
+ ' style="behavior: url(#default#VML); '+(style||'')+ '" />';
313
+ }
314
+
241
315
  $.extend(self, {
242
316
  init: function()
243
317
  {
244
- var enabled = self.detectCorner() && (hasCanvas || $.browser.msie);
318
+ var enabled = parseCorner() && (hasCanvas || $.browser.msie);
245
319
 
246
320
  // Determine tip corner and type
247
321
  if(enabled) {
@@ -251,81 +325,20 @@ function Tip(qTip, command)
251
325
 
252
326
  // Bind update events
253
327
  tooltip.unbind(namespace).bind('tooltipmove'+namespace, reposition);
254
- }
255
-
256
- return enabled;
257
- },
258
328
 
259
- detectCorner: function()
260
- {
261
- var corner = opts.corner,
262
- posOptions = qTip.options.position,
263
- at = posOptions.at,
264
- my = posOptions.my.string ? posOptions.my.string() : posOptions.my;
265
-
266
- // Detect corner and mimic properties
267
- if(corner === FALSE || (my === FALSE && at === FALSE)) {
268
- return FALSE;
269
- }
270
- else {
271
- if(corner === TRUE) {
272
- self.corner = new PLUGINS.Corner(my);
273
- }
274
- else if(!corner.string) {
275
- self.corner = new PLUGINS.Corner(corner);
276
- self.corner.fixed = TRUE;
329
+ // Fix for issue of tips not showing after redraw in IE (VML...)
330
+ if(!hasCanvas) {
331
+ tooltip.bind('tooltipredraw tooltipredrawn', function(event) {
332
+ if(event.type === 'tooltipredraw') {
333
+ tiphtml = elems.tip.html();
334
+ elems.tip.html('');
335
+ }
336
+ else { elems.tip.html(tiphtml); }
337
+ });
277
338
  }
278
339
  }
279
-
280
- // Cache it
281
- cache.corner = new PLUGINS.Corner( self.corner.string() );
282
-
283
- return self.corner.string() !== 'centercenter';
284
- },
285
-
286
- detectColours: function(actual) {
287
- var i, fill, border,
288
- tip = elems.tip.css('cssText', ''),
289
- corner = actual || self.corner,
290
- precedance = corner[ corner.precedance ],
291
-
292
- borderSide = 'border-' + precedance + '-color',
293
- borderSideCamel = 'border' + precedance.charAt(0) + precedance.substr(1) + 'Color',
294
-
295
- invalid = /rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i,
296
- backgroundColor = 'background-color',
297
- transparent = 'transparent',
298
- important = ' !important',
299
-
300
- useTitle = elems.titlebar && (corner.y === 'top' || (corner.y === 'center' && tip.position().top + (size.height / 2) + opts.offset < elems.titlebar.outerHeight(1))),
301
- colorElem = useTitle ? elems.titlebar : elems.tooltip;
302
-
303
- // Apply the fluid class so we can see our CSS values properly
304
- tooltip.addClass(fluidClass);
305
-
306
- // Detect tip colours from CSS styles
307
- color.fill = fill = tip.css(backgroundColor);
308
- color.border = border = tip[0].style[ borderSideCamel ] || tip.css(borderSide) || tooltip.css(borderSide);
309
-
310
- // Make sure colours are valid
311
- if(!fill || invalid.test(fill)) {
312
- color.fill = colorElem.css(backgroundColor) || transparent;
313
- if(invalid.test(color.fill)) {
314
- color.fill = tooltip.css(backgroundColor) || fill;
315
- }
316
- }
317
- if(!border || invalid.test(border) || border === $(document.body).css('color')) {
318
- color.border = colorElem.css(borderSide) || transparent;
319
- if(invalid.test(color.border) || color.border === colorElem.css('color')) {
320
- color.border = tooltip.css(borderSide) || tooltip.css(borderSideCamel) || border;
321
- }
322
- }
323
-
324
- // Reset background and border colours
325
- $('*', tip).add(tip).css('cssText', backgroundColor+':'+transparent+important+';border:0'+important+';');
326
-
327
- // Remove fluid class
328
- tooltip.removeClass(fluidClass);
340
+
341
+ return enabled;
329
342
  },
330
343
 
331
344
  create: function()
@@ -346,7 +359,7 @@ function Tip(qTip, command)
346
359
  $('<canvas />').appendTo(elems.tip)[0].getContext('2d').save();
347
360
  }
348
361
  else {
349
- vml = '<vml:shape coordorigin="0,0" style="display:inline-block; position:absolute; behavior:url(#default#VML);"></vml:shape>';
362
+ vml = createVML('shape', 'coordorigin="0,0"', 'position:absolute;');
350
363
  elems.tip.html(vml + vml);
351
364
 
352
365
  // Prevent mousing down on the tip since it causes problems with .live() handling in IE due to VML
@@ -360,8 +373,6 @@ function Tip(qTip, command)
360
373
  inner = tip.children(),
361
374
  width = size.width,
362
375
  height = size.height,
363
- regular = 'px solid ',
364
- transparent = 'px dashed transparent', // Dashed IE6 border-transparency hack. Awesome!
365
376
  mimic = opts.mimic,
366
377
  round = Math.round,
367
378
  precedance, context, coords, translate, newSize;
@@ -386,7 +397,7 @@ function Tip(qTip, command)
386
397
  precedance = mimic.precedance;
387
398
 
388
399
  // Ensure the tip width.height are relative to the tip position
389
- if(corner.precedance === 'x') { swapDimensions(); }
400
+ if(corner.precedance === X) { swapDimensions(); }
390
401
  else { resetDimensions(); }
391
402
 
392
403
  // Set the tip dimensions
@@ -396,12 +407,12 @@ function Tip(qTip, command)
396
407
  });
397
408
 
398
409
  // Update our colours
399
- self.detectColours(corner);
410
+ parseColours(corner);
400
411
 
401
412
  // Detect border width, taking into account colours
402
413
  if(color.border !== 'transparent') {
403
414
  // Grab border width
404
- border = borderWidth(corner, NULL, TRUE);
415
+ border = parseWidth(corner, NULL);
405
416
 
406
417
  // If border width isn't zero, use border color as fill (1.0 style tips)
407
418
  if(opts.border === 0 && border > 0) { color.fill = color.border; }
@@ -421,16 +432,16 @@ function Tip(qTip, command)
421
432
  tip.css(newSize);
422
433
 
423
434
  // Calculate tip translation
424
- if(corner.precedance === 'y') {
435
+ if(corner.precedance === Y) {
425
436
  translate = [
426
- round(mimic.x === 'left' ? border : mimic.x === 'right' ? newSize.width - width - border : (newSize.width - width) / 2),
427
- round(mimic.y === 'top' ? newSize.height - height : 0)
437
+ round(mimic.x === LEFT ? border : mimic.x === RIGHT ? newSize.width - width - border : (newSize.width - width) / 2),
438
+ round(mimic.y === TOP ? newSize.height - height : 0)
428
439
  ];
429
440
  }
430
441
  else {
431
442
  translate = [
432
- round(mimic.x === 'left' ? newSize.width - width : 0),
433
- round(mimic.y === 'top' ? border : mimic.y === 'bottom' ? newSize.height - height - border : (newSize.height - height) / 2)
443
+ round(mimic.x === LEFT ? newSize.width - width : 0),
444
+ round(mimic.y === TOP ? border : mimic.y === BOTTOM ? newSize.height - height - border : (newSize.height - height) / 2)
434
445
  ];
435
446
  }
436
447
 
@@ -487,9 +498,10 @@ function Tip(qTip, command)
487
498
 
488
499
  // Set initial CSS
489
500
  inner.css({
490
- antialias: ''+(mimic.string().indexOf('center') > -1),
491
- left: translate[0] - (translate[2] * Number(precedance === 'x')),
492
- top: translate[1] - (translate[2] * Number(precedance === 'y')),
501
+ coordsize: (width+border) + ' ' + (height+border),
502
+ antialias: ''+(mimic.string().indexOf(CENTER) > -1),
503
+ left: translate[0],
504
+ top: translate[1],
493
505
  width: width + border,
494
506
  height: height + border
495
507
  })
@@ -504,13 +516,12 @@ function Tip(qTip, command)
504
516
  filled: !!i,
505
517
  stroked: !i
506
518
  })
507
- .css({ display: border || i ? 'block' : 'none' });
519
+ .toggle(!!(border || i));
508
520
 
509
521
  // Check if border is enabled and add stroke element
510
522
  if(!i && $this.html() === '') {
511
523
  $this.html(
512
- '<vml:stroke weight="'+(border*2)+'px" color="'+color.border+'" miterlimit="1000" joinstyle="miter" ' +
513
- ' style="behavior:url(#default#VML); display:inline-block;" />'
524
+ createVML('stroke', 'weight="'+(border*2)+'px" color="'+color.border+'" miterlimit="1000" joinstyle="miter"')
514
525
  );
515
526
  }
516
527
  });
@@ -540,27 +551,28 @@ function Tip(qTip, command)
540
551
 
541
552
  // Setup corners and offset array
542
553
  corners = [ corner.x, corner.y ];
543
- if(precedance === 'x') { corners.reverse(); }
554
+ if(precedance === X) { corners.reverse(); }
544
555
 
545
556
  // Calculate tip position
546
557
  $.each(corners, function(i, side) {
547
- var b, br;
558
+ var b, bc, br;
548
559
 
549
- if(side === 'center') {
550
- b = precedance === 'y' ? 'left' : 'top';
560
+ if(side === CENTER) {
561
+ b = precedance === Y ? LEFT : TOP;
551
562
  position[ b ] = '50%';
552
- position['margin-' + b] = -Math.round(dimensions[ precedance === 'y' ? 'width' : 'height' ] / 2) + userOffset;
563
+ position['margin-' + b] = -Math.round(dimensions[ precedance === Y ? WIDTH : HEIGHT ] / 2) + userOffset;
553
564
  }
554
565
  else {
555
- b = borderWidth(corner, side);
556
- br = borderRadius(corner);
566
+ b = parseWidth(corner, side);
567
+ bc = parseWidth(corner, side, elems.content);
568
+ br = parseRadius(corner);
557
569
 
558
- position[ side ] = i ? 0 : (userOffset + (br > b ? br : -b));
570
+ position[ side ] = i ? bc : (userOffset + (br > b ? br : -b));
559
571
  }
560
572
  });
561
573
 
562
574
  // Adjust for tip dimensions
563
- position[ corner[precedance] ] -= dimensions[ precedance === 'x' ? 'width' : 'height' ];
575
+ position[ corner[precedance] ] -= dimensions[ precedance === X ? WIDTH : HEIGHT ];
564
576
 
565
577
  // Set and return new position
566
578
  tip.css({ top: '', bottom: '', left: '', right: '', margin: '' }).css(position);
@@ -598,7 +610,7 @@ PLUGINS.tip.sanitize = function(options)
598
610
  if(style && 'tip' in style) {
599
611
  opts = options.style.tip;
600
612
  if(typeof opts !== 'object'){ options.style.tip = { corner: opts }; }
601
- if(!(/string|boolean/i).test(typeof opts.corner)) { opts.corner = TRUE; }
613
+ if(!(/string|boolean/i).test(typeof opts['corner'])) { opts['corner'] = TRUE; }
602
614
  if(typeof opts.width !== 'number'){ delete opts.width; }
603
615
  if(typeof opts.height !== 'number'){ delete opts.height; }
604
616
  if(typeof opts.border !== 'number' && opts.border !== TRUE){ delete opts.border; }