Index: trunk/extensions/SemanticMediaWiki/skins/SMW_tooltip.js |
— | — | @@ -8,7 +8,8 @@ |
9 | 9 | BubbleTT = new Object(); |
10 | 10 | BubbleTT.Platform= new Object(); |
11 | 11 | |
12 | | -var tt; //the tooltip |
| 12 | +var tt = null; //the tooltip |
| 13 | +var all_tt = []; //record all active tooltips |
13 | 14 | |
14 | 15 | var imagePath=wgScriptPath+"/extensions/SemanticMediaWiki/skins/images/"; |
15 | 16 | |
— | — | @@ -85,6 +86,7 @@ |
86 | 87 | while(!(origin.className=="smwttactivepersist")){origin=origin.parentNode}; |
87 | 88 | |
88 | 89 | tt = BubbleTT.createBubbleForPoint(true,origin,x,y,SMWTT_WIDTH_P,SMWTT_HEIGHT_P); |
| 90 | + all_tt.push(tt); |
89 | 91 | BubbleTT.fillBubble(tt, origin); |
90 | 92 | |
91 | 93 | //unregister handler to open bubble |
— | — | @@ -98,6 +100,9 @@ |
99 | 101 | |
100 | 102 | |
101 | 103 | function smw_showTooltipInline(e) { |
| 104 | + if (tt != null) { // show only one tooltip at a time |
| 105 | + return; |
| 106 | + } |
102 | 107 | var x; |
103 | 108 | var y; |
104 | 109 | if(BubbleTT.Platform.browser.isIE){ |
— | — | @@ -117,12 +122,24 @@ |
118 | 123 | BubbleTT.fillBubble(tt, origin); |
119 | 124 | } |
120 | 125 | |
121 | | - |
122 | 126 | function smw_hideTooltip(){ |
123 | | - if (tt) tt.close(); |
| 127 | + if (tt) { |
| 128 | + tt.close(); |
| 129 | + tt = null; |
| 130 | + } |
124 | 131 | } |
125 | 132 | |
126 | 133 | /** |
| 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 | +/** |
127 | 144 | * gets the coordinates of the element elmt |
128 | 145 | * used to place tooltips in IE as mouse coordinates |
129 | 146 | * behave strangely |