PageSourceSearch

http://www.tavsiyeediyorum.com/clientscript/tipso.js

js tavsiyeediyorum.com collected 2026-10-02 12:43:03 UTC 34,331 bytes, 1,008 lines download raw bytes

1
2/*! TAV HOVER TIPS JS start*/
3
4 // CommonJS, AMD or browser globals
5(function (factory) {
6    if (typeof define === 'function' && define.amd) {
7        // AMD. Register as an anonymous module.
8        define(['jquery'], factory);
9    } else if (typeof exports === 'object') {
10        // Node/CommonJS
11        module.exports = factory(require('jquery'));
12    } else {
13        // Browser globals
14        factory(jQuery);
15    }
16}(function($) {
17  var pluginName = "tipso",
18    defaults = {
19      speed             : 400,          //Animation speed
20      background        : '#55b555',
21      titleBackground   : '#333333',
22      color             : '#ffffff',
23      titleColor        : '#ffffff',
24      titleContent      : '',           //Content of the title bar
25      showArrow         : true,
26      position          : 'top',
27      width             : 200,
28      maxWidth          : '',
29      delay             : 200,
30      hideDelay         : 0,
31      animationIn       : '',
32      animationOut      : '',
33      offsetX           : 0,
34      offsetY           : 0,
35      arrowWidth        : 8,
36      tooltipHover      : false,
37      content           : null,
38      ajaxContentUrl    : null,
39      ajaxContentBuffer : 0,
40      contentElementId  : null,         //Normally used for picking template scripts
41      useTitle          : false,        //Use the title tag as tooptip or not
42      templateEngineFunc: null,         //A function that compiles and renders the content
43      onBeforeShow      : null,
44      onShow            : null,
45      onHide            : null
46    };
47
48  function Plugin(element, options) {
49    this.element = element;
50    this.$element = $(this.element);
51    this.doc = $(document);
52    this.win = $(window);
53    this.settings = $.extend({}, defaults, options);
54
55    /*
56     * Process and add data-attrs to settings as well for ease of use. Also, if
57     * data-tipso is an object then use it as extra settings and if it's not
58     * then use it as a title.
59     */
60    if (typeof(this.$element.data("tipso")) === "object")
61    {
62      $.extend(this.settings, this.$element.data("tipso"));
63    }
64
65    var data_keys = Object.keys(this.$element.data());
66    var data_attrs = {};
67    for (var i = 0; i < data_keys.length; i++)
68    {
69      var key = data_keys[i].replace(pluginName, "");
70      if (key === "")
71      {
72        continue;
73      }
74      //lowercase first letter
75      key = key.charAt(0).toLowerCase() + key.slice(1);
76      data_attrs[key] = this.$element.data(data_keys[i]);
77
78      //We cannot use extend for data_attrs because they are automatically
79      //lowercased. We need to do this manually and extend this.settings with
80      //data_attrs
81      for (var settings_key in this.settings)
82      {
83        if (settings_key.toLowerCase() == key)
84        {
85          this.settings[settings_key] = data_attrs[key];
86        }
87      }
88    }
89
90    this._defaults = defaults;
91    this._name = pluginName;
92    this._title = this.$element.attr('title');
93    this.mode = 'hide';
94    this.ieFade = !supportsTransitions;
95
96    //By keeping the original prefered position and repositioning by calling
97    //the reposition function we can make for more smart and easier positioning
98    //in complex scenarios!
99    this.settings.preferedPosition = this.settings.position;
100
101    this.init();
102  }
103
104  $.extend(Plugin.prototype, {
105    init: function() {
106      var obj = this,
107        $e = this.$element,
108        $doc = this.doc;
109      $e.addClass('tipso_style').removeAttr('title');
110
111      if (obj.settings.tooltipHover) {
112        var waitForHover = null,
113            hoverHelper = null;
114        $e.on('mouseover' + '.' + pluginName, function() {
115          clearTimeout(waitForHover);
116          clearTimeout(hoverHelper);
117          hoverHelper = setTimeout(function(){
118            obj.show();
119          }, 150);
120        });
121        $e.on('mouseout' + '.' + pluginName, function() {
122          clearTimeout(waitForHover);
123          clearTimeout(hoverHelper);
124          waitForHover = setTimeout(function(){
125            obj.hide();
126          }, 200);
127
128          obj.tooltip()
129            .on('mouseover' + '.' + pluginName, function() {
130              obj.mode = 'tooltipHover';
131            })
132            .on('mouseout' + '.' + pluginName, function() {
133              obj.mode = 'show';
134              clearTimeout(waitForHover);
135              waitForHover = setTimeout(function(){
136                obj.hide();
137              }, 200);
138            })
139        ;
140        });
141      } else {
142        $e.on('mouseover' + '.' + pluginName, function() {
143          obj.show();
144        });
145        $e.on('mouseout' + '.' + pluginName, function() {
146          obj.hide();
147        });
148      }
149	  if(obj.settings.ajaxContentUrl)
150	  {
151		obj.ajaxContent = null;
152	  }
153    },
154    tooltip: function() {
155      if (!this.tipso_bubble) {
156        this.tipso_bubble = $(
157          '<div class="tipso_bubble"><div class="tipso_title"></div><div class="tipso_content"></div><div class="tipso_arrow"></div></div>'
158        );
159      }
160      return this.tipso_bubble;
161    },
162    show: function() {
163      var tipso_bubble = this.tooltip(),
164        obj = this,
165        $win = this.win;
166
167      if (obj.settings.showArrow === false) {
168          tipso_bubble.find(".tipso_arrow").hide();
169      }
170      else {
171          tipso_bubble.find(".tipso_arrow").show();
172      }
173
174      if (obj.mode === 'hide') {
175        if ($.isFunction(obj.settings.onBeforeShow)) {
176          obj.settings.onBeforeShow(obj.$element, obj.element, obj);
177        }
178        if (obj.settings.size) {
179            tipso_bubble.addClass(obj.settings.size);
180        }
181        if (obj.settings.width) {
182          tipso_bubble.css({
183            background: obj.settings.background,
184            color: obj.settings.color,
185            width: obj.settings.width
186          }).hide();
187        } else if (obj.settings.maxWidth){
188          tipso_bubble.css({
189            background: obj.settings.background,
190            color: obj.settings.color,
191            maxWidth: obj.settings.maxWidth
192          }).hide();
193        } else {
194          tipso_bubble.css({
195            background: obj.settings.background,
196            color: obj.settings.color,
197            width: 200
198          }).hide();
199        }
200        tipso_bubble.find('.tipso_title').css({
201            background: obj.settings.titleBackground,
202            color: obj.settings.titleColor
203        });
204        tipso_bubble.find('.tipso_content').html(obj.content());
205        tipso_bubble.find('.tipso_title').html(obj.titleContent());
206        reposition(obj);
207
208        $win.on('resize' + '.' + pluginName, function tipsoResizeHandler () {
209            obj.settings.position = obj.settings.preferedPosition;
210            reposition(obj);
211        });
212
213        window.clearTimeout(obj.timeout);
214        obj.timeout = null;
215        obj.timeout = window.setTimeout(function() {
216          if (obj.ieFade || obj.settings.animationIn === '' || obj.settings.animationOut === ''){
217            tipso_bubble.appendTo('body').stop(true, true).fadeIn(obj.settings
218            .speed, function() {
219              obj.mode = 'show';
220              if ($.isFunction(obj.settings.onShow)) {
221                obj.settings.onShow(obj.$element, obj.element, obj);
222              }
223            });
224          } else {
225            tipso_bubble.remove().appendTo('body')
226            .stop(true, true)
227            .removeClass('animated ' + obj.settings.animationOut)
228            .addClass('noAnimation')
229            .removeClass('noAnimation')
230            .addClass('animated ' + obj.settings.animationIn).fadeIn(obj.settings.speed, function() {
231              $(this).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
232                $(this).removeClass('animated ' + obj.settings.animationIn);
233              });
234              obj.mode = 'show';
235              if ($.isFunction(obj.settings.onShow)) {
236                obj.settings.onShow(obj.$element, obj.element, obj);
237              }
238              $win.off('resize' + '.' + pluginName, null, 'tipsoResizeHandler');
239            });
240          }
241        }, obj.settings.delay);
242      }
243    },
244    hide: function(force) {
245      var obj = this,
246        $win = this.win,
247        tipso_bubble = this.tooltip(),
248        hideDelay = obj.settings.hideDelay;
249
250      if (force) {
251        hideDelay = 0;
252        obj.mode = 'show';
253      }
254
255      window.clearTimeout(obj.timeout);
256      obj.timeout = null;
257      obj.timeout = window.setTimeout(function() {
258        if (obj.mode !== 'tooltipHover') {
259          if (obj.ieFade || obj.settings.animationIn === '' || obj.settings.animationOut === ''){
260            tipso_bubble.stop(true, true).fadeOut(obj.settings.speed,
261            function() {
262              $(this).remove();
263              if ($.isFunction(obj.settings.onHide) && obj.mode === 'show') {
264                obj.settings.onHide(obj.$element, obj.element, obj);
265              }
266              obj.mode = 'hide';
267              $win.off('resize' + '.' + pluginName, null, 'tipsoResizeHandler');
268            });
269          } else {
270            tipso_bubble.stop(true, true)
271            .removeClass('animated ' + obj.settings.animationIn)
272            .addClass('noAnimation').removeClass('noAnimation')
273            .addClass('animated ' + obj.settings.animationOut)
274            .one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
275              $(this).removeClass('animated ' + obj.settings.animationOut).remove();
276              if ($.isFunction(obj.settings.onHide) && obj.mode === 'show') {
277                obj.settings.onHide(obj.$element, obj.element, obj);
278              }
279              obj.mode = 'hide';
280              $win.off('resize' + '.' + pluginName, null, 'tipsoResizeHandler');
281            });
282          }
283        }
284      }, hideDelay);
285    },
286    close: function() {
287      this.hide(true);
288    },
289    destroy: function() {
290      var $e = this.$element,
291        $win = this.win,
292        $doc = this.doc;
293      $e.off('.' + pluginName);
294      $win.off('resize' + '.' + pluginName, null, 'tipsoResizeHandler');
295      $e.removeData(pluginName);
296      $e.removeClass('tipso_style').attr('title', this._title);
297    },
298    titleContent: function() {
299        var content,
300          $e = this.$element,
301          obj = this;
302        if (obj.settings.titleContent)
303        {
304            content = obj.settings.titleContent;
305        }
306        else
307        {
308            content = $e.data('tipso-title');
309        }
310        return content;
311    },
312    content: function() {
313      var content,
314        $e = this.$element,
315        obj = this,
316        title = this._title;
317      if (obj.settings.ajaxContentUrl)
318      {
319		if(obj._ajaxContent)
320		{
321			content = obj._ajaxContent;
322		}
323		else 
324		{
325			obj._ajaxContent = content = $.ajax({
326			  type: "GET",
327			  url: obj.settings.ajaxContentUrl,
328			  async: false
329			}).responseText;
330			if(obj.settings.ajaxContentBuffer > 0)
331			{
332				setTimeout(function(){ 
333					obj._ajaxContent = null;
334				}, obj.settings.ajaxContentBuffer);
335			}
336			else 
337			{
338				obj._ajaxContent = null;
339			}
340		}
341      }
342      else if (obj.settings.contentElementId)
343      {
344        content = $("#" + obj.settings.contentElementId).text();
345      }
346      else if (obj.settings.content)
347      {
348        content = obj.settings.content;
349      }
350      else
351      {
352        if (obj.settings.useTitle === true)
353        {
354          content = title;
355        }
356        else
357        {
358          // Only use data-tipso as content if it's not being used for settings
359          if (typeof($e.data("tipso")) === "string")
360          {
361            content = $e.data('tipso');
362          }
363        }
364      }
365      if (obj.settings.templateEngineFunc !== null)
366      {
367          content = obj.settings.templateEngineFunc(content);
368      }
369      return content;
370    },
371    update: function(key, value) {
372      var obj = this;
373      if (value) {
374        obj.settings[key] = value;
375      } else {
376        return obj.settings[key];
377      }
378    }
379  });
380
381  function realHeight(obj) {
382    var clone = obj.clone();
383    clone.css("visibility", "hidden");
384    $('body').append(clone);
385    var height = clone.outerHeight();
386    var width = clone.outerWidth();
387    clone.remove();
388    return {
389      'width' : width,
390      'height' : height
391    };
392  }
393
394  var supportsTransitions = (function() {
395    var s = document.createElement('p').style,
396        v = ['ms','O','Moz','Webkit'];
397    if( s['transition'] === '' ) return true;
398    while( v.length )
399        if( v.pop() + 'Transition' in s )
400            return true;
401    return false;
402  })();
403
404  function removeCornerClasses(obj) {
405    obj.removeClass("top_right_corner bottom_right_corner top_left_corner bottom_left_corner");
406    obj.find(".tipso_title").removeClass("top_right_corner bottom_right_corner top_left_corner bottom_left_corner");
407  }
408
409  function reposition(thisthat) {
410    var tipso_bubble = thisthat.tooltip(),
411      $e = thisthat.$element,
412      obj = thisthat,
413      $win = $(window),
414      arrow = 10,
415      pos_top, pos_left, diff;
416
417    var arrow_color = obj.settings.background;
418    var title_content = obj.titleContent();
419    if (title_content !== undefined && title_content !== '') {
420        arrow_color = obj.settings.titleBackground;
421    }
422
423    if ($e.parent().outerWidth() > $win.outerWidth()) {
424      $win = $e.parent();
425    }
426
427    switch (obj.settings.position)
428    {
429      case 'top-right':
430        pos_left = $e.offset().left + ($e.outerWidth());
431        pos_top = $e.offset().top - realHeight(tipso_bubble).height - arrow;
432        tipso_bubble.find('.tipso_arrow').css({
433          marginLeft: -obj.settings.arrowWidth,
434          marginTop: '',
435        });
436        if (pos_top < $win.scrollTop())
437        {
438          pos_top = $e.offset().top + $e.outerHeight() + arrow;
439
440          tipso_bubble.find('.tipso_arrow').css({
441            'border-bottom-color': arrow_color,
442            'border-top-color': 'transparent',
443            'border-left-color': 'transparent',
444            'border-right-color': 'transparent'
445          });
446
447          /*
448           * Hide and show the appropriate rounded corners
449           */
450          removeCornerClasses(tipso_bubble);
451          tipso_bubble.addClass("bottom_right_corner");
452          tipso_bubble.find(".tipso_title").addClass("bottom_right_corner");
453          tipso_bubble.find('.tipso_arrow').css({
454            'border-left-color': arrow_color,
455          });
456
457          tipso_bubble.removeClass('top-right top bottom left right');
458          tipso_bubble.addClass('bottom');
459        }
460        else
461        {
462          tipso_bubble.find('.tipso_arrow').css({
463            'border-top-color': obj.settings.background,
464            'border-bottom-color': 'transparent ',
465            'border-left-color': 'transparent',
466            'border-right-color': 'transparent'
467          });
468
469          /*
470           * Hide and show the appropriate rounded corners
471           */
472          removeCornerClasses(tipso_bubble);
473          tipso_bubble.addClass("top_right_corner");
474          tipso_bubble.find('.tipso_arrow').css({
475            'border-left-color': obj.settings.background,
476          });
477
478          tipso_bubble.removeClass('top bottom left right');
479          tipso_bubble.addClass('top');
480        }
481        break;
482      case 'top-left':
483        pos_left = $e.offset().left - (realHeight(tipso_bubble).width);
484        pos_top = $e.offset().top - realHeight(tipso_bubble).height - arrow;
485        tipso_bubble.find('.tipso_arrow').css({
486          marginLeft: -obj.settings.arrowWidth,
487          marginTop: '',
488        });
489        if (pos_top < $win.scrollTop())
490        {
491          pos_top = $e.offset().top + $e.outerHeight() + arrow;
492
493          tipso_bubble.find('.tipso_arrow').css({
494            'border-bottom-color': arrow_color,
495            'border-top-color': 'transparent',
496            'border-left-color': 'transparent',
497            'border-right-color': 'transparent'
498          });
499
500          /*
501           * Hide and show the appropriate rounded corners
502           */
503          removeCornerClasses(tipso_bubble);
504          tipso_bubble.addClass("bottom_left_corner");
505          tipso_bubble.find(".tipso_title").addClass("bottom_left_corner");
506          tipso_bubble.find('.tipso_arrow').css({
507            'border-right-color': arrow_color,
508          });
509
510          tipso_bubble.removeClass('top-right top bottom left right');
511          tipso_bubble.addClass('bottom');
512        }
513        else
514        {
515          tipso_bubble.find('.tipso_arrow').css({
516            'border-top-color': obj.settings.background,
517            'border-bottom-color': 'transparent ',
518            'border-left-color': 'transparent',
519            'border-right-color': 'transparent'
520          });
521
522          /*
523           * Hide and show the appropriate rounded corners
524           */
525          removeCornerClasses(tipso_bubble);
526          tipso_bubble.addClass("top_left_corner");
527          tipso_bubble.find('.tipso_arrow').css({
528            'border-right-color': obj.settings.background,
529          });
530
531          tipso_bubble.removeClass('top bottom left right');
532          tipso_bubble.addClass('top');
533        }
534        break;
535
536      /*
537       * Bottom right position
538       */
539      case 'bottom-right':
540       pos_left = $e.offset().left + ($e.outerWidth());
541       pos_top = $e.offset().top + $e.outerHeight() + arrow;
542       tipso_bubble.find('.tipso_arrow').css({
543         marginLeft: -obj.settings.arrowWidth,
544         marginTop: '',
545       });
546       if (pos_top + realHeight(tipso_bubble).height > $win.scrollTop() + $win.outerHeight())
547       {
548         pos_top = $e.offset().top - realHeight(tipso_bubble).height - arrow;
549
550         tipso_bubble.find('.tipso_arrow').css({
551           'border-bottom-color': 'transparent',
552           'border-top-color': obj.settings.background,
553           'border-left-color': 'transparent',
554           'border-right-color': 'transparent'
555         });
556
557         /*
558          * Hide and show the appropriate rounded corners
559          */
560         removeCornerClasses(tipso_bubble);
561         tipso_bubble.addClass("top_right_corner");
562         tipso_bubble.find(".tipso_title").addClass("top_left_corner");
563         tipso_bubble.find('.tipso_arrow').css({
564           'border-left-color': obj.settings.background,
565         });
566
567         tipso_bubble.removeClass('top-right top bottom left right');
568         tipso_bubble.addClass('top');
569       }
570       else
571       {
572         tipso_bubble.find('.tipso_arrow').css({
573           'border-top-color': 'transparent',
574           'border-bottom-color': arrow_color,
575           'border-left-color': 'transparent',
576           'border-right-color': 'transparent'
577         });
578
579         /*
580          * Hide and show the appropriate rounded corners
581          */
582         removeCornerClasses(tipso_bubble);
583         tipso_bubble.addClass("bottom_right_corner");
584         tipso_bubble.find(".tipso_title").addClass("bottom_right_corner");
585         tipso_bubble.find('.tipso_arrow').css({
586           'border-left-color': arrow_color,
587         });
588
589         tipso_bubble.removeClass('top bottom left right');
590         tipso_bubble.addClass('bottom');
591       }
592       break;
593
594       /*
595        * Bottom left position
596        */
597       case 'bottom-left':
598        pos_left = $e.offset().left - (realHeight(tipso_bubble).width);
599        pos_top = $e.offset().top + $e.outerHeight() + arrow;
600        tipso_bubble.find('.tipso_arrow').css({
601          marginLeft: -obj.settings.arrowWidth,
602          marginTop: '',
603        });
604        if (pos_top + realHeight(tipso_bubble).height > $win.scrollTop() + $win.outerHeight())
605        {
606          pos_top = $e.offset().top - realHeight(tipso_bubble).height - arrow;
607
608          tipso_bubble.find('.tipso_arrow').css({
609            'border-bottom-color': 'transparent',
610            'border-top-color': obj.settings.background,
611            'border-left-color': 'transparent',
612            'border-right-color': 'transparent'
613          });
614
615          /*
616           * Hide and show the appropriate rounded corners
617           */
618          removeCornerClasses(tipso_bubble);
619          tipso_bubble.addClass("top_left_corner");
620          tipso_bubble.find(".tipso_title").addClass("top_left_corner");
621          tipso_bubble.find('.tipso_arrow').css({
622            'border-right-color': obj.settings.background,
623          });
624
625          tipso_bubble.removeClass('top-right top bottom left right');
626          tipso_bubble.addClass('top');
627        }
628        else
629        {
630          tipso_bubble.find('.tipso_arrow').css({
631            'border-top-color': 'transparent',
632            'border-bottom-color': arrow_color,
633            'border-left-color': 'transparent',
634            'border-right-color': 'transparent'
635          });
636
637          /*
638           * Hide and show the appropriate rounded corners
639           */
640          removeCornerClasses(tipso_bubble);
641          tipso_bubble.addClass("bottom_left_corner");
642          tipso_bubble.find(".tipso_title").addClass("bottom_left_corner");
643          tipso_bubble.find('.tipso_arrow').css({
644            'border-right-color': arrow_color,
645          });
646
647          tipso_bubble.removeClass('top bottom left right');
648          tipso_bubble.addClass('bottom');
649        }
650        break;
651      /*
652       * Top position
653       */
654      case 'top':
655        pos_left = $e.offset().left + ($e.outerWidth() / 2) - (realHeight(tipso_bubble).width / 2);
656        pos_top = $e.offset().top - realHeight(tipso_bubble).height - arrow;
657        tipso_bubble.find('.tipso_arrow').css({
658          marginLeft: -obj.settings.arrowWidth,
659          marginTop: '',
660        });
661        if (pos_top < $win.scrollTop())
662        {
663          pos_top = $e.offset().top + $e.outerHeight() + arrow;
664
665          tipso_bubble.find('.tipso_arrow').css({
666            'border-bottom-color': arrow_color,
667            'border-top-color': 'transparent',
668            'border-left-color': 'transparent',
669            'border-right-color': 'transparent'
670          });
671
672          tipso_bubble.removeClass('top bottom left right');
673          tipso_bubble.addClass('bottom');
674        }
675        else
676        {
677          tipso_bubble.find('.tipso_arrow').css({
678            'border-top-color': obj.settings.background,
679            'border-bottom-color': 'transparent',
680            'border-left-color': 'transparent',
681            'border-right-color': 'transparent'
682          });
683          tipso_bubble.removeClass('top bottom left right');
684          tipso_bubble.addClass('top');
685        }
686        break;
687      case 'bottom':
688        pos_left = $e.offset().left + ($e.outerWidth() / 2) - (realHeight(tipso_bubble).width / 2);
689        pos_top = $e.offset().top + $e.outerHeight() + arrow;
690        tipso_bubble.find('.tipso_arrow').css({
691          marginLeft: -obj.settings.arrowWidth,
692          marginTop: '',
693        });
694        if (pos_top + realHeight(tipso_bubble).height > $win.scrollTop() + $win.outerHeight())
695        {
696          pos_top = $e.offset().top - realHeight(tipso_bubble).height - arrow;
697          tipso_bubble.find('.tipso_arrow').css({
698            'border-top-color': obj.settings.background,
699            'border-bottom-color': 'transparent',
700            'border-left-color': 'transparent',
701            'border-right-color': 'transparent'
702          });
703          tipso_bubble.removeClass('top bottom left right');
704          tipso_bubble.addClass('top');
705        }
706        else
707        {
708          tipso_bubble.find('.tipso_arrow').css({
709            'border-bottom-color': arrow_color,
710            'border-top-color': 'transparent',
711            'border-left-color': 'transparent',
712            'border-right-color': 'transparent'
713          });
714          tipso_bubble.removeClass('top bottom left right');
715          tipso_bubble.addClass(obj.settings.position);
716        }
717        break;
718      case 'left':
719        pos_left = $e.offset().left - realHeight(tipso_bubble).width - arrow;
720        pos_top = $e.offset().top + ($e.outerHeight() / 2) - (realHeight(tipso_bubble).height / 2);
721        tipso_bubble.find('.tipso_arrow').css({
722          marginTop: -obj.settings.arrowWidth,
723          marginLeft: ''
724        });
725        if (pos_left < $win.scrollLeft())
726        {
727          pos_left = $e.offset().left + $e.outerWidth() + arrow;
728          tipso_bubble.find('.tipso_arrow').css({
729            'border-right-color': obj.settings.background,
730            'border-left-color': 'transparent',
731            'border-top-color': 'transparent',
732            'border-bottom-color': 'transparent'
733          });
734          tipso_bubble.removeClass('top bottom left right');
735          tipso_bubble.addClass('right');
736        }
737        else
738        {
739          tipso_bubble.find('.tipso_arrow').css({
740            'border-left-color': obj.settings.background,
741            'border-right-color': 'transparent',
742            'border-top-color': 'transparent',
743            'border-bottom-color': 'transparent'
744          });
745          tipso_bubble.removeClass('top bottom left right');
746          tipso_bubble.addClass(obj.settings.position);
747        }
748        break;
749      case 'right':
750        pos_left = $e.offset().left + $e.outerWidth() + arrow;
751        pos_top = $e.offset().top + ($e.outerHeight() / 2) - (realHeight(tipso_bubble).height / 2);
752        tipso_bubble.find('.tipso_arrow').css({
753          marginTop: -obj.settings.arrowWidth,
754          marginLeft: ''
755        });
756        if (pos_left + arrow + obj.settings.width > $win.scrollLeft() + $win.outerWidth())
757        {
758          pos_left = $e.offset().left - realHeight(tipso_bubble).width - arrow;
759          tipso_bubble.find('.tipso_arrow').css({
760            'border-left-color': obj.settings.background,
761            'border-right-color': 'transparent',
762            'border-top-color': 'transparent',
763            'border-bottom-color': 'transparent'
764          });
765          tipso_bubble.removeClass('top bottom left right');
766          tipso_bubble.addClass('left');
767        }
768        else
769        {
770          tipso_bubble.find('.tipso_arrow').css({
771            'border-right-color': obj.settings.background,
772            'border-left-color': 'transparent',
773            'border-top-color': 'transparent',
774            'border-bottom-color': 'transparent'
775          });
776          tipso_bubble.removeClass('top bottom left right');
777          tipso_bubble.addClass(obj.settings.position);
778        }
779        break;
780    }
781    /*
782     * Set the position of the arrow for the corner positions
783     */
784    if (obj.settings.position === 'top-right')
785    {
786      tipso_bubble.find('.tipso_arrow').css({
787        'margin-left': -obj.settings.width / 2
788      });
789    }
790    if (obj.settings.position === 'top-left')
791    {
792      var tipso_arrow = tipso_bubble.find(".tipso_arrow").eq(0);
793      tipso_arrow.css({
794        'margin-left': obj.settings.width / 2 - 2 * obj.settings.arrowWidth
795      });
796    }
797    if (obj.settings.position === 'bottom-right')
798    {
799      var tipso_arrow = tipso_bubble.find(".tipso_arrow").eq(0);
800      tipso_arrow.css({
801        'margin-left': -obj.settings.width / 2,
802        
802'margin-top': ''
803      });
804    }
805    if (obj.settings.position === 'bottom-left')
806    {
807      var tipso_arrow = tipso_bubble.find(".tipso_arrow").eq(0);
808      tipso_arrow.css({
809        'margin-left': obj.settings.width / 2 - 2 * obj.settings.arrowWidth,
810        'margin-top': ''
811      });
812    }
813
814    /*
815     * Check out of boundness
816     */
817    if (pos_left < $win.scrollLeft() && (obj.settings.position === 'bottom' || obj.settings.position === 'top'))
818    {
819      tipso_bubble.find('.tipso_arrow').css({
820        marginLeft: pos_left - obj.settings.arrowWidth
821      });
822      pos_left = 0;
823    }
824    if (pos_left + obj.settings.width > $win.outerWidth() && (obj.settings.position === 'bottom' || obj.settings.position === 'top'))
825    {
826      diff = $win.outerWidth() - (pos_left + obj.settings.width);
827      tipso_bubble.find('.tipso_arrow').css({
828        marginLeft: -diff - obj.settings.arrowWidth,
829        marginTop: ''
830      });
831      pos_left = pos_left + diff;
832    }
833    if (pos_left < $win.scrollLeft() &&
834       (obj.settings.position === 'left' ||
835        obj.settings.position === 'right' ||
836        obj.settings.position === 'top-right' ||
837        obj.settings.position === 'top-left' ||
838        obj.settings.position === 'bottom-right' ||
839        obj.settings.position === 'bottom-left'))
840    {
841      pos_left = $e.offset().left + ($e.outerWidth() / 2) - (realHeight(tipso_bubble).width / 2);
842      tipso_bubble.find('.tipso_arrow').css({
843        marginLeft: -obj.settings.arrowWidth,
844        marginTop: ''
845      });
846      pos_top = $e.offset().top - realHeight(tipso_bubble).height - arrow;
847      if (pos_top < $win.scrollTop())
848      {
849        pos_top = $e.offset().top + $e.outerHeight() + arrow;
850        tipso_bubble.find('.tipso_arrow').css({
851          'border-bottom-color': arrow_color,
852          'border-top-color': 'transparent',
853          'border-left-color': 'transparent',
854          'border-right-color': 'transparent'
855        });
856        tipso_bubble.removeClass('top bottom left right');
857        removeCornerClasses(tipso_bubble);
858        tipso_bubble.addClass('bottom');
859      }
860      else
861      {
862        tipso_bubble.find('.tipso_arrow').css({
863          'border-top-color': obj.settings.background,
864          'border-bottom-color': 'transparent',
865          'border-left-color': 'transparent',
866          'border-right-color': 'transparent'
867        });
868        tipso_bubble.removeClass('top bottom left right');
869        removeCornerClasses(tipso_bubble);
870        tipso_bubble.addClass('top');
871      }
872      if (pos_left + obj.settings.width > $win.outerWidth())
873      {
874        diff = $win.outerWidth() - (pos_left + obj.settings.width);
875        tipso_bubble.find('.tipso_arrow').css({
876          marginLeft: -diff - obj.settings.arrowWidth,
877          marginTop: ''
878        });
879        pos_left = pos_left + diff;
880      }
881      if (pos_left < $win.scrollLeft())
882      {
883        tipso_bubble.find('.tipso_arrow').css({
884          marginLeft: pos_left - obj.settings.arrowWidth
885        });
886        pos_left = 0;
887      }
888    }
889
890    /*
891     * If out of bounds from the right hand side
892     */
893    if (pos_left + obj.settings.width > $win.outerWidth() &&
894       (obj.settings.position === 'left' ||
895        obj.settings.position === 'right' ||
896        obj.settings.position === 'top-right' ||
897        obj.settings.position === 'top-left' ||
898        obj.settings.position === 'bottom-right' ||
899        obj.settings.position === 'bottom-right'))
900    {
901      pos_left = $e.offset().left + ($e.outerWidth() / 2) - (realHeight(tipso_bubble).width / 2);
902      tipso_bubble.find('.tipso_arrow').css({
903        marginLeft: -obj.settings.arrowWidth,
904        marginTop: ''
905      });
906      pos_top = $e.offset().top - realHeight(tipso_bubble).height - arrow;
907      if (pos_top < $win.scrollTop())
908      {
909        pos_top = $e.offset().top + $e.outerHeight() + arrow;
910        tipso_bubble.find('.tipso_arrow').css({
911          'border-bottom-color': arrow_color,
912          'border-top-color': 'transparent',
913          'border-left-color': 'transparent',
914          'border-right-color': 'transparent'
915        });
916
917        removeCornerClasses(tipso_bubble);
918        tipso_bubble.removeClass('top bottom left right');
919        tipso_bubble.addClass('bottom');
920      }
921      else
922      {
923        tipso_bubble.find('.tipso_arrow').css({
924          'border-top-color': obj.settings.background,
925          'border-bottom-color': 'transparent',
926          'border-left-color': 'transparent',
927          'border-right-color': 'transparent'
928        });
929
930        /*
931         * Hide and show the appropriate rounded corners
932         */
933        removeCornerClasses(tipso_bubble);
934        tipso_bubble.removeClass('top bottom left right');
935        tipso_bubble.addClass('top');
936      }
937      if (pos_left + obj.settings.width > $win.outerWidth())
938      {
939        diff = $win.outerWidth() - (pos_left + obj.settings.width);
940        tipso_bubble.find('.tipso_arrow').css({
941          marginLeft: -diff - obj.settings.arrowWidth,
942          marginTop: ''
943        });
944        pos_left = pos_left + diff;
945      }
946      if (pos_left < $win.scrollLeft())
947      {
948        tipso_bubble.find('.tipso_arrow').css({
949          marginLeft: pos_left - obj.settings.arrowWidth
950        });
951        pos_left = 0;
952      }
953    }
954    tipso_bubble.css({
955      left: pos_left + obj.settings.offsetX,
956      top: pos_top + obj.settings.offsetY
957    });
958
959    // If positioned right or left and tooltip is out of bounds change position
960    // This position change will be temporary, because preferedPosition is there
961    // to help!!
962    if (pos_top < $win.scrollTop() && (obj.settings.position === 'right' || obj.settings.position === 'left'))
963    {
964      $e.tipso('update', 'position', 'bottom');
965      reposition(obj);
966    }
967    if (pos_top + realHeight(tipso_bubble).height > $win.scrollTop() + $win.outerHeight() &&
968        (obj.settings.position === 'right' || obj.settings.position === 'left'))
969    {
970      $e.tipso('update', 'position', 'top');
971      reposition(obj);
972    }
973
974  }
975  $[pluginName] = $.fn[pluginName] = function(options) {
976    var args = arguments;
977    if (options === undefined || typeof options === 'object') {
978      if (!(this instanceof $)) {
979        $.extend(defaults, options);
980      }
981      return this.each(function() {
982        if (!$.data(this, 'plugin_' + pluginName)) {
983          $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
984        }
985      });
986    } else if (typeof options === 'string' && options[0] !== '_' && options !==
987      'init') {
988      var returns;
989      this.each(function() {
990        var instance = $.data(this, 'plugin_' + pluginName);
991        if (!instance) {
992          instance = $.data(this, 'plugin_' + pluginName, new Plugin(
993            this, options));
994        }
995        if (instance instanceof Plugin && typeof instance[options] ===
996          'function') {
997          returns = instance[options].apply(instance, Array.prototype.slice
998            .call(args, 1));
999        }
1000        if (options === 'destroy') {
1001          $.data(this, 'plugin_' + pluginName, null);
1002        }
1003      });
1004      return returns !== undefined ? returns : this;
1005    }
1006  };
1007}));
1008/*! TAV HOVER TIPS JS end*/

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.