Index: trunk/extensions/SemanticMediaWiki/skins/SMW_tooltip.js |
— | — | @@ -1,117 +1,480 @@ |
2 | | -var ns4, ie4, ie5, kon // to check which browser |
3 | | -var x,y |
4 | | -var toolTipElement = null // to save id of current toolTip |
5 | | -var px="px" // entity for position and size |
6 | 2 | |
7 | | -var offsetX = -156; // offset of tooltip to cursor |
8 | | -var offsetY = -15; |
9 | 3 | |
| 4 | +addOnloadHook(smw_tooltipInit); |
10 | 5 | |
11 | | -/* |
12 | | -// only to handle problems with Netscape 4 and Konqueror |
13 | | -*/ |
14 | | -function rebrowse() { |
15 | | - window.location.reload(); |
16 | | -} |
17 | 6 | |
18 | | -/* |
19 | | -// We have to check the current browser in order to |
20 | | -// pimp the javascript ... |
21 | | -*/ |
22 | | -function initToolTip() { |
23 | | - ns4 = (document.layers)? true : false; |
24 | | - ie4 = (document.all)? true : false; |
25 | | - ie5 = ((ie4) && ((navigator.userAgent.indexOf('MSIE 5')>0) || (navigator.userAgent.indexOf('MSIE 6')>0)))? true : false; |
26 | | - kon = (navigator.userAgent.indexOf('konqueror')>0)? true : false; |
27 | | - x = 0; |
28 | | - y = 0; |
29 | | - document.onmousemove = mousemove; |
30 | | - if (ns4 && document.captureEvents) document.captureEvents(Event.MOUSEMOVE); |
31 | | - if (ns4 || kon) setTimeout("window.onresize = rebrowse", 2000); |
32 | | - if (ns4) px=""; |
| 7 | +//these two objects needed due to the "hack" in timeline-api.js |
| 8 | +//see the comment there |
| 9 | +BubbleTT = new Object(); |
| 10 | +BubbleTT.Platform= new Object(); |
| 11 | + |
| 12 | +var tt; //the tooltip |
| 13 | + |
| 14 | +var imagePath=wgScriptPath+"/extensions/SemanticMediaWiki/skins/images/"; |
| 15 | + |
| 16 | +/*register events for the tooltips*/ |
| 17 | +function smw_tooltipInit() { |
| 18 | + var anchs = document.getElementsByTagName("span"); |
| 19 | + for (var i=0; i<anchs.length; i++) { |
| 20 | + if(anchs[i].className=="smwttpersist")smw_makePersistentTooltip(anchs[i]); |
| 21 | + if(anchs[i].className=="smwttinline")smw_makeInlineTooltip(anchs[i]); |
| 22 | + } |
33 | 23 | } |
34 | 24 | |
35 | | -/* |
36 | | -// Just hiding the tooltip |
37 | | -*/ |
38 | | -function hideToolTip() { |
39 | | - if (toolTipElement) toolTipElement.visibility = ns4? "hide" : "hidden"; |
40 | | - toolTipElement = null; |
| 25 | +function smw_makeInlineTooltip(a) { |
| 26 | + var spans = a.getElementsByTagName("span"); |
| 27 | + //make content invisible |
| 28 | + //done here and not in the css so that non-js clients can see it |
| 29 | + for (var i=0;i<spans.length;i++) { |
| 30 | + if(spans[i].className=="smwttcontent"){ |
| 31 | + spans[i].style.display="none"; |
| 32 | + } |
| 33 | + } |
| 34 | + a.onmouseover=smw_showTooltipInline; |
| 35 | + a.onmouseout=smw_hideTooltip; |
41 | 36 | } |
42 | 37 | |
43 | | -/* |
44 | | -// Here we are looking for the HTML element which represents the tooltip. |
45 | | -// We try to find this element by iterating all elements in the document. |
46 | | -// This function is that complicated, since there different browsers are |
47 | | -// implementing this functionality differently. |
48 | | -*/ |
49 | | -function getToolTip(id) { |
50 | | - if (document.layers && document.layers[id]) { |
51 | | - return document.layers[id]; |
| 38 | +function smw_makePersistentTooltip(a) { |
| 39 | + var spans = a.getElementsByTagName("span"); |
| 40 | + for (var i=0;i<spans.length;i++) { |
| 41 | + if(spans[i].className=="smwtticon"){ |
| 42 | + img=document.createElement("img"); |
| 43 | + img.setAttribute("src",imagePath+spans[i].innerHTML); |
| 44 | + a.replaceChild(img, a.firstChild); |
| 45 | + } |
| 46 | + //make content invisible |
| 47 | + //done here and not in the css so that non-js clients can see it |
| 48 | + if(spans[i].className=="smwttcontent"){ |
| 49 | + spans[i].style.display="none"; |
| 50 | + } |
52 | 51 | } |
53 | | - if (document.all && document.all[id] && document.all[id].style) { |
54 | | - return document.all[id].style; |
| 52 | + //register event with anchor |
| 53 | + if (Timeline.Platform.browser.isIE) { |
| 54 | + a.attachEvent("onclick", smw_showTooltipPersist); |
| 55 | + } else { |
| 56 | + a.addEventListener("click", smw_showTooltipPersist, false); |
55 | 57 | } |
56 | | - if (document[id]) { |
57 | | - return document[id]; |
| 58 | +} |
| 59 | + |
| 60 | +/*display tooltip*/ |
| 61 | +function smw_showTooltipPersist(e) { |
| 62 | + var x; |
| 63 | + var y; |
| 64 | + if(BubbleTT.Platform.browser.isIE){ |
| 65 | + c = BubbleTT.getElementCoordinates(window.event.srcElement); |
| 66 | + x = c.left; |
| 67 | + y = c.top; |
| 68 | + }else{ |
| 69 | + x = e.pageX; |
| 70 | + y = e.pageY; |
58 | 71 | } |
59 | | - if (document.getElementById(id)) { |
60 | | - return document.getElementById(id).style; |
| 72 | + var origin = (BubbleTT.Platform.browser.isIE) ? window.event.srcElement : e.target; |
| 73 | + //If the anchor of the tooltip contains hmtl, the source of the event is not the anchor. |
| 74 | + //As we need a reference to it to get the tooltip content we need to go up the dom-tree. |
| 75 | + while(!(origin.className=="smwttpersist")){origin=origin.parentNode}; |
| 76 | + |
| 77 | + tt = BubbleTT.createBubbleForPoint(true,origin,x,y,200,50); |
| 78 | + BubbleTT.fillBubble(tt, origin); |
| 79 | + |
| 80 | + //unregister handler to open bubble |
| 81 | + if (Timeline.Platform.browser.isIE) { |
| 82 | + origin.detachEvent("onclick", smw_showTooltipPersist); |
| 83 | + } else { |
| 84 | + origin.removeEventListener("click", smw_showTooltipPersist, false); |
61 | 85 | } |
62 | | - return 0; |
63 | 86 | } |
64 | 87 | |
65 | | -/* |
66 | | -// This function creates a tooltip. A div-Tag containing the given text |
67 | | -// is written to the document and set to invisble (byx css). |
68 | | -*/ |
69 | | -function createToolTip(id, text) { |
70 | | - document.write('<div id="' + id + '" name="' + id + '" class="smwtt">' + text + '</div>'); |
| 88 | + |
| 89 | + |
| 90 | +function smw_showTooltipInline(e) { |
| 91 | + var x; |
| 92 | + var y; |
| 93 | + if(BubbleTT.Platform.browser.isIE){ |
| 94 | + c = BubbleTT.getElementCoordinates(window.event.srcElement); |
| 95 | + x = c.left; |
| 96 | + y = c.top; |
| 97 | + }else{ |
| 98 | + x = e.pageX; |
| 99 | + y = e.pageY; |
| 100 | + } |
| 101 | + var origin = (BubbleTT.Platform.browser.isIE) ? window.event.srcElement : e.target; |
| 102 | + //If the anchor of the tooltip contains hmtl, the source of the event is not the anchor. |
| 103 | + //As we need a reference to it to get the tooltip content we need to go up the dom-tree. |
| 104 | + while(!(origin.className=="smwttinline"))origin=origin.parentNode; |
| 105 | + var doc = origin.ownerDocument; |
| 106 | + tt = BubbleTT.createBubbleForPoint(false,origin,x,y,150,50); |
| 107 | + BubbleTT.fillBubble(tt, origin); |
71 | 108 | } |
72 | 109 | |
73 | | -/* |
74 | | -// This function is called from HTML-attribute (e.g. onMouseOver). We try to |
75 | | -// get the current window size in order to not set a position which is out of |
76 | | -// the view range. (This possibility is not used at the moment!) |
77 | | -*/ |
78 | | -function showToolTip(id) { |
79 | | - if (toolTipElement) hideToolTip(id); |
80 | | - toolTipElement = getToolTip(id); |
81 | | - setPositionAndVisible(); |
| 110 | + |
| 111 | + |
| 112 | +function smw_hideTooltip(){ |
| 113 | + tt.close(); |
82 | 114 | } |
83 | 115 | |
84 | | -/* |
85 | | -// Just sets the position of the tooltip to current |
86 | | -// mouse position and makes the tooltip visile |
87 | | -*/ |
88 | | -function setPositionAndVisible() { |
89 | | - toolTipElement.left = x + offsetX + px; |
90 | | - toolTipElement.top = y + offsetY + px; |
91 | | - toolTipElement.visibility = ns4? "show" : "visible"; |
| 116 | +/** |
| 117 | + * gets the coordinates of the element elmt |
| 118 | + * used to place tooltips in IE as mouse coordinates |
| 119 | + * behave strangely |
| 120 | + */ |
| 121 | +BubbleTT.getElementCoordinates = function(elmt) { |
| 122 | + var left = 0; |
| 123 | + var top = 0; |
| 124 | + |
| 125 | + if (elmt.nodeType != 1) { |
| 126 | + elmt = elmt.parentNode; |
| 127 | + } |
| 128 | + |
| 129 | + while (elmt != null) { |
| 130 | + left += elmt.offsetLeft; |
| 131 | + top += elmt.offsetTop; |
| 132 | + elmt = elmt.offsetParent; |
| 133 | + } |
| 134 | + return { left: left, top: top }; |
| 135 | +}; |
| 136 | + |
| 137 | + |
| 138 | +/*================================================================== |
| 139 | + * code below from Simile-Timeline (util/graphics.js) modified |
| 140 | + *================================================================== |
| 141 | + */ |
| 142 | + |
| 143 | + |
| 144 | +BubbleTT._bubbleMargins = { |
| 145 | + top: 33, |
| 146 | + bottom: 42, |
| 147 | + left: 33, |
| 148 | + right: 40 |
92 | 149 | } |
93 | 150 | |
94 | | -/* |
95 | | -// In order to move the toolTip with the cursor, |
96 | | -// we have to get the mouse position on each "move" event |
97 | | -*/ |
98 | | -function mousemove(e) { |
99 | | - if (e) { |
100 | | - x = e.pageX? e.pageX : e.clientX? e.clientX : 0; |
101 | | - y = e.pageY? e.pageY : e.clientY? e.clientY : 0; |
| 151 | +/*pixels from boundary of the whole bubble div to the tip of the arrow*/ |
| 152 | +BubbleTT._arrowOffsets = { |
| 153 | + top: 0, |
| 154 | + bottom: 9, |
| 155 | + left: 1, |
| 156 | + right: 8 |
| 157 | +} |
| 158 | + |
| 159 | +BubbleTT._bubblePadding = 15; |
| 160 | +BubbleTT._bubblePointOffset = 15; |
| 161 | +BubbleTT._halfArrowWidth = 18; |
| 162 | + |
| 163 | + |
| 164 | + |
| 165 | +/*creates an empty bubble*/ |
| 166 | +BubbleTT.createBubbleForPoint = function(closingButton, origin, pageX, pageY, contentWidth, contentHeight) { |
| 167 | + var doc = origin.ownerDocument; |
| 168 | + var bubble = { |
| 169 | + _closed: false, |
| 170 | + _doc: doc, |
| 171 | + close: function() { |
| 172 | + if (!this._closed) { |
| 173 | + this._doc.body.removeChild(this._div); |
| 174 | + this._doc = null; |
| 175 | + this._div = null; |
| 176 | + this._content = null; |
| 177 | + this._closed = true; |
| 178 | + if(closingButton){//for persistent bubble: re-attach handler to open bubble again |
| 179 | + if (Timeline.Platform.browser.isIE) { |
| 180 | + origin.attachEvent("onclick", smw_showTooltipPersist); |
| 181 | + } else { |
| 182 | + origin.addEventListener("click", smw_showTooltipPersist, false); |
| 183 | + } |
| 184 | + } |
| 185 | + } |
| 186 | + } |
| 187 | + }; |
| 188 | + |
| 189 | + var docWidth = doc.body.offsetWidth; |
| 190 | + var docHeight = doc.body.offsetHeight; |
| 191 | + |
| 192 | + var margins = BubbleTT._bubbleMargins; |
| 193 | + var bubbleWidth = margins.left + contentWidth + margins.right; |
| 194 | + var bubbleHeight = margins.top + contentHeight + margins.bottom; |
| 195 | + |
| 196 | + var pngIsTranslucent = (!BubbleTT.Platform.browser.isIE) || (BubbleTT.Platform.browser.majorVersion > 6); |
| 197 | + |
| 198 | + var setImg = function(elmt, url, width, height) { |
| 199 | + elmt.style.position = "absolute"; |
| 200 | + elmt.style.width = width + "px"; |
| 201 | + elmt.style.height = height + "px"; |
| 202 | + if (pngIsTranslucent) { |
| 203 | + elmt.style.background = "url(" + url + ")"; |
| 204 | + } else { |
| 205 | + elmt.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + url +"', sizingMethod='crop')"; |
| 206 | + } |
102 | 207 | } |
103 | | - else if (event) { |
104 | | - x = event.clientX; |
105 | | - y = event.clientY; |
| 208 | + var div = doc.createElement("div"); |
| 209 | + div.style.width = bubbleWidth + "px"; |
| 210 | + div.style.height = bubbleHeight + "px"; |
| 211 | + div.style.position = "absolute"; |
| 212 | + div.style.zIndex = 1000; |
| 213 | + bubble._div = div; |
| 214 | + |
| 215 | + var divInner = doc.createElement("div"); |
| 216 | + divInner.style.width = "100%"; |
| 217 | + divInner.style.height = "100%"; |
| 218 | + divInner.style.position = "relative"; |
| 219 | + div.appendChild(divInner); |
| 220 | + |
| 221 | + var createImg = function(url, left, top, width, height) { |
| 222 | + var divImg = doc.createElement("div"); |
| 223 | + divImg.style.left = left + "px"; |
| 224 | + divImg.style.top = top + "px"; |
| 225 | + setImg(divImg, url, width, height); |
| 226 | + divInner.appendChild(divImg); |
106 | 227 | } |
107 | | - else { |
108 | | - x = 0; |
109 | | - y = 0; |
| 228 | + |
| 229 | + createImg(imagePath + "bubble-top-left.png", 0, 0, margins.left, margins.top); |
| 230 | + createImg(imagePath + "bubble-top.png", margins.left, 0, contentWidth, margins.top); |
| 231 | + createImg(imagePath + "bubble-top-right.png", margins.left + contentWidth, 0, margins.right, margins.top); |
| 232 | + |
| 233 | + createImg(imagePath + "bubble-left.png", 0, margins.top, margins.left, contentHeight); |
| 234 | + createImg(imagePath + "bubble-right.png", margins.left + contentWidth, margins.top, margins.right, contentHeight); |
| 235 | + |
| 236 | + createImg(imagePath + "bubble-bottom-left.png", 0, margins.top + contentHeight, margins.left, margins.bottom); |
| 237 | + createImg(imagePath + "bubble-bottom.png", margins.left, margins.top + contentHeight, contentWidth, margins.bottom); |
| 238 | + createImg(imagePath + "bubble-bottom-right.png", margins.left + contentWidth, margins.top + contentHeight, margins.right, margins.bottom); |
| 239 | + |
| 240 | + //closing button |
| 241 | + if(closingButton){ |
| 242 | + var divClose = doc.createElement("div"); |
| 243 | + divClose.style.left = (bubbleWidth - margins.right + BubbleTT._bubblePadding - 16 - 2) + "px"; |
| 244 | + divClose.style.top = (margins.top - BubbleTT._bubblePadding + 1) + "px"; |
| 245 | + divClose.style.cursor = "pointer"; |
| 246 | + setImg(divClose, imagePath + "close-button.png", 16, 16); |
| 247 | + BubbleTT.DOM.registerEventWithObject(divClose, "click", bubble, bubble.close); |
| 248 | + divInner.appendChild(divClose); |
110 | 249 | } |
111 | | - if ((ie4||ie5) && document.documentElement) { |
112 | | - x += document.documentElement.scrollLeft; |
113 | | - y += document.documentElement.scrollTop; |
| 250 | + |
| 251 | + var divContent = doc.createElement("div"); |
| 252 | + divContent.style.position = "absolute"; |
| 253 | + divContent.style.left = margins.left + "px"; |
| 254 | + divContent.style.top = margins.top + "px"; |
| 255 | + divContent.style.width = contentWidth + "px"; |
| 256 | + divContent.style.height = contentHeight + "px"; |
| 257 | + divContent.style.overflow = "auto"; |
| 258 | + divContent.style.background = "white"; |
| 259 | + divInner.appendChild(divContent); |
| 260 | + bubble.content = divContent; |
| 261 | + |
| 262 | + (function() { |
| 263 | + if (pageX - BubbleTT._halfArrowWidth - BubbleTT._bubblePadding > 0 && |
| 264 | + pageX + BubbleTT._halfArrowWidth + BubbleTT._bubblePadding < docWidth) { |
| 265 | + |
| 266 | + var left = pageX - Math.round(contentWidth / 2) - margins.left; |
| 267 | + left = pageX < (docWidth / 2) ? |
| 268 | + Math.max(left, -(margins.left - BubbleTT._bubblePadding)) : |
| 269 | + Math.min(left, docWidth + (margins.right - BubbleTT._bubblePadding) - bubbleWidth); |
| 270 | + |
| 271 | + if (pageY - BubbleTT._bubblePointOffset - bubbleHeight > 0) { // top |
| 272 | + var divImg = doc.createElement("div"); |
| 273 | + |
| 274 | + divImg.style.left = (pageX - BubbleTT._halfArrowWidth - left) + "px"; |
| 275 | + divImg.style.top = (margins.top + contentHeight) + "px"; |
| 276 | + setImg(divImg, imagePath + "bubble-bottom-arrow.png", 37, margins.bottom); |
| 277 | + divInner.appendChild(divImg); |
| 278 | + |
| 279 | + div.style.left = left + "px"; |
| 280 | + div.style.top = (pageY - BubbleTT._bubblePointOffset - bubbleHeight + |
| 281 | + BubbleTT._arrowOffsets.bottom) + "px"; |
| 282 | + |
| 283 | + return; |
| 284 | + } else if (pageY + BubbleTT._bubblePointOffset + bubbleHeight < docHeight) { // bottom |
| 285 | + var divImg = doc.createElement("div"); |
| 286 | + |
| 287 | + divImg.style.left = (pageX - BubbleTT._halfArrowWidth - left) + "px"; |
| 288 | + divImg.style.top = "0px"; |
| 289 | + setImg(divImg, imagePath + "bubble-top-arrow.png", 37, margins.top); |
| 290 | + divInner.appendChild(divImg); |
| 291 | + |
| 292 | + div.style.left = left + "px"; |
| 293 | + div.style.top = (pageY + BubbleTT._bubblePointOffset - |
| 294 | + BubbleTT._arrowOffsets.top) + "px"; |
| 295 | + |
| 296 | + return; |
| 297 | + } |
| 298 | + } |
| 299 | + |
| 300 | + var top = pageY - Math.round(contentHeight / 2) - margins.top; |
| 301 | + top = pageY < (docHeight / 2) ? |
| 302 | + Math.max(top, -(margins.top - BubbleTT._bubblePadding)) : |
| 303 | + Math.min(top, docHeight + (margins.bottom - BubbleTT._bubblePadding) - bubbleHeight); |
| 304 | + |
| 305 | + if (pageX - BubbleTT._bubblePointOffset - bubbleWidth > 0) { // left |
| 306 | + var divImg = doc.createElement("div"); |
| 307 | + |
| 308 | + divImg.style.left = (margins.left + contentWidth) + "px"; |
| 309 | + divImg.style.top = (pageY - BubbleTT._halfArrowWidth - top) + "px"; |
| 310 | + setImg(divImg, imagePath + "bubble-right-arrow.png", margins.right, 37); |
| 311 | + divInner.appendChild(divImg); |
| 312 | + |
| 313 | + div.style.left = (pageX - BubbleTT._bubblePointOffset - bubbleWidth + |
| 314 | + BubbleTT._arrowOffsets.right) + "px"; |
| 315 | + div.style.top = top + "px"; |
| 316 | + } else { // right |
| 317 | + var divImg = doc.createElement("div"); |
| 318 | + |
| 319 | + divImg.style.left = "0px"; |
| 320 | + divImg.style.top = (pageY - BubbleTT._halfArrowWidth - top) + "px"; |
| 321 | + setImg(divImg, imagePath + "bubble-left-arrow.png", margins.left, 37); |
| 322 | + divInner.appendChild(divImg); |
| 323 | + |
| 324 | + div.style.left = (pageX + BubbleTT._bubblePointOffset - |
| 325 | + BubbleTT._arrowOffsets.left) + "px"; |
| 326 | + div.style.top = top + "px"; |
| 327 | + } |
| 328 | + })(); |
| 329 | + |
| 330 | + doc.body.appendChild(div); |
| 331 | + return bubble; |
| 332 | +}; |
| 333 | + |
| 334 | + |
| 335 | + |
| 336 | +/*fill bubble with html content*/ |
| 337 | +BubbleTT.fillBubble = function(bubble,origin){ |
| 338 | + doc=bubble._doc; |
| 339 | + div = doc.createElement("div"); |
| 340 | + div.className = "smwtt"; |
| 341 | + //get tooltip content |
| 342 | + spans=origin.getElementsByTagName("span"); |
| 343 | + for (i=0; i<spans.length; i++){ |
| 344 | + if(spans[i].className=="smwttcontent") div.innerHTML=spans[i].innerHTML; |
114 | 345 | } |
115 | | - if (toolTipElement) setPositionAndVisible(); |
| 346 | + bubble.content.appendChild(div); |
116 | 347 | } |
117 | 348 | |
118 | | -window.onload = initToolTip; |
| 349 | + |
| 350 | +/*================================================================== |
| 351 | + * all below from Simile-Timeline (util/platform.js) with classname |
| 352 | + * Timeline replaced by BubbleTT to avoid complications with both |
| 353 | + * scripts running on the same page |
| 354 | + *================================================================== |
| 355 | + */ |
| 356 | + |
| 357 | + |
| 358 | +BubbleTT.Platform.os = { |
| 359 | + isMac: false, |
| 360 | + isWin: false, |
| 361 | + isWin32: false, |
| 362 | + isUnix: false |
| 363 | +}; |
| 364 | +BubbleTT.Platform.browser = { |
| 365 | + isIE: false, |
| 366 | + isNetscape: false, |
| 367 | + isMozilla: false, |
| 368 | + isFirefox: false, |
| 369 | + isOpera: false, |
| 370 | + isSafari: false, |
| 371 | + |
| 372 | + majorVersion: 0, |
| 373 | + minorVersion: 0 |
| 374 | +}; |
| 375 | + |
| 376 | +(function() { |
| 377 | + var an = navigator.appName.toLowerCase(); |
| 378 | + var ua = navigator.userAgent.toLowerCase(); |
| 379 | + |
| 380 | + /* |
| 381 | + * Operating system |
| 382 | + */ |
| 383 | + BubbleTT.Platform.os.isMac = (ua.indexOf('mac') != -1); |
| 384 | + BubbleTT.Platform.os.isWin = (ua.indexOf('win') != -1); |
| 385 | + BubbleTT.Platform.os.isWin32 = BubbleTT.Platform.isWin && ( |
| 386 | + ua.indexOf('95') != -1 || |
| 387 | + ua.indexOf('98') != -1 || |
| 388 | + ua.indexOf('nt') != -1 || |
| 389 | + ua.indexOf('win32') != -1 || |
| 390 | + ua.indexOf('32bit') != -1 |
| 391 | + ); |
| 392 | + BubbleTT.Platform.os.isUnix = (ua.indexOf('x11') != -1); |
| 393 | + |
| 394 | + /* |
| 395 | + * Browser |
| 396 | + */ |
| 397 | + BubbleTT.Platform.browser.isIE = (an.indexOf("microsoft") != -1); |
| 398 | + BubbleTT.Platform.browser.isNetscape = (an.indexOf("netscape") != -1); |
| 399 | + BubbleTT.Platform.browser.isMozilla = (ua.indexOf("mozilla") != -1); |
| 400 | + BubbleTT.Platform.browser.isFirefox = (ua.indexOf("firefox") != -1); |
| 401 | + BubbleTT.Platform.browser.isOpera = (an.indexOf("opera") != -1); |
| 402 | + //BubbleTT.Platform.browser.isSafari = (an.indexOf("safari") != -1); |
| 403 | + |
| 404 | + var parseVersionString = function(s) { |
| 405 | + var a = s.split("."); |
| 406 | + BubbleTT.Platform.browser.majorVersion = parseInt(a[0]); |
| 407 | + BubbleTT.Platform.browser.minorVersion = parseInt(a[1]); |
| 408 | + }; |
| 409 | + var indexOf = function(s, sub, start) { |
| 410 | + var i = s.indexOf(sub, start); |
| 411 | + return i >= 0 ? i : s.length; |
| 412 | + }; |
| 413 | + |
| 414 | + if (BubbleTT.Platform.browser.isMozilla) { |
| 415 | + var offset = ua.indexOf("mozilla/"); |
| 416 | + if (offset >= 0) { |
| 417 | + parseVersionString(ua.substring(offset + 8, indexOf(ua, " ", offset))); |
| 418 | + } |
| 419 | + } |
| 420 | + if (BubbleTT.Platform.browser.isIE) { |
| 421 | + var offset = ua.indexOf("msie "); |
| 422 | + if (offset >= 0) { |
| 423 | + parseVersionString(ua.substring(offset + 5, indexOf(ua, ";", offset))); |
| 424 | + } |
| 425 | + } |
| 426 | + if (BubbleTT.Platform.browser.isNetscape) { |
| 427 | + var offset = ua.indexOf("rv:"); |
| 428 | + if (offset >= 0) { |
| 429 | + parseVersionString(ua.substring(offset + 3, indexOf(ua, ")", offset))); |
| 430 | + } |
| 431 | + } |
| 432 | + if (BubbleTT.Platform.browser.isFirefox) { |
| 433 | + var offset = ua.indexOf("firefox/"); |
| 434 | + if (offset >= 0) { |
| 435 | + parseVersionString(ua.substring(offset + 8, indexOf(ua, " ", offset))); |
| 436 | + } |
| 437 | + } |
| 438 | +})(); |
| 439 | + |
| 440 | +BubbleTT.Platform.getDefaultLocale = function() { |
| 441 | + return BubbleTT.Platform.clientLocale; |
| 442 | +}; |
| 443 | + |
| 444 | +/*================================================== |
| 445 | + * DOM Utility Functions |
| 446 | + * all below from Simile-Timeline (util/dom.js) with classname |
| 447 | + * Timeline replaced by BubbleTT to avoid complications with both |
| 448 | + * scripts running on the same page |
| 449 | + *================================================== |
| 450 | + */ |
| 451 | + |
| 452 | +BubbleTT.DOM = new Object(); |
| 453 | + |
| 454 | +BubbleTT.DOM.registerEventWithObject = function(elmt, eventName, obj, handler) { |
| 455 | + BubbleTT.DOM.registerEvent(elmt, eventName, function(elmt2, evt, target) { |
| 456 | + return handler.call(obj, elmt2, evt, target); |
| 457 | + }); |
| 458 | +}; |
| 459 | + |
| 460 | +BubbleTT.DOM.registerEvent = function(elmt, eventName, handler) { |
| 461 | + var handler2 = function(evt) { |
| 462 | + evt = (evt) ? evt : ((event) ? event : null); |
| 463 | + if (evt) { |
| 464 | + var target = (evt.target) ? |
| 465 | + evt.target : ((evt.srcElement) ? evt.srcElement : null); |
| 466 | + if (target) { |
| 467 | + target = (target.nodeType == 1 || target.nodeType == 9) ? |
| 468 | + target : target.parentNode; |
| 469 | + } |
| 470 | + |
| 471 | + return handler(elmt, evt, target); |
| 472 | + } |
| 473 | + return true; |
| 474 | + } |
| 475 | + |
| 476 | + if (BubbleTT.Platform.browser.isIE) { |
| 477 | + elmt.attachEvent("on" + eventName, handler2); |
| 478 | + } else { |
| 479 | + elmt.addEventListener(eventName, handler2, false); |
| 480 | + } |
| 481 | +}; |
Index: trunk/extensions/SemanticMediaWiki/skins/images/dull-red-circle.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/dull-red-circle.png |
___________________________________________________________________ |
Added: svn:mime-type |
119 | 482 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/copyright.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/copyright.png |
___________________________________________________________________ |
Added: svn:mime-type |
120 | 483 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/close-button.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/close-button.png |
___________________________________________________________________ |
Added: svn:mime-type |
121 | 484 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/message-bottom-left.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/message-bottom-left.png |
___________________________________________________________________ |
Added: svn:mime-type |
122 | 485 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/copyright-vertical.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/copyright-vertical.png |
___________________________________________________________________ |
Added: svn:mime-type |
123 | 486 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/bubble-left.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/bubble-left.png |
___________________________________________________________________ |
Added: svn:mime-type |
124 | 487 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/bubble-top-left.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/bubble-top-left.png |
___________________________________________________________________ |
Added: svn:mime-type |
125 | 488 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/bubble-bottom-left.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/bubble-bottom-left.png |
___________________________________________________________________ |
Added: svn:mime-type |
126 | 489 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/blue-circle.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/blue-circle.png |
___________________________________________________________________ |
Added: svn:mime-type |
127 | 490 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/dark-red-circle.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/dark-red-circle.png |
___________________________________________________________________ |
Added: svn:mime-type |
128 | 491 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/bubble-top.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/bubble-top.png |
___________________________________________________________________ |
Added: svn:mime-type |
129 | 492 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/top-bubble.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/top-bubble.png |
___________________________________________________________________ |
Added: svn:mime-type |
130 | 493 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/dull-green-circle.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/dull-green-circle.png |
___________________________________________________________________ |
Added: svn:mime-type |
131 | 494 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/bubble-bottom.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/bubble-bottom.png |
___________________________________________________________________ |
Added: svn:mime-type |
132 | 495 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/message-top-right.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/message-top-right.png |
___________________________________________________________________ |
Added: svn:mime-type |
133 | 496 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/message-right.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/message-right.png |
___________________________________________________________________ |
Added: svn:mime-type |
134 | 497 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/gray-circle.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/gray-circle.png |
___________________________________________________________________ |
Added: svn:mime-type |
135 | 498 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/progress-running.gif |
Cannot display: file marked as a binary type. |
svn:mime-type = image/gif |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/progress-running.gif |
___________________________________________________________________ |
Added: svn:mime-type |
136 | 499 | + image/gif |
Index: trunk/extensions/SemanticMediaWiki/skins/images/dark-blue-circle.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/dark-blue-circle.png |
___________________________________________________________________ |
Added: svn:mime-type |
137 | 500 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/bubble-right.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/bubble-right.png |
___________________________________________________________________ |
Added: svn:mime-type |
138 | 501 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/bubble-top-right.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/bubble-top-right.png |
___________________________________________________________________ |
Added: svn:mime-type |
139 | 502 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/bubble-bottom-right.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/bubble-bottom-right.png |
___________________________________________________________________ |
Added: svn:mime-type |
140 | 503 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/red-circle.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/red-circle.png |
___________________________________________________________________ |
Added: svn:mime-type |
141 | 504 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/bubble-left-arrow.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/bubble-left-arrow.png |
___________________________________________________________________ |
Added: svn:mime-type |
142 | 505 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/message-left.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/message-left.png |
___________________________________________________________________ |
Added: svn:mime-type |
143 | 506 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/message-top-left.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/message-top-left.png |
___________________________________________________________________ |
Added: svn:mime-type |
144 | 507 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/dark-green-circle.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/dark-green-circle.png |
___________________________________________________________________ |
Added: svn:mime-type |
145 | 508 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/bubble-top-arrow.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/bubble-top-arrow.png |
___________________________________________________________________ |
Added: svn:mime-type |
146 | 509 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/dull-blue-circle.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/dull-blue-circle.png |
___________________________________________________________________ |
Added: svn:mime-type |
147 | 510 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/bubble-bottom-arrow.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/bubble-bottom-arrow.png |
___________________________________________________________________ |
Added: svn:mime-type |
148 | 511 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/bubble-right-arrow.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/bubble-right-arrow.png |
___________________________________________________________________ |
Added: svn:mime-type |
149 | 512 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/green-circle.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/green-circle.png |
___________________________________________________________________ |
Added: svn:mime-type |
150 | 513 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/skins/images/message-bottom-right.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/SemanticMediaWiki/skins/images/message-bottom-right.png |
___________________________________________________________________ |
Added: svn:mime-type |
151 | 514 | + image/png |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php |
— | — | @@ -117,7 +117,6 @@ |
118 | 118 | $wgHooks['TitleMoveComplete'][]='smwfMoveHook'; |
119 | 119 | $wgHooks['BeforePageDisplay'][]='smwfAddHTMLHeader'; |
120 | 120 | $wgHooks['ParserBeforeStrip'][] = 'smwfRegisterInlineQueries'; // a hook for registering the <ask> parser hook |
121 | | - |
122 | 121 | $wgHooks['ArticleFromTitle'][] = 'smwfShowListPage'; |
123 | 122 | |
124 | 123 | /**********************************************/ |
— | — | @@ -147,13 +146,14 @@ |
148 | 147 | global $smwgScriptPath; |
149 | 148 | |
150 | 149 | if (!$smwgHeadersInPlace) { |
151 | | - $toolTipScript = '<script type="text/javascript" src="' . $smwgScriptPath . '/skins/SMW_tooltip.js"></script>'; |
152 | | - $out->addScript($toolTipScript); |
153 | 150 | $sortTableScript = '<script type="text/javascript" id="SMW_sorttable_script_inclusion" src="' . $smwgScriptPath . '/skins/SMW_sorttable.js"></script>'; |
154 | 151 | // The above id is essential for the JavaScript to find out the $smwgScriptPath to |
155 | 152 | // include images. Changes in the above must always be coordinated with the script! |
156 | 153 | $out->addScript($sortTableScript); |
157 | 154 | |
| 155 | + $toolTipScript = '<script type="text/javascript" src="' . $smwgScriptPath . '/skins/SMW_tooltip.js"></script>'; |
| 156 | + $out->addScript($toolTipScript); |
| 157 | + |
158 | 158 | // TODO: we should rather have a script that only pulls the whole Timeline on demand, if possible |
159 | 159 | $TimelineScript = '<script type="text/javascript" src="' . $smwgScriptPath . '/skins/SimileTimeline/timeline-api.js"></script>'; |
160 | 160 | $SMWTimelineScript = '<script type="text/javascript" src="' . $smwgScriptPath . '/skins/SMW_timeline.js"></script>'; |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Hooks.php |
— | — | @@ -150,10 +150,7 @@ |
151 | 151 | } else { |
152 | 152 | $tip = $semanticLink[1]; |
153 | 153 | } |
154 | | - $id = uniqid('SMW_'); // parameter needed up to PHP4 |
155 | | - $result = '<span><script type="text/javascript">/*<![CDATA[*/ createToolTip(\''.$id.'\', \''.$tip.'\');/*]]>*/</script>'; |
156 | | - $result .= '<a class="smwatr" onmouseover="showToolTip(\''.$id.'\')" onmouseout="hideToolTip()">'.$semanticLink[2].'</a></span>'; //no CamelCase for onmouse... -> W3C Validator |
157 | | - |
| 154 | + $result = '<span class="smwttinline">' . $semanticLink[2] . '<span class="smwttcontent">' . $tip . '</span></span>'; |
158 | 155 | return $result; |
159 | 156 | } |
160 | 157 | |