Author: sdumitriu Date: 2008-02-18 02:12:29 +0100 (Mon, 18 Feb 2008) New Revision: 7782
Modified: xwiki-platform/skins/trunk/albatross/src/main/resources/albatross/ajax/ieemu.js xwiki-platform/skins/trunk/albatross/src/main/resources/albatross/ajax/panelWizard.js xwiki-platform/skins/trunk/albatross/src/main/resources/albatross/ajax/toolTip.js xwiki-platform/skins/trunk/toucan/src/main/resources/toucan/ajax/panelWizard.js Log: XSTOUCAN-1: Create Toucan skin from xwiki.org Fixed: Tooltip appears at the wrong position in IE Also refactored the tooltip code a bit. Modified: xwiki-platform/skins/trunk/albatross/src/main/resources/albatross/ajax/ieemu.js =================================================================== --- xwiki-platform/skins/trunk/albatross/src/main/resources/albatross/ajax/ieemu.js 2008-02-17 19:50:29 UTC (rev 7781) +++ xwiki-platform/skins/trunk/albatross/src/main/resources/albatross/ajax/ieemu.js 2008-02-18 01:12:29 UTC (rev 7782) @@ -30,7 +30,6 @@ Event.RIGHT = 2; } else { - Event = {}; // IE is returning wrong button number Event.LEFT = 1; Event.MIDDLE = 4; Modified: xwiki-platform/skins/trunk/albatross/src/main/resources/albatross/ajax/panelWizard.js =================================================================== --- xwiki-platform/skins/trunk/albatross/src/main/resources/albatross/ajax/panelWizard.js 2008-02-17 19:50:29 UTC (rev 7781) +++ xwiki-platform/skins/trunk/albatross/src/main/resources/albatross/ajax/panelWizard.js 2008-02-18 01:12:29 UTC (rev 7782) @@ -98,9 +98,9 @@ function onDragStart(el,x,y) { if (el.isDragging) return; - hideddrivetip(); + hideTip(); window.isDraggingPanel = true; - if (enabletip==true) hideddrivetip(); + if (enabletip==true) hideTip(); realParent = el.parentNode; parentNode = el.parentNode; var isAdded = (realParent != leftPanels && realParent != rightPanels); @@ -143,7 +143,7 @@ } function onDrag(el,x,y) { - if (enabletip==true) hideddrivetip(); + if (enabletip==true) hideTip(); parentNode = getClosestDropTarget(x,y, el.offsetWidth, el.offsetHeight); if(parentNode != prevcolumn){ if(prevcolumn != allPanels) { Modified: xwiki-platform/skins/trunk/albatross/src/main/resources/albatross/ajax/toolTip.js =================================================================== --- xwiki-platform/skins/trunk/albatross/src/main/resources/albatross/ajax/toolTip.js 2008-02-17 19:50:29 UTC (rev 7781) +++ xwiki-platform/skins/trunk/albatross/src/main/resources/albatross/ajax/toolTip.js 2008-02-18 01:12:29 UTC (rev 7782) @@ -1,78 +1,72 @@ -/*********************************************** -* Cool DHTML tooltip script- Dynamic Drive DHTML code library (www.dynamicdrive.com) -* This notice MUST stay intact for legal use -* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code -***********************************************/ - -var offsetxpoint=-60 //Customize x offset of tooltip -var offsetypoint=20 //Customize y offset of tooltip +var offsetxpoint=-60; //Customize x offset of tooltip +var offsetypoint=20; //Customize y offset of tooltip var ie=document.all var ns6=document.getElementById && !document.all -var enabletip=false -if (ie||ns6) -var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : "" +var enabletip=false; +var tipobj=$("dhtmltooltip"); +var tippedNode = undefined; function ietruebody(){ - return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body + return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body } function showtip(node, txt, w, align){ - document.onmousemove=positiontip; - node.onmouseout = hideddrivetip; - //node.onclick = hideddrivetip; - if (ns6||ie){ - if (align) tipobj.style.textAlign=align; - tipobj.innerHTML=txt; - if (tipobj.offsetWidth>w) tipobj.style.width=w+"px"; - enabletip=true; - return false - } + Event.observe(document, "mousemove", positionTip); + Event.observe(node, "mouseout", hideTip); + if (align) { + tipobj.style.textAlign=align; + } + tippedNode = node; + tipobj.style.visibility = "hidden"; + tipobj.style.display = "block"; + tipobj.style.width = "auto"; + tipobj.innerHTML=txt; + if (tipobj.offsetWidth > w) { + tipobj.style.width = w + "px"; + } + tipobj.style.display = "none"; + tipobj.style.visibility="visible"; + enabletip = true; + return false } -function positiontip(e){ - if (enabletip){ - var curX=(ns6)?e.pageX : event.x+ietruebody().scrollLeft; - var curY=(ns6)?e.pageY : event.y+ietruebody().scrollTop; - //Find out how close the mouse is to the corner of the window - var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20 - var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20 - - var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000 - - //if the horizontal distance isn't enough to accomodate the width of the context menu - if (rightedge<tipobj.offsetWidth) - //move the horizontal position of the menu to the left by it's width - tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px" - else if (curX<leftedge) - tipobj.style.left="5px" - else - //position the horizontal position of the menu where the mouse is positioned - tipobj.style.left=curX+offsetxpoint+"px" - - //same concept with the vertical position - if (bottomedge<tipobj.offsetHeight) - tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px" - else - tipobj.style.top=curY+offsetypoint+"px" - tipobj.style.visibility="visible" - } -} +function positionTip(e){ + if (enabletip){ + var curX=Event.pointerX(e); + var curY=Event.pointerY(e); + //Find out how close the mouse is to the corner of the window + var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20 + var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20 -function hideddrivetip(){ - if(!window.enabletip) return; - document.onmousemove=null; - if (ns6||ie){ - enabletip=false - tipobj.style.visibility="hidden" - tipobj.style.left="-1000px" - tipobj.style.backgroundColor='' - tipobj.style.width='' - } + var leftedge=(offsetxpoint<0) ? offsetxpoint*(-1) : -1000 + + //if the horizontal distance isn't enough to accomodate the width of the context menu + if (rightedge<tipobj.offsetWidth) { + //move the horizontal position of the menu to the left by it's width + tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px" + } else if (curX<leftedge) { + tipobj.style.left="5px" + } else { + //position the horizontal position of the menu where the mouse is positioned + tipobj.style.left=curX+offsetxpoint+"px" + } + //same concept with the vertical position + if (bottomedge<tipobj.offsetHeight) { + tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : + window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px" + } else { + tipobj.style.top=curY+offsetypoint+"px" + } + tipobj.style.display="block"; + } } -if (window.addEventListener) { - window.addEventListener("load",function() {document.getElementById("body").appendChild(tipobj);},false); +function hideTip(e){ + if (!window.enabletip) { + return; + } + Event.stopObserving(document, "mousemove", positionTip); + enabletip=false + tipobj.style.display="none"; } -else if (window.attachEvent) { - window.attachEvent("onload",function() {document.getElementById("body").appendChild(tipobj);}); -} \ No newline at end of file +Event.observe(window, "load", function() {$("body").appendChild(tipobj);}); \ No newline at end of file Modified: xwiki-platform/skins/trunk/toucan/src/main/resources/toucan/ajax/panelWizard.js =================================================================== --- xwiki-platform/skins/trunk/toucan/src/main/resources/toucan/ajax/panelWizard.js 2008-02-17 19:50:29 UTC (rev 7781) +++ xwiki-platform/skins/trunk/toucan/src/main/resources/toucan/ajax/panelWizard.js 2008-02-18 01:12:29 UTC (rev 7782) @@ -98,9 +98,9 @@ function onDragStart(el,x,y) { if (el.isDragging) return; - hideddrivetip(); + hideTip(); window.isDraggingPanel = true; - if (enabletip==true) hideddrivetip(); + if (enabletip==true) hideTip(); realParent = el.parentNode; parentNode = el.parentNode; var isAdded = (realParent != leftPanels && realParent != rightPanels); @@ -143,7 +143,7 @@ } function onDrag(el,x,y) { - if (enabletip==true) hideddrivetip(); + if (enabletip==true) hideTip(); parentNode = getClosestDropTarget(x,y, el.offsetWidth, el.offsetHeight); if(parentNode != prevcolumn){ if(prevcolumn != allPanels) { _______________________________________________ notifications mailing list notifications@xwiki.org http://lists.xwiki.org/mailman/listinfo/notifications