Show More
@@ -327,6 +327,7 b' var show_changeset_tooltip = function(){' | |||||
327 | var json = JSON.parse(o.responseText); |
|
327 | var json = JSON.parse(o.responseText); | |
328 | YUD.addClass(target,'tooltip') |
|
328 | YUD.addClass(target,'tooltip') | |
329 | YUD.setAttribute(target, 'title',json['message']); |
|
329 | YUD.setAttribute(target, 'title',json['message']); | |
|
330 | YAHOO.yuitip.main.set_listeners(target); | |||
330 | YAHOO.yuitip.main.show_yuitip(e, target); |
|
331 | YAHOO.yuitip.main.show_yuitip(e, target); | |
331 | } |
|
332 | } | |
332 | if(rid && !YUD.hasClass(target, 'tooltip')){ |
|
333 | if(rid && !YUD.hasClass(target, 'tooltip')){ | |
@@ -343,8 +344,6 b' var show_changeset_tooltip = function(){' | |||||
343 | YAHOO.namespace('yuitip'); |
|
344 | YAHOO.namespace('yuitip'); | |
344 | YAHOO.yuitip.main = { |
|
345 | YAHOO.yuitip.main = { | |
345 |
|
346 | |||
346 | YE: YAHOO.util.Event, |
|
|||
347 | Dom: YAHOO.util.Dom, |
|
|||
348 | $: YAHOO.util.Dom.get, |
|
347 | $: YAHOO.util.Dom.get, | |
349 |
|
348 | |||
350 | bgColor: '#000', |
|
349 | bgColor: '#000', | |
@@ -352,8 +351,15 b' YAHOO.yuitip.main = {' | |||||
352 | opacity: 0.9, |
|
351 | opacity: 0.9, | |
353 | offset: [15,15], |
|
352 | offset: [15,15], | |
354 | useAnim: false, |
|
353 | useAnim: false, | |
355 |
maxWidth: |
|
354 | maxWidth: 300, | |
356 | add_links: false, |
|
355 | add_links: false, | |
|
356 | yuitips: [], | |||
|
357 | ||||
|
358 | set_listeners: function(tt){ | |||
|
359 | YUE.on(tt, 'mouseover', yt.show_yuitip, tt); | |||
|
360 | YUE.on(tt, 'mousemove', yt.move_yuitip, tt); | |||
|
361 | YUE.on(tt, 'mouseout', yt.close_yuitip, tt); | |||
|
362 | }, | |||
357 |
|
363 | |||
358 | init: function(){ |
|
364 | init: function(){ | |
359 | yt._tooltip = ''; |
|
365 | yt._tooltip = ''; | |
@@ -364,13 +370,13 b' YAHOO.yuitip.main = {' | |||||
364 | yt.tipBox.id = 'tip-box'; |
|
370 | yt.tipBox.id = 'tip-box'; | |
365 | } |
|
371 | } | |
366 |
|
372 | |||
367 |
|
|
373 | YUD.setStyle(yt.tipBox, 'display', 'none'); | |
368 |
|
|
374 | YUD.setStyle(yt.tipBox, 'position', 'absolute'); | |
369 | if(yt.maxWidth !== null){ |
|
375 | if(yt.maxWidth !== null){ | |
370 |
|
|
376 | YUD.setStyle(yt.tipBox, 'max-width', yt.maxWidth+'px'); | |
371 | } |
|
377 | } | |
372 |
|
378 | |||
373 |
var yuitips = |
|
379 | var yuitips = YUD.getElementsByClassName('tooltip'); | |
374 |
|
380 | |||
375 | if(yt.add_links === true){ |
|
381 | if(yt.add_links === true){ | |
376 | var links = document.getElementsByTagName('a'); |
|
382 | var links = document.getElementsByTagName('a'); | |
@@ -383,37 +389,28 b' YAHOO.yuitip.main = {' | |||||
383 | var yuiLen = yuitips.length; |
|
389 | var yuiLen = yuitips.length; | |
384 |
|
390 | |||
385 | for(i=0;i<yuiLen;i++){ |
|
391 | for(i=0;i<yuiLen;i++){ | |
386 | yt.YE.on(yuitips[i], 'mouseover', yt.show_yuitip, yuitips[i]); |
|
392 | yt.set_listeners(yuitips[i]); | |
387 | yt.YE.on(yuitips[i], 'mousemove', yt.move_yuitip, yuitips[i]); |
|
|||
388 | yt.YE.on(yuitips[i], 'mouseout', yt.close_yuitip, yuitips[i]); |
|
|||
389 | } |
|
393 | } | |
390 | }, |
|
394 | }, | |
391 |
|
395 | |||
392 | show_yuitip: function(e, el){ |
|
396 | show_yuitip: function(e, el){ | |
393 |
|
|
397 | YUE.stopEvent(e); | |
394 | if(el.tagName.toLowerCase() === 'img'){ |
|
398 | if(el.tagName.toLowerCase() === 'img'){ | |
395 | yt.tipText = el.alt ? el.alt : ''; |
|
399 | yt.tipText = el.alt ? el.alt : ''; | |
396 | } else { |
|
400 | } else { | |
397 | yt.tipText = el.title ? el.title : ''; |
|
401 | yt.tipText = el.title ? el.title : ''; | |
398 | } |
|
402 | } | |
399 |
|
403 | |||
400 |
|
||||
401 | if(yt.tipText !== ''){ |
|
404 | if(yt.tipText !== ''){ | |
402 | // save org title |
|
405 | // save org title | |
403 | yt._tooltip = yt.tipText; |
|
406 | yt._tooltip = yt.tipText; | |
404 | // reset title to not show org tooltips |
|
407 | // reset title to not show org tooltips | |
405 | YUD.setAttribute(el, 'title', ''); |
|
408 | YUD.setAttribute(el, 'title', ''); | |
406 |
|
409 | |||
407 | var newTipText = yt.tipText.split(' - '); |
|
|||
408 | var tipLen = newTipText.length; |
|
|||
409 | yt.tipText = ''; |
|
|||
410 | for(var i=0;i<tipLen;i++){ |
|
|||
411 | yt.tipText+= newTipText[i]+"<br/>"; |
|
|||
412 | } |
|
|||
413 | yt.tipBox.innerHTML = yt.tipText; |
|
410 | yt.tipBox.innerHTML = yt.tipText; | |
414 |
|
|
411 | YUD.setStyle(yt.tipBox, 'display', 'block'); | |
415 | if(yt.useAnim === true){ |
|
412 | if(yt.useAnim === true){ | |
416 |
|
|
413 | YUD.setStyle(yt.tipBox, 'opacity', '0'); | |
417 | var newAnim = new YAHOO.util.Anim(yt.tipBox, |
|
414 | var newAnim = new YAHOO.util.Anim(yt.tipBox, | |
418 | { |
|
415 | { | |
419 | opacity: { to: yt.opacity } |
|
416 | opacity: { to: yt.opacity } | |
@@ -425,14 +422,14 b' YAHOO.yuitip.main = {' | |||||
425 | }, |
|
422 | }, | |
426 |
|
423 | |||
427 | move_yuitip: function(e, el){ |
|
424 | move_yuitip: function(e, el){ | |
428 |
|
|
425 | YUE.stopEvent(e); | |
429 |
var movePos = |
|
426 | var movePos = YUE.getXY(e); | |
430 |
|
|
427 | YUD.setStyle(yt.tipBox, 'top', (movePos[1] + yt.offset[1]) + 'px'); | |
431 |
|
|
428 | YUD.setStyle(yt.tipBox, 'left', (movePos[0] + yt.offset[0]) + 'px'); | |
432 | }, |
|
429 | }, | |
433 |
|
430 | |||
434 | close_yuitip: function(e, el){ |
|
431 | close_yuitip: function(e, el){ | |
435 |
|
|
432 | YUE.stopEvent(e); | |
436 |
|
433 | |||
437 | if(yt.useAnim === true){ |
|
434 | if(yt.useAnim === true){ | |
438 | var newAnim = new YAHOO.util.Anim(yt.tipBox, |
|
435 | var newAnim = new YAHOO.util.Anim(yt.tipBox, | |
@@ -442,7 +439,7 b' YAHOO.yuitip.main = {' | |||||
442 | ); |
|
439 | ); | |
443 | newAnim.animate(); |
|
440 | newAnim.animate(); | |
444 | } else { |
|
441 | } else { | |
445 |
|
|
442 | YUD.setStyle(yt.tipBox, 'display', 'none'); | |
446 | } |
|
443 | } | |
447 | YUD.setAttribute(el,'title', yt._tooltip); |
|
444 | YUD.setAttribute(el,'title', yt._tooltip); | |
448 | } |
|
445 | } |
General Comments 0
You need to be logged in to leave comments.
Login now