/* Script adapte pour Metal Integral - Planete Music Original : WebSnapr - Preview Bubble Javascript Written by Juan Xavier Larrea http://www.websnapr.com - xavier@websnapr.com */ var bulleImage = '/commun/images/site/infobulle.png'; function attachBulle(evt) { var elementOrigine; var source = getSource(evt); if(source["srcElement"]) { elementOrigine=source["srcElement"]; } else { elementOrigine=source.parentNode; } var x=getMousePos(evt)[0]+5; var y=getMousePos(evt)[1]+17; var bulle=document.createElement("div"); document.getElementsByTagName("body")[0].appendChild(bulle); bulle.className="bulleElementDiv"; if (BrowserDetect.browser == 'Explorer') { bulle.style.width="240px"; bulle.style.position="absolute"; bulle.style.top=y; bulle.style.zIndex=99999; bulle.style.left=x; bulle.style.textAlign="left"; bulle.style.height="190px"; bulle.style.paddingTop="0"; bulle.style.paddingLeft="0"; bulle.style.paddingBottom="0"; bulle.style.paddingRight="0"; bulle.style.marginTop="0"; bulle.style.marginLeft="0"; bulle.style.marginBottom="0"; bulle.style.marginRight="0"; bulle.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + bulleImage + "',sizingMethod='image')"; } else { bulle.setAttribute("style","text-align: center; z-index: 99999; position: absolute; top: "+y+"px ; left: "+x+"px ; background: url("+ bulleImage +") no-repeat; width: 240px; height: 190px; padding: 0; margin: 0;"); } if (BrowserDetect.browser == 'Safari' || BrowserDetect.browser == 'Konqueror' ) { bulle.setAttribute("style","text-align: center; z-index: 99999; position: absolute; top: "+y+"px ; left: "+x+"px ; background: url("+ bulleImage +") no-repeat; width: 240px; height: 190px; padding: 0; margin: 0;"); } // On récupère le texte à afficher // elementOrigine = l'élément contenu dans le lien (image, texte) parentNode = la balise lien var listesP = elementOrigine.parentNode.getElementsByTagName("p"); var p=document.createElement("p"); bulle.appendChild(p); p.innerHTML = listesP[0].innerHTML; if (BrowserDetect.browser == 'Explorer') { p.style.paddingTop="0"; p.style.paddingLeft="0"; p.style.paddingBottom="0"; p.style.paddingRight="0"; p.style.margin="auto"; p.style.marginTop="27px"; p.style.marginLeft="25px"; p.style.marginBottom="0"; p.style.marginRight="0"; p.style.borderTop="0"; p.style.borderLeft="0"; p.style.borderBottom="0"; p.style.borderRight="0"; } else { p.setAttribute("style","padding-top: 0; padding-left: 0; padding-right: 0; padding-bottom: 0; margin-top: 27px; margin-left: 12px; margin-bottom: 0; margin-right: 0; border: 0"); } p.setAttribute("width",202); p.setAttribute("height",152); } if(typeof Array.prototype.push!="function") { Array.prototype.push=ArrayPush; function ArrayPush(_1) { this[this.length]=_1; } } function getSource(event) { if (!event) var event = window.event; var targ; if (event.target) targ = event.target; if (event.srcElement) targ = event.srcElement; if (targ.nodeType == 3) targ = targ.parentNode; // defeat Safari bug return targ; } function lierBulles(e) { lbActions=WSR_getElementsByClassName(document,"a","bulleElement"); for(i=0; i < lbActions.length;i++) { if(window.addEventListener) { lbActions[i].addEventListener("mouseover",attachBulle,false); lbActions[i].addEventListener("mouseout",detachBulle,false); } else { lbActions[i].attachEvent("onmouseover",attachBulle); lbActions[i].attachEvent("onmouseout",detachBulle); } } } function WSR_getElementsByClassName(doc,nomTag,nomClasse) { var nbreElements=(nomTag=="*"&&doc.all)?doc.all:doc.getElementsByTagName(nomTag); var _6=new Array(); nomClasse=nomClasse.replace(/\-/g,"\\-"); var _7=new RegExp("(^|\\s)"+nomClasse+"(\\s|$)"); var _8; for(var i=0; i < nbreElements.length;i++) { _8=nbreElements[i]; if(_7.test(_8.className)) { _6.push(_8); } } return (_6); } function detachBulle(bool) { lbActions=WSR_getElementsByClassName(document,"div","bulleElementDiv"); for(i=0;i < lbActions.length;i++) { lbActions[i].parentNode.removeChild(lbActions[i]); } } if(window.addEventListener) { addEventListener("load",lierBulles,false); } else { attachEvent("onload",lierBulles); } function findPos(obj) { var x=y=0; if(obj.offsetParent) { x=obj.offsetLeft; y=obj.offsetTop; while(obj=obj.offsetParent) { x+=obj.offsetLeft; y+=obj.offsetTop; } } return [x,y]; } function getMousePos(evt) { var event; if(document.all) { event = window.event; var scrollObj = (document.documentElement) ? document.documentElement : document.body; var posX = self.event.clientX+scrollObj.scrollLeft; var posY = self.event.clientY+scrollObj.scrollTop; } else { event = evt; var posX = evt.pageX ; var posY = evt.pageY ; } return [posX,posY]; } var BrowserDetect = { init: function () { this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version"; this.OS = this.searchString(this.dataOS) || "an unknown OS"; }, searchString: function (data) { for (var i=0;i < data.length;i++) { var dataString = data[i].string; var dataProp = data[i].prop; this.versionSearchString = data[i].versionSearch || data[i].identity; if (dataString) { if (dataString.indexOf(data[i].subString) != -1) return data[i].identity; } else if (dataProp) return data[i].identity; } }, searchVersion: function (dataString) { var index = dataString.indexOf(this.versionSearchString); if (index == -1) return; return parseFloat(dataString.substring(index+this.versionSearchString.length+1)); }, dataBrowser: [ { string: navigator.userAgent, subString: "OmniWeb", versionSearch: "OmniWeb/", identity: "OmniWeb" }, { string: navigator.vendor, subString: "Apple", identity: "Safari" }, { prop: window.opera, identity: "Opera" }, { string: navigator.vendor, subString: "iCab", identity: "iCab" }, { string: navigator.vendor, subString: "KDE", identity: "Konqueror" }, { string: navigator.userAgent, subString: "Firefox", identity: "Firefox" }, { string: navigator.vendor, subString: "Camino", identity: "Camino" }, { // Netscape (6+) string: navigator.userAgent, subString: "Netscape", identity: "Netscape" }, { string: navigator.userAgent, subString: "MSIE", identity: "Explorer", versionSearch: "MSIE" }, { string: navigator.userAgent, subString: "Gecko", identity: "Mozilla", versionSearch: "rv" }, { // Netscape (4-) string: navigator.userAgent, subString: "Mozilla", identity: "Netscape", versionSearch: "Mozilla" } ], dataOS : [ { string: navigator.platform, subString: "Win", identity: "Windows" }, { string: navigator.platform, subString: "Mac", identity: "Mac" }, { string: navigator.platform, subString: "Linux", identity: "Linux" } ] }; BrowserDetect.init();