web/data/jquery.qtip.js
author David Douard <david.douard@logilab.fr>
Wed, 22 Apr 2015 11:00:50 +0200
changeset 10308 3f94034cc972
parent 10102 769695d59add
permissions -rw-r--r--
[hooks] add a looping task that dumps the stats regularly in a file
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10102
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
     1
/*!
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
     2
 * jquery.qtip. The jQuery tooltip plugin
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
     3
 *
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
     4
 * Copyright (c) 2009 Craig Thompson
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
     5
 * http://craigsworks.com
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
     6
 *
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
     7
 * Licensed under MIT
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
     8
 * http://www.opensource.org/licenses/mit-license.php
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
     9
 *
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    10
 * Launch  : February 2009
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    11
 * Version : 1.0.0-rc3
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    12
 * Released: Tuesday 12th May, 2009 - 00:00
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    13
 * Debug: jquery.qtip.debug.js
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    14
 */
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    15
(function($)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    16
{
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    17
   // Implementation
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    18
   $.fn.qtip = function(options, blanket)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    19
   {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    20
      var i, id, interfaces, opts, obj, command, config, api;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    21
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    22
      // Return API / Interfaces if requested
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    23
      if(typeof options == 'string')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    24
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    25
         // Make sure API data exists if requested
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    26
         if(typeof $(this).data('qtip') !== 'object')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    27
            $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.NO_TOOLTIP_PRESENT, false);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    28
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    29
         // Return requested object
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    30
         if(options == 'api')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    31
            return $(this).data('qtip').interfaces[ $(this).data('qtip').current ];
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    32
         else if(options == 'interfaces')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    33
            return $(this).data('qtip').interfaces;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    34
      }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    35
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    36
      // Validate provided options
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    37
      else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    38
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    39
         // Set null options object if no options are provided
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    40
         if(!options) options = {};
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    41
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    42
         // Sanitize option data
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    43
         if(typeof options.content !== 'object' || (options.content.jquery && options.content.length > 0)) options.content = { text: options.content };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    44
         if(typeof options.content.title !== 'object') options.content.title = { text: options.content.title };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    45
         if(typeof options.position !== 'object') options.position = { corner: options.position };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    46
         if(typeof options.position.corner !== 'object') options.position.corner = { target: options.position.corner, tooltip: options.position.corner };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    47
         if(typeof options.show !== 'object') options.show = { when: options.show };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    48
         if(typeof options.show.when !== 'object') options.show.when = { event: options.show.when };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    49
         if(typeof options.show.effect !== 'object') options.show.effect = { type: options.show.effect };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    50
         if(typeof options.hide !== 'object') options.hide = { when: options.hide };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    51
         if(typeof options.hide.when !== 'object') options.hide.when = { event: options.hide.when };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    52
         if(typeof options.hide.effect !== 'object') options.hide.effect = { type: options.hide.effect };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    53
         if(typeof options.style !== 'object') options.style = { name: options.style };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    54
         options.style = sanitizeStyle(options.style);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    55
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    56
         // Build main options object
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    57
         opts = $.extend(true, {}, $.fn.qtip.defaults, options);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    58
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    59
         // Inherit all style properties into one syle object and include original options
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    60
         opts.style = buildStyle.call({ options: opts }, opts.style);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    61
         opts.user = $.extend(true, {}, options);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    62
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    63
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    64
      // Iterate each matched element
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    65
      return $(this).each(function() // Return original elements as per jQuery guidelines
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    66
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    67
         // Check for API commands
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    68
         if(typeof options == 'string')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    69
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    70
            command = options.toLowerCase();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    71
            interfaces = $(this).qtip('interfaces');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    72
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    73
            // Make sure API data exists$('.qtip').qtip('destroy')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    74
            if(typeof interfaces == 'object')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    75
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    76
               // Check if API call is a BLANKET DESTROY command
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    77
               if(blanket === true && command == 'destroy')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    78
                  while(interfaces.length > 0) interfaces[interfaces.length-1].destroy();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    79
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    80
               // API call is not a BLANKET DESTROY command
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    81
               else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    82
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    83
                  // Check if supplied command effects this tooltip only (NOT BLANKET)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    84
                  if(blanket !== true) interfaces = [ $(this).qtip('api') ];
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    85
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    86
                  // Execute command on chosen qTips
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    87
                  for(i = 0; i < interfaces.length; i++)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    88
                  {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    89
                     // Destroy command doesn't require tooltip to be rendered
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    90
                     if(command == 'destroy') interfaces[i].destroy();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    91
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    92
                     // Only call API if tooltip is rendered and it wasn't a destroy call
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    93
                     else if(interfaces[i].status.rendered === true)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    94
                     {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    95
                        if(command == 'show') interfaces[i].show();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    96
                        else if(command == 'hide') interfaces[i].hide();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    97
                        else if(command == 'focus') interfaces[i].focus();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    98
                        else if(command == 'disable') interfaces[i].disable(true);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
    99
                        else if(command == 'enable') interfaces[i].disable(false);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   100
                     };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   101
                  };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   102
               };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   103
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   104
         }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   105
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   106
         // No API commands, continue with qTip creation
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   107
         else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   108
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   109
            // Create unique configuration object
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   110
            config = $.extend(true, {}, opts);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   111
            config.hide.effect.length = opts.hide.effect.length;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   112
            config.show.effect.length = opts.show.effect.length;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   113
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   114
            // Sanitize target options
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   115
            if(config.position.container === false) config.position.container = $(document.body);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   116
            if(config.position.target === false) config.position.target = $(this);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   117
            if(config.show.when.target === false) config.show.when.target = $(this);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   118
            if(config.hide.when.target === false) config.hide.when.target = $(this);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   119
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   120
            // Determine tooltip ID (Reuse array slots if possible)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   121
            id = $.fn.qtip.interfaces.length;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   122
            for(i = 0; i < id; i++)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   123
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   124
               if(typeof $.fn.qtip.interfaces[i] == 'undefined'){ id = i; break; };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   125
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   126
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   127
            // Instantiate the tooltip
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   128
            obj = new qTip($(this), config, id);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   129
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   130
            // Add API references
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   131
            $.fn.qtip.interfaces[id] = obj;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   132
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   133
            // Check if element already has qTip data assigned
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   134
            if(typeof $(this).data('qtip') == 'object')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   135
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   136
               // Set new current interface id
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   137
               if(typeof $(this).attr('qtip') === 'undefined')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   138
                  $(this).data('qtip').current = $(this).data('qtip').interfaces.length;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   139
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   140
               // Push new API interface onto interfaces array
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   141
               $(this).data('qtip').interfaces.push(obj);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   142
            }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   143
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   144
            // No qTip data is present, create now
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   145
            else $(this).data('qtip', { current: 0, interfaces: [obj] });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   146
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   147
            // If prerendering is disabled, create tooltip on showEvent
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   148
            if(config.content.prerender === false && config.show.when.event !== false && config.show.ready !== true)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   149
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   150
               config.show.when.target.bind(config.show.when.event+'.qtip-'+id+'-create', { qtip: id }, function(event)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   151
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   152
                  // Retrieve API interface via passed qTip Id
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   153
                  api = $.fn.qtip.interfaces[ event.data.qtip ];
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   154
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   155
                  // Unbind show event and cache mouse coords
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   156
                  api.options.show.when.target.unbind(api.options.show.when.event+'.qtip-'+event.data.qtip+'-create');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   157
                  api.cache.mouse = { x: event.pageX, y: event.pageY };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   158
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   159
                  // Render tooltip and start the event sequence
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   160
                  construct.call( api );
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   161
                  api.options.show.when.target.trigger(api.options.show.when.event);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   162
               });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   163
            }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   164
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   165
            // Prerendering is enabled, create tooltip now
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   166
            else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   167
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   168
               // Set mouse position cache to top left of the element
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   169
               obj.cache.mouse = {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   170
                  x: config.show.when.target.offset().left,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   171
                  y: config.show.when.target.offset().top
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   172
               };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   173
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   174
               // Construct the tooltip
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   175
               construct.call(obj);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   176
            }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   177
         };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   178
      });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   179
   };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   180
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   181
   // Instantiator
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   182
   function qTip(target, options, id)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   183
   {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   184
      // Declare this reference
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   185
      var self = this;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   186
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   187
      // Setup class attributes
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   188
      self.id = id;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   189
      self.options = options;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   190
      self.status = {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   191
         animated: false,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   192
         rendered: false,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   193
         disabled: false,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   194
         focused: false
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   195
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   196
      self.elements = {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   197
         target: target.addClass(self.options.style.classes.target),
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   198
         tooltip: null,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   199
         wrapper: null,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   200
         content: null,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   201
         contentWrapper: null,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   202
         title: null,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   203
         button: null,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   204
         tip: null,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   205
         bgiframe: null
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   206
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   207
      self.cache = {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   208
         mouse: {},
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   209
         position: {},
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   210
         toggle: 0
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   211
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   212
      self.timers = {};
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   213
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   214
      // Define exposed API methods
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   215
      $.extend(self, self.options.api,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   216
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   217
         show: function(event)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   218
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   219
            var returned, solo;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   220
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   221
            // Make sure tooltip is rendered and if not, return
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   222
            if(!self.status.rendered)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   223
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'show');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   224
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   225
            // Only continue if element is visible
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   226
            if(self.elements.tooltip.css('display') !== 'none') return self;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   227
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   228
            // Clear animation queue
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   229
            self.elements.tooltip.stop(true, false);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   230
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   231
            // Call API method and if return value is false, halt
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   232
            returned = self.beforeShow.call(self, event);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   233
            if(returned === false) return self;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   234
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   235
            // Define afterShow callback method
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   236
            function afterShow()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   237
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   238
               // Call API method and focus if it isn't static
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   239
               if(self.options.position.type !== 'static') self.focus();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   240
               self.onShow.call(self, event);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   241
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   242
               // Prevent antialias from disappearing in IE7 by removing filter attribute
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   243
               if($.browser.msie) self.elements.tooltip.get(0).style.removeAttribute('filter');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   244
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   245
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   246
            // Maintain toggle functionality if enabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   247
            self.cache.toggle = 1;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   248
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   249
            // Update tooltip position if it isn't static
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   250
            if(self.options.position.type !== 'static')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   251
               self.updatePosition(event, (self.options.show.effect.length > 0));
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   252
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   253
            // Hide other tooltips if tooltip is solo
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   254
            if(typeof self.options.show.solo == 'object') solo = $(self.options.show.solo);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   255
            else if(self.options.show.solo === true) solo = $('div.qtip').not(self.elements.tooltip);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   256
            if(solo) solo.each(function(){ if($(this).qtip('api').status.rendered === true) $(this).qtip('api').hide(); });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   257
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   258
            // Show tooltip
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   259
            if(typeof self.options.show.effect.type == 'function')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   260
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   261
               self.options.show.effect.type.call(self.elements.tooltip, self.options.show.effect.length);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   262
               self.elements.tooltip.queue(function(){ afterShow(); $(this).dequeue(); });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   263
            }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   264
            else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   265
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   266
               switch(self.options.show.effect.type.toLowerCase())
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   267
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   268
                  case 'fade':
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   269
                     self.elements.tooltip.fadeIn(self.options.show.effect.length, afterShow);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   270
                     break;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   271
                  case 'slide':
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   272
                     self.elements.tooltip.slideDown(self.options.show.effect.length, function()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   273
                     {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   274
                        afterShow();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   275
                        if(self.options.position.type !== 'static') self.updatePosition(event, true);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   276
                     });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   277
                     break;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   278
                  case 'grow':
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   279
                     self.elements.tooltip.show(self.options.show.effect.length, afterShow);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   280
                     break;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   281
                  default:
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   282
                     self.elements.tooltip.show(null, afterShow);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   283
                     break;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   284
               };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   285
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   286
               // Add active class to tooltip
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   287
               self.elements.tooltip.addClass(self.options.style.classes.active);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   288
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   289
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   290
            // Log event and return
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   291
            return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_SHOWN, 'show');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   292
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   293
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   294
         hide: function(event)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   295
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   296
            var returned;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   297
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   298
            // Make sure tooltip is rendered and if not, return
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   299
            if(!self.status.rendered)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   300
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'hide');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   301
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   302
            // Only continue if element is visible
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   303
            else if(self.elements.tooltip.css('display') === 'none') return self;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   304
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   305
            // Stop show timer and animation queue
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   306
            clearTimeout(self.timers.show);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   307
            self.elements.tooltip.stop(true, false);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   308
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   309
            // Call API method and if return value is false, halt
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   310
            returned = self.beforeHide.call(self, event);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   311
            if(returned === false) return self;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   312
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   313
            // Define afterHide callback method
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   314
            function afterHide(){ self.onHide.call(self, event); };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   315
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   316
            // Maintain toggle functionality if enabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   317
            self.cache.toggle = 0;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   318
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   319
            // Hide tooltip
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   320
            if(typeof self.options.hide.effect.type == 'function')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   321
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   322
               self.options.hide.effect.type.call(self.elements.tooltip, self.options.hide.effect.length);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   323
               self.elements.tooltip.queue(function(){ afterHide(); $(this).dequeue(); });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   324
            }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   325
            else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   326
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   327
               switch(self.options.hide.effect.type.toLowerCase())
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   328
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   329
                  case 'fade':
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   330
                     self.elements.tooltip.fadeOut(self.options.hide.effect.length, afterHide);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   331
                     break;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   332
                  case 'slide':
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   333
                     self.elements.tooltip.slideUp(self.options.hide.effect.length, afterHide);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   334
                     break;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   335
                  case 'grow':
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   336
                     self.elements.tooltip.hide(self.options.hide.effect.length, afterHide);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   337
                     break;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   338
                  default:
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   339
                     self.elements.tooltip.hide(null, afterHide);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   340
                     break;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   341
               };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   342
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   343
               // Remove active class to tooltip
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   344
               self.elements.tooltip.removeClass(self.options.style.classes.active);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   345
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   346
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   347
            // Log event and return
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   348
            return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_HIDDEN, 'hide');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   349
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   350
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   351
         updatePosition: function(event, animate)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   352
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   353
            var i, target, tooltip, coords, mapName, imagePos, newPosition, ieAdjust, ie6Adjust, borderAdjust, mouseAdjust, offset, curPosition, returned
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   354
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   355
            // Make sure tooltip is rendered and if not, return
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   356
            if(!self.status.rendered)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   357
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'updatePosition');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   358
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   359
            // If tooltip is static, return
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   360
            else if(self.options.position.type == 'static')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   361
               return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.CANNOT_POSITION_STATIC, 'updatePosition');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   362
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   363
            // Define property objects
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   364
            target = {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   365
               position: { left: 0, top: 0 },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   366
               dimensions: { height: 0, width: 0 },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   367
               corner: self.options.position.corner.target
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   368
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   369
            tooltip = {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   370
               position: self.getPosition(),
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   371
               dimensions: self.getDimensions(),
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   372
               corner: self.options.position.corner.tooltip
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   373
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   374
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   375
            // Target is an HTML element
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   376
            if(self.options.position.target !== 'mouse')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   377
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   378
               // If the HTML element is AREA, calculate position manually
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   379
               if(self.options.position.target.get(0).nodeName.toLowerCase() == 'area')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   380
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   381
                  // Retrieve coordinates from coords attribute and parse into integers
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   382
                  coords = self.options.position.target.attr('coords').split(',');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   383
                  for(i = 0; i < coords.length; i++) coords[i] = parseInt(coords[i]);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   384
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   385
                  // Setup target position object
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   386
                  mapName = self.options.position.target.parent('map').attr('name');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   387
                  imagePos = $('img[usemap="#'+mapName+'"]:first').offset();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   388
                  target.position = {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   389
                     left: Math.floor(imagePos.left + coords[0]),
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   390
                     top: Math.floor(imagePos.top + coords[1])
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   391
                  };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   392
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   393
                  // Determine width and height of the area
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   394
                  switch(self.options.position.target.attr('shape').toLowerCase())
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   395
                  {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   396
                     case 'rect':
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   397
                        target.dimensions = {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   398
                           width: Math.ceil(Math.abs(coords[2] - coords[0])),
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   399
                           height: Math.ceil(Math.abs(coords[3] - coords[1]))
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   400
                        };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   401
                        break;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   402
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   403
                     case 'circle':
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   404
                        target.dimensions = {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   405
                           width: coords[2] + 1,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   406
                           height: coords[2] + 1
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   407
                        };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   408
                        break;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   409
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   410
                     case 'poly':
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   411
                        target.dimensions = {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   412
                           width: coords[0],
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   413
                           height: coords[1]
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   414
                        };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   415
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   416
                        for(i = 0; i < coords.length; i++)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   417
                        {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   418
                           if(i % 2 == 0)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   419
                           {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   420
                              if(coords[i] > target.dimensions.width)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   421
                                 target.dimensions.width = coords[i];
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   422
                              if(coords[i] < coords[0])
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   423
                                 target.position.left = Math.floor(imagePos.left + coords[i]);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   424
                           }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   425
                           else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   426
                           {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   427
                              if(coords[i] > target.dimensions.height)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   428
                                 target.dimensions.height = coords[i];
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   429
                              if(coords[i] < coords[1])
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   430
                                 target.position.top = Math.floor(imagePos.top + coords[i]);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   431
                           };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   432
                        };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   433
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   434
                        target.dimensions.width = target.dimensions.width - (target.position.left - imagePos.left);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   435
                        target.dimensions.height = target.dimensions.height - (target.position.top - imagePos.top);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   436
                        break;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   437
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   438
                     default:
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   439
                        return $.fn.qtip.log.error.call(self, 4, $.fn.qtip.constants.INVALID_AREA_SHAPE, 'updatePosition');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   440
                        break;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   441
                  };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   442
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   443
                  // Adjust position by 2 pixels (Positioning bug?)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   444
                  target.dimensions.width -= 2; target.dimensions.height -= 2;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   445
               }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   446
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   447
               // Target is the document
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   448
               else if(self.options.position.target.add(document.body).length === 1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   449
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   450
                  target.position = { left: $(document).scrollLeft(), top: $(document).scrollTop() };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   451
                  target.dimensions = { height: $(window).height(), width: $(window).width() };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   452
               }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   453
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   454
               // Target is a regular HTML element, find position normally
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   455
               else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   456
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   457
                  // Check if the target is another tooltip. If its animated, retrieve position from newPosition data
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   458
                  if(typeof self.options.position.target.attr('qtip') !== 'undefined')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   459
                     target.position = self.options.position.target.qtip('api').cache.position;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   460
                  else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   461
                     target.position = self.options.position.target.offset();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   462
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   463
                  // Setup dimensions objects
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   464
                  target.dimensions = {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   465
                     height: self.options.position.target.outerHeight(),
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   466
                     width: self.options.position.target.outerWidth()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   467
                  };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   468
               };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   469
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   470
               // Calculate correct target corner position
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   471
               newPosition = $.extend({}, target.position);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   472
               if(target.corner.search(/right/i) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   473
                  newPosition.left += target.dimensions.width;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   474
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   475
               if(target.corner.search(/bottom/i) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   476
                  newPosition.top += target.dimensions.height;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   477
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   478
               if(target.corner.search(/((top|bottom)Middle)|center/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   479
                  newPosition.left += (target.dimensions.width / 2);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   480
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   481
               if(target.corner.search(/((left|right)Middle)|center/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   482
                  newPosition.top += (target.dimensions.height / 2);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   483
            }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   484
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   485
            // Mouse is the target, set position to current mouse coordinates
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   486
            else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   487
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   488
               // Setup target position and dimensions objects
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   489
               target.position = newPosition = { left: self.cache.mouse.x, top: self.cache.mouse.y };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   490
               target.dimensions = { height: 1, width: 1 };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   491
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   492
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   493
            // Calculate correct target corner position
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   494
            if(tooltip.corner.search(/right/i) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   495
               newPosition.left -= tooltip.dimensions.width;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   496
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   497
            if(tooltip.corner.search(/bottom/i) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   498
               newPosition.top -= tooltip.dimensions.height;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   499
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   500
            if(tooltip.corner.search(/((top|bottom)Middle)|center/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   501
               newPosition.left -= (tooltip.dimensions.width / 2);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   502
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   503
            if(tooltip.corner.search(/((left|right)Middle)|center/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   504
               newPosition.top -= (tooltip.dimensions.height / 2);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   505
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   506
            // Setup IE adjustment variables (Pixel gap bugs)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   507
            ieAdjust = ($.browser.msie) ? 1 : 0; // And this is why I hate IE...
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   508
            ie6Adjust = ($.browser.msie && parseInt($.browser.version.charAt(0)) === 6) ? 1 : 0; // ...and even more so IE6!
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   509
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   510
            // Adjust for border radius
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   511
            if(self.options.style.border.radius > 0)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   512
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   513
               if(tooltip.corner.search(/Left/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   514
                  newPosition.left -= self.options.style.border.radius;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   515
               else if(tooltip.corner.search(/Right/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   516
                  newPosition.left += self.options.style.border.radius;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   517
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   518
               if(tooltip.corner.search(/Top/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   519
                  newPosition.top -= self.options.style.border.radius;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   520
               else if(tooltip.corner.search(/Bottom/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   521
                  newPosition.top += self.options.style.border.radius;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   522
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   523
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   524
            // IE only adjustments (Pixel perfect!)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   525
            if(ieAdjust)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   526
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   527
               if(tooltip.corner.search(/top/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   528
                  newPosition.top -= ieAdjust
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   529
               else if(tooltip.corner.search(/bottom/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   530
                  newPosition.top += ieAdjust
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   531
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   532
               if(tooltip.corner.search(/left/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   533
                  newPosition.left -= ieAdjust
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   534
               else if(tooltip.corner.search(/right/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   535
                  newPosition.left += ieAdjust
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   536
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   537
               if(tooltip.corner.search(/leftMiddle|rightMiddle/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   538
                  newPosition.top -= 1
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   539
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   540
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   541
            // If screen adjustment is enabled, apply adjustments
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   542
            if(self.options.position.adjust.screen === true)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   543
               newPosition = screenAdjust.call(self, newPosition, target, tooltip);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   544
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   545
            // If mouse is the target, prevent tooltip appearing directly under the mouse
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   546
            if(self.options.position.target === 'mouse' && self.options.position.adjust.mouse === true)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   547
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   548
               if(self.options.position.adjust.screen === true && self.elements.tip)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   549
                  mouseAdjust = self.elements.tip.attr('rel');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   550
               else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   551
                  mouseAdjust = self.options.position.corner.tooltip;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   552
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   553
               newPosition.left += (mouseAdjust.search(/right/i) !== -1) ? -6 : 6;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   554
               newPosition.top += (mouseAdjust.search(/bottom/i) !== -1) ? -6 : 6;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   555
            }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   556
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   557
            // Initiate bgiframe plugin in IE6 if tooltip overlaps a select box or object element
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   558
            if(!self.elements.bgiframe && $.browser.msie && parseInt($.browser.version.charAt(0)) == 6)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   559
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   560
               $('select, object').each(function()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   561
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   562
                  offset = $(this).offset();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   563
                  offset.bottom = offset.top + $(this).height();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   564
                  offset.right = offset.left + $(this).width();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   565
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   566
                  if(newPosition.top + tooltip.dimensions.height >= offset.top
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   567
                  && newPosition.left + tooltip.dimensions.width >= offset.left)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   568
                     bgiframe.call(self);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   569
               });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   570
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   571
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   572
            // Add user xy adjustments
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   573
            newPosition.left += self.options.position.adjust.x;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   574
            newPosition.top += self.options.position.adjust.y;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   575
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   576
            // Set new tooltip position if its moved, animate if enabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   577
            curPosition = self.getPosition();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   578
            if(newPosition.left != curPosition.left || newPosition.top != curPosition.top)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   579
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   580
               // Call API method and if return value is false, halt
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   581
               returned = self.beforePositionUpdate.call(self, event);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   582
               if(returned === false) return self;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   583
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   584
               // Cache new position
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   585
               self.cache.position = newPosition;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   586
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   587
               // Check if animation is enabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   588
               if(animate === true)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   589
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   590
                  // Set animated status
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   591
                  self.status.animated = true;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   592
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   593
                  // Animate and reset animated status on animation end
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   594
                  self.elements.tooltip.animate(newPosition, 200, 'swing', function(){ self.status.animated = false });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   595
               }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   596
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   597
               // Set new position via CSS
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   598
               else self.elements.tooltip.css(newPosition);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   599
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   600
               // Call API method and log event if its not a mouse move
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   601
               self.onPositionUpdate.call(self, event);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   602
               if(typeof event !== 'undefined' && event.type && event.type !== 'mousemove')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   603
                  $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_POSITION_UPDATED, 'updatePosition');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   604
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   605
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   606
            return self;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   607
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   608
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   609
         updateWidth: function(newWidth)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   610
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   611
            var hidden;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   612
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   613
            // Make sure tooltip is rendered and if not, return
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   614
            if(!self.status.rendered)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   615
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'updateWidth');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   616
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   617
            // Make sure supplied width is a number and if not, return
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   618
            else if(newWidth && typeof newWidth !== 'number')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   619
               return $.fn.qtip.log.error.call(self, 2, 'newWidth must be of type number', 'updateWidth');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   620
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   621
            // Setup elements which must be hidden during width update
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   622
            hidden = self.elements.contentWrapper.siblings().add(self.elements.tip).add(self.elements.button);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   623
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   624
            // Calculate the new width if one is not supplied
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   625
            if(!newWidth)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   626
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   627
               // Explicit width is set
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   628
               if(typeof self.options.style.width.value == 'number')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   629
                  newWidth = self.options.style.width.value;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   630
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   631
               // No width is set, proceed with auto detection
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   632
               else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   633
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   634
                  // Set width to auto initally to determine new width and hide other elements
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   635
                  self.elements.tooltip.css({ width: 'auto' });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   636
                  hidden.hide();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   637
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   638
                  // Set position and zoom to defaults to prevent IE hasLayout bug
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   639
                  if($.browser.msie)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   640
                     self.elements.wrapper.add(self.elements.contentWrapper.children()).css({ zoom: 'normal' });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   641
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   642
                  // Set the new width
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   643
                  newWidth = self.getDimensions().width + 1;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   644
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   645
                  // Make sure its within the maximum and minimum width boundries
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   646
                  if(!self.options.style.width.value)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   647
                  {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   648
                     if(newWidth > self.options.style.width.max) newWidth = self.options.style.width.max
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   649
                     if(newWidth < self.options.style.width.min) newWidth = self.options.style.width.min
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   650
                  };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   651
               };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   652
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   653
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   654
            // Adjust newWidth by 1px if width is odd (IE6 rounding bug fix)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   655
            if(newWidth % 2 !== 0) newWidth -= 1;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   656
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   657
            // Set the new calculated width and unhide other elements
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   658
            self.elements.tooltip.width(newWidth);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   659
            hidden.show();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   660
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   661
            // Set the border width, if enabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   662
            if(self.options.style.border.radius)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   663
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   664
               self.elements.tooltip.find('.qtip-betweenCorners').each(function(i)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   665
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   666
                  $(this).width(newWidth - (self.options.style.border.radius * 2));
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   667
               })
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   668
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   669
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   670
            // IE only adjustments
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   671
            if($.browser.msie)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   672
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   673
               // Reset position and zoom to give the wrapper layout (IE hasLayout bug)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   674
               self.elements.wrapper.add(self.elements.contentWrapper.children()).css({ zoom: '1' });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   675
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   676
               // Set the new width
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   677
               self.elements.wrapper.width(newWidth);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   678
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   679
               // Adjust BGIframe height and width if enabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   680
               if(self.elements.bgiframe) self.elements.bgiframe.width(newWidth).height(self.getDimensions.height);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   681
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   682
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   683
            // Log event and return
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   684
            return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_WIDTH_UPDATED, 'updateWidth');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   685
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   686
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   687
         updateStyle: function(name)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   688
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   689
            var tip, borders, context, corner, coordinates;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   690
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   691
            // Make sure tooltip is rendered and if not, return
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   692
            if(!self.status.rendered)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   693
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'updateStyle');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   694
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   695
            // Return if style is not defined or name is not a string
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   696
            else if(typeof name !== 'string' || !$.fn.qtip.styles[name])
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   697
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.STYLE_NOT_DEFINED, 'updateStyle');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   698
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   699
            // Set the new style object
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   700
            self.options.style = buildStyle.call(self, $.fn.qtip.styles[name], self.options.user.style);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   701
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   702
            // Update initial styles of content and title elements
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   703
            self.elements.content.css( jQueryStyle(self.options.style) );
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   704
            if(self.options.content.title.text !== false)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   705
               self.elements.title.css( jQueryStyle(self.options.style.title, true) );
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   706
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   707
            // Update CSS border colour
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   708
            self.elements.contentWrapper.css({ borderColor: self.options.style.border.color });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   709
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   710
            // Update tip color if enabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   711
            if(self.options.style.tip.corner !== false)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   712
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   713
               if($('<canvas>').get(0).getContext)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   714
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   715
                  // Retrieve canvas context and clear
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   716
                  tip = self.elements.tooltip.find('.qtip-tip canvas:first');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   717
                  context = tip.get(0).getContext('2d');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   718
                  context.clearRect(0,0,300,300);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   719
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   720
                  // Draw new tip
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   721
                  corner = tip.parent('div[rel]:first').attr('rel');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   722
                  coordinates = calculateTip(corner, self.options.style.tip.size.width, self.options.style.tip.size.height);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   723
                  drawTip.call(self, tip, coordinates, self.options.style.tip.color || self.options.style.border.color);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   724
               }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   725
               else if($.browser.msie)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   726
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   727
                  // Set new fillcolor attribute
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   728
                  tip = self.elements.tooltip.find('.qtip-tip [nodeName="shape"]');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   729
                  tip.attr('fillcolor', self.options.style.tip.color || self.options.style.border.color);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   730
               };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   731
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   732
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   733
            // Update border colors if enabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   734
            if(self.options.style.border.radius > 0)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   735
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   736
               self.elements.tooltip.find('.qtip-betweenCorners').css({ backgroundColor: self.options.style.border.color });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   737
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   738
               if($('<canvas>').get(0).getContext)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   739
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   740
                  borders = calculateBorders(self.options.style.border.radius)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   741
                  self.elements.tooltip.find('.qtip-wrapper canvas').each(function()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   742
                  {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   743
                     // Retrieve canvas context and clear
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   744
                     context = $(this).get(0).getContext('2d');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   745
                     context.clearRect(0,0,300,300);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   746
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   747
                     // Draw new border
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   748
                     corner = $(this).parent('div[rel]:first').attr('rel')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   749
                     drawBorder.call(self, $(this), borders[corner],
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   750
                        self.options.style.border.radius, self.options.style.border.color);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   751
                  });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   752
               }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   753
               else if($.browser.msie)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   754
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   755
                  // Set new fillcolor attribute on each border corner
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   756
                  self.elements.tooltip.find('.qtip-wrapper [nodeName="arc"]').each(function()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   757
                  {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   758
                     $(this).attr('fillcolor', self.options.style.border.color)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   759
                  });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   760
               };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   761
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   762
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   763
            // Log event and return
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   764
            return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_STYLE_UPDATED, 'updateStyle');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   765
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   766
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   767
         updateContent: function(content, reposition)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   768
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   769
            var parsedContent, images, loadedImages;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   770
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   771
            // Make sure tooltip is rendered and if not, return
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   772
            if(!self.status.rendered)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   773
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'updateContent');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   774
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   775
            // Make sure content is defined before update
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   776
            else if(!content)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   777
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.NO_CONTENT_PROVIDED, 'updateContent');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   778
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   779
            // Call API method and set new content if a string is returned
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   780
            parsedContent = self.beforeContentUpdate.call(self, content);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   781
            if(typeof parsedContent == 'string') content = parsedContent;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   782
            else if(parsedContent === false) return;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   783
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   784
            // Set position and zoom to defaults to prevent IE hasLayout bug
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   785
            if($.browser.msie) self.elements.contentWrapper.children().css({ zoom: 'normal' });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   786
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   787
            // Append new content if its a DOM array and show it if hidden
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   788
            if(content.jquery && content.length > 0)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   789
               content.clone(true).appendTo(self.elements.content).show();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   790
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   791
            // Content is a regular string, insert the new content
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   792
            else self.elements.content.html(content);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   793
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   794
            // Check if images need to be loaded before position is updated to prevent mis-positioning
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   795
            images = self.elements.content.find('img[complete=false]');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   796
            if(images.length > 0)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   797
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   798
               loadedImages = 0;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   799
               images.each(function(i)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   800
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   801
                  $('<img src="'+ $(this).attr('src') +'" />')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   802
                     .load(function(){ if(++loadedImages == images.length) afterLoad(); });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   803
               });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   804
            }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   805
            else afterLoad();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   806
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   807
            function afterLoad()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   808
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   809
               // Update the tooltip width
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   810
               self.updateWidth();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   811
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   812
               // If repositioning is enabled, update positions
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   813
               if(reposition !== false)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   814
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   815
                  // Update position if tooltip isn't static
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   816
                  if(self.options.position.type !== 'static')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   817
                     self.updatePosition(self.elements.tooltip.is(':visible'), true);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   818
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   819
                  // Reposition the tip if enabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   820
                  if(self.options.style.tip.corner !== false)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   821
                     positionTip.call(self);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   822
               };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   823
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   824
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   825
            // Call API method and log event
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   826
            self.onContentUpdate.call(self);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   827
            return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_CONTENT_UPDATED, 'loadContent');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   828
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   829
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   830
         loadContent: function(url, data, method)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   831
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   832
            var returned;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   833
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   834
            // Make sure tooltip is rendered and if not, return
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   835
            if(!self.status.rendered)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   836
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'loadContent');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   837
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   838
            // Call API method and if return value is false, halt
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   839
            returned = self.beforeContentLoad.call(self);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   840
            if(returned === false) return self;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   841
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   842
            // Load content using specified request type
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   843
            if(method == 'post')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   844
               $.post(url, data, setupContent);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   845
            else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   846
               $.get(url, data, setupContent);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   847
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   848
            function setupContent(content)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   849
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   850
               // Call API method and log event
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   851
               self.onContentLoad.call(self);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   852
               $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_CONTENT_LOADED, 'loadContent');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   853
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   854
               // Update the content
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   855
               self.updateContent(content);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   856
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   857
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   858
            return self;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   859
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   860
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   861
         updateTitle: function(content)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   862
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   863
            // Make sure tooltip is rendered and if not, return
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   864
            if(!self.status.rendered)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   865
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'updateTitle');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   866
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   867
            // Make sure content is defined before update
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   868
            else if(!content)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   869
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.NO_CONTENT_PROVIDED, 'updateTitle');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   870
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   871
            // Call API method and if return value is false, halt
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   872
            returned = self.beforeTitleUpdate.call(self);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   873
            if(returned === false) return self;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   874
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   875
            // Set the new content and reappend the button if enabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   876
            if(self.elements.button) self.elements.button = self.elements.button.clone(true);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   877
            self.elements.title.html(content)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   878
            if(self.elements.button) self.elements.title.prepend(self.elements.button);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   879
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   880
            // Call API method and log event
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   881
            self.onTitleUpdate.call(self);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   882
            return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_TITLE_UPDATED, 'updateTitle');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   883
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   884
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   885
         focus: function(event)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   886
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   887
            var curIndex, newIndex, elemIndex, returned;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   888
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   889
            // Make sure tooltip is rendered and if not, return
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   890
            if(!self.status.rendered)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   891
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'focus');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   892
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   893
            else if(self.options.position.type == 'static')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   894
               return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.CANNOT_FOCUS_STATIC, 'focus');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   895
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   896
            // Set z-index variables
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   897
            curIndex = parseInt( self.elements.tooltip.css('z-index') );
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   898
            newIndex = 6000 + $('div.qtip[qtip]').length - 1;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   899
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   900
            // Only update the z-index if it has changed and tooltip is not already focused
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   901
            if(!self.status.focused && curIndex !== newIndex)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   902
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   903
               // Call API method and if return value is false, halt
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   904
               returned = self.beforeFocus.call(self, event);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   905
               if(returned === false) return self;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   906
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   907
               // Loop through all other tooltips
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   908
               $('div.qtip[qtip]').not(self.elements.tooltip).each(function()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   909
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   910
                  if($(this).qtip('api').status.rendered === true)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   911
                  {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   912
                     elemIndex = parseInt($(this).css('z-index'));
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   913
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   914
                     // Reduce all other tooltip z-index by 1
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   915
                     if(typeof elemIndex == 'number' && elemIndex > -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   916
                        $(this).css({ zIndex: parseInt( $(this).css('z-index') ) - 1 });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   917
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   918
                     // Set focused status to false
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   919
                     $(this).qtip('api').status.focused = false;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   920
                  }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   921
               })
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   922
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   923
               // Set the new z-index and set focus status to true
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   924
               self.elements.tooltip.css({ zIndex: newIndex });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   925
               self.status.focused = true;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   926
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   927
               // Call API method and log event
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   928
               self.onFocus.call(self, event);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   929
               $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_FOCUSED, 'focus');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   930
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   931
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   932
            return self;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   933
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   934
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   935
         disable: function(state)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   936
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   937
            // Make sure tooltip is rendered and if not, return
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   938
            if(!self.status.rendered)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   939
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'disable');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   940
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   941
            if(state)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   942
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   943
               // Tooltip is not already disabled, proceed
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   944
               if(!self.status.disabled)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   945
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   946
                  // Set the disabled flag and log event
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   947
                  self.status.disabled = true;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   948
                  $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_DISABLED, 'disable');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   949
               }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   950
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   951
               // Tooltip is already disabled, inform user via log
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   952
               else  $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.TOOLTIP_ALREADY_DISABLED, 'disable');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   953
            }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   954
            else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   955
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   956
               // Tooltip is not already enabled, proceed
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   957
               if(self.status.disabled)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   958
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   959
                  // Reassign events, set disable status and log
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   960
                  self.status.disabled = false;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   961
                  $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_ENABLED, 'disable');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   962
               }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   963
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   964
               // Tooltip is already enabled, inform the user via log
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   965
               else $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.TOOLTIP_ALREADY_ENABLED, 'disable');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   966
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   967
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   968
            return self;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   969
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   970
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   971
         destroy: function()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   972
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   973
            var i, returned, interfaces;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   974
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   975
            // Call API method and if return value is false, halt
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   976
            returned = self.beforeDestroy.call(self);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   977
            if(returned === false) return self;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   978
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   979
            // Check if tooltip is rendered
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   980
            if(self.status.rendered)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   981
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   982
               // Remove event handlers and remove element
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   983
               self.options.show.when.target.unbind('mousemove.qtip', self.updatePosition);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   984
               self.options.show.when.target.unbind('mouseout.qtip', self.hide);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   985
               self.options.show.when.target.unbind(self.options.show.when.event + '.qtip');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   986
               self.options.hide.when.target.unbind(self.options.hide.when.event + '.qtip');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   987
               self.elements.tooltip.unbind(self.options.hide.when.event + '.qtip');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   988
               self.elements.tooltip.unbind('mouseover.qtip', self.focus);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   989
               self.elements.tooltip.remove();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   990
            }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   991
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   992
            // Tooltip isn't yet rendered, remove render event
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   993
            else self.options.show.when.target.unbind(self.options.show.when.event+'.qtip-create');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   994
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   995
            // Check to make sure qTip data is present on target element
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   996
            if(typeof self.elements.target.data('qtip') == 'object')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   997
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   998
               // Remove API references from interfaces object
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
   999
               interfaces = self.elements.target.data('qtip').interfaces;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1000
               if(typeof interfaces == 'object' && interfaces.length > 0)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1001
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1002
                  // Remove API from interfaces array
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1003
                  for(i = 0; i < interfaces.length - 1; i++)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1004
                     if(interfaces[i].id == self.id) interfaces.splice(i, 1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1005
               }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1006
            }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1007
            delete $.fn.qtip.interfaces[self.id];
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1008
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1009
            // Set qTip current id to previous tooltips API if available
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1010
            if(typeof interfaces == 'object' && interfaces.length > 0)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1011
               self.elements.target.data('qtip').current = interfaces.length -1;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1012
            else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1013
               self.elements.target.removeData('qtip');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1014
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1015
            // Call API method and log destroy
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1016
            self.onDestroy.call(self);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1017
            $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_DESTROYED, 'destroy');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1018
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1019
            return self.elements.target
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1020
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1021
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1022
         getPosition: function()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1023
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1024
            var show, offset;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1025
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1026
            // Make sure tooltip is rendered and if not, return
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1027
            if(!self.status.rendered)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1028
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'getPosition');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1029
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1030
            show = (self.elements.tooltip.css('display') !== 'none') ? false : true;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1031
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1032
            // Show and hide tooltip to make sure coordinates are returned
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1033
            if(show) self.elements.tooltip.css({ visiblity: 'hidden' }).show();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1034
            offset = self.elements.tooltip.offset();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1035
            if(show) self.elements.tooltip.css({ visiblity: 'visible' }).hide();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1036
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1037
            return offset;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1038
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1039
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1040
         getDimensions: function()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1041
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1042
            var show, dimensions;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1043
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1044
            // Make sure tooltip is rendered and if not, return
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1045
            if(!self.status.rendered)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1046
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'getDimensions');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1047
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1048
            show = (!self.elements.tooltip.is(':visible')) ? true : false;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1049
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1050
            // Show and hide tooltip to make sure dimensions are returned
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1051
            if(show) self.elements.tooltip.css({ visiblity: 'hidden' }).show();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1052
            dimensions = {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1053
               height: self.elements.tooltip.outerHeight(),
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1054
               width: self.elements.tooltip.outerWidth()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1055
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1056
            if(show) self.elements.tooltip.css({ visiblity: 'visible' }).hide();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1057
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1058
            return dimensions;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1059
         }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1060
      });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1061
   };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1062
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1063
   // Define priamry construct function
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1064
   function construct()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1065
   {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1066
      var self, adjust, content, url, data, method, tempLength;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1067
      self = this;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1068
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1069
      // Call API method
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1070
      self.beforeRender.call(self);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1071
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1072
      // Set rendered status to true
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1073
      self.status.rendered = true;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1074
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1075
      // Create initial tooltip elements
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1076
      self.elements.tooltip =  '<div qtip="'+self.id+'" ' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1077
         'class="qtip '+(self.options.style.classes.tooltip || self.options.style)+'"' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1078
         'style="display:none; -moz-border-radius:0; -webkit-border-radius:0; border-radius:0;' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1079
         'position:'+self.options.position.type+';">' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1080
         '  <div class="qtip-wrapper" style="position:relative; overflow:hidden; text-align:left;">' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1081
         '    <div class="qtip-contentWrapper" style="overflow:hidden;">' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1082
         '       <div class="qtip-content '+self.options.style.classes.content+'"></div>' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1083
         '</div></div></div>';
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1084
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1085
      // Append to container element
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1086
      self.elements.tooltip = $(self.elements.tooltip);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1087
      self.elements.tooltip.appendTo(self.options.position.container)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1088
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1089
      // Setup tooltip qTip data
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1090
      self.elements.tooltip.data('qtip', { current: 0, interfaces: [self] });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1091
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1092
      // Setup element references
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1093
      self.elements.wrapper = self.elements.tooltip.children('div:first');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1094
      self.elements.contentWrapper = self.elements.wrapper.children('div:first').css({ background: self.options.style.background });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1095
      self.elements.content = self.elements.contentWrapper.children('div:first').css( jQueryStyle(self.options.style) );
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1096
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1097
      // Apply IE hasLayout fix to wrapper and content elements
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1098
      if($.browser.msie) self.elements.wrapper.add(self.elements.content).css({ zoom: 1 });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1099
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1100
      // Setup tooltip attributes
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1101
      if(self.options.hide.when.event == 'unfocus') self.elements.tooltip.attr('unfocus', true);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1102
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1103
      // If an explicit width is set, updateWidth prior to setting content to prevent dirty rendering
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1104
      if(typeof self.options.style.width.value == 'number') self.updateWidth();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1105
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1106
      // Create borders and tips if supported by the browser
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1107
      if($('<canvas>').get(0).getContext || $.browser.msie)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1108
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1109
         // Create border
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1110
         if(self.options.style.border.radius > 0)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1111
            createBorder.call(self);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1112
         else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1113
            self.elements.contentWrapper.css({ border: self.options.style.border.width+'px solid '+self.options.style.border.color  });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1114
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1115
         // Create tip if enabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1116
         if(self.options.style.tip.corner !== false)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1117
            createTip.call(self);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1118
      }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1119
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1120
      // Neither canvas or VML is supported, tips and borders cannot be drawn!
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1121
      else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1122
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1123
         // Set defined border width
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1124
         self.elements.contentWrapper.css({ border: self.options.style.border.width+'px solid '+self.options.style.border.color  });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1125
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1126
         // Reset border radius and tip
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1127
         self.options.style.border.radius = 0;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1128
         self.options.style.tip.corner = false;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1129
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1130
         // Inform via log
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1131
         $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.CANVAS_VML_NOT_SUPPORTED, 'render');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1132
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1133
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1134
      // Use the provided content string or DOM array
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1135
      if((typeof self.options.content.text == 'string' && self.options.content.text.length > 0)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1136
      || (self.options.content.text.jquery && self.options.content.text.length > 0))
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1137
         content = self.options.content.text;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1138
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1139
      // Use title string for content if present
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1140
      else if(typeof self.elements.target.attr('title') == 'string' && self.elements.target.attr('title').length > 0)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1141
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1142
         content = self.elements.target.attr('title').replace("\\n", '<br />');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1143
         self.elements.target.attr('title', ''); // Remove title attribute to prevent default tooltip showing
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1144
      }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1145
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1146
      // No title is present, use alt attribute instead
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1147
      else if(typeof self.elements.target.attr('alt') == 'string' && self.elements.target.attr('alt').length > 0)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1148
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1149
         content = self.elements.target.attr('alt').replace("\\n", '<br />');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1150
         self.elements.target.attr('alt', ''); // Remove alt attribute to prevent default tooltip showing
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1151
      }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1152
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1153
      // No valid content was provided, inform via log
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1154
      else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1155
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1156
         content = ' ';
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1157
         $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.NO_VALID_CONTENT, 'render');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1158
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1159
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1160
      // Set the tooltips content and create title if enabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1161
      if(self.options.content.title.text !== false) createTitle.call(self);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1162
      self.updateContent(content);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1163
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1164
      // Assign events and toggle tooltip with focus
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1165
      assignEvents.call(self);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1166
      if(self.options.show.ready === true) self.show();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1167
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1168
      // Retrieve ajax content if provided
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1169
      if(self.options.content.url !== false)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1170
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1171
         url = self.options.content.url;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1172
         data = self.options.content.data;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1173
         method = self.options.content.method || 'get';
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1174
         self.loadContent(url, data, method);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1175
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1176
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1177
      // Call API method and log event
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1178
      self.onRender.call(self);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1179
      $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_RENDERED, 'render');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1180
   };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1181
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1182
   // Create borders using canvas and VML
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1183
   function createBorder()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1184
   {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1185
      var self, i, width, radius, color, coordinates, containers, size, betweenWidth, betweenCorners, borderTop, borderBottom, borderCoord, sideWidth, vertWidth;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1186
      self = this;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1187
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1188
      // Destroy previous border elements, if present
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1189
      self.elements.wrapper.find('.qtip-borderBottom, .qtip-borderTop').remove();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1190
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1191
      // Setup local variables
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1192
      width = self.options.style.border.width;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1193
      radius = self.options.style.border.radius;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1194
      color = self.options.style.border.color || self.options.style.tip.color;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1195
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1196
      // Calculate border coordinates
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1197
      coordinates = calculateBorders(radius);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1198
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1199
      // Create containers for the border shapes
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1200
      containers = {};
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1201
      for(i in coordinates)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1202
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1203
         // Create shape container
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1204
         containers[i] = '<div rel="'+i+'" style="'+((i.search(/Left/) !== -1) ? 'left' : 'right') + ':0; ' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1205
            'position:absolute; height:'+radius+'px; width:'+radius+'px; overflow:hidden; line-height:0.1px; font-size:1px">';
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1206
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1207
         // Canvas is supported
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1208
         if($('<canvas>').get(0).getContext)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1209
            containers[i] += '<canvas height="'+radius+'" width="'+radius+'" style="vertical-align: top"></canvas>';
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1210
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1211
         // No canvas, but if it's IE use VML
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1212
         else if($.browser.msie)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1213
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1214
            size = radius * 2 + 3;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1215
            containers[i] += '<v:arc stroked="false" fillcolor="'+color+'" startangle="'+coordinates[i][0]+'" endangle="'+coordinates[i][1]+'" ' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1216
               'style="width:'+size+'px; height:'+size+'px; margin-top:'+((i.search(/bottom/) !== -1) ? -2 : -1)+'px; ' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1217
               'margin-left:'+((i.search(/Right/) !== -1) ? coordinates[i][2] - 3.5 : -1)+'px; ' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1218
               'vertical-align:top; display:inline-block; behavior:url(#default#VML)"></v:arc>';
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1219
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1220
         };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1221
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1222
         containers[i] += '</div>';
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1223
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1224
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1225
      // Create between corners elements
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1226
      betweenWidth = self.getDimensions().width - (Math.max(width, radius) * 2);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1227
      betweenCorners = '<div class="qtip-betweenCorners" style="height:'+radius+'px; width:'+betweenWidth+'px; ' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1228
         'overflow:hidden; background-color:'+color+'; line-height:0.1px; font-size:1px;">';
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1229
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1230
      // Create top border container
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1231
      borderTop = '<div class="qtip-borderTop" dir="ltr" style="height:'+radius+'px; ' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1232
         'margin-left:'+radius+'px; line-height:0.1px; font-size:1px; padding:0;">' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1233
         containers['topLeft'] + containers['topRight'] + betweenCorners;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1234
      self.elements.wrapper.prepend(borderTop);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1235
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1236
      // Create bottom border container
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1237
      borderBottom = '<div class="qtip-borderBottom" dir="ltr" style="height:'+radius+'px; ' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1238
         'margin-left:'+radius+'px; line-height:0.1px; font-size:1px; padding:0;">' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1239
         containers['bottomLeft'] + containers['bottomRight'] + betweenCorners;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1240
      self.elements.wrapper.append(borderBottom);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1241
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1242
      // Draw the borders if canvas were used (Delayed til after DOM creation)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1243
      if($('<canvas>').get(0).getContext)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1244
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1245
         self.elements.wrapper.find('canvas').each(function()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1246
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1247
            borderCoord = coordinates[ $(this).parent('[rel]:first').attr('rel') ];
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1248
            drawBorder.call(self, $(this), borderCoord, radius, color);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1249
         })
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1250
      }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1251
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1252
      // Create a phantom VML element (IE won't show the last created VML element otherwise)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1253
      else if($.browser.msie) self.elements.tooltip.append('<v:image style="behavior:url(#default#VML);"></v:image>');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1254
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1255
      // Setup contentWrapper border
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1256
      sideWidth = Math.max(radius, (radius + (width - radius)) )
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1257
      vertWidth = Math.max(width - radius, 0);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1258
      self.elements.contentWrapper.css({
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1259
         border: '0px solid ' + color,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1260
         borderWidth: vertWidth + 'px ' + sideWidth + 'px'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1261
      })
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1262
   };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1263
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1264
   // Border canvas draw method
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1265
   function drawBorder(canvas, coordinates, radius, color)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1266
   {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1267
      // Create corner
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1268
      var context = canvas.get(0).getContext('2d');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1269
      context.fillStyle = color;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1270
      context.beginPath();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1271
      context.arc(coordinates[0], coordinates[1], radius, 0, Math.PI * 2, false);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1272
      context.fill();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1273
   };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1274
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1275
   // Create tip using canvas and VML
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1276
   function createTip(corner)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1277
   {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1278
      var self, color, coordinates, coordsize, path;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1279
      self = this;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1280
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1281
      // Destroy previous tip, if there is one
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1282
      if(self.elements.tip !== null) self.elements.tip.remove();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1283
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1284
      // Setup color and corner values
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1285
      color = self.options.style.tip.color || self.options.style.border.color;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1286
      if(self.options.style.tip.corner === false) return;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1287
      else if(!corner) corner = self.options.style.tip.corner;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1288
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1289
      // Calculate tip coordinates
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1290
      coordinates = calculateTip(corner, self.options.style.tip.size.width, self.options.style.tip.size.height);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1291
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1292
      // Create tip element
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1293
      self.elements.tip =  '<div class="'+self.options.style.classes.tip+'" dir="ltr" rel="'+corner+'" style="position:absolute; ' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1294
         'height:'+self.options.style.tip.size.height+'px; width:'+self.options.style.tip.size.width+'px; ' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1295
         'margin:0 auto; line-height:0.1px; font-size:1px;">';
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1296
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1297
      // Use canvas element if supported
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1298
      if($('<canvas>').get(0).getContext)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1299
          self.elements.tip += '<canvas height="'+self.options.style.tip.size.height+'" width="'+self.options.style.tip.size.width+'"></canvas>';
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1300
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1301
      // Canvas not supported - Use VML (IE)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1302
      else if($.browser.msie)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1303
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1304
         // Create coordize and tip path using tip coordinates
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1305
         coordsize = self.options.style.tip.size.width + ',' + self.options.style.tip.size.height;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1306
         path = 'm' + coordinates[0][0] + ',' + coordinates[0][1];
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1307
         path += ' l' + coordinates[1][0] + ',' + coordinates[1][1];
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1308
         path += ' ' + coordinates[2][0] + ',' + coordinates[2][1];
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1309
         path += ' xe';
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1310
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1311
         // Create VML element
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1312
         self.elements.tip += '<v:shape fillcolor="'+color+'" stroked="false" filled="true" path="'+path+'" coordsize="'+coordsize+'" ' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1313
            'style="width:'+self.options.style.tip.size.width+'px; height:'+self.options.style.tip.size.height+'px; ' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1314
            'line-height:0.1px; display:inline-block; behavior:url(#default#VML); ' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1315
            'vertical-align:'+((corner.search(/top/) !== -1) ? 'bottom' : 'top')+'"></v:shape>';
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1316
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1317
         // Create a phantom VML element (IE won't show the last created VML element otherwise)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1318
         self.elements.tip += '<v:image style="behavior:url(#default#VML);"></v:image>';
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1319
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1320
         // Prevent tooltip appearing above the content (IE z-index bug)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1321
         self.elements.contentWrapper.css('position', 'relative');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1322
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1323
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1324
      // Attach new tip to tooltip element
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1325
      self.elements.tooltip.prepend(self.elements.tip + '</div>');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1326
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1327
      // Create element reference and draw the canvas tip (Delayed til after DOM creation)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1328
      self.elements.tip = self.elements.tooltip.find('.'+self.options.style.classes.tip).eq(0);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1329
      if($('<canvas>').get(0).getContext)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1330
         drawTip.call(self, self.elements.tip.find('canvas:first'), coordinates, color);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1331
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1332
      // Fix IE small tip bug
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1333
      if(corner.search(/top/) !== -1 && $.browser.msie && parseInt($.browser.version.charAt(0)) === 6)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1334
         self.elements.tip.css({ marginTop: -4 });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1335
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1336
      // Set the tip position
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1337
      positionTip.call(self, corner);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1338
   };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1339
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1340
   // Canvas tip drawing method
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1341
   function drawTip(canvas, coordinates, color)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1342
   {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1343
      // Setup properties
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1344
      var context = canvas.get(0).getContext('2d');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1345
      context.fillStyle = color;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1346
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1347
      // Create tip
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1348
      context.beginPath();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1349
      context.moveTo(coordinates[0][0], coordinates[0][1]);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1350
      context.lineTo(coordinates[1][0], coordinates[1][1]);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1351
      context.lineTo(coordinates[2][0], coordinates[2][1]);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1352
      context.fill();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1353
   };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1354
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1355
   function positionTip(corner)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1356
   {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1357
      var self, ieAdjust, paddingCorner, paddingSize, newMargin;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1358
      self = this;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1359
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1360
      // Return if tips are disabled or tip is not yet rendered
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1361
      if(self.options.style.tip.corner === false || !self.elements.tip) return;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1362
      if(!corner) corner = self.elements.tip.attr('rel');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1363
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1364
      // Setup adjustment variables
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1365
      ieAdjust = positionAdjust = ($.browser.msie) ? 1 : 0;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1366
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1367
      // Set initial position
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1368
      self.elements.tip.css(corner.match(/left|right|top|bottom/)[0], 0);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1369
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1370
      // Set position of tip to correct side
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1371
      if(corner.search(/top|bottom/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1372
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1373
         // Adjustments for IE6 - 0.5px border gap bug
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1374
         if($.browser.msie)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1375
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1376
            if(parseInt($.browser.version.charAt(0)) === 6)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1377
               positionAdjust = (corner.search(/top/) !== -1) ? -3 : 1;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1378
            else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1379
               positionAdjust = (corner.search(/top/) !== -1) ? 1 : 2;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1380
         };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1381
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1382
         if(corner.search(/Middle/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1383
            self.elements.tip.css({ left: '50%', marginLeft: -(self.options.style.tip.size.width / 2) });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1384
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1385
         else if(corner.search(/Left/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1386
            self.elements.tip.css({ left: self.options.style.border.radius - ieAdjust });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1387
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1388
         else if(corner.search(/Right/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1389
            self.elements.tip.css({ right: self.options.style.border.radius + ieAdjust });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1390
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1391
         if(corner.search(/top/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1392
            self.elements.tip.css({ top: -positionAdjust });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1393
         else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1394
            self.elements.tip.css({ bottom: positionAdjust });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1395
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1396
      }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1397
      else if(corner.search(/left|right/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1398
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1399
         // Adjustments for IE6 - 0.5px border gap bug
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1400
         if($.browser.msie)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1401
            positionAdjust = (parseInt($.browser.version.charAt(0)) === 6) ? 1 : ((corner.search(/left/) !== -1) ? 1 : 2);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1402
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1403
         if(corner.search(/Middle/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1404
            self.elements.tip.css({ top: '50%', marginTop: -(self.options.style.tip.size.height / 2) });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1405
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1406
         else if(corner.search(/Top/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1407
            self.elements.tip.css({ top: self.options.style.border.radius - ieAdjust });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1408
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1409
         else if(corner.search(/Bottom/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1410
            self.elements.tip.css({ bottom: self.options.style.border.radius + ieAdjust });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1411
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1412
         if(corner.search(/left/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1413
            self.elements.tip.css({ left: -positionAdjust });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1414
         else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1415
            self.elements.tip.css({ right: positionAdjust });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1416
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1417
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1418
      // Adjust tooltip padding to compensate for tip
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1419
      paddingCorner = 'padding-' + corner.match(/left|right|top|bottom/)[0];
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1420
      paddingSize = self.options.style.tip.size[ (paddingCorner.search(/left|right/) !== -1) ? 'width' : 'height' ];
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1421
      self.elements.tooltip.css('padding', 0);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1422
      self.elements.tooltip.css(paddingCorner, paddingSize);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1423
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1424
      // Match content margin to prevent gap bug in IE6 ONLY
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1425
      if($.browser.msie && parseInt($.browser.version.charAt(0)) == 6)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1426
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1427
         newMargin = parseInt(self.elements.tip.css('margin-top')) || 0;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1428
         newMargin += parseInt(self.elements.content.css('margin-top')) || 0;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1429
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1430
         self.elements.tip.css({ marginTop: newMargin });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1431
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1432
   };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1433
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1434
   // Create title bar for content
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1435
   function createTitle()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1436
   {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1437
      var self = this;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1438
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1439
      // Destroy previous title element, if present
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1440
      if(self.elements.title !== null) self.elements.title.remove();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1441
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1442
      // Create title element
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1443
      self.elements.title = $('<div class="'+self.options.style.classes.title+'">')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1444
         .css( jQueryStyle(self.options.style.title, true) )
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1445
         .css({ zoom: ($.browser.msie) ? 1 : 0 })
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1446
         .prependTo(self.elements.contentWrapper);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1447
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1448
      // Update title with contents if enabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1449
      if(self.options.content.title.text) self.updateTitle.call(self, self.options.content.title.text);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1450
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1451
      // Create title close buttons if enabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1452
      if(self.options.content.title.button !== false
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1453
      && typeof self.options.content.title.button == 'string')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1454
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1455
         self.elements.button = $('<a class="'+self.options.style.classes.button+'" style="float:right; position: relative"></a>')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1456
            .css( jQueryStyle(self.options.style.button, true) )
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1457
            .html(self.options.content.title.button)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1458
            .prependTo(self.elements.title)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1459
            .click(function(event){ if(!self.status.disabled) self.hide(event) });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1460
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1461
   };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1462
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1463
   // Assign hide and show events
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1464
   function assignEvents()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1465
   {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1466
      var self, showTarget, hideTarget, inactiveEvents;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1467
      self = this;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1468
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1469
      // Setup event target variables
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1470
      showTarget = self.options.show.when.target;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1471
      hideTarget = self.options.hide.when.target;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1472
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1473
      // Add tooltip as a hideTarget is its fixed
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1474
      if(self.options.hide.fixed) hideTarget = hideTarget.add(self.elements.tooltip);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1475
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1476
      // Check if the hide event is special 'inactive' type
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1477
      if(self.options.hide.when.event == 'inactive')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1478
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1479
         // Define events which reset the 'inactive' event handler
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1480
         inactiveEvents = ['click', 'dblclick', 'mousedown', 'mouseup', 'mousemove',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1481
         'mouseout', 'mouseenter', 'mouseleave', 'mouseover' ];
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1482
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1483
         // Define 'inactive' event timer method
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1484
         function inactiveMethod(event)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1485
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1486
            if(self.status.disabled === true) return;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1487
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1488
            //Clear and reset the timer
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1489
            clearTimeout(self.timers.inactive);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1490
            self.timers.inactive = setTimeout(function()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1491
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1492
               // Unassign 'inactive' events
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1493
               $(inactiveEvents).each(function()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1494
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1495
                  hideTarget.unbind(this+'.qtip-inactive');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1496
                  self.elements.content.unbind(this+'.qtip-inactive');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1497
               });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1498
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1499
               // Hide the tooltip
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1500
               self.hide(event);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1501
            }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1502
            , self.options.hide.delay);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1503
         };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1504
      }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1505
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1506
      // Check if the tooltip is 'fixed'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1507
      else if(self.options.hide.fixed === true)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1508
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1509
         self.elements.tooltip.bind('mouseover.qtip', function()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1510
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1511
            if(self.status.disabled === true) return;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1512
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1513
            // Reset the hide timer
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1514
            clearTimeout(self.timers.hide);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1515
         });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1516
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1517
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1518
      // Define show event method
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1519
      function showMethod(event)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1520
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1521
         if(self.status.disabled === true) return;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1522
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1523
         // If set, hide tooltip when inactive for delay period
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1524
         if(self.options.hide.when.event == 'inactive')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1525
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1526
            // Assign each reset event
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1527
            $(inactiveEvents).each(function()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1528
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1529
               hideTarget.bind(this+'.qtip-inactive', inactiveMethod);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1530
               self.elements.content.bind(this+'.qtip-inactive', inactiveMethod);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1531
            });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1532
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1533
            // Start the inactive timer
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1534
            inactiveMethod();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1535
         };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1536
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1537
         // Clear hide timers
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1538
         clearTimeout(self.timers.show);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1539
         clearTimeout(self.timers.hide);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1540
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1541
         // Start show timer
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1542
         self.timers.show = setTimeout(function(){ self.show(event); }, self.options.show.delay);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1543
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1544
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1545
      // Define hide event method
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1546
      function hideMethod(event)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1547
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1548
         if(self.status.disabled === true) return;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1549
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1550
         // Prevent hiding if tooltip is fixed and event target is the tooltip
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1551
         if(self.options.hide.fixed === true
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1552
         && self.options.hide.when.event.search(/mouse(out|leave)/i) !== -1
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1553
         && $(event.relatedTarget).parents('div.qtip[qtip]').length > 0)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1554
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1555
            // Prevent default and popagation
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1556
            event.stopPropagation();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1557
            event.preventDefault();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1558
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1559
            // Reset the hide timer
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1560
            clearTimeout(self.timers.hide);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1561
            return false;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1562
         };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1563
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1564
         // Clear timers and stop animation queue
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1565
         clearTimeout(self.timers.show);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1566
         clearTimeout(self.timers.hide);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1567
         self.elements.tooltip.stop(true, true);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1568
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1569
         // If tooltip has displayed, start hide timer
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1570
         self.timers.hide = setTimeout(function(){ self.hide(event); }, self.options.hide.delay);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1571
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1572
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1573
      // Both events and targets are identical, apply events using a toggle
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1574
      if((self.options.show.when.target.add(self.options.hide.when.target).length === 1
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1575
      && self.options.show.when.event == self.options.hide.when.event
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1576
      && self.options.hide.when.event !== 'inactive')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1577
      || self.options.hide.when.event == 'unfocus')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1578
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1579
         self.cache.toggle = 0;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1580
         // Use a toggle to prevent hide/show conflicts
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1581
         showTarget.bind(self.options.show.when.event + '.qtip', function(event)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1582
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1583
            if(self.cache.toggle == 0) showMethod(event);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1584
            else hideMethod(event);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1585
         });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1586
      }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1587
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1588
      // Events are not identical, bind normally
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1589
      else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1590
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1591
         showTarget.bind(self.options.show.when.event + '.qtip', showMethod);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1592
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1593
         // If the hide event is not 'inactive', bind the hide method
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1594
         if(self.options.hide.when.event !== 'inactive')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1595
            hideTarget.bind(self.options.hide.when.event + '.qtip', hideMethod);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1596
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1597
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1598
      // Focus the tooltip on mouseover
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1599
      if(self.options.position.type.search(/(fixed|absolute)/) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1600
         self.elements.tooltip.bind('mouseover.qtip', self.focus);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1601
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1602
      // If mouse is the target, update tooltip position on mousemove
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1603
      if(self.options.position.target === 'mouse' && self.options.position.type !== 'static')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1604
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1605
         showTarget.bind('mousemove.qtip', function(event)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1606
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1607
            // Set the new mouse positions if adjustment is enabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1608
            self.cache.mouse = { x: event.pageX, y: event.pageY };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1609
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1610
            // Update the tooltip position only if the tooltip is visible and adjustment is enabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1611
            if(self.status.disabled === false
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1612
            && self.options.position.adjust.mouse === true
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1613
            && self.options.position.type !== 'static'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1614
            && self.elements.tooltip.css('display') !== 'none')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1615
               self.updatePosition(event);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1616
         });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1617
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1618
   };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1619
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1620
   // Screen position adjustment
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1621
   function screenAdjust(position, target, tooltip)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1622
   {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1623
      var self, adjustedPosition, adjust, newCorner, overflow, corner;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1624
      self = this;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1625
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1626
      // Setup corner and adjustment variable
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1627
      if(tooltip.corner == 'center') return target.position // TODO: 'center' corner adjustment
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1628
      adjustedPosition = $.extend({}, position);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1629
      newCorner = { x: false, y: false };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1630
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1631
      // Define overflow properties
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1632
      overflow = {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1633
         left: (adjustedPosition.left < $.fn.qtip.cache.screen.scroll.left),
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1634
         right: (adjustedPosition.left + tooltip.dimensions.width + 2 >= $.fn.qtip.cache.screen.width + $.fn.qtip.cache.screen.scroll.left),
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1635
         top: (adjustedPosition.top < $.fn.qtip.cache.screen.scroll.top),
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1636
         bottom: (adjustedPosition.top + tooltip.dimensions.height + 2 >= $.fn.qtip.cache.screen.height + $.fn.qtip.cache.screen.scroll.top)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1637
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1638
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1639
      // Determine new positioning properties
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1640
      adjust = {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1641
         left: (overflow.left && (tooltip.corner.search(/right/i) != -1 || (tooltip.corner.search(/right/i) == -1 && !overflow.right))),
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1642
         right: (overflow.right && (tooltip.corner.search(/left/i) != -1 || (tooltip.corner.search(/left/i) == -1 && !overflow.left))),
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1643
         top: (overflow.top && tooltip.corner.search(/top/i) == -1),
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1644
         bottom: (overflow.bottom && tooltip.corner.search(/bottom/i) == -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1645
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1646
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1647
      // Tooltip overflows off the left side of the screen
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1648
      if(adjust.left)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1649
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1650
         if(self.options.position.target !== 'mouse')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1651
            adjustedPosition.left = target.position.left + target.dimensions.width;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1652
         else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1653
            adjustedPosition.left = self.cache.mouse.x
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1654
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1655
         newCorner.x = 'Left';
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1656
      }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1657
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1658
      // Tooltip overflows off the right side of the screen
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1659
      else if(adjust.right)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1660
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1661
         if(self.options.position.target !== 'mouse')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1662
            adjustedPosition.left = target.position.left - tooltip.dimensions.width;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1663
         else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1664
            adjustedPosition.left = self.cache.mouse.x - tooltip.dimensions.width;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1665
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1666
         newCorner.x = 'Right';
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1667
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1668
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1669
      // Tooltip overflows off the top of the screen
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1670
      if(adjust.top)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1671
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1672
         if(self.options.position.target !== 'mouse')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1673
            adjustedPosition.top = target.position.top + target.dimensions.height;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1674
         else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1675
            adjustedPosition.top = self.cache.mouse.y
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1676
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1677
         newCorner.y = 'top';
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1678
      }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1679
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1680
      // Tooltip overflows off the bottom of the screen
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1681
      else if(adjust.bottom)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1682
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1683
         if(self.options.position.target !== 'mouse')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1684
            adjustedPosition.top = target.position.top - tooltip.dimensions.height;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1685
         else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1686
            adjustedPosition.top = self.cache.mouse.y - tooltip.dimensions.height;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1687
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1688
         newCorner.y = 'bottom';
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1689
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1690
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1691
      // Don't adjust if resulting position is negative
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1692
      if(adjustedPosition.left < 0)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1693
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1694
         adjustedPosition.left = position.left;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1695
         newCorner.x = false;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1696
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1697
      if(adjustedPosition.top < 0)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1698
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1699
         adjustedPosition.top = position.top;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1700
         newCorner.y = false;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1701
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1702
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1703
      // Change tip corner if positioning has changed and tips are enabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1704
      if(self.options.style.tip.corner !== false)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1705
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1706
         // Determine new corner properties
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1707
         adjustedPosition.corner = new String(tooltip.corner);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1708
         if(newCorner.x !== false) adjustedPosition.corner = adjustedPosition.corner.replace(/Left|Right|Middle/, newCorner.x);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1709
         if(newCorner.y !== false) adjustedPosition.corner = adjustedPosition.corner.replace(/top|bottom/, newCorner.y);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1710
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1711
         // Adjust tip if position has changed and tips are enabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1712
         if(adjustedPosition.corner !== self.elements.tip.attr('rel'))
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1713
            createTip.call(self, adjustedPosition.corner);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1714
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1715
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1716
      return adjustedPosition;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1717
   };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1718
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1719
   // Build a jQuery style object from supplied style object
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1720
   function jQueryStyle(style, sub)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1721
   {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1722
      var styleObj, i;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1723
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1724
      styleObj = $.extend(true, {}, style);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1725
      for(i in styleObj)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1726
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1727
         if(sub === true && i.search(/(tip|classes)/i) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1728
            delete styleObj[i];
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1729
         else if(!sub && i.search(/(width|border|tip|title|classes|user)/i) !== -1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1730
            delete styleObj[i];
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1731
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1732
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1733
      return styleObj;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1734
   };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1735
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1736
   // Sanitize styles
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1737
   function sanitizeStyle(style)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1738
   {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1739
      if(typeof style.tip !== 'object') style.tip = { corner: style.tip };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1740
      if(typeof style.tip.size !== 'object') style.tip.size = { width: style.tip.size, height: style.tip.size };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1741
      if(typeof style.border !== 'object') style.border = { width: style.border };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1742
      if(typeof style.width !== 'object') style.width = { value: style.width };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1743
      if(typeof style.width.max == 'string') style.width.max = parseInt(style.width.max.replace(/([0-9]+)/i, "$1"));
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1744
      if(typeof style.width.min == 'string') style.width.min = parseInt(style.width.min.replace(/([0-9]+)/i, "$1"));
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1745
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1746
      // Convert deprecated x and y tip values to width/height
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1747
      if(typeof style.tip.size.x == 'number')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1748
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1749
         style.tip.size.width = style.tip.size.x;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1750
         delete style.tip.size.x;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1751
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1752
      if(typeof style.tip.size.y == 'number')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1753
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1754
         style.tip.size.height = style.tip.size.y;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1755
         delete style.tip.size.y;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1756
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1757
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1758
      return style;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1759
   };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1760
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1761
   // Build styles recursively with inheritance
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1762
   function buildStyle()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1763
   {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1764
      var self, i, styleArray, styleExtend, finalStyle, ieAdjust;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1765
      self = this;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1766
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1767
      // Build style options from supplied arguments
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1768
      styleArray = [true, {}];
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1769
      for(i = 0; i < arguments.length; i++)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1770
         styleArray.push(arguments[i]);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1771
      styleExtend = [ $.extend.apply($, styleArray) ];
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1772
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1773
      // Loop through each named style inheritance
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1774
      while(typeof styleExtend[0].name == 'string')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1775
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1776
         // Sanitize style data and append to extend array
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1777
         styleExtend.unshift( sanitizeStyle($.fn.qtip.styles[ styleExtend[0].name ]) );
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1778
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1779
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1780
      // Make sure resulting tooltip className represents final style
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1781
      styleExtend.unshift(true, {classes:{ tooltip: 'qtip-' + (arguments[0].name || 'defaults') }}, $.fn.qtip.styles.defaults);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1782
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1783
      // Extend into a single style object
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1784
      finalStyle = $.extend.apply($, styleExtend);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1785
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1786
      // Adjust tip size if needed (IE 1px adjustment bug fix)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1787
      ieAdjust = ($.browser.msie) ? 1 : 0;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1788
      finalStyle.tip.size.width += ieAdjust;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1789
      finalStyle.tip.size.height += ieAdjust;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1790
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1791
      // Force even numbers for pixel precision
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1792
      if(finalStyle.tip.size.width % 2 > 0) finalStyle.tip.size.width += 1;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1793
      if(finalStyle.tip.size.height % 2 > 0) finalStyle.tip.size.height += 1;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1794
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1795
      // Sanitize final styles tip corner value
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1796
      if(finalStyle.tip.corner === true)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1797
         finalStyle.tip.corner = (self.options.position.corner.tooltip === 'center') ? false : self.options.position.corner.tooltip;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1798
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1799
      return finalStyle;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1800
   };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1801
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1802
   // Tip coordinates calculator
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1803
   function calculateTip(corner, width, height)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1804
   {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1805
      // Define tip coordinates in terms of height and width values
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1806
      var tips = {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1807
         bottomRight:   [[0,0],              [width,height],      [width,0]],
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1808
         bottomLeft:    [[0,0],              [width,0],           [0,height]],
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1809
         topRight:      [[0,height],         [width,0],           [width,height]],
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1810
         topLeft:       [[0,0],              [0,height],          [width,height]],
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1811
         topMiddle:     [[0,height],         [width / 2,0],       [width,height]],
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1812
         bottomMiddle:  [[0,0],              [width,0],           [width / 2,height]],
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1813
         rightMiddle:   [[0,0],              [width,height / 2],  [0,height]],
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1814
         leftMiddle:    [[width,0],          [width,height],      [0,height / 2]]
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1815
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1816
      tips.leftTop = tips.bottomRight;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1817
      tips.rightTop = tips.bottomLeft;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1818
      tips.leftBottom = tips.topRight;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1819
      tips.rightBottom = tips.topLeft;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1820
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1821
      return tips[corner];
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1822
   };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1823
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1824
   // Border coordinates calculator
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1825
   function calculateBorders(radius)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1826
   {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1827
      var borders;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1828
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1829
      // Use canvas element if supported
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1830
      if($('<canvas>').get(0).getContext)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1831
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1832
         borders = {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1833
            topLeft: [radius,radius], topRight: [0,radius],
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1834
            bottomLeft: [radius,0], bottomRight: [0,0]
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1835
         };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1836
      }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1837
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1838
      // Canvas not supported - Use VML (IE)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1839
      else if($.browser.msie)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1840
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1841
         borders = {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1842
            topLeft: [-90,90,0], topRight: [-90,90,-radius],
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1843
            bottomLeft: [90,270,0], bottomRight: [90, 270,-radius]
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1844
         };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1845
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1846
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1847
      return borders;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1848
   };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1849
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1850
   // BGIFRAME JQUERY PLUGIN ADAPTION
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1851
   //   Special thanks to Brandon Aaron for this plugin
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1852
   //   http://plugins.jquery.com/project/bgiframe
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1853
   function bgiframe()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1854
   {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1855
      var self, html, dimensions;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1856
      self = this;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1857
      dimensions = self.getDimensions();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1858
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1859
      // Setup iframe HTML string
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1860
      html = '<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:false" '+
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1861
         'style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=\'0\'); border: 1px solid red; ' +
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1862
         'height:'+dimensions.height+'px; width:'+dimensions.width+'px" />';
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1863
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1864
      // Append the new HTML and setup element reference
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1865
      self.elements.bgiframe = self.elements.wrapper.prepend(html).children('.qtip-bgiframe:first');
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1866
   };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1867
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1868
   // Assign cache and event initialisation on document load
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1869
   $(document).ready(function()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1870
   {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1871
      // Setup library cache with window scroll and dimensions of document
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1872
      $.fn.qtip.cache = {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1873
         screen: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1874
            scroll: { left: $(window).scrollLeft(), top: $(window).scrollTop() },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1875
            width: $(window).width(),
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1876
            height: $(window).height()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1877
         }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1878
      };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1879
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1880
      // Adjust positions of the tooltips on window resize or scroll if enabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1881
      var adjustTimer;
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1882
      $(window).bind('resize scroll', function(event)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1883
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1884
         clearTimeout(adjustTimer);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1885
         adjustTimer = setTimeout(function()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1886
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1887
            // Readjust cached screen values
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1888
            if(event.type === 'scroll')
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1889
               $.fn.qtip.cache.screen.scroll = { left: $(window).scrollLeft(), top: $(window).scrollTop() };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1890
            else
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1891
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1892
               $.fn.qtip.cache.screen.width = $(window).width();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1893
               $.fn.qtip.cache.screen.height = $(window).height();
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1894
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1895
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1896
            for(i = 0; i < $.fn.qtip.interfaces.length; i++)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1897
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1898
               // Access current elements API
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1899
               var api = $.fn.qtip.interfaces[i];
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1900
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1901
               // Update position if resize or scroll adjustments are enabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1902
               if(api.status.rendered === true
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1903
               && (api.options.position.type !== 'static'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1904
               || api.options.position.adjust.scroll && event.type === 'scroll'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1905
               || api.options.position.adjust.resize && event.type === 'resize'))
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1906
               {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1907
                  // Queue the animation so positions are updated correctly
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1908
                  api.updatePosition(event, true);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1909
               }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1910
            };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1911
         }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1912
         , 100);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1913
      })
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1914
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1915
      // Hide unfocus toolipts on document mousedown
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1916
      $(document).bind('mousedown.qtip', function(event)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1917
      {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1918
         if($(event.target).parents('div.qtip').length === 0)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1919
         {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1920
            $('.qtip[unfocus]').each(function()
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1921
            {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1922
               var api = $(this).qtip("api");
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1923
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1924
               // Only hide if its visible and not the tooltips target
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1925
               if($(this).is(':visible') && !api.status.disabled
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1926
               && $(event.target).add(api.elements.target).length > 1)
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1927
                  api.hide(event);
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1928
            })
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1929
         };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1930
      })
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1931
   });
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1932
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1933
   // Define qTip API interfaces array
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1934
   $.fn.qtip.interfaces = []
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1935
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1936
   // Define log and constant place holders
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1937
   $.fn.qtip.log = { error: function(){ return this; } };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1938
   $.fn.qtip.constants = {};
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1939
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1940
   // Define configuration defaults
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1941
   $.fn.qtip.defaults = {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1942
      // Content
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1943
      content: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1944
         prerender: false,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1945
         text: false,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1946
         url: false,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1947
         data: null,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1948
         title: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1949
            text: false,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1950
            button: false
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1951
         }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1952
      },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1953
      // Position
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1954
      position: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1955
         target: false,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1956
         corner: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1957
            target: 'bottomRight',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1958
            tooltip: 'topLeft'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1959
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1960
         adjust: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1961
            x: 0, y: 0,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1962
            mouse: true,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1963
            screen: false,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1964
            scroll: true,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1965
            resize: true
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1966
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1967
         type: 'absolute',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1968
         container: false
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1969
      },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1970
      // Effects
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1971
      show: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1972
         when: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1973
            target: false,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1974
            event: 'mouseover'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1975
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1976
         effect: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1977
            type: 'fade',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1978
            length: 100
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1979
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1980
         delay: 140,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1981
         solo: false,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1982
         ready: false
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1983
      },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1984
      hide: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1985
         when: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1986
            target: false,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1987
            event: 'mouseout'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1988
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1989
         effect: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1990
            type: 'fade',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1991
            length: 100
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1992
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1993
         delay: 0,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1994
         fixed: false
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1995
      },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1996
      // Callbacks
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1997
      api: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1998
         beforeRender: function(){},
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  1999
         onRender: function(){},
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2000
         beforePositionUpdate: function(){},
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2001
         onPositionUpdate: function(){},
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2002
         beforeShow: function(){},
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2003
         onShow: function(){},
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2004
         beforeHide: function(){},
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2005
         onHide: function(){},
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2006
         beforeContentUpdate: function(){},
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2007
         onContentUpdate: function(){},
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2008
         beforeContentLoad: function(){},
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2009
         onContentLoad: function(){},
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2010
         beforeTitleUpdate: function(){},
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2011
         onTitleUpdate: function(){},
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2012
         beforeDestroy: function(){},
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2013
         onDestroy: function(){},
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2014
         beforeFocus: function(){},
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2015
         onFocus: function(){}
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2016
      }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2017
   };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2018
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2019
   $.fn.qtip.styles = {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2020
      defaults: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2021
         background: 'white',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2022
         color: '#111',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2023
         overflow: 'hidden',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2024
         textAlign: 'left',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2025
         width: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2026
            min: 0,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2027
            max: 250
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2028
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2029
         padding: '5px 9px',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2030
         border: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2031
            width: 1,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2032
            radius: 0,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2033
            color: '#d3d3d3'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2034
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2035
         tip: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2036
            corner: false,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2037
            color: false,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2038
            size: { width: 13, height: 13 },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2039
            opacity: 1
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2040
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2041
         title: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2042
            background: '#e1e1e1',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2043
            fontWeight: 'bold',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2044
            padding: '7px 12px'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2045
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2046
         button: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2047
            cursor: 'pointer'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2048
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2049
         classes: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2050
            target: '',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2051
            tip: 'qtip-tip',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2052
            title: 'qtip-title',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2053
            button: 'qtip-button',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2054
            content: 'qtip-content',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2055
            active: 'qtip-active'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2056
         }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2057
      },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2058
      cream: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2059
         border: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2060
            width: 3,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2061
            radius: 0,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2062
            color: '#F9E98E'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2063
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2064
         title: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2065
            background: '#F0DE7D',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2066
            color: '#A27D35'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2067
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2068
         background: '#FBF7AA',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2069
         color: '#A27D35',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2070
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2071
         classes: { tooltip: 'qtip-cream' }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2072
      },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2073
      light: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2074
         border: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2075
            width: 3,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2076
            radius: 0,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2077
            color: '#E2E2E2'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2078
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2079
         title: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2080
            background: '#f1f1f1',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2081
            color: '#454545'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2082
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2083
         background: 'white',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2084
         color: '#454545',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2085
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2086
         classes: { tooltip: 'qtip-light' }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2087
      },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2088
      dark: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2089
         border: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2090
            width: 3,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2091
            radius: 0,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2092
            color: '#303030'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2093
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2094
         title: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2095
            background: '#404040',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2096
            color: '#f3f3f3'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2097
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2098
         background: '#505050',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2099
         color: '#f3f3f3',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2100
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2101
         classes: { tooltip: 'qtip-dark' }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2102
      },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2103
      red: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2104
         border: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2105
            width: 3,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2106
            radius: 0,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2107
            color: '#CE6F6F'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2108
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2109
         title: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2110
            background: '#f28279',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2111
            color: '#9C2F2F'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2112
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2113
         background: '#F79992',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2114
         color: '#9C2F2F',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2115
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2116
         classes: { tooltip: 'qtip-red' }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2117
      },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2118
      green: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2119
         border: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2120
            width: 3,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2121
            radius: 0,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2122
            color: '#A9DB66'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2123
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2124
         title: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2125
            background: '#b9db8c',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2126
            color: '#58792E'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2127
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2128
         background: '#CDE6AC',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2129
         color: '#58792E',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2130
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2131
         classes: { tooltip: 'qtip-green' }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2132
      },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2133
      blue: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2134
         border: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2135
            width: 3,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2136
            radius: 0,
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2137
            color: '#ADD9ED'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2138
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2139
         title: {
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2140
            background: '#D0E9F5',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2141
            color: '#5E99BD'
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2142
         },
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2143
         background: '#E5F6FE',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2144
         color: '#4D9FBF',
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2145
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2146
         classes: { tooltip: 'qtip-blue' }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2147
      }
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2148
   };
769695d59add [web] Add source for jquery.qtip.js
Julien Cristau <julien.cristau@logilab.fr>
parents:
diff changeset
  2149
})(jQuery);