r38134 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r38133‎ | r38134 | r38135 >
Date:15:38, 28 July 2008
Author:mkroetzsch
Status:old
Tags:
Comment:
incorporated function for closing all tooltips (useful for some extensions, e.g. Halo, but little code)
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/skins/SMW_tooltip.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/skins/SMW_tooltip.js
@@ -8,7 +8,8 @@
99 BubbleTT = new Object();
1010 BubbleTT.Platform= new Object();
1111
12 -var tt; //the tooltip
 12+var tt = null; //the tooltip
 13+var all_tt = []; //record all active tooltips
1314
1415 var imagePath=wgScriptPath+"/extensions/SemanticMediaWiki/skins/images/";
1516
@@ -85,6 +86,7 @@
8687 while(!(origin.className=="smwttactivepersist")){origin=origin.parentNode};
8788
8889 tt = BubbleTT.createBubbleForPoint(true,origin,x,y,SMWTT_WIDTH_P,SMWTT_HEIGHT_P);
 90+ all_tt.push(tt);
8991 BubbleTT.fillBubble(tt, origin);
9092
9193 //unregister handler to open bubble
@@ -98,6 +100,9 @@
99101
100102
101103 function smw_showTooltipInline(e) {
 104+ if (tt != null) { // show only one tooltip at a time
 105+ return;
 106+ }
102107 var x;
103108 var y;
104109 if(BubbleTT.Platform.browser.isIE){
@@ -117,12 +122,24 @@
118123 BubbleTT.fillBubble(tt, origin);
119124 }
120125
121 -
122126 function smw_hideTooltip(){
123 - if (tt) tt.close();
 127+ if (tt) {
 128+ tt.close();
 129+ tt = null;
 130+ }
124131 }
125132
126133 /**
 134+ * Provided for the convenience of SMW extensions, used, e.g., by Halo
 135+ */
 136+function _smw_hideAllTooltips() {
 137+ for(var i = 0; i < all_tt.length; i++) {
 138+ all_tt[i].close();
 139+ }
 140+ all_tt = [];
 141+}
 142+
 143+/**
127144 * gets the coordinates of the element elmt
128145 * used to place tooltips in IE as mouse coordinates
129146 * behave strangely

Status & tagging log