Show More
@@ -26,10 +26,10 b' TTIP.main = {' | |||
|
26 | 26 | offset: [15,15], |
|
27 | 27 | maxWidth: 600, |
|
28 | 28 | |
|
29 |
set |
|
|
30 |
$( |
|
|
31 |
$( |
|
|
32 |
$( |
|
|
29 | setDeferredListeners: function(){ | |
|
30 | $('body').on('mouseover', '.tooltip', yt.show_tip); | |
|
31 | $('body').on('mousemove', '.tooltip', yt.move_tip); | |
|
32 | $('body').on('mouseout', '.tooltip', yt.close_tip); | |
|
33 | 33 | }, |
|
34 | 34 | |
|
35 | 35 | init: function(){ |
@@ -43,19 +43,13 b' TTIP.main = {' | |||
|
43 | 43 | if(yt.maxWidth !== null){ |
|
44 | 44 | $(yt.tipBox).css('max-width', yt.maxWidth+'px'); |
|
45 | 45 | } |
|
46 | ||
|
47 | var tooltips = $('.tooltip'); | |
|
48 | var ttLen = tooltips.length; | |
|
49 | ||
|
50 | for(i=0;i<ttLen;i++){ | |
|
51 | yt.set_listeners(tooltips[i]); | |
|
52 | } | |
|
46 | yt.setDeferredListeners(); | |
|
53 | 47 | }, |
|
54 | 48 | |
|
55 | 49 | show_tip: function(e, el){ |
|
56 | 50 | e.stopPropagation(); |
|
57 | 51 | e.preventDefault(); |
|
58 | var el = e.data || el; | |
|
52 | var el = e.data || e.currentTarget || el; | |
|
59 | 53 | if(el.tagName.toLowerCase() === 'img'){ |
|
60 | 54 | yt.tipText = el.alt ? el.alt : ''; |
|
61 | 55 | } else { |
@@ -76,7 +70,7 b' TTIP.main = {' | |||
|
76 | 70 | move_tip: function(e, el){ |
|
77 | 71 | e.stopPropagation(); |
|
78 | 72 | e.preventDefault(); |
|
79 | var el = e.data || el; | |
|
73 | var el = e.data || e.currentTarget || el; | |
|
80 | 74 | var movePos = [e.pageX, e.pageY]; |
|
81 | 75 | $(yt.tipBox).css('top', (movePos[1] + yt.offset[1]) + 'px') |
|
82 | 76 | $(yt.tipBox).css('left', (movePos[0] + yt.offset[0]) + 'px') |
@@ -85,7 +79,7 b' TTIP.main = {' | |||
|
85 | 79 | close_tip: function(e, el){ |
|
86 | 80 | e.stopPropagation(); |
|
87 | 81 | e.preventDefault(); |
|
88 | var el = e.data || el; | |
|
82 | var el = e.data || e.currentTarget || el; | |
|
89 | 83 | $(yt.tipBox).hide(); |
|
90 | 84 | $(el).attr('title', $(el).attr('tt_title')); |
|
91 | 85 | $('#tip-box').hide(); |
@@ -97,30 +91,13 b' TTIP.main = {' | |||
|
97 | 91 | */ |
|
98 | 92 | var tooltip_activate = function(){ |
|
99 | 93 | yt = TTIP.main; |
|
100 | $(document).ready(yt.init); | |
|
94 | if ($(document).data('activated-tooltips') !== '1'){ | |
|
95 | $(document).ready(yt.init); | |
|
96 | $(document).data('activated-tooltips', '1'); | |
|
97 | } | |
|
101 | 98 | }; |
|
102 | 99 | |
|
103 | 100 | /** |
|
104 | 101 | * show changeset tooltip |
|
105 | 102 | */ |
|
106 | var show_changeset_tooltip = function(){ | |
|
107 | $('.lazy-cs').mouseover(function(e) { | |
|
108 | var target = e.currentTarget; | |
|
109 | var rid = $(target).attr('raw_id'); | |
|
110 | var repo_name = $(target).attr('repo_name'); | |
|
111 | var ttid = 'tt-'+rid; | |
|
112 | var success = function(o){ | |
|
113 | $(target).addClass('tooltip') | |
|
114 | $(target).attr('title', o['message']); | |
|
115 | TTIP.main.show_tip(e, target); | |
|
116 | } | |
|
117 | if(rid && !$(target).hasClass('tooltip')){ | |
|
118 | $(target).attr('id', ttid); | |
|
119 | $(target).attr('title', _gettext('loading ...')); | |
|
120 | TTIP.main.set_listeners(target); | |
|
121 | TTIP.main.show_tip(e, target); | |
|
122 | var url = pyroutes.url('changeset_info', {"repo_name":repo_name, "revision": rid}); | |
|
123 | ajaxGET(url, success); | |
|
124 | } | |
|
125 | }); | |
|
126 | }; | |
|
103 | var show_changeset_tooltip = function(){}; |
General Comments 0
You need to be logged in to leave comments.
Login now