You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(17) |
Nov
(47) |
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(44) |
Feb
(8) |
Mar
|
Apr
(26) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2003 |
Jan
|
Feb
(1) |
Mar
(44) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(13) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Robert R. <rai...@us...> - 2002-04-10 18:32:57
|
Update of /cvsroot/dynapi/dynapi2x/src/dynapi/util In directory usw-pr-cvs1:/tmp/cvs-serv14312/src/dynapi/util Removed Files: cookie.js ioelement.js Log Message: removed --- cookie.js DELETED --- --- ioelement.js DELETED --- |
From: Robert R. <rai...@us...> - 2002-04-10 18:32:55
|
Update of /cvsroot/dynapi/dynapi2x/src/dynapi/images In directory usw-pr-cvs1:/tmp/cvs-serv14312/src/dynapi/images Removed Files: arrowdown.gif arrowleft.gif arrowright.gif arrowup.gif blank.gif button.gif button_mo.gif Log Message: removed --- arrowdown.gif DELETED --- --- arrowleft.gif DELETED --- --- arrowright.gif DELETED --- --- arrowup.gif DELETED --- --- blank.gif DELETED --- --- button.gif DELETED --- --- button_mo.gif DELETED --- |
Update of /cvsroot/dynapi/dynapi2x/examples In directory usw-pr-cvs1:/tmp/cvs-serv14312/examples Removed Files: dynapi.api.dynlayer-anchor.html dynapi.api.dynlayer-create.html dynapi.api.dynlayer-slide.html dynapi.api.ext.dragevent.html dynapi.api.mouseevent.html dynapi.fx.pathanim-glide.html dynapi.fx.pathanim-slide.html dynapi.fx.pathanim.html dynapi.gui.graphics.html dynapi.library-file1.js dynapi.library-file2.js dynapi.library-load.html dynapi.util.ioelement-testfile.html dynapi.util.ioelement.html Log Message: removed --- dynapi.api.dynlayer-anchor.html DELETED --- --- dynapi.api.dynlayer-create.html DELETED --- --- dynapi.api.dynlayer-slide.html DELETED --- --- dynapi.api.ext.dragevent.html DELETED --- --- dynapi.api.mouseevent.html DELETED --- --- dynapi.fx.pathanim-glide.html DELETED --- --- dynapi.fx.pathanim-slide.html DELETED --- --- dynapi.fx.pathanim.html DELETED --- --- dynapi.gui.graphics.html DELETED --- --- dynapi.library-file1.js DELETED --- --- dynapi.library-file2.js DELETED --- --- dynapi.library-load.html DELETED --- --- dynapi.util.ioelement-testfile.html DELETED --- --- dynapi.util.ioelement.html DELETED --- |
From: Robert R. <rai...@us...> - 2002-04-10 18:32:03
|
Update of /cvsroot/dynapi/dynapi2x In directory usw-pr-cvs1:/tmp/cvs-serv14312 Removed Files: LICENSE README REVISION Log Message: removed --- LICENSE DELETED --- --- README DELETED --- --- REVISION DELETED --- |
From: Robert R. <rai...@us...> - 2002-04-10 18:31:46
|
Update of /cvsroot/dynapi/dynapi2x/examples/mypackage In directory usw-pr-cvs1:/tmp/cvs-serv19326/examples/mypackage Added Files: myobject1.js myobject2.js myobject3.js Log Message: initial import |
Update of /cvsroot/dynapi/dynapi2x/examples In directory usw-pr-cvs1:/tmp/cvs-serv19326/examples Added Files: dynapi.api.dynlayer-anchor.html dynapi.api.dynlayer-create.html dynapi.api.dynlayer-destroy.html dynapi.api.dynlayer-slide.html dynapi.api.ext.dragevent.html dynapi.api.ext.inline.html dynapi.api.mouseevent.html dynapi.fx.bezier.html dynapi.fx.motionx.html dynapi.fx.pathanim-glide.html dynapi.fx.pathanim-slide.html dynapi.fx.pathanim.html dynapi.fx.timerx.html dynapi.gui.graphics.html dynapi.library-file1.js dynapi.library-file2.js dynapi.library-load.html dynapi.util.ioelement-post.html dynapi.util.ioelement-testfile.html dynapi.util.ioelement.html ioelement-client.html ioelement-server.html Log Message: initial import --- NEW FILE --- <html> <head> <title>DynAPI - DynLayer Destroy</title> <script language="JavaScript" src="../src/dynapi.js"></script> <script language="Javascript"> dynapi.library.setPath('../src/'); dynapi.library.include('dynapi.api'); dynapi.library.include('dynapi.functions'); </script> <script language="Javascript"> dynapi.onLoad(init); function init() { document.countform.counttext.value = 0; }; var counter = 0; function generate(n) { for (var i=0;i<n;i++) { var d = new DynLayer(); d.setBgColor(dynapi.functions.getRandomColor()); d.setSize(10+80*Math.random(),10+80*Math.random()); d.setLocation(130+500*Math.random(),500*Math.random()); dynapi.document.addChild(d); counter++; document.countform.counttext.value = counter; } } var timer; function start() { timer = setInterval('generate(10)',1); } function stop() { clearInterval(timer); } function destroyAll() { dynapi.document.destroyAllChildren(); document.countform.counttext.value = 0; } </script> </head> <body bgcolor="#999999"> <p><a href="javascript:start()">Start generation</a><br> <a href="javascript:stop()">Stop generation</a><br> <a href="javascript:destroyAll()">Destroy all</a><br> <form name="countform"> <input type=text name="counttext" size=5> </form> </body> </html> --- NEW FILE --- <html> <head> <title>DynAPI Examples - DynLyaer [Inline]</title> <script language="JavaScript" src="../src/dynapi.js"></script> <script language="Javascript"> dynapi.library.setPath('../src/'); dynapi.library.include('dynapi.library'); dynapi.library.include('dynapi.debug'); dynapi.library.include('dynapi.api.DynEvent'); dynapi.library.include('dynapi.api.DynDocument'); dynapi.library.include('dynapi.api.DynLayer'); dynapi.library.include('dynapi.api.ext.DynLayer_inline'); </script> <script language="JavaScript" src="../src/dynapi/api/mouse_ns4.js"></script> <script language="Javascript"> dynapi.onLoad(init); function init() { mylayer = DynLayer.getInline("mylayer"); mychild = DynLayer.getInline("mychild", mylayer); var el = { onmousedown : function(e) { dynapi.debug.print('mousedown on '+e.getSource().id) e.preventBubble(); } } mylayer.addEventListener(el); mychild.addEventListener(el); }; function checkProperties(dlyr) { var str = 'id = '+dlyr.id+'\n'+ 'parent id = '+dlyr.parent.id+'\n'+ 'x = '+dlyr.x+'\n'+ 'y = '+dlyr.y+'\n'+ 'w = '+dlyr.w+'\n'+ 'h = '+dlyr.h+'\n'+ 'clip = '+dlyr.clip+'\n'+ 'z = '+dlyr.z+'\n'+ 'visible = '+dlyr.visible+'\n'+ 'bgColor = '+dlyr.bgColor+'\n'+ 'bgImage = '+dlyr.bgImage+'\n'+ 'html = '+dlyr.html+'\n'; alert(str); } </script> <style type="text/css"> <!-- #mylayer {position:absolute; left:250px; top:50px; width:200px; height:200px; clip:rect(0px 200px 200px 0px); background-color:red; layer-background-color:red;} #mychild {position:absolute; left:50px; top:50px; background-color:yellow; z-index:5; layer-background-color:yellow; layer-background-image:url("../src/dynapi/images/blank.gif");} --> </style> </head> <body bgcolor="#999999"> <p>Check Properties of:<br> <a href="javascript:checkProperties(mylayer)">mylayer</a><br> <a href="javascript:checkProperties(mychild)">mychild</a> <div id="mylayer"> mylayer is inline <div id="mychild"> mychild is inline </div> </div> </body> </html> --- NEW FILE --- <html> <head> <title>DynAPI - Bezier Animation</title> <script language="JavaScript" src="../src/dynapi.js"></script> <script language="Javascript"> dynapi.library.setPath('../src/'); dynapi.library.include('dynapi.api'); dynapi.library.include('dynapi.fx.PathAnimation'); dynapi.library.include('dynapi.fx.Bezier'); </script> <script language="Javascript"> //var controlPoints = [150,150, 200,400, 250,100, 500,300]; //var steps = 25; var path; function drawBezier() { var controlPoints = eval(document.b.cps.value); var steps = parseInt(document.b.steps.value); // results in total of steps+1 points along path, includes // includes starting and ending points path = Bezier(controlPoints, steps); for (var i=0;i<path.length/2;i++) { var x = path[i*2]; var y = path[i*2+1]; dynapi.document.addChild(new DynLayer('',x,y,2,2,'black')); } for (var i=0;i<controlPoints.length/2;i++) { var x = controlPoints[i*2]; var y = controlPoints[i*2+1]; var color = 'red'; if (i==0 || i==controlPoints.length/2-1) color = 'yellow' dynapi.document.addChild(new DynLayer('',x-2,y-2,5,5,color)); } } var playblock = dynapi.document.addChild(new DynLayer('',0,0,15,15,'red')); playblock.setVisible(false); //var pathanim = PathAnimation(playblock); function animateStart() { if (path) { playblock.setVisible(true); var i = pathanim.add(path, true); pathanim.play(i); } } function animateStop() { playblock.setVisible(false); pathanim.stop(); } function clearPage() { for (var i=0;i<dynapi.document.children.length;i++) { dynapi.document.children[i]._remove(); } } </script> </head> <body bgcolor="#999999"> <form name=b> Control Points: <input type=text name="cps" value="[150,150, 200,400, 250,100, 500,300]" size=50><br> Steps: <input type=text name="steps" value="25" size=4><br> <input type=button value="Draw" onclick="drawBezier()"><br> <input type=button value="Clear Page" onclick="clearPage()"><br> <input type=button value="Start Animation" onclick="animateStart()"><br> <input type=button value="Stop Animation" onclick="animateStop()"><br> </form> </body> </html> --- NEW FILE --- <html> <head> <title>dynapi Examples - MotionX Class</title> <script language="JavaScript" src="../src/dynapi.js"></script> <script language="Javascript"> dynapi.library.setPath('../src/'); dynapi.library.include('dynapi.library'); dynapi.library.include('dynapi.api'); dynapi.library.include('dynapi.api.ext.DynKeyEvent'); dynapi.library.include('dynapi.fx.TimerX'); dynapi.library.include('dynapi.fx.MotionX'); </script> <script language="Javascript"> var score,hits=0 ball= new DynLayer(null,350,100,10,10,'#000000') ball.setID('ball'); score= new DynLayer("Score:0",350,150,70,20) score.setID('score') pad=new DynLayer("<font face=arial size=3><b><<oo>></b></font>",155,250,60,20) pad.setID('p'); blockT=new DynLayer(null,105,60,465,5,'#c0c0c0'); blockT.setID('t'); blockL=new DynLayer(null,105,60,5,205,'#c0c0c0'); blockL.setID('l'); blockB=new DynLayer(null,105,265,465,10,'#c0c0c0'); blockB.setID('b'); blockR=new DynLayer(null,565,60,5,205,'#c0c0c0'); blockR.setID('r') blockA=new DynLayer(null,140,90,40,30,'#c0c0c0'); blockA.setID('a'); blockC=new DynLayer(null,125,195,80,20,'#c0c0c0'); blockC.setID('c'); blockD=new DynLayer(null,470,190,40,30,'#c0c0c0'); blockD.setID('d'); blockE=new DynLayer(null,440,90,80,20,'#c0c0c0'); blockE.setID('e'); blockT.makeSolid() blockL.makeSolid() blockB.makeSolid() blockR.makeSolid() blockA.makeSolid() blockC.makeSolid() blockD.makeSolid() blockE.makeSolid() pad.makeSolid() evn={} evn.oncollide=function(e) { var me=e.getSource(); var blocks="adce" if (blocks.indexOf(me.id)>=0) { me.setBgColor('#FFCC00') setTimeout(me+'.setBgColor("#c0c0c0");',500) }else if (me.id=="p") { me.setHTML("<font color=#008000 face=arial size=3><b><<00>></b></font>") setTimeout(me+'.setHTML("<font face=arial size=3><b><<oo>></b></font>");',500) }else { me.setBgColor('#0000FF') setTimeout(me+'.setBgColor("#c0c0c0");',500) if (me.id=="b") { hits-- score.setHTML("Score:"+hits) } } } blockT.addEventListener(evn) blockL.addEventListener(evn) blockB.addEventListener(evn) blockR.addEventListener(evn) blockA.addEventListener(evn) blockC.addEventListener(evn) blockD.addEventListener(evn) blockE.addEventListener(evn) pad.addEventListener(evn) evn={} evn.onkeydown=function(e) { alert() var me=dynapi.document.getAll()['p'] if ((e.which==39||e.charKey=='6') && (me.x+me.w+20)<=595) { me.moveBy(20,0);return true }else if ((e.which==37||e.charKey=='4')){ if (me.x-20>=145) { me.moveBy(-20,0);return true }else{ me.setLocation(145) } } } dynapi.document.addEventListener(evn); //------- Add Listener to ball ------------------ evn={} evn.ontimer=function(e){ var me=e.getSource(); var x=me.x var y=me.y x=x+me.fx y=y+me.fy if(x>595){x=150;y=80} me.setLocation(x,y) } evn.oncollide=function(e){ var me=e.getSource(); var obs=me.getObstacle() xx="EW";yy="NS" if (xx.indexOf(me.getImpactSide())>=0) me.fx=me.fx*-1 if (yy.indexOf(me.getImpactSide())>=0) me.fy=me.fy*-1 status = me.id +" collides with "+obs.id setTimeout("status=''",1500) xx="adce" if (xx.indexOf(obs.id)>=0) {hits++} score.setHTML("Score:"+hits) } ball.addEventListener(evn) ball.makeSolid() ball.fx=10;ball.fy=10 ball.startTimer(60) dynapi.document.addChild(blockT) dynapi.document.addChild(blockL) dynapi.document.addChild(blockB) dynapi.document.addChild(blockR) dynapi.document.addChild(blockA) dynapi.document.addChild(blockC) dynapi.document.addChild(blockD) dynapi.document.addChild(blockE) dynapi.document.addChild(ball) dynapi.document.addChild(pad) dynapi.document.addChild(score) </script> </head> <body bgcolor="#FFFFFF"> <script> dynapi.document.insertAllChildren(); </script> <table border="0" width="100%"> <tr> <td width="100%"><font face="Arial" size="4"><b>Motion Extension (MotionX) </b></font></td> </tr> <tr> <td width="100%"><hr size="1" color="#000000"> </td> </tr> <tr> <td width="100%"><table border="0" height="209"> <tr> <td width="103" height="201" valign="top"><font face="Arial" size="2"> </font></td> </tr> </table> <table border="0" width="100%"> <tr> <td width="100%" colspan="2"><hr size="1" color="#000000"> </td> </tr> <tr> <td width="100%" colspan="2"> <b><font face="Arial" size="2">Remarks</font> </b><font face="Arial" size="2"><br> MotionX is an extension to the DynLayer API which is used to make a layer appears to be solid, and will trigger a oncollide() event whenever collisions occurs<br> </font> </td> </tr> <tr> <td width="53%" valign="top"><font face="Arial" size="2">Making a layer solid does not prevent other layers from passing through it. It simple means that the layer will receive an event whenever it comes in contact with another solid layer. This also enables the layer to tell the direction in which it is moving. MotionX was design mainly for creating games with dynapi.</font> <p><font face="Arial" size="2"><b>Getting the direction of a layer:<br> </b>When the getDirection() method is called a string data-type is returned which can be used to tell the direction in which the layer is moving. The following are some possible directions returned by the getDirection() method:</font></p> <blockquote> <table border="0" width="202"> <tr> <td width="35"><font face="Arial" size="2">N </font></td> <td width="153"><font face="Arial" size="2">North</font></td> </tr> <tr> <td width="35"><font face="Arial" size="2">S </font></td> <td width="153"><font face="Arial" size="2">South</font></td> </tr> <tr> <td width="35"><font face="Arial" size="2">E </font></td> <td width="153"><font face="Arial" size="2">East</font></td> </tr> <tr> <td width="35"><font face="Arial" size="2">W</font></td> <td width="153"><font face="Arial" size="2">West</font></td> </tr> <tr> <td width="35"><font face="Arial" size="2">NE </font></td> <td width="153"><font face="Arial" size="2">North East</font></td> </tr> <tr> <td width="35"><font face="Arial" size="2">NW </font></td> <td width="153"><font face="Arial" size="2">Noth West</font></td> </tr> <tr> <td width="35"><font face="Arial" size="2">SE </font></td> <td width="153"><font face="Arial" size="2">South East</font></td> </tr> <tr> <td width="35"><font face="Arial" size="2">SW </font></td> <td width="153"><font face="Arial" size="2">South West</font></td> </tr> </table> </blockquote> <p><font size="2" face="Arial">A more accurate way of knowing the direction in which the layer is moving can be done by calling the getDirectionAngle() method. This method returns an angle ranging from 0 to 259</font>. <br> </p> <p><font face="Arial"><b><font size="2" face="Arial">Example:</font></b><br> <font size="2">To play the game above use the left and right arrow keys (or the numbers 4 & 6 when using NS4) to prevent the ball from touching the base line.<br> <i>Note: The game has some minor flaws, but works great for a demonstration. Enjoy!</i></font></font></p> </td> <td width="47%" valign="top"><table border="0" width="100%" bgcolor="#000000" cellspacing="1"> <tr> <td width="100%" bgcolor="#E0E0E0"><b><font face="Arial" color="#000080" size="2">Public Properties & Methods</font></b></td> </tr> <tr> <td width="100%" bgcolor="#FFFFFF"><ul> <li><font size="2" face="Arial">void <b>makeSolid</b>()</font></li> <li><font size="2" face="Arial">string <b>getImpactSide</b>()<br> <font color="#333333">returns the impacted side of the layer. Example: N, S, E or W</font></font></li> <li><font size="2" face="Arial">dynlayer <b>getObstacle</b>()<br> <font color="#333333">returns the colliding DynLayer</font></font></li> <li><font size="2" face="Arial">string <b>getDirection</b>()<br> <font color="#333333">returns the direction in which the layer is moving. Example N, S, E, W, etc.</font></font></li> <li><font color="#333333" size="2" face="Arial">int <b>getDirectionAngle</b>()<br> returns the angle in which the layer is moving </font></li> </ul> </td> </tr> <tr> <td width="100%" bgcolor="#E0E0E0"><b><font face="Arial" color="#000080" size="2">Events</font></b></td> </tr> <tr> <td width="100%" bgcolor="#FFFFFF"><ul> <li><font size="2" face="Arial">oncollide()</font></li> <li><font size="2" face="Arial">onmove()</font></li> </ul> </td> </tr> <tr> <td width="100%" bgcolor="#E0E0E0"><b><font face="Arial" color="#000080" size="2">Minimum Requirements</font></b></td> </tr> <tr> <td width="100%" bgcolor="#FFFFFF"> <ul> <li><font size="2" face="Arial">DynLayer </font></li> </ul> </td> </tr> <tr> <td width="100%" bgcolor="#E0E0E0"><font face="Arial" color="#000080" size="2"><b>Known Issues</b></font></td> </tr> <tr> <td width="100%" bgcolor="#FFFFFF"> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </body> </html> --- NEW FILE --- <html> <head> <title>DynAPI Examples - TimerX Class</title> <script language="JavaScript" src="../src/dynapi.js"></script> <script language="Javascript"> dynapi.library.setPath('../src/'); dynapi.library.include('dynapi.library'); dynapi.library.include('dynapi.api'); dynapi.library.include('dynapi.fx.TimerX'); </script> <script language="Javascript"> myLayer=new DynLayer(null,135,100,130,50,'#00A000') myClock=new DynLayer(null,270,100,200,50,'#0000A0') myLayer.addEventListener({ ontimer:function(e){ var o=e.getSource() var src='<font size=2 face=arial color=#ffffff> Tick @ 200ms <br> Tick count='+o.getTickCount()+'</font>' o.setHTML(src) } }) myClock.addEventListener({ ontimer:function(e){ var o=e.getSource() var src='<font size=2 face=arial color=#ffffff> '+new Date()+'</font>' o.setHTML(src) } }) myLayer.startTimer(200) myClock.startTimer(1000) dynapi.document.addChild(myLayer) dynapi.document.addChild(myClock) </script> </head> <body> <script> dynapi.document.insertAllChildren(); </script> <table border="0" width="100%"> <tr> <td width="100%"><font face="Arial" size="4"><b>Timer Extension (TimerX) Class</b></font></td> </tr> <tr> <td width="100%"><hr size="1" color="#000000"> </td> </tr> <tr> <td width="100%"><table border="0"> <tr> <td width="103" height="134" valign="top"></td> </tr> </table> <table border="0" width="100%"> <tr> <td width="100%" colspan="2"><hr size="1" color="#000000"> </td> </tr> <tr> <td width="100%" colspan="2"><b><font face="Arial" size="2">Remarks</font></b><font face="Arial" size="2"><br> The TimerX Class is a simple extension to the DynLayer Class which is used to trigger timer events at set intervals. </font> </td> </tr> <tr> <td width="53%" valign="top"><font face="Arial" size="2">Example:</font> <blockquote> <p><font face="Arial" size="2">myLayer=new DynLayer(null,135,70,100,50)<br> myLayer.setBgColor('#000000')</font></p> <p><font face="Arial" size="2">var e={}<br> e.ontimer=function(e){<br> var o=e.getSource()<br> var src='<font size=2 color=#ffffff>'<br> src+='o.getTickCount()+'</font>'<br> o.setHTML(src)<br> }<br> myLayer.addEventListener(e)<br> myLayer.startTimer(1000)</font></p> <p><font face="Arial" size="2">dynapi.document.addChild(myLayer)</font></p> </blockquote> <p> </p> <p><font face="Arial" size="2"><br> </font></td> <td width="47%" valign="top"><table border="0" width="100%" bgcolor="#000000" cellspacing="1"> <tr> <td width="100%" bgcolor="#E0E0E0"><b><font face="Arial" color="#000080" size="2">Public Properties & Methods</font></b></td> </tr> <tr> <td width="100%" bgcolor="#FFFFFF"><ul> <li><font face="Arial" size="2">void <b>startTimer</b>(int interval)<br> <font color="#333333">enable timer and set the interval</font></font></li> <li><font face="Arial" size="2">void <b>stopTimer</b>()<br> <font color="#333333">disable timer</font></font></li> <li><font face="Arial" size="2">void <b>setTimerInterval</b>(int interval)</font></li> <li><font face="Arial" size="2">int <b>getTimerInterval</b>()</font></li> <li><font face="Arial" size="2">int <b>getTickCount</b>()<br> <font color="#333333">returns total number of ticks since the last startTimer() call </font></font></li> <li><font face="Arial" size="2">int <b>resetTickCount</b>()<br> <font color="#333333">resets the tick count to 0</font></font></li> </ul> </td> </tr> <tr> <td width="100%" bgcolor="#E0E0E0"><b><font face="Arial" color="#000080" size="2">Events</font></b></td> </tr> <tr> <td width="100%" bgcolor="#FFFFFF"><ul> <li><font face="Arial" size="2">ontimer()</font></li> </ul> </td> </tr> <tr> <td width="100%" bgcolor="#E0E0E0"><b><font face="Arial" color="#000080" size="2">Minimum Requirements</font></b></td> </tr> <tr> <td width="100%" bgcolor="#FFFFFF"><font face="Arial" size="2"><ul><li>dynapi.api </li></ul></font></td> </tr> <tr> <td width="100%" bgcolor="#E0E0E0"><font face="Arial" color="#000080" size="2"><b>Known Issues</b></font></td> </tr> <tr> <td width="100%" bgcolor="#FFFFFF"><font face="Arial" size="2">[none]</font> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </body> </html> --- NEW FILE --- <html> <head> <title>DynAPI - I/O Element [Post]</title> <script language="JavaScript" src="../src/dynapi.js"></script> <script language="Javascript"> dynapi.library.setPath('../src/'); dynapi.library.include('dynapi.debug'); dynapi.library.include('dynapi.api'); dynapi.library.include('IOElement'); </script> <script language="Javascript"> var ioelement = new IOElement(true); dynapi.onLoad(init); function init() { } function loadtest() { var fn = function(e, success) { if (success) { var o = e.getSource(); var response = o.getVariable('response'); alert('The server said:\n' + response); } } var f = document.forms.iotest; var data = { name : f.name.value, color : f.color.options[f.color.selectedIndex].value } var file = f.file.options[f.file.selectedIndex].value; var method = f.method.options[f.method.selectedIndex].value; if (method=="post") ioelement.post(file, data, fn); else ioelement.get(file, data, fn); } </script> </head> <body bgcolor="#999999"> <form name="iotest"> Select the file to load: <select name="file"> <option value="dynapi.util.ioelement-postresponse.php">dynapi.util.ioelement-postresponse.php</option> <option value="dynapi.util.ioelement-postresponse.asp">dynapi.util.ioelement-postresponse.asp</option> </select><br> Method: <select name="method"> <option value="post">post</option> <option value="get">get</option> </select> <p>Your Name: <input type=text name="name" size=20 value="My Name"><br> Favorite Color: <select name="color"> <option value="red">red</option> <option value="blue">blue</option> <option value="black">black</option> </select><br> <a href="javascript:loadtest()">submit</a> </form> </body> </html> --- NEW FILE --- <html> <head> <title>DynAPI - I/O Element Client</title> <script language="JavaScript" src="../src/dynapi.js"></script> <script language="Javascript"> dynapi.library.setPath('../src/'); dynapi.library.include('dynapi.debug'); dynapi.library.include('dynapi.api'); dynapi.library.include('IOElement'); </script> <script language="Javascript"> // create a hidden IOElement // you do not have to add the IOElement to dynapi.document manually // it is done automatically when "true" is passed to the constructor hidden_io = new IOElement(true); function sendtest(vl,m) { var fn = function(e) { var o = e.getSource(); var result=o.getResult() alert('IOElement load handler found these values:\nboolValue = ' + o.getScope().boolValue+'\nrandValue = ' + o.getScope().randValue+'\nmyValue = ' + o.getScope().myValue); if (result) alert(result) } hidden_io.send("ioelement-server.html?myvalue=12345",vl,fn,m); } </script> </head> <body bgcolor="#999999"> Load "ioelement-server.html" using IOElement (hidden mode):<br> <form name="frm">Enter some text to send:<br><input type="textbox" name="txt"><br> <a href="javascript:sendtest(document.forms['frm']['txt'].value,'get')">Send Data (using GET Method)</a> | <a href="javascript:sendtest(document.forms['frm']['txt'].value,'post')">Send Data (using POST Method)</a><br> <br>Check the Debug window for displayed data </form> <script> dynapi.document.insertAllChildren(); </script> </body> </html> --- NEW FILE --- <html> <script> <!-- var dynapi = parent.dynapi; var ioelement; if (dynapi) { ioelement = parent.IOElement.notify(this, init); // run init() when this file loads } else alert('Error: aa no dynapi'); // you can server-generate js variables and retrieve them in the load handler var boolValue = true; var randValue = Math.random(); // obtain arguments passed in the url if (dynapi) { var args = dynapi.functions.getURLArguments(this); var data=args['ioData'] if (data) data=data.replace(/\+/g,' ') // replace + with a blank space for GET post dynapi.debug.print('Data sent by from main page:'+data) } function init() { dynapi.debug.print('loaded ioelement-testfile.html'); } //--> </script> <body> <script> <!-- if (ioelement) { // fix iframe bgcolor to parent IOElement's bgcolor, IE/Moz only if (!dynapi.ua.ns4) this.document.body.style.backgroundColor = ioelement.getBgColor(); document.write('<b>server-generated values:</b><br>'); document.write('boolValue = '+boolValue+'<br>'); document.write('randValue = '+randValue+'<br>'); document.write('<b>value passed in the URL:</b><br>'); document.write('myvalue = '+args['myvalue']+'<br>'); document.write('<b>values used by IOElement:</b><br>'); document.write('ioLoadID = '+args['ioLoadID']+'<br>'); document.write('ioElmID = '+args['ioElmID']+'<br>'); var data=args['ioData'] if (data) data=data.replace(/\+/g,' ') // replace + with a blank space for GET post // write output form - a server-side script can generate this read out document.write('<form name="ioDataForm"><textarea name="ioResult">Server Says Hello, \n\n You have sent the following info :'+ (data||'')+'.\n\nNote: Because this is not a real server-side script, you only be able to see data sent via the GET method.</textarea></form>') } //--> </script> <p>test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br>test<br> </body> </html> |
From: Robert R. <rai...@us...> - 2002-04-10 18:31:42
|
Update of /cvsroot/dynapi/dynapi2x/src/api In directory usw-pr-cvs1:/tmp/cvs-serv19326/src/api Added Files: dyndocument.js dynlayer.js event.js mouse_ie.js mouse_ns4.js mouse_ns6.js Log Message: initial import --- NEW FILE --- /* DynAPI Distribution DynDocument Class The DynAPI Distribution is distributed under the terms of the GNU LGPL license. requires: dynapi.api.DynElement */ function DynDocument(frame) { this.inherit('DynElement'); this.frame = frame; this.doc = this.frame.document; this._dyndoc = this; this.x = 0; this.y = 0; this.w = 0; this.h = 0; this._topZIndex = 10000; var o = this; this.frame.onresize = function() {o._handleResize()}; this.onResizeNS4 = "reload" // or "redraw" this.fgColor = this.doc.fgColor||''; this.bgColor = this.doc.bgColor||''; this._created = false; }; var p = dynapi.setPrototype('DynDocument','DynElement'); p.getBgColor = function() { return this.bgColor; }; p._remove = function() { this.elm=null; this.doc=null; this.frame=null; }; p.getX = p.getY = p.getPageX = p.getPageY = dynapi.functions.Zero; p.getWidth = function() { if (!this.w) this.findDimensions(); return this.w; }; p.getHeight = function() { if (!this.h) this.findDimensions(); return this.h; }; p.findDimensions = function() { this.w=(dynapi.ua.ns||dynapi.ua.opera)? this.frame.innerWidth : this.elm.clientWidth; this.h=(dynapi.ua.ns||dynapi.ua.opera)? this.frame.innerHeight : this.elm.clientHeight; }; p.setBgColor = function(color) { if (color == null) color=''; if (dynapi.ua.ns4 && color == '') color = '#ffffff'; this.bgColor = color; this.doc.bgColor = color; }; p.setFgColor = function(color) { if (color == null) color=''; if (dynapi.ua.ns4 && color == '') color='#ffffff'; this.fgColor = color; this.doc.fgColor = color; }; p.insertChild = function(c) { if (c.parent == this) { DynElement._flagEvent(c,'precreate'); this.doc.write(c.getOuterHTML()); c._inserted = true; } }; p.insertAllChildren = function() { var str = ''; var c; for (var i=0;i<this.children.length;i++) { c = this.children[i]; DynElement._flagEvent(c,'precreate'); str += c.getOuterHTML(); c._inserted = true; } this.doc.write(str); this.doc.close(); }; p._create = function() { this._created = true; if (dynapi.ua.ns4) { this.css = this.doc; this.elm = this.doc; } else { this.elm = this.frame.document.body; this.css = this.frame.document.body.style; if (dynapi.ua.ie) { this._overflow = this.css.overflow || ''; if (this._cursor) this.css.cursor = this._cursor; } } this.elm._dynobj = this; this.findDimensions(); for (var i=0;i<this.children.length;i++) { if (this.children[i]._inserted) { DynLayer._assignElement(this.children[i]); DynElement._flagEvent(this.children[i],'create'); } else this.children[i]._create(); } this._updateAnchors(); if (this.captureMouseEvents) this.captureMouseEvents(); this.invokeEvent('load'); }; p.destroyAllChildren = function() { for (var i=0;i<this.children.length;i++) { this.children[i]._destroy(); delete this.children[i]; } }; p._destroy = function() { this.destroyAllChildren(); delete DynObject.all; this.elm = null; this.css = null; this.frame = null; }; p._handleResize = function() { var w = this.w; var h = this.h; this.findDimensions(); if (this.w!=w || this.h!=h) { if (dynapi.ua.ns4) { if (this.onResizeNS4=="redraw") { for (var i=0;i<this.children.length;i++) { this.children[i].elm = null; if (this.children[i]._created) { this.children[i]._created = false; this.children[i]._create(); } } this.invokeEvent('resize'); } else if (this.onResizeNS4=="reload") { this.doc.location.href = this.doc.location.href; } } else { this.invokeEvent('resize'); this._updateAnchors(); } } }; p.setCursor = function(c) { if (!c) c = 'default'; if (dynapi.ua.ie && this._cursor!=c) { this._cursor = c; if (this.css) this.css.cursor = c; } }; function main() { if (dynapi.document==null) { dynapi.document = new DynDocument(dynapi.frame); if (dynapi.loaded) dynapi.document._create(); else dynapi.onLoad(function() { dynapi.document._create(); }); } }; if (!dynapi.loaded) main(); --- NEW FILE --- /* DynAPI Distribution DynLayer Class The DynAPI Distribution is distributed under the terms of the GNU LGPL license. requires: dynapi.api.DynDocument */ // to-do: split this file into ns4/ie4 versions, correct dynapi.library definitions to reflect function DynLayer() { this.inherit('DynElement'); var a = arguments; if (a[0]) this.setHTML(a[0]); else this.html = null; this.x = a[1]; this.y = a[2]; this.w = a[3]; this.h = a[4]; this.bgColor = a[5]; this.visible = true; this.z = 1; this.elm = null; this.doc = null; this.css = null; this._saveAnchor = false; this._textSelectable = true; }; var p = dynapi.setPrototype('DynLayer','DynElement'); p._destroy = function() { for (var i=0;i<this.children.length;i++) { this.children[i]._destroy(); } this.removeAllEventListeners(); if (this.elm) this._remove(); DynObject.all[this.id] = null; this.children = null; this.frame = null; this.bgImage = null; this.bgColor = null; this.html = null; this.x = null; this.y = null; this.w = null; this.h = null; this.z = null; this.doc = null; this.css = null; this._dyndoc = null; this.parent = null; }; p._remove = function() { if (this.elm) { if (dynapi.ua.def) { //this.elm.style.visibility = "hidden"; this.elm.innerHTML = ""; this.elm.outerHTML = ""; } else if (dynapi.ua.ns4) { if (!this.parent.doc.recycled) this.parent.doc.recycled=[]; this.parent.doc.recycled[this.parent.doc.recycled.length]=this.elm; this.elm.visibility="hide"; } this.elm = null; this.releaseMouseEvents(); } /*this.frame = null; this.bgImage = null; this.bgColor = null; this.html = null; this.z = null; this.w = null; this.h = null; this.elm = null; this.doc = null; this.css = null;*/ }; if (dynapi.ua.ns4) { p._create = function() { if (this.parent && !this.elm) { DynElement._flagEvent(this,'precreate'); var parentElement = this.parent.isClass('DynLayer')? this.parent.elm : this.parent.frame; var elm = new Layer(this.w||0, parentElement); if (this.w) elm.clip.width = this.w; if (this.h) elm.clip.height = this.h; if (this.x && this.y) elm.moveTo(this.x,this.y); else if (this.x) elm.left = this.x; else if (this.y) elm.top = this.y; if (this.children.length || (this.html!=null && this.html!='')) { elm.document.write(this.getInnerHTML()); elm.document.close(); } if (this.bgColor!=null) elm.document.bgColor = this.bgColor; if (this.clip) { var c = elm.clip, cl = this.clip; c.top=cl[0], c.right=cl[1], c.bottom=cl[2], c.left=cl[3]; } if (this.z) elm.zIndex = this.z; if (this.visible) elm.visibility = 'inherit'; DynLayer._assignElement(this,elm); //if (this.updateLayout) this.updateLayout(); DynElement._flagEvent(this,'create'); } }; DynLayer._assignElement = function(dlyr,elm) { if (!elm) elm = dlyr.parent.doc.layers[dlyr.id]; dlyr.elm = elm; dlyr.css = elm; dlyr.doc = elm.document; dlyr._dyndoc = dlyr.parent._dyndoc; if (dlyr.html!=null && dlyr.html!='' && (dlyr.w==null || dlyr.h==null)) { var cw = (dlyr.w==null)? dlyr.getContentWidth() : null; var ch = (dlyr.h==null)? dlyr.getContentHeight() : null; dlyr.setSize(cw,ch); } if (dlyr.bgImage!=null) dlyr.setBgImage(dlyr.bgImage); for (var i=0; i<dlyr.children.length; i++) { DynLayer._assignElement(dlyr.children[i]); } if (dlyr._hasMouseEvents) dlyr.captureMouseEvents(); }; p.getOuterHTML=function() { var s='\n<layer id="'+this.id+'"'; if (this.visible) s+=' visibility="inherit"'; else s+=' visibility="hide"'; s+=' left='+(this.x!=null? this.x : 0); s+=' top='+(this.y!=null? this.y : 0); if (this.w!=null) s+=' width='+this.w; if (this.h!=null) s+=' height='+this.h; if (this.clip) s+=' clip="'+this.clip[3]+','+this.clip[0]+','+this.clip[1]+','+this.clip[2]+'"'; else s+=' clip="0,0,'+((this.w>=0)?this.w:0)+','+((this.h>=0)?this.h:0)+'"'; if (this.z) s+=' z-index='+this.z; if (this.bgColor!=null) s+=' bgcolor="'+this.bgColor+'"'; s+='>'; s += this.getInnerHTML(); s+='</layer>'; return s; }; p.setLocation = function(x,y) { var cx = (x!=null && x!=this.x); var cy = (y!=null && y!=this.y); if (cx) this.x = x||0; if (cy) this.y = y||0; if (this.css!=null) { if (cx && cy) this.elm.moveTo(this.x, this.y); else if (cx) this.css.left = this.x; else if (cy) this.css.top = this.y; } return (cx||cy); }; p.setPageLocation = function(x,y) { if (this.css) { if (x!=null) { this.css.pageX = x; this.x = this.css.left; } if (y!=null) { this.css.pageY = y; this.y = this.css.top; } return true; } else { if (this.isChild) { if (x!=null) x = x - this.parent.getPageX(); if (y!=null) y = y - this.parent.getPageY(); } return this.setLocation(x,y); } }; p.getPageX = function() {return this.css? this.css.pageX : null}; p.getPageY = function() {return this.css? this.css.pageY : null}; p.setVisible = function(b) { if (b!=this.visible) { this.visible = b; if (this.css) this.css.visibility = b? "inherit" : "hide"; } }; p.setSize = function(w,h) { var cw = (w!=null && w!=this.w); var ch = (h!=null && h!=this.h); if (cw) this.w = w<0? 0 : w; if (ch) this.h = h<0? 0 : h; if (cw||ch) { if (this._updateAnchors) this._updateAnchors(); if (this.css) { if (cw) this.css.clip.width = this.w || 0; if (ch) this.css.clip.height = this.h || 0; if (this.updateLayout) this.updateLayout(); } } return (cw||ch); }; p.setHTML=function(html) { var ch = (html!=null && html!=this.html); if (ch) { this.html = html; if (this.css) { this.doc.open(); this.doc.write(this.html); this.doc.close(); var i; for (i=0;i<this.doc.images.length;i++) this.doc.images[i]._dynobj = this; for (i=0;i<this.doc.links.length;i++) this.doc.links[i]._dynobj = this; } } }; } else { p._create = function() { if (this.parent && !this.elm) { DynElement._flagEvent(this,'precreate'); var elm, parentElement; if (dynapi.ua.ns6) { parentElement = this.parent.elm; var r = parentElement.ownerDocument.createRange(); r.setStartBefore(parentElement); var ptxt = r.createContextualFragment(this.getOuterHTML()); parentElement.appendChild(ptxt); elm = parentElement.lastChild; } else if (dynapi.ua.ie) { parentElement = this.parent.elm; parentElement.insertAdjacentHTML("beforeEnd",this.getOuterHTML()); elm = parentElement.children[parentElement.children.length-1]; } DynLayer._assignElement(this,elm); DynElement._flagEvent(this,'create'); } }; DynLayer._assignElement = function(dlyr,elm) { if (!elm) elm = dynapi.ua.ns6? dlyr.parent.doc.getElementById(dlyr.id) : dlyr.parent.elm.all[dlyr.id]; dlyr.elm = elm; dlyr.css = elm.style; dlyr.doc = dlyr.parent.doc; dlyr.elm.lyrobj = dlyr; dlyr.elm._dynobj = dlyr; dlyr._dyndoc = dlyr.parent._dyndoc; if (dlyr.z && dynapi.ua.ns6) dlyr.css.zIndex = dlyr.z; if (dlyr.html!=null && dlyr.html!='' && (dlyr.w==null || dlyr.h==null)) { var cw = (dlyr.w==null)? dlyr.getContentWidth() : null; var ch = (dlyr.h==null)? dlyr.getContentHeight() : null; dlyr.setSize(cw,ch); } for (var i=0; i<dlyr.children.length; i++) { DynLayer._assignElement(dlyr.children[i]); } if (this._textSelectable==false) elm.onselectstart = dynapi.functions.Disallow; if (dynapi.ua.ie && elm.all.tags("img").length) elm.ondragstart = dynapi.functions.False; if (dlyr._hasMouseEvents) dlyr.captureMouseEvents(); }; p.getOuterHTML=function() { var s='<div id="'+this.id+'" style="'; if (this.visible==false) s+=' visibility:hidden;'; s+=' left:'+(this.x!=null? this.x : 0)+'px;'; s+=' top:'+(this.y!=null? this.y : 0)+'px;'; if (this.w!=null) s+=' width:'+this.w+'px;'; if (this.h!=null) s+=' height:'+this.h+'px;'; if (this.clip) s+=' clip:rect('+this.clip[0]+'px '+this.clip[1]+'px '+this.clip[2]+'px '+this.clip[3]+'px);'; else if (this.w!=null && this.h!=null) s+=' clip:rect(0px '+this.w+'px '+this.h+'px 0px);'; if (this.z) s+=' z-index='+this.z+';'; if (this.bgImage!=null) s+=' background-image:url('+this.bgImage+');'; if (this.bgColor!=null) s+=' background-color:'+this.bgColor+';'; if (dynapi.ua.ie && this.bgImage==null && this.html==null) s+=' background-image:none;'; if (this._cursor!=null) s+=' cursor:'+this._cursor+';'; s+=' position:absolute;">'; s += this.getInnerHTML(); s+='</div>'; return s; }; p.setLocation=function(x,y) { var cx = (x!=null && x!=this.x); var cy = (y!=null && y!=this.y); if (cx) this.x = x||0; if (cy) this.y = y||0; if (this.css!=null) { if (dynapi.ua.ie && dynapi.ua.v>=5) { if (cx) this.css.pixelLeft = this.x; if (cy) this.css.pixelTop = this.y; } else { if (cx) this.css.left = this.x+"px"; if (cy) this.css.top = this.y+"px"; } } return (cx||cy); }; p.setPageLocation = function(x,y) { if (this.isChild) { if (x!=null) x = x - this.parent.getPageX(); if (y!=null) y = y - this.parent.getPageY(); } return this.setLocation(x,y); }; p.getPageX=function() {return (this.isChild)? this.parent.getPageX()+(this.x||0) : this.x||0}; p.getPageY=function() {return (this.isChild)? this.parent.getPageY()+(this.y||0) : this.y||0}; p.setVisible=function(b) { //if (b!=this.visible) { this.visible = b; if (this.css) this.css.visibility = b? "inherit" : "hidden"; //} }; p.setSize = function(w,h) { var cw = (w!=null && w!=this.w); var ch = (h!=null && h!=this.h); if (cw) this.w = w<0? 0 : w; if (ch) this.h = h<0? 0 : h; if (cw||ch) { if (this._updateAnchors) this._updateAnchors(); if (this.css) { if (cw) this.css.width = this.w||0; if (ch) this.css.height = this.h||0; if (cw || ch) this.css.clip = 'rect(0px '+(this.w||0)+'px '+(this.h||0)+'px 0px)'; if (this.updateLayout) this.updateLayout(); } } return (cw||ch); }; if (dynapi.ua.ie) { p.setHTML = function(html) { var ch = (html!=null && html!='' && html!=this.html); if (ch) { this.html = html; if (this.css) { this.elm.innerHTML = html; } } }; } else { p.setHTML=function(html) { var ch = (html!=null && html!=this.html); if (ch) { this.html = html; if (this.css) { var sTmp=(this.w==null)?'<NOBR>'+this.html+'</NOBR>':this.html; while (this.elm.hasChildNodes()) this.elm.removeChild(this.elm.firstChild); var r=this.elm.ownerDocument.createRange(); r.selectNodeContents(this.elm); r.collapse(true); var df=r.createContextualFragment(sTmp); this.elm.appendChild(df); } } }; } } p.setAnchor = function(anchor) { if (anchor == null) { delete this._saveAnchor; if (this.parent && this.parent._childAnchors && this.parent._childAnchors[this.is]) delete this.parent._childAnchors[this.is]; } else if (this.parent) { if (!this.parent._childAnchors) this.parent._childAnchors = {}; var a = this.parent._childAnchors; a[this.id] = anchor; this.parent._updateAnchor(this.id); } else this._saveAnchor = anchor; }; p.setTextSelectable=function(b) { this._textSelectable = b if (dynapi.ua.ie) { if (this.elm) this.elm.onselectstart = b? dynapi.functions.Allow : dynapi.functions.Deny; if (!b) this.setCursor('default'); } if (dynapi.ua.ns4){ this.addEventListener({ onmousemove : function(e) { e.preventDefault(); } }); } // && this.captureMouseEvents && !this._hasMouseEvents) this.captureMouseEvents(); }; p.setX=function(x) {this.setLocation(x,null)}; p.setY=function(y) {this.setLocation(null,y)}; p.getX=function() {return this.x||0}; p.getY=function() {return this.y||0}; p.setPageX = function(x) {this.setPageLocation(x,null)}; p.setPageY = function(y) {this.setPageLocation(null,y)}; p.getVisible=function() {return this.visible}; p.setZIndex=function(z) { if (typeof(z)=="object") { if (z.above) this.z = z.above.z + 1; else if (z.below) this.z = z.below.z - 1; else if (z.topmost && this.parent) { if (this.parent._topZ==null) this.parent._topZ = 10000; this.z = this.parent._topZ++; } } else this.z = z; if (this.css) this.css.zIndex = this.z; }; p.getZIndex=function() {return this.z}; p.getInnerHTML=function() { var s = ''; if (this.html!=null) { if (dynapi.ua.ns4 && this.w==null) s += '<nobr>'+this.html+'</nobr>'; else s += this.html; } for (var i=0;i<this.children.length;i++) s += this.children[i].getOuterHTML(); return s; }; p.getHTML = function() {return this.html}; p.setWidth=function(w) {this.setSize(w,null)}; p.setHeight=function(h) {this.setSize(null,h)}; p.getWidth=function() {return this.w||0}; p.getHeight=function() {return this.h||0}; p.getBgImage=function() {return this.bgImage}; p.getBgColor=function() {return this.bgColor}; p.setCursor = function(c) { if (!c) c = 'default'; if (dynapi.ua.ie && this._cursor!=c) { this._cursor = c; if (this.css) this.css.cursor = c; } }; p.getCursor = function() {return this._cursor}; p.setBgColor=function(c) { if (c==null && !dynapi.ua.ns4) c = 'transparent'; this.bgColor = c; if (this.css) { if (dynapi.ua.ns4) this.doc.bgColor = c; else this.css.backgroundColor = c; } }; p.setBgImage=function(path) { this.bgImage=path; if (this.css) { if (dynapi.ua.ns4) { if (!path) this.setBgColor(this.getBgColor()); else setTimeout(this+'.elm.background.src="'+path+'"',1); } else this.css.backgroundImage='url('+path+')'; } }; p.getContentWidth=function() { if (this.elm==null) return 0; else { if (dynapi.ua.ns4) return this.doc.width; else if (dynapi.ua.ie) { if (dynapi.ua.platform=="mac") return this.elm.offsetWidth; return parseInt(this.elm.scrollWidth); } else { var tw = this.elm.style.width; this.elm.style.width = "auto"; var w = this.elm.offsetWidth; this.elm.style.width = tw; return w; } }; }; p.getContentHeight=function() { if (this.elm==null) return 0; else { if (dynapi.ua.ns4) return this.doc.height; else if (dynapi.ua.ie) { if (dynapi.ua.platform=="mac") return this.elm.offsetHeight; return parseInt(this.elm.scrollHeight); } else { var th = this.elm.style.height; this.elm.style.height = "auto"; var h = this.elm.offsetHeight; this.elm.style.height = th; return h; } } }; p.setClip=function(clip) { var cc=this.getClip(); for (var i=0;i<clip.length;i++) if (clip[i]==null) clip[i]=cc[i]; this.clip=clip; if (this.css==null) return; var c=this.css.clip; if (dynapi.ua.ns4) c.top=clip[0], c.right=clip[1], c.bottom=clip[2], c.left=clip[3]; else this.css.clip="rect("+clip[0]+"px "+clip[1]+"px "+clip[2]+"px "+clip[3]+"px)"; }; p.getClip=function() { if (this.css==null || !this.css.clip) return [0,0,0,0]; var c = this.css.clip; if (c) { if (dynapi.ua.ns4) return [c.top,c.right,c.bottom,c.left]; if (c.indexOf("rect(")>-1) { c=c.split("rect(")[1].split(")")[0].split("px"); for (var i=0;i<c.length;i++) c[i]=parseInt(c[i]); return [c[0],c[1],c[2],c[3]]; } else return [0,this.w,this.h,0]; } }; p.slideTo = function(endx,endy,inc,speed) { if (!this._slideActive) { var x = this.x||0; var y = this.y||0; if (endx==null) endx = x; if (endy==null) endy = y; var distx = endx-x; var disty = endy-y; if (x==endx && y==endy) return; var num = Math.sqrt(Math.pow(distx,2) + Math.pow(disty,2))/(inc||10)-1; var dx = distx/num; var dy = disty/num; this._slideActive = true; this._slide(dx,dy,endx,endy,num,this.x,this.y,1,(speed||20)); } }; p.slideStop = function() { this._slideActive = false; //this.invokeEvent('pathcancel'); }; p._slide = function(dx,dy,endx,endy,num,x,y,i,speed) { if (!this._slideActive) this.slideStop(); else if (i++ < num) { this.invokeEvent('pathrun'); if (this._slideActive) { x += dx; y += dy; this.setLocation(Math.round(x),Math.round(y)); setTimeout(this+'._slide('+dx+','+dy+','+endx+','+endy+','+num+','+x+','+y+','+i+','+speed+')',speed); } else this.slideStop(); } else { this._slideActive = false; this.invokeEvent('pathrun'); this.setLocation(endx,endy); this.invokeEvent('pathfinish'); } }; --- NEW FILE --- /* DynAPI Distribution DynEvent, EventObject, DynElement Classes The DynAPI Distribution is distributed under the terms of the GNU LGPL license. */ function DynEvent(type,src) { this.inherit('DynObject'); this.type = type; this.src = src; this.origin = src; this.propagate = true; this.bubble = false; this.bubbleChild = null; this.defaultValue = true; }; var p = dynapi.setPrototype('DynEvent','DynObject'); p.getType = function() {return this.type}; p.getSource = function() {return this.src}; p.getOrigin=function() {return this.origin}; p.stopPropagation = function() {this.propagate = false}; p.preventBubble = function() {this.bubble = false}; p.preventDefault = function() {this.defaultValue = false}; p.getBubbleChild = function() {return this.bubbleChild}; function EventObject() { this.inherit('DynObject'); this._listeners = []; } p = dynapi.setPrototype('EventObject','DynObject'); p.addEventListener = function(el) { if (el) { for (var i=0;i<this._listeners.length;i++) if (this._listeners[i]==el) return; this._listeners[this._listeners.length] = el; if (this.captureMouseEvents) { if (this._created && !this._hasMouseEvents && (el.onmousedown || el.onmouseup || el.onmouseover || el.onmouseout || el.onclick || el.ondblclick)) { this.captureMouseEvents(); } else this._hasMouseEvents = true; } } }; p.removeEventListener = function(el) { if (el) { DynAPI.functions.removeFromArray(this._listeners, el, false); if (!this._listeners.length && this.releaseMouseEvents && this.getClassName()!='DynDocument') this.releaseMouseEvents(); } }; p.removeAllEventListeners = function() { this._listeners = []; }; p.invokeEvent = function(type,e,args) { if (!e) e = new DynEvent(type,this); e.src = this; e.type = type; if (this._listeners.length) for (var i=0;i<this._listeners.length;i++) { if (this._listeners[i]["on"+type]) this._listeners[i]["on"+type](e,args); if (!e.propagate) break; } if (this["on"+type]) this["on"+type](e,args); if (e.bubble && this.parent) { //if ((type=="mouseover" || type=="mouseout") && e._relative==this.parent) return; e.x += this.x; e.y += this.y; e.bubbleChild = this; this.parent.invokeEvent(type,e,args); } }; function DynElement() { this.inherit('EventObject'); this.isChild = false; this._created = false; this.parent = null; this._dyndoc = null; this.children = []; this._childAnchors = []; }; p = dynapi.setPrototype('DynElement','EventObject'); p.addChild = function(c) { if (!c) return dynapi.debug.print("Error: no object sent to [DynLayer].addChild()"); if (c.isChild) c.removeFromParent(); c.isChild = true; c.parent = this; if (c._saveAnchor) { c.setAnchor(c._saveAnchor); delete c._saveAnchor; } if (this._created) c._create(); this.children[this.children.length] = c; return c; }; p.removeChild = function(c) { var l = this.children.length; for (var i=0;i<l && this.children[i]!=c;i++); if (i!=l) { c._remove(); c._created = false; c.isChild = false; c.parent = null; c.dyndoc = null; this.children[i] = this.children[l-1]; this.children[l-1] = null; this.children.length--; } }; p.deleteChild = function(c) { c.removeFromParent(); c._delete(); }; p.deleteAllChildren = function() { var l = this.children.length; for(var i=0;i<l;i++) { this.children[i].del(); delete this.children[i]; } this.children = []; }; p.deleteFromParent = function () { if (this.parent) this.parent.deleteChild(this); }; p.removeFromParent = function () { if (this.parent) this.parent.removeChild(this); }; p._create = p._remove = p._delete = p._destroy = dynapi.functions.Null; p.getChildren = function() {return this.children} p.getAllChildren = function() { var ret = []; var temp; var l = this.children.length; for(var i=0;i<l;i++) { ret[this.children[i].id] = this.children[i]; temp = this.children[i].getAll(); for(var j in temp) ret[j] = temp[j]; } return ret }; p.getParents = function(l) { if (l==null) l = []; if (this.parent) { l[l.length] = this.parent; l = this.parent.getParents(l); } return l; }; p.isParentOf = function(c) { if (c) { var p = c.getParents(); for (var i=0;i<p.length;i++) { if (p[i]==this) return true; } } return false; }; p.isChildOf = function(p) { if (!p) return false; return p.isParentOf(this); }; DynElement._flagEvent = function(c,type) { if (type=="create") c._created = true; c.invokeEvent(type); for (var i=0; i<c.children.length; i++) { DynElement._flagEvent(c.children[i],type); } }; p.updateAnchor = function() { this.parent._updateAnchor(this.id); }; p._updateAnchor = function(id) { if (!id) return; var dlyr = DynObject.all[id]; var a = this._childAnchors[id]; var tw = this.w; var th = this.h; if (tw==null && th==null) return; var x = a.left; var y = a.top; var w = null; var h = null; if (a.centerH!=null) { x = Math.ceil(tw/2 - dlyr.getWidth()/2 + a.centerH); } else if (a.right!=null) { if (a.left!=null) w = tw - a.right - a.left; else x = tw - dlyr.getWidth() - a.right; } if (a.centerV!=null) { y = Math.ceil(th/2 - dlyr.getHeight()/2 + a.centerV); } else if (a.bottom!=null) { if (a.top!=null) h = th - a.bottom - a.top; else y = th - dlyr.getHeight() - a.bottom; } dlyr.setLocation(x,y); dlyr.setSize(w,h); }; p._updateAnchors = function() { var tw = this.w; var th = this.h; if (tw==null && th==null) return; for (id in this._childAnchors) this._updateAnchor(id); }; --- NEW FILE --- /* DynAPI Distribution MouseEvent Class The DynAPI Distribution is distributed under the terms of the GNU LGPL license. requires: dynapi.api.DynDocument */ function MouseEvent(dyndoc) { this.inherit('DynEvent'); this.bubble = true; this._mouseEvent = null; this._relative = null; this._dyndoc = dyndoc; }; var p = dynapi.setPrototype('MouseEvent','DynEvent'); p.getX = function() {return this.x}; p.getY = function() {return this.y}; p.getPageX = function() {return this.pageX}; p.getPageY = function() {return this.pageY}; p.trapMouseUp = dynapi.functions.Null; p.getRelative = function() {return this._relative}; p.preventBubble = function() {this.bubble = false;}; p.getButton = function() { if (!this._mouseEvent) return "left"; var b = this._mouseEvent.button; if (b==4) return "middle"; if (b==2) return "right"; else return "left"; }; p._init = function(type,e,src) { this.type = type; this._mouseEvent = e; this.origin = src; this.bubbleChild = null; this.defaultValue = true; this.bubble = true; }; p._invoke = function() { var o = this.origin; o.invokeEvent(this.type,this); }; MouseEvent._getContainerLayerOf = function(element) { if (!element) return null; while (!element._dynobj && element.parentElement && element.parentElement!=element) { element = element.parentElement; } return element._dynobj; }; MouseEvent._eventHandler = function() { var dynobj = this._dynobj; if (!dynobj) return true; var dyndoc = dynobj._dyndoc; var e = dyndoc.frame.event; var target = e.srcElement; var me = dyndoc._mouseEvent; var src = MouseEvent._getContainerLayerOf(target); me._init(e.type,e,src); var rel = e.type=="mouseout"? e.toElement : e.fromElement; var r = me._relative = MouseEvent._getContainerLayerOf(rel); if (e.type=="mouseout" || e.type=="mouseover") { if (r&&src.isParentOf(r)) return; if (r&&(r==src.parent||r.isChildOf(src.parent))) me.bubble=false; } me.pageX = e.clientX; me.pageY = e.clientY; me.x = me.pageX - src.getPageX(); //offsetX; me.y = me.pageY - src.getPageY(); //offsetY; e.cancelBubble = true; me._invoke(); }; DynElement.prototype.captureMouseEvents = function() { this._hasMouseEvents = true; if (this.elm) { var elm = (this.getClassName()=='DynDocument')? this.doc : this.elm; elm.onmouseover = elm.onmouseout = elm.onmousedown = elm.onmouseup = elm.onclick = elm.ondblclick = elm.onmousemove = MouseEvent._eventHandler; } }; DynElement.prototype.releaseMouseEvents = function() { this._hasMouseEvents = false; if (this.elm) { var elm = (this.getClassName()=='DynDocument')? this.doc : this.elm; elm.onmousedown = elm.onmouseup = elm.onclick = elm.ondblclick = null; } }; function main() { dynapi.document._mouseEvent = new MouseEvent(dynapi.document); } if (!dynapi.loaded) main(); --- NEW FILE --- /* DynAPI Distribution MouseEvent Class The DynAPI Distribution is distributed under the terms of the GNU LGPL license. requires: dynapi.api.DynDocument */ function MouseEvent(dyndoc) { this.inherit('DynEvent'); this.bubble = true; this._browserEvent = null; this._relative = null; this._dyndoc = dyndoc; }; var p = dynapi.setPrototype('MouseEvent','DynEvent'); p.getX = function() {return this.x}; p.getY = function() {return this.y}; p.getPageX = function() {return this.pageX}; p.getPageY = function() {return this.pageY}; p.trapMouseUp = dynapi.functions.Null; p.getRelative = function() {return this._relative}; p.getButton = function() { if (!this._browserEvent) return "left"; var b = this._browserEvent.which; if (b==2) return "middle"; if (b==3) return "right"; else return "left"; }; p._init = function(type,e,src) { this.type = type; this._browserEvent = e; this.origin = src; this.bubbleChild = null; this.pageX = e.pageX-this._dyndoc.frame.pageXOffset; this.pageY = e.pageY-this._dyndoc.frame.pageYOffset; if (e.target._dynobj == src) { this.x = e.layerX; this.y = e.layerY; } else { this.x = e.pageX - (src.pageX||0); this.y = e.pageY - (src.pageY||0); } this.defaultValue = true; this.bubble = true; }; p._invoke = function() { var o = this.origin; if (this.type=='mousedown' && o._textSelectable==false) this.defaultValue = false; o.invokeEvent(this.type,this); // synthetic click event if (this.type=='mouseup') { this._init('click',this._browserEvent,o); this._invoke(); // synthetic dblclick event if (dynapi.ua.other); } }; function main() { dynapi.document._mouseEvent = new MouseEvent(dynapi.document); } if (!dynapi.loaded) main(); MouseEvent._docMoveHandler = function(e) { var dyndoc = this._dynobj; var src = e.target; var dynobj = src._dynobj || src._dynobji; if (!dynobj) { dyndoc._moveOver = null; return true; } var me = dyndoc._mouseEvent; //dynapi.debug.status('move '+dynobj.name+' '+e.layerX+' '+e.layerY); me._init('mousemove',e,dynobj); me._invoke(); var defaultVal = me.defaultValue; // synthetic mouseover/out events if (dyndoc._moveOver!=dynobj) { var rel = dyndoc._moveOver; var bubble = true; // mouse out if (rel) { // && !rel.isChildOf(dynobj) // during mouseout e.getRelated() is which elm it is moving to //bubble = !dynobj.isChildOf(rel); me._init('mouseout',e,rel); me._relative = dynobj; me._invoke(); //MouseEvent._generateEvent('mouseout',e,me,rel,dynobj,bubble); // out occurs before over } // mouse over dyndoc._moveOver = dynobj; //if (rel) var bubble = !rel.isChildOf(dynobj); //var bubble = !dynobj.isChildOf(rel); // during mouseover e.getRelated() is which elm it is moving to me._init('mouseover',e,dynobj); me._relative = rel; me._invoke(); //MouseEvent._generateEvent('mouseover',e,me,dynobj,rel); } return defaultVal; } MouseEvent._eventHandler = function(e) { var src = e.target; var dynobj = this._dynobj; if (!dynobj) return true; var dyndoc = dynobj._dyndoc; var me = dyndoc._mouseEvent; me._wasHandled = false; var r = routeEvent(e); if (!me._wasHandled) { if (src._dynobji) { // src._dynobji == dynlayer.doc.images[x]._dynobji me._init(e.type,e,src._dynobji); if (e.type=='mousedown') me.defaultValue = false; me._invoke(); } else if (src._dynobj) { // src._dynobj == dynlayer.doc._dynobj me._init(e.type,e,src._dynobj); me._invoke(); } else { // dynobj == dynlayer.elm._dynobj me._init(e.type,e,dynobj); me._invoke(); } me._wasHandled = true; } return me.defaultValue; }; DynElement.prototype.captureMouseEvents = function() { this._hasMouseEvents = true; var elm = this.elm; if (elm) { elm.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP | Event.DBLCLICK); elm.onmousedown = elm.onmouseup = elm.ondblclick = MouseEvent._eventHandler; if (this.getClassName()=='DynDocument') { // move/over/out events are generated from the document this.doc.captureEvents(Event.MOUSEMOVE); elm.onmousemove = MouseEvent._docMoveHandler; } elm._dynobj = this; this.doc._dynobj = this; for (var i=0;i<this.doc.images.length;i++) this.doc.images[i]._dynobji=this; for (var i=0;i<this.doc.links.length;i++) this.doc.links[i]._dynobj=this; } }; DynElement.prototype.releaseMouseEvents = function() { this._hasMouseEvents = false; var elm = this.elm; if (elm) { elm.releaseEvents(Event.MOUSEDOWN | Event.MOUSEUP | Event.DBLCLICK); elm.onmousedown = elm.onmouseup = elm.ondblclick = null; if (this.getClassName()=='DynDocument') { elm.releaseEvents(Event.MOUSEMOVE); elm.onmousemove = null; } elm._dynobj = null; this.doc._dynobj = null; for (var i=0;i<this.doc.images.length;i++) this.doc.images[i]._dynobji=null; for (var i=0;i<this.doc.links.length;i++) this.doc.links[i]._dynobj=null; } }; --- NEW FILE --- /* DynAPI Distribution MouseEvent Class The DynAPI Distribution is distributed under the terms of the GNU LGPL license. requires: dynapi.api.DynDocument */ function MouseEvent(dyndoc) { this.inherit('DynEvent'); this.bubble = true; this._mouseEvent = null; this._relative = null; this._dyndoc = dyndoc; }; var p = dynapi.setPrototype('MouseEvent','DynEvent'); p.getX = function() {return this.x}; p.getY = function() {return this.y}; p.getPageX = function() {return this.pageX}; p.getPageY = function() {return this.pageY}; p.trapMouseUp = dynapi.functions.Null; p.getRelative = function() {return this._relative}; p.preventBubble = function() { this.bubble = false; }; p.getButton = function() { if (!this._mouseEvent) return "left"; var b = this._mouseEvent.which; if (b==2) return "middle"; if (b==3) return "right"; else return "left"; }; p._init = function(type,e,src) { this.type = type; this._mouseEvent = e; this.origin = src; this.bubbleChild = null; this.defaultValue = true; this.bubble = true; }; p._invoke = function() { var o = this.origin; o.invokeEvent(this.type,this); }; MouseEvent._getContainerLayerOf = function(element) { if (!element) return null; while (!element._dynobj && element.parentNode && element.parentNode!=element) { element = element.parentNode; } return element._dynobj; }; MouseEvent._eventHandler = function(e) { var dynobj = this._dynobj; if (!dynobj) return true; var dyndoc = dynobj._dyndoc; var target = e.target; var me = dyndoc._mouseEvent; var src = MouseEvent._getContainerLayerOf(target); me._init(e.type,e,src); var rel = e.relatedTarget; var r = me._relative = MouseEvent._getContainerLayerOf(rel); if (e.type=="mouseout" || e.type=="mouseover") { if (r&&src.isParentOf(r)) return; if (r&&(r==src.parent||r.isChildOf(src.parent))) me.bubble=false; } me.pageX = e.clientX; me.pageY = e.clientY; me.x = me.pageX - src.getPageX(); //offsetX; me.y = me.pageY - src.getPageY(); //offsetY; e.cancelBubble = true; me._invoke(); }; DynElement.prototype.captureMouseEvents = function() { this._hasMouseEvents = true; var elm = (this.getClassName()=='DynDocument')? this.doc : this.elm; elm.addEventListener("mousemove",MouseEvent._eventHandler,false); elm.addEventListener("mousedown",MouseEvent._eventHandler,false); elm.addEventListener("mouseup",MouseEvent._eventHandler,false); elm.addEventListener("mouseover",MouseEvent._eventHandler,false); elm.addEventListener("mouseout",MouseEvent._eventHandler,false); elm.addEventListener("click",MouseEvent._eventHandler,false); elm.addEventListener("dblclick",MouseEvent._eventHandler,false); }; DynElement.prototype.releaseMouseEvents=function() { this._hasMouseEvents = false; var elm = (this.getClassName()=='DynDocument')? this.doc : this.elm; elm.removeEventListener("mousemove",MouseEvent._eventHandler,false); elm.removeEventListener("mousedown",MouseEvent._eventHandler,false); elm.removeEventListener("mouseup",MouseEvent._eventHandler,false); elm.removeEventListener("mouseover",MouseEvent._eventHandler,false); elm.removeEventListener("mouseout",MouseEvent._eventHandler,false); elm.removeEventListener("click",MouseEvent._eventHandler,false); elm.removeEventListener("dblclick",MouseEvent._eventHandler,false); }; function main() { dynapi.document._mouseEvent = new MouseEvent(dynapi.document); } if (!dynapi.loaded) main(); |
From: Robert R. <rai...@us...> - 2002-04-10 18:31:30
|
Update of /cvsroot/dynapi/dynapi2x/src In directory usw-pr-cvs1:/tmp/cvs-serv19326/src Added Files: dynapi.js Log Message: initial import |
From: Robert R. <rai...@us...> - 2002-04-10 18:31:21
|
Update of /cvsroot/dynapi/dynapi2x/src/gui In directory usw-pr-cvs1:/tmp/cvs-serv17931/gui Log Message: Directory /cvsroot/dynapi/dynapi2x/src/gui added to the repository |
From: Robert R. <rai...@us...> - 2002-04-10 18:31:11
|
Update of /cvsroot/dynapi/dynapi2x/src/fx In directory usw-pr-cvs1:/tmp/cvs-serv19326/src/fx Added Files: bezier.js circleanim.js hoveranim.js imganim.js motionx.js pathanim.js pathanim_glide.js pathanim_slide.js thread.js timerx.js Log Message: initial import --- NEW FILE --- // Bezier Algorithm Reference: http://astronomy.swin.edu.au/~pbourke/curves/bezier/ function Bezier(cp, n) { var l = cp.length; var p = []; for (var i=0; i<n; i++) p = p.concat(Bezier._plot(cp,i/n)); return p.concat([cp[l-2],cp[l-1]]); } Bezier._plot = function (cp, mu) { var n = (cp.length/2)-1; var k,kn,nn,nkn; var blend; var b = [0,0]; var muk = 1; var munk = Math.pow(1-mu, n); for (k=0;k<=n;k++) { nn = n; kn = k; nkn = n - k; blend = muk * munk; muk *= mu; munk /= (1-mu); while (nn >= 1) { blend *= nn; nn--; if (kn > 1) { blend /= kn; kn--; } if (nkn > 1) { blend /= nkn; nkn--; } } b[0] += cp[k*2] * blend; b[1] += cp[k*2+1] * blend; } b[0] = Math.round(b[0]); b[1] = Math.round(b[1]); return b; } /*function Bezier3(cp,mu) { var x1=cp[0],y1=cp[1],x2=cp[2],y2=cp[3],x3=cp[4],y3=cp[5]; var mu2 = mu * mu; var mum1 = 1 - mu; var mum12 = mum1 * mum1; var x = Math.round(x1 * mum12 + 2 * x2 * mum1 * mu + x3 * mu2); var y = Math.round(y1 * mum12 + 2 * y2 * mum1 * mu + y3 * mu2); return [x,y]; } function Bezier4(cp,mu) { var x1=cp[0],y1=cp[1],x2=cp[2],y2=cp[3],x3=cp[4],y3=cp[5],x4=cp[6],y4=cp[7]; var mum1 = 1 - mu; var mum13 = mum1 * mum1 * mum1; var mu3 = mu * mu * mu; var x = Math.round(mum13*x1 + 3*mu*mum1*mum1*x2 + 3*mu*mu*mum1*x3 + mu3*x4); var y = Math.round(mum13*y1 + 3*mu*mum1*mum1*y2 + 3*mu*mu*mum1*y3 + mu3*y4); return [x,y]; }*/ --- NEW FILE --- /* DynAPI Distribution CircleAnimation Class The DynAPI Distribution is distributed under the terms of the GNU LGPL license. requires: PathAnimation */ // You must add this to the DynAPI library if you want to include it via dynapi.library.include('CircleAnimation'); // dynapi.library.add('dynapi.fx.CircleAnimation','circleanim.js',['Thread','dynapi.functions']); function CircleAnimation(dlyr) { this.inherit('Thread',dlyr); this.offsetX = 0; this.offsetY = 0; this.playing = false; this.radius = 100; this.angle = 0; this.setAngleIncrement(10); } dynapi.setPrototype('CircleAnimation','Thread'); CircleAnimation.prototype.setRadius = function (r) { this.hradius = this.vradius = r; }; CircleAnimation.prototype.setHRadius = function (r) { this.hradius = r; }; CircleAnimation.prototype.setVRadius = function (r) { this.vradius = r; }; CircleAnimation.prototype.setAngle = function (a) { this.angle = dynapi.functions.degreeToRadian(a); }; CircleAnimation.prototype.setAngleIncrement = function (inc) { this.angleinc = dynapi.functions.degreeToRadian(inc); }; CircleAnimation.prototype.playAnimation = function () { this.playing = true; if (this.dlyr!=null) { this.offsetX = this.hradius*Math.cos(this.angle); this.offsetY = -this.vradius*Math.sin(this.angle); this.baseX = this.dlyr.x-this.offsetX; this.baseY = this.dlyr.y+this.offsetY; this.dlyr.invokeEvent("circlestart"); } this.start(); }; CircleAnimation.prototype.stopAnimation = function () { this.playing = false; this.stop(); if (this.dlyr!=null) this.dlyr.invokeEvent("circlestop"); }; CircleAnimation.prototype.run = function () { if (!this.playing || this.dlyr==null) return; this.angle += this.angleinc; this.offsetX = this.hradius*Math.cos(this.angle); this.offsetY = -this.vradius*Math.sin(this.angle); if (this.dlyr!=null) { this.dlyr.invokeEvent("circlerun"); this.dlyr.moveTo(this.baseX+this.offsetX,this.baseY+this.offsetY); } }; CircleAnimation.prototype.reset = function () { this.angle = this.offsetX = this.offsetY = 0; }; CircleAnimation.prototype.generatePath = function(centerX,centerY) { if (centerX==null) centerX = this.dlyr!=null? this.dlyr.x : 0; if (centerY==null) centerY = this.dlyr!=null? this.dlyr.y : 0; var path = []; var i = 0; /* for (var a=this.angle;a<=this.angle+Math.PI*2;a+=this.angleinc) { path[i] = Math.round(centerX + this.hradius*Math.cos(a)); path[i+1] = Math.round(centerY - this.vradius*Math.sin(a)); i+=2; }*/ if (this.angleinc>0) for (var a=this.angle;a<=this.angle+Math.PI*2;a+=this.angleinc) { path[i] = Math.round(centerX + this.hradius*Math.cos(a)); path[i+1] = Math.round(centerY - this.vradius*Math.sin(a)); i+=2; } else for (var a=this.angle;a>=this.angle-Math.PI*2;a+=this.angleinc) { path[i] = Math.round(centerX + this.hradius*Math.cos(a)); path[i+1] = Math.round(centerY - this.vradius*Math.sin(a)); i+=2; } return path; }; --- NEW FILE --- /* DynAPI Distribution HoverAnimation Class The DynAPI Distribution is distributed under the terms of the GNU LGPL license. requires: PathAnimation */ // You must add this to the DynAPI library if you want to include it via dynapi.library.include('HoverAnimation'); // dynapi.library.add('HoverAnimation','hoveranim.js','Thread','dynapi.fx'); function HoverAnimation(dlyr) { this.Thread = Thread; this.Thread(dlyr); this.offsetX = 0; this.offsetY = 0; this.playing = false; this.amplitude = 100; this.angle = 0; this.setAngleIncrement(10); } HoverAnimation.prototype = new Thread; HoverAnimation.prototype.setAmplitude = function (amp) { this.amplitude = amp; }; HoverAnimation.prototype.setAngle = function (a) { this.angle = PathAnimation.degreeToRadian(a); }; HoverAnimation.prototype.setAngleIncrement = function (inc) { this.angleinc = PathAnimation.degreeToRadian(inc); }; HoverAnimation.prototype.playAnimation = function () { this.playing = true; if (this.dlyr!=null) { this.offsetX = 0; this.offsetY = this.amplitude*Math.sin(this.angle); this.baseX = this.dlyr.x; this.baseY = this.dlyr.y+this.offsetY; this.dlyr.invokeEvent("hoverstart"); } this.start(); }; HoverAnimation.prototype.stopAnimation = function () { this.playing = false; this.stop(); if (this.dlyr!=null) this.dlyr.invokeEvent("hoverstop"); }; HoverAnimation.prototype.run = function () { if (!this.playing || this.dlyr==null) return; this.angle += this.angleinc; this.offsetX = 0; this.offsetY = this.amplitude*Math.sin(this.angle); if (this.dlyr!=null) { this.dlyr.invokeEvent("hoverrun"); this.dlyr.moveTo(this.baseX+this.offsetX,this.baseY+this.offsetY); } }; HoverAnimation.prototype.reset = function () { this.angle = this.offsetX = this.offsetY = 0; }; HoverAnimation.prototype.generatePath = function(centerX,centerY) { // to do }; --- NEW FILE --- /* DynAPI Distribution ImageAnimation Class The DynAPI Distribution is distributed under the terms of the GNU LGPL license. requires: Thread */ function ImageAnimation(dynimage) { this.Thread = Thread; this.Thread(dynimage); this.imgAnim = new Array(); this.imgAnim.playing = null; } ImageAnimation.prototype = new Thread; ImageAnimation.prototype.addAnimation = function (imgArray) { var animNum = this.imgAnim.length; this.imgAnim[animNum] = imgArray; this.imgAnim[animNum].loops = false; this.imgAnim[animNum].resets = false; this.imgAnim[animNum].frame = 0; this.imgAnim[animNum].playing = true; this.imgAnim[animNum].direction = 0; this.imgAnim[animNum].alternates = false; return animNum; }; ImageAnimation.prototype.getFrame = function (animNum,frameNum) { return this.imgAnim[animNum][frameNum]; }; ImageAnimation.prototype.setLoops = function (animNum,loop) { this.imgAnim[animNum].loops = loop; }; ImageAnimation.prototype.setResets = function (animNum) { this.imgAnim[animNum].resets = true; }; ImageAnimation.prototype.setAlternates = function (animNum,alt) { this.imgAnim[animNum].loops = true; this.imgAnim[animNum].alternates = alt; }; ImageAnimation.prototype.playAnimation = function (animNum) { if (animNum!=null && this.imgAnim.playing!=animNum) { this.playing = true; this.imgAnim.playing = animNum; if (this.dlyr!=null) this.dlyr.invokeEvent("imgstart"); this.start(); } }; ImageAnimation.prototype.stopAnimation = function () { this.imgAnim.playing = null; this.playing = false; this.stop(); if (this.dlyr!=null) this.dlyr.invokeEvent("imgrun"); }; ImageAnimation.prototype.run = function () { if (!this.playing || this.imgAnim.playing==null || this.dlyr==null) return; var anim = this.imgAnim[this.imgAnim.playing]; if (anim.frame==0 && this.img==anim[anim.frame]) { anim.frame++; // skip 1st frame if same } if (this.dlyr!=null) this.dlyr.invokeEvent("imgrun"); this.dlyr.setImage(anim[anim.frame]); if (anim.frame>=anim.length-1) { if (anim.loops) { if (anim.alternates && anim.direction==0 && anim.frame==anim.length-1) { anim.direction = 1; anim.frame = anim.length-2; } else anim.frame = 0; } else if (anim.resets) { anim.frame = 0; this.stop() } else { this.stop() } } else { if (anim.alternates) { if (anim.frame==0 && anim.direction==1) { anim.direction = 0; anim.frame = 1; } else if (anim.direction==0) { anim.frame++; } else if (anim.direction==1) { anim.frame--; } } else { anim.frame++; } } }; --- NEW FILE --- /* DynAPI Distribution MotionX Class by Raymond Irving (xw...@ya...) The DynAPI Distribution is distributed under the terms of the GNU LGPL license. requires: Dynlayer */ DynLayer.prototype.makeSolid=function(){ this.isHard=true this._collideX=this.x this._collideY=this.x this.collideEvent ={ onmove:function(e) { var me=e.getSource() var dirX='',dirY='' // get direction if (me._collideX!=me.x) { if (me._collideX<me.x){dirX="E"}else{dirX="W"} } if (me._collideY!=me.y){ if (me._collideY<me.y){dirY="S"}else{dirY="N"} } // get angle direction me._setCollideAngleDirection(me._collideX,me._collideY,me.x,me.y) me._collideX=me.x; me._collideY=me.y; me._collideDirection=dirY+dirX; me._checkForCollision(); } } this.addEventListener(this.collideEvent) } DynLayer.prototype._setLocation=DynLayer.prototype.setLocation; DynLayer.prototype.setLocation=function(x,y) { this._setLocation(x,y); this.invokeEvent('move'); } DynLayer.prototype._setCollideAngleDirection = function(x1,y1,x2,y2) { var distx = (x2-x1),disty = (y1-y2),angle; //if (distx==0 && disty==0) return 0; var rad=Math.abs(Math.atan2(disty,distx)) if (disty>=0) { if (distx>=0) angle = 90-(rad*180/Math.PI) else angle = 270+(180-(rad*180/Math.PI)); }else{ angle = 90+(rad*180/Math.PI) } this._collideAngle=Math.ceil(angle); }; DynLayer.prototype._checkForCollision=function(){ if (!this.parent.children.length>0) return false; var ch,chX,sX,sY,colX1,colX2,colY1,colY2,n1,n2; this.collideObject==null for (var i in this.parent.children) { ch=this.parent.children[i]; if (ch!=this && ch.isHard==true) { chX=ch.x; chY=ch.y; sX=this.x; sY=this.y; colX1=(sX>=chX && sX<=chX+ch.w) colX2=(chX>=sX && chX<=sX+this.w) colY1=(sY>=chY && sY<=chY+ch.h) colY2=(chY>=sY && chY<=sY+this.h) if ((colX1 || colX2) && (colY1 || colY2)) { if (this._collideDirection=='NE') { n1=((chY+ch.h)-this.y);n2=((sX+this.w)-chX) if (n1<n2) {face="S"}else{face="W"} }else if (this._collideDirection=='NW') { n1=((chY+ch.h)-this.y);n2=((chX+ch.w)-sX) if (n1<n2) {face="S"}else{face="E"} }else if (this._collideDirection=='SE') { n1=((sY+this.h)-ch.y);n2=((sX+this.w)-chX) if (n1<n2) {face="N"}else{face="W"} }else if (this._collideDirection=='SW') { n1=((sY+this.h)-ch.y);n2=((chX+ch.w)-sX) if (n1<n2) {face="N"}else{face="E"} }else if (this._collideDirection=='E') { face="W" }else if (this._collideDirection=='W') { face="E" }else if (this._collideDirection=='N') { face="S" }else if (this._collideDirection=='S') { face="N" } ch._impactSide=face if (face=="W"){this._impactSide="E"} if (face=="E"){this._impactSide="W"} if (face=="N"){this._impactSide="S"} if (face=="S"){this._impactSide="N"} this._collideObject=ch this.invokeEvent("collide"); ch._collideObject=this ch.invokeEvent("collide"); } } } return false; }; DynLayer.prototype.getImpactSide=function(){ return this._impactSide; } DynLayer.prototype.getObstacle=function(){ return this._collideObject; } DynLayer.prototype.getDirection=function(){ return this._collideDirection; } DynLayer.prototype.getDirectionAngle=function(){ return this._collideAngle; } --- NEW FILE --- /* DynAPI Distribution PathAnimation Class The DynAPI Distribution is distributed under the terms of the GNU LGPL license. requires: dynapi.fx.Thread */ function PathAnimation(dlyr) { this.inherit('Thread',dlyr); this.paths = new Array(); this.pathPlaying = null; } var p = dynapi.setPrototype('PathAnimation','Thread'); p.add = function (path, loops, resets) { var n = this.paths.length; this.paths[n] = path; this.setLoops(n,loops); this.setResets(n,resets); this.setFrame(n,0); return n; }; p.setLoops = function (n, loops) { this.paths[n].loops = (loops); }; p.setResets = function (n, resets) { this.paths[n].resets = (resets); }; p.setFrame = function (n, frame) { this.paths[n].frame = frame; }; p.play = function (noevt) { if (!this.playing) { this.pathPlaying = null; if (arguments[0]==null) arguments[0] = 0; if (typeof(arguments[0]) == "number") { this.pathPlaying = this.paths[arguments[0]]; } else if (typeof(arguments[0]) == "object") { this.pathPlaying = arguments[0]; this.pathPlaying.loops = arguments[1]||false; this.pathPlaying.resets = arguments[2]||false; this.pathPlaying.frame = 0; } this.playing = true; if (this.dlyr!=null && noevt!=false) this.dlyr.invokeEvent("pathstart"); this.start(); } }; p._Thread_stop = Thread.prototype.stop; p.stop = function (noevt) { if (this.pathPlaying && this.pathPlaying.resets && !this.cancelThread && this.dlyr!=null) this.dlyr.setLocation(this.pathPlaying[0],this.pathPlaying[1]); this._Thread_stop(); this.pathPlaying = null; this.playing = false; if (this.dlyr!=null && noevt!=false) this.dlyr.invokeEvent("pathcancel"); }; p.run = function () { if (!this.playing || this.pathPlaying==null) return; var anim = this.pathPlaying; if (anim.frame>=anim.length/2) { if (anim.loops) { anim.frame = 0; } else if (anim.resets) { anim.frame = 0; if (this.dlyr!=null) this.dlyr.setLocation(anim[0],anim[1]); this.stop(); this.dlyr.invokeEvent("pathfinish"); return; } else { anim.frame = 0; this.stop(); this.dlyr.invokeEvent("pathfinish"); return; } } if (anim.frame==0 && (this.dlyr!=null && this.dlyr.x==anim[0] && this.dlyr.y==anim[1])) { anim.frame += 1; } this.newX = anim[anim.frame*2]; this.newY = anim[anim.frame*2+1]; if (this.dlyr!=null) { this.dlyr.invokeEvent("pathrun"); this.dlyr.setLocation(this.newX,this.newY); } anim.frame++; }; // Path Functions // Combines separate [x1,x2],[y1,y2] arrays into a path array [x1,y1,x2,y2] /*PathAnimation.interlace = function(x,y) { var l = Math.max(x.length,y.length); var a = new Array(l*2); for (var i=0; i<l; i++) { a[i*2] = x[i]; a[i*2+1] = y[i]; } return a; }; // Returns correct angle in radians between 2 points PathAnimation.getNormalizedAngle = function(x1,y1,x2,y2) { var distx = Math.abs(x1-x2); var disty = Math.abs(y1-y2); if (distx==0 && disty==0) angle = 0; else if (distx==0) angle = Math.PI/2; else angle = Math.atan(disty/distx); if (x1<x2) { if (y1<y2) angle = Math.PI*2-angle; } else { if (y1<y2) angle = Math.PI+angle; else angle = Math.PI-angle; } return angle; }; */ --- NEW FILE --- /* DynAPI Distribution Glide Animation Extension The DynAPI Distribution is distributed under the terms of the GNU LGPL license. requires: PathAnimation */ // To use on a DynLayer: // dlyr.addMethod("glideTo",PathAnimation.glideTo); // dlyr.addMethod("glideStop",PathAnimation.glideStop); // dlyr.glideTo(x,y,"slow","slow",5,10); // dlyr.glideStop(); // Or attach to all DynLayers or another class like this: // DynLayer.prototype.glideTo = PathAnimation.glideTo; // DynLayer.prototype.glideStop = PathAnimation.glideStop; // These will invoke "pathstart", "pathrun", "pathfinish" and "pathcancel" events on the dynlayer PathAnimation.glideTo = function(x2,y2,angleinc,ms,startSpeed,endSpeed) { if (!this._pathanim) this._pathanim = new PathAnimation(this); if (!ms) ms = 20; if (x2==null) x2 = this.x; if (y2==null) y2 = this.y; if (this.x==x2 && this.y==y2) return; this._pathanim.sleep(ms); this._pathanim.play( GlideAnimation(this.x,this.y,x2,y2,angleinc,startSpeed,endSpeed) ); }; PathAnimation.glideStop = function () { if (this._pathanim) this._pathanim.stop(); }; function GlideAnimation(x1,y1,x2,y2,angleinc,startSpeed,endSpeed) { var normAngle = PathAnimation.getNormalizedAngle(x1,y1,x2,y2); var distx = x2-x1; var disty = y2-y1; var distance = Math.sqrt(Math.pow(distx,2) + Math.pow(disty,2)); angleinc = (angleinc==null)? 7 : Math.abs(angleinc); // a terrible mess but it works var r = 1; if (startSpeed == "fast") { var centerX = x1; var centerY = y1; var centerX2 = x2; var centerY2 = y2; startAngle = 0; endAngle = 90; if (endSpeed=="fast") distance = distance/2; } else { startAngle = -90; endAngle = 0; if (endSpeed == "fast") { var centerX = x1+distx; var centerY = y1+disty; } else { // default slow,slow var centerX2 = x2-distx/2; var centerY2 = y2-disty/2; distance = distance/2; var centerX = x1+distx/2; var centerY = y1+disty/2; r = -1; } } var i,d,x,y,dx,dy,path=[]; for (var a=startAngle; a<endAngle; a+=angleinc) { i = path.length; d = distance*Math.sin(a*Math.PI/180); path[i] = Math.round(centerX + d*Math.cos(normAngle)); path[i+1] = Math.round(centerY - d*Math.sin(normAngle)); } if (startSpeed==endSpeed) { for (var a=endAngle; a<endAngle+90; a+=angleinc) { i = path.length; d = distance*Math.sin(a*Math.PI/180); path[i] = Math.round(centerX2 - r*d*Math.cos(normAngle)); path[i+1] = Math.round(centerY2 + r*d*Math.sin(normAngle)); } } var l = path.length; if (path[l-2] != x2 && path[l-1]!=y2) { path[l] = x2; path[l+1] = y2; } return path; }; PathAnimation.glide = GlideAnimation; --- NEW FILE --- /* DynAPI Distribution Slide Animation Extension The DynAPI Distribution is distributed under the terms of the GNU LGPL license. requires: PathAnimation */ // To use on a DynLayer: // dlyr.setMethod("slideTo",PathAnimation.slideTo); // will overwrite the built in DynLayer.slideTo() // dlyr.setMethod("slideStop",PathAnimation.slideStop); // dlyr.slideTo(x,y,5,10); // dlyr.slideStop(); // Or attach to all DynLayers or another class like this: // DynLayer.prototype.glideTo = PathAnimation.glideTo; // DynLayer.prototype.glideStop = PathAnimation.glideStop; // These will invoke "pathstart", "pathrun", "pathfinish" and "pathcancel" events on the dynlayer PathAnimation.slideTo = function(x,y,inc,ms) { if (!this._pathanim) this._pathanim = new PathAnimation(this); if (!ms) ms = 20; if (!inc) inc = 10; if (x==null) x = this.x; if (y==null) y = this.y; this._pathanim.sleep(ms); this._pathanim.play( SlideAnimation(this.x,this.y, x,y, inc) ); }; PathAnimation.slideStop = function () { if (this._pathanim) this._pathanim.stop(); }; // Generates a path between 2 points, stepping inc pixels at a time function SlideAnimation(x1,y1,x2,y2,inc) { if (x2==null) x2 = x1; if (y2==null) y2 = y1; var distx = x2-x1; var disty = y2-y1; if (x1==x2 && y1==y2) return; var num = Math.sqrt(Math.pow(distx,2) + Math.pow(disty,2))/(inc||10)-1; var dx = distx/num; var dy = disty/num; var path = []; var x = x1; var y = y1; for (var i=0;i<=num;i++) { x += dx; y += dy; path[i*2] = Math.round(x); path[i*2+1] = Math.round(y); } if (path[i*2-2] != x2 || path[i*2-1] != y2) { path[i*2] = x2; path[i*2+1] = y2; } return path; }; PathAnimation.line = SlideAnimation; // a useful functions in some cases but not needed for slide // Generates a path between 2 points in N steps /*PathAnimation.lineN = function(x1,y1,x2,y2,N) { if (N==0) return []; var dx = (x2 == x1)? 0 : (x2 - x1)/N; var dy = (y2 == y1)? 0 : (y2 - y1)/N; var path = new Array(); for (var i=0;i<=N;i++) { path[i*2] = Math.round(x1 + i*dx); path[i*2+1] = Math.round(y1 + i*dy); } return path; };*/ --- NEW FILE --- /* DynAPI Distribution Thread class The DynAPI Distribution is distributed under the terms of the GNU LGPL license. requires: dynapi.api.DynLayer */ function Thread(dlyr) { // Inherit from object. Provides unique ID this.inherit('DynObject'); this.setDynLayer(dlyr); } var p = dynapi.setPrototype('Thread','DynObject'); p.active = false; p.interval = 50; p.cancelThread = false; p.sleep = function (ms) { this.interval = Math.abs(parseInt(ms)); if (this.active) { this.stop(); setTimeout(this+'.start()',this.interval+1); } }; p.setFPS = function (fps) { this.sleep(Math.floor(1000/fps)); }; p.cancel = function () { this.cancelThread = true; this.stop(); }; p.start = function () { if (!this.active) { this.active = true; if (!this.cancelThread) this.timer = setInterval(this+'.run()',this.interval); } }; p.run = dynapi.functions.Null; // overwrite run p.stop = function () { this.active = false; if (!this.cancelThread && this.timer) { clearInterval(this.timer); delete this.timer; } }; p.setDynLayer = function (dlyr) { this.dlyr = dlyr; }; p.getDynLayer = function () { return this.dlyr; }; --- NEW FILE --- /* DynAPI Distribution TimerX Class by Raymond Irving (xw...@ya...) The DynAPI Distribution is distributed under the terms of the GNU LGPL license. requires: Dynlayer */ DynLayer.prototype.startTimer=function(interval) { if (this.tickTimer>0) this.stopTimer() this._timerInterval=interval||5 this._timerTickCount=0 this._timerStoped=false this._tickTimer=setTimeout(this+'.tickLoop()',this._timerInterval) } DynLayer.prototype.tickLoop=function() { if (this._timerStoped==true||this._timerStoped==null) return this._timerTickCount++; this.invokeEvent("timer") this._tickTimer=setTimeout(this+'.tickLoop()',this._timerInterval) } DynLayer.prototype.stopTimer=function() { this._timerStoped=true clearTimeout(this._tickTimer) status="stop" } DynLayer.prototype.setTimerInterval=function(interval) { this._timerInterval=interval||this._timerInterval } DynLayer.prototype.getTimerInterval=function() { return this._timerInterval } DynLayer.prototype.getTickCount=function() { return this._timerTickCount } DynLayer.prototype.resetTickCount=function() { this._timerTickCount=0 } |
From: Robert R. <rai...@us...> - 2002-04-10 18:31:06
|
Update of /cvsroot/dynapi/dynapi2x/src/ext In directory usw-pr-cvs1:/tmp/cvs-serv19326/src/ext Added Files: debug.html debug.js functions.js library.html library.js Log Message: initial import --- NEW FILE --- <html> <title>DynAPI Debugger</title> <script> var dynapi = window.opener.dynapi; function handleError(msg, url, lno) { dynapi.debug.error(msg, "Debugger", lno); }; var win = this; win.onload = function() { // move the debug window to the right edge? //dynapi.debug.win.clientWidth = 200; //win.document.body.style.width = 200; //clientWidth=200 //alert(win.setSize) //alert(win.document.body.clientWidth) var w = dynapi.ua.mac? (dynapi.ua.ie?330:300) : 360; if (dynapi.ua.ie) { var f = dynapi.frame; var b = f.document.body; var x = Math.min(f.screenLeft+b.clientWidth+20,screen.width-w-10); dynapi.debug.win.moveTo(x,f.screenTop-50); } else if (dynapi.ua.ns4) { var f = dynapi.frame; dynapi.debug.win.moveTo(f.screenX+f.outerWidth,f.screenY); } dynapi.debug.print(); } if (!dynapi.ua.ns6) self.onerror = handleError; </script> <style type="text/css"> </style> <body bgcolor="#D4D0C8" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" scrolling=no style="overflow:hidden"> <script> var stat = 'DynAPI '+dynapi.version+' ['+dynapi.ua.b+' '+dynapi.ua.v+']'; var str='<form name=debugform><font face="'+(dynapi.ua.mac?'Monaco':'Courier')+'" size="1">'+ '<table cellspacing=0 cellpadding=0 border=0><tr><td colspan=2>'+ '<textarea name="print" cols="'+(dynapi.ua.mac? (dynapi.ua.ie?42:42) :40)+'" rows="'+(dynapi.ua.ie?12:13)+'" wrap="off"></textarea><br>'+ '<input type=text name="stat" size="'+(dynapi.ua.mac? (dynapi.ua.ie?44:46) :42)+'" style="font-family:'+(dynapi.ua.mac?'Monaco':'Courier')+';" value="'+stat+'"><br>'+ '<textarea name="eval" cols="'+(dynapi.ua.mac? (dynapi.ua.ie?42:42) :40)+'" rows="'+(dynapi.ua.ie?7:8)+'" wrap="off"></textarea><br>'+ '</td></tr><tr>'+ '<td><input type=button value="Evaluate" onclick="window.opener.DynAPI.debug.evaluate(this.form.eval.value)"></td>'+ '<td align=right><input type="button" value="Clear" onclick="{this.form.print.value=\'\'; this.form.stat.value=\'\'; this.form.eval.value=\'\';}"></td></tr></table>'+ '</font></form>'; document.open(); document.write(str); document.close(); </script> </body> </html> --- NEW FILE --- /* DynAPI Distribution Debugger The DynAPI Distribution is distributed under the terms of the GNU LGPL license. */ function Debugger() { this.inherit('DynObject'); this.win = null; this._buffer = dynapi._debugBuffer; dynapi._debugBuffer = null; // close the debug window on unload this.closeOnUnLoad = false; dynapi.onUnload(function() { if (dynapi.debug.closeOnUnLoad) dynapi.debug.close(); }); this.open(); } dynapi.setPrototype('Debugger','DynObject'); Debugger.prototype.isLoaded = function() { return (this.win!=null && typeof(this.win.document.debugform)=="object"); }; Debugger.prototype.status = function(str) { if (this.isLoaded()) { for (var i=1;i<arguments.length;i++) { str += ', '+arguments[i]; } this.win.document.debugform.stat.value = str; }; }; // lists all known properties of an object Debugger.prototype.inspect = function(obj,showFunctions) { this.print('Inspecting:'); var v; if (typeof(obj)=='object') { for (var i in obj) { if (typeof(obj[i])=='undefined') v = "null"; else if (typeof(obj[i])=='function') { if (showFunctions==false) continue; else v = '[Function]'; } else if (typeof(obj[i])=='object' && typeof(obj[i].length)!='undefined') v = 'Array ['+obj[i]+']'; else if (typeof(obj[i])=='object') v = '[Object]'; else v = obj[i]; this.print(' '+i+' = '+v); } } else this.print(' undefined'); }; // output text to the debug window Debugger.prototype.print = function(s) { if (!s) s = ''; else s = s + '\n'; if (this.isLoaded()) { if (this._buffer != '') { // dump buffer s = this._buffer + s; this._buffer = ''; } this.win.document.debugform.print.value += s; // Does mozilla has something like this? if (dynapi.ua.ie) { var po = this.win.document.debugform.print; po.scrollTop = po.scrollHeight; var range = po.createTextRange(); range.collapse(false); range.select(); } } else this._buffer += s; }; // output a browser generated error to the debug window Debugger.prototype.error = function(msg, url, lno) { if (url && url.indexOf(dynapi.documentPath)==0) { url = url.substring(dynapi.documentPath.length); } this.print('Error:'+ (lno? ' Line '+lno : '') +' ['+url+']\n '+msg); }; // evaluates an expression in the scope of the main dynapi window Debugger.prototype.evaluate = function(str) { dynapi.frame.eval(str); }; // enters text to the evaluate field in the debugger widnow Debugger.prototype.setEvaluate = function(str) { if (this.isLoaded()) this.win.document.debugform.eval.value = str }; // opens the debugger window Debugger.prototype.open = function() { var p = dynapi.library.path; if (!this.isLoaded() && p) { var url = dynapi.documentPath+p+'ext/debug.html#'; var w = dynapi.ua.mac? (dynapi.ua.ie?330:300) : 350; var h = dynapi.ua.mac? (dynapi.ua.ie?405:365) : dynapi.ua.ie? 420:465; this.win = window.open(url,'debugwin','width='+w+',height='+h+',scrollbars=no,status=no,toolbar=no'); //,resizable=no this.win.focus(); this.print(); dynapi.frame.onerror = function(msg, url, lno) { dynapi.debug.error(msg, url, lno); }; } }; Debugger.prototype.close = function() { if (this.isLoaded()) { this.win.close(); this.win = null; } }; dynapi.debug = new Debugger(); --- NEW FILE --- /* DynAPI Distribution dynapi.functions extension The DynAPI Distribution is distributed under the terms of the GNU LGPL license. */ dynapi.functions.DecToHex = function(val){ lo=val%16; val-=lo; lo+=48; if (lo>57) lo+=7; hi=val/16; hi+=48; if (hi>57) hi+=7; return String.fromCharCode(hi,lo); }; dynapi.functions.getColor = function(r,g,b) { return '#'+dynapi.functions.DecToHex(r)+dynapi.functions.DecToHex(g)+dynapi.functions.DecToHex(b); }; dynapi.functions.getRandomColor = function() { var s = ''; for (var i=0;i<3;i++) s += dynapi.functions.DecToHex(Math.floor(255*Math.random())); return s; }; dynapi.functions.createRedPal = function(pal) { var r=g=b=0; for (var i=0; i<256; i++){ pal[i]=dynapi.functions.getColor(r,g,b); r+=8; if (r>255) { r=255; g+=6; b+=2; } if (g>255) { g=255; b+=2; } if (b>255) { b=255; } } }; dynapi.functions.createGrayPal = function(pal) { var r=0; for (var i=0; i<256; i++){ pal[i]=dynapi.functions.getColor(r,r,r); r+=4; if (r>255) { r=255; } } }; dynapi.functions.createBluePal = function(pal){ var r=g=b=0; for (var i=0; i<256; i++){ pal[i]=dynapi.functions.getColor(r,g,b); b+=6; if (b>255) { b=255; g+=2; } if (g>255) { g=255; r+=2; } } }; dynapi.functions.createGreenPal = function(pal) { var r=g=b=0; for (var i=0; i<256; i++){ pal[i]=dynapi.functions.getColor(r,g,b); g+=6; if (g>255) { g=255; b+=2; } if (b>255) { b=255; r+=2; } } }; dynapi.functions.radianToDegree = function(radian) { return radian*180/Math.PI }; dynapi.functions.degreeToRadian = function(degree) { return degree*Math.PI/180 }; dynapi.functions.sintable = function(lsin) { for (var i=0; i<361; i+=1) lsin[i]=Math.sin((i/180)*Math.PI); }; dynapi.functions.costable = function(lcos) { for (var i=0; i<361; i+=1) lcos[i]=Math.cos((i/180)*Math.PI); }; --- NEW FILE --- <script> dynapi.library._handleLoad(this); </script> --- NEW FILE --- /* DynAPI Distribution Dynamic Loading extension to dynapi.library The DynAPI Distribution is distributed under the terms of the GNU LGPL license. */ // begin loading the object DynAPILibrary.prototype.load = function(n,fn) { var list = this._queue(n,null,arguments[2]); //return dynapi.debug.print('going to load: '+list); if (list.length) { var s,src; for (var i=0;i<list.length;i++) { src = list[i]; s = this.scripts[list[i]]; if (i==list.length-1 && fn!=null) s.fn = fn; this.loadList[this.loadList.length] = src; } this._load(); } else if (fn) fn(); }; // reload the object DynAPILibrary.prototype.reload = function(n,fn,force) { var s = this.objects[n]; if (s) { s.loaded = false; this.load(n,fn,force); } }; // load a script that is not added to the library DynAPILibrary.prototype.loadScript = function(src,fn) { if (!this.scripts[src]) { var n = 'unnamed'+this._c++; s = this.add(n,src); // generate a name for the script s.unnamed = true; s.fn = null; s.dep = []; this.load(n,fn); } }; // inserts the script element into the page DynAPILibrary.prototype._load = function() { if (this.busy) return; // dynapi.debug.print('Library Warning: busy'); else { if (this.loadIndex<this.loadList.length-1) { this.busy = true; this.loadIndex++; var src = this.loadList[this.loadIndex]; //if (!confirm('load: '+src+' ?')) return; var rsrc = src + '?'+Math.random(); // random ensures cached files are not loaded var s = this.scripts[src]; if (dynapi.ua.ns4) { // delete the constructors for (var j=0;j<s.objects.length;j++) { var n = s.objects[j]; if (dynapi.frame[n]) { dynapi.frame[n] = null; if (s.pkg) dynapi.frame[s.pkg+'.'+n] = null; } } this.elm.src = dynapi._path+'ext/library.html?js='+src; } else if (dynapi.ua.ie && (dynapi.ua.v==4 || dynapi.ua.mac)) { dynapi.frame.document.body.insertAdjacentHTML('beforeEnd','<script language="javascript" src="'+rsrc+'" defer><\/script>'); this._export(src); } else { var elm = s.elm = dynapi.frame.document.createElement('script'); elm.src = rsrc; elm.type = 'text/javascript'; elm.defer = true; if (dynapi.ua.ie) { elm.C = 0; var o = this; elm.onreadystatechange = function() { elm.C++; if (elm.C==2 || elm.readyState=="complete") { // use 2nd statechange for onload o._export(src); } } } dynapi.frame.document.getElementsByTagName('head')[0].appendChild(elm); // I could not find way to know when the script is complete in Moz v0.9.3 if (dynapi.ua.ns6) setTimeout(this+'._export("'+src+'")',100); } } } }; // executed after a script is finished loading, run main() functions DynAPILibrary.prototype._export = function(src) { var src = this.loadList[this.loadIndex]; var s = this.scripts[src]; if (s) { this._register(s); // run elm.main)() before global main() if (dynapi.ua.ns4 && typeof(this.elm.main)=="function") { this.elm.main(); this.elm.main = null; } // run global main() if available if (typeof(main)=="function") { main(); main = null; } // clear out all functions in the layer's scope if (dynapi.ua.ns4) { for (var i in this.elm) { if (typeof(this.elm[i])=="function") delete this.elm[i]; } } this.busy = false; // load next file this._load(); } //else return alert('Library Error: unknown script '+src); }; // registers the script as loaded, exports the objects DynAPILibrary.prototype._register = function(s) { //dynapi.debug.print('loaded "'+s.src+'"'); s.loaded = true; s.queued = false; if (!s.unnamed) { var n,found; // loop through each object that the script contains for (var i=0;i<s.objects.length;i++) { found = false; n = s.objects[i]; // scope local objects in the layer to the DynAPI frame if (dynapi.ua.ns4 && this.elm && typeof(this.elm[n])!="undefined") { dynapi.frame[n] = this.elm[n]; found = true; } else if (typeof(dynapi.frame[n])!="undefined") found = true; else if (n.indexOf('.')>0) { var ns = n.split('.'), o = dynapi.frame, b = false; for (var j=0;j<ns.length;j++) { o = o[ns[j]]; } if (typeof(o)!="undefined") found = true; } else if (typeof(dynapi[n])!="undefined") found = true; if (found) { if (s.pkg) { // make package link: dynapi.api.DynLayer = DynLayer if (s.pkg!="dynapi") this.packages[s.pkg][n] = dynapi.frame[n]; n = s.pkg+'.'+n; } dynapi.debug.print('loaded ['+n+']'); } else { dynapi.debug.print('Library Error: could not find ['+n+']'); } } } // run handler if available if (s.fn) { s.fn(); delete s.fn; } }; // called from /lib/dynapi/library.html to write the <script>, NS4 only DynAPILibrary.prototype._handleLoad = function(elm) { var args = dynapi.functions.getURLArguments(elm.src); var js = args["js"]; if (js) { if (js.indexOf('http')!=0) { var l = dynapi.frame.document.location; if (js.substr(0,1)=='/') js = l.port+'//'+host+src; else js = dynapi.documentPath+js; } elm.document.write('<script language="JavaScript" src="'+js+'?r'+Math.random()+'"><\/script>'); elm.document.close(); elm.onload = function() { dynapi.library._export(js); } } }; // inserts the layer for NS4, register included scripts DynAPILibrary.prototype._create = function() { // ensure a previous main function is wiped out if (typeof(main)=="function") main = null; // register objects from scripts included by dynapi.library.include() or manually var s; for (var i in this.scripts) { s = this.scripts[i]; if (s.loaded || (s.objects[0] && dynapi.frame[s.objects[0]])) this._register(s); } // create NS4 layer to load scripts into if (dynapi.ua.ns4) this.elm = new Layer(0, dynapi.frame); this.busy = false; // load any scripts before proceeding if (this.loadList.length) { var s = this.scripts[this.loadList[this.loadList.length-1]]; s.fn = function() { setTimeout('dynapi._onLoad()',1); } this._load(); } else setTimeout('dynapi._onLoad()',1); }; |
From: Jordi M. <do...@us...> - 2002-02-28 18:01:41
|
Update of /cvsroot/dynapi/dynapi/examples In directory usw-pr-cvs1:/tmp/cvs-serv14945 Added Files: dynapi.gui.explorer.html Log Message: dynapi.gui.explorer example (simple) --- NEW FILE --- <html> <head> <title>DynAPI Examples - File explorer</title> <script language="JavaScript" src="../src/dynapi.js"></script> <script language="Javascript"> DynAPI.setLibraryPath('../src/lib/'); DynAPI.include('dynapi.api.browser.js'); DynAPI.include('dynapi.api.dynlayer.js'); DynAPI.include('dynapi.api.dyndocument.js'); DynAPI.include('dynapi.event.*') DynAPI.include('dynapi.gui.explorer') </script> <style> .linkS { font-family: Arial, Helvetica, sans-serif; font-size: 9pt; font-weight: normal; color: #09478C; text-decoration: none } .currentS { font-family: Arial, Helvetica, sans-serif; font-size: 9pt; font-weight: bold; color: #09478C; text-decoration: none } </style> <script language="Javascript"> DynAPI.onLoad = function() { var rrr = new explorer() rrr.moveTo(100,100) rrr.setWidth(200) rrr.setBgColor("silver") rrr.addLeave("1","../src/lib/dynapi/images/explorer/carpeta.gif","../src/lib/dynapi/images/explorer/carpeta_abierta.gif","page1.html","Node 1") rrr.addLeave("2","../src/lib/dynapi/images/explorer/carpeta.gif","../src/lib/dynapi/images/explorer/carpeta_abierta.gif","page2.html","Node 2") rrr.addLeave("3","../src/lib/dynapi/images/explorer/carpeta.gif","../src/lib/dynapi/images/explorer/carpeta_abierta.gif","page3.html","Node 3") rrr.addLeave("1.1","../src/lib/dynapi/images/explorer/carpeta.gif","../src/lib/dynapi/images/explorer/carpeta_abierta.gif","page1_1.html","Node 1.1","1") rrr.addLeave("1.2","../src/lib/dynapi/images/explorer/carpeta.gif","../src/lib/dynapi/images/explorer/carpeta_abierta.gif","page1_2.html","Node 1.2","1") rrr.addLeave("1.2.1","../src/lib/dynapi/images/explorer/carpeta.gif","../src/lib/dynapi/images/explorer/carpeta_abierta.gif","page1_2_1.html","Node 1.2.1","1.2") rrr.addLeave("1.2.2","../src/lib/dynapi/images/explorer/carpeta.gif","../src/lib/dynapi/images/explorer/carpeta_abierta.gif","page1_2_2.html","Node 1.2.2","1.2") rrr.addLeave("1.2.3","../src/lib/dynapi/images/explorer/carpeta.gif","../src/lib/dynapi/images/explorer/carpeta_abierta.gif","page1_2_3.html","Node 1.2.3","1.2") rrr.addLeave("1.2.4","../src/lib/dynapi/images/explorer/carpeta.gif","../src/lib/dynapi/images/explorer/carpeta_abierta.gif","page1_2_4.html","Node 1.2.4","1.2") rrr.addLeave("1.2.5","../src/lib/dynapi/images/explorer/carpeta.gif","../src/lib/dynapi/images/explorer/carpeta_abierta.gif","page1_2_5.html","Node 1.2.5","1.2") rrr.addLeave("1.2.5.1","../src/lib/dynapi/images/explorer/carpeta.gif","../src/lib/dynapi/images/explorer/carpeta_abierta.gif","page1_2_5_1.html","Node 1.2.5.1","1.2.5") rrr.addLeave("1.2.5.1.1","../src/lib/dynapi/images/explorer/carpeta.gif","../src/lib/dynapi/images/explorer/carpeta_abierta.gif","page1_2_5_1_1.html","Node 1.2.5.1.1","1.2.5.1") rrr.addLeave("1.3","../src/lib/dynapi/images/explorer/network.gif","../src/lib/dynapi/images/explorer/network.gif","net.html","Network","1") rrr.addLeave("1.4","../src/lib/dynapi/images/explorer/trash.gif","../src/lib/dynapi/images/explorer/trash.gif","trash.html","Trash","1") jare = new EventListener() jare.onselect = function(e) { alert("Current ID is: "+e.getSource().currentPos+" and currentUrl is: "+e.getSource().currentUrl) } rrr.addEventListener(jare) this.document.addChild(rrr) rrr.css.border = "1px solid black" } </script> </head> <body bgcolor="#ffffff"> </body> </html> |
From: Jordi M. <do...@us...> - 2002-02-28 18:00:37
|
Update of /cvsroot/dynapi/dynapi/src/lib/dynapi/gui In directory usw-pr-cvs1:/tmp/cvs-serv14631 Added Files: explorer.js Log Message: new file explorer widget --- NEW FILE --- /* DynAPI Distribution explorer Tree class The DynAPI Distribution is distributed under the terms of the GNU LGPL license. Requirements: dynapi.api [dynlayer, dyndocument, browser, events] */ // This object represents a leave in our content tree. Notice that it is not dynlayer-inherited leave = function(tree,id,icon,icon_sel,url,text,parent) { // internal this.id = id this.tree = tree this.icon = icon this.icon_sel = icon_sel this.url = url this.text = text||"" this.parent = parent this.children = [] this.count = 0 // state this.open = false // init this.tree.allLeaves[this.id] = this } leave.prototype.getHTML = function(level,last,lD) { var niv = level||0 var listaD = lD || new Array() var ret = "<tr><td><img src="+leave.white+" height=1 width=5></td><td valign=top>" for(var i=0;i<(niv-1);i++) ret += "<img src='"+(listaD[i]?leave.white:leave.line)+"' align=top>" if(niv == 0) ret += "" else if (this.children.length==0) ret += "<img src='"+(last?leave.noChildrenlast:leave.noChildren)+"' align=top>" else { if(this.open) ret += "<a href='javascript:"+this.tree+".fold(\""+this.id+"\")'><img border=0 src='"+(last?leave.closelast:leave.close)+"' align=top></a>" else ret += "<a href='javascript:"+this.tree+".unfold(\""+this.id+"\")'><img border=0 src='"+(last?leave.openlast:leave.open)+"' align=top></a>" } if(niv!=0) { if (this.id == this.tree.currentPos) ret += "<img src='"+(this.icon_sel)+"' align=top>" else ret += "<img src='"+(this.icon)+"' align=top>" } ret += "<a class='"+(niv==0 ? leave.style_home: (this.id == this.tree.currentPos ? leave.style_current : leave.style_link)) + "' href='javascript:"+this.tree+".setCurrent(\""+ this.id +"\")'>" while(this.text.indexOf(" ")>=0) this.text = this.text.replace(" "," ") if(niv!=0) ret += " " ret += this.text+"</a></td><td><img src="+leave.white+" height=1 width=25></td></tr>" var q=0 listaD[niv-1] = last if((this.open || niv==0) && this.children.length!=0) { for(var i in this.children) { q++; ret += this.children[i].getHTML(niv+1,q==this.count,listaD) } } return ret } leave.prototype.unfoldTo = function(c) { this.open = false for(var i in this.children) if(this.children[i].unfoldTo(c)) this.open = true return this.open || (this.id == c) } leave.prototype.toString = function() { return this.id } // Tree object explorer = function() { this.DynLayer = DynLayer; this.DynLayer(); this.allLeaves = [] this.root = new leave(this,this+"Root") this.currentPos = 0 this.currentUrl = "" this.addEventListener(explorer.cL) } // Initialization listener explorer.cL = new EventListener explorer.cL.oncreate = function(e) { e.getSource().init() e.getSource().draw() } // Prototypes explorer.prototype = new DynLayer explorer.prototype.addLeave = function(id,icon,icon_sel,url,text,parent) { new leave(this,id,icon,icon_sel,url,text,(parent&&(parent!="0"))?parent:this.root.toString()) } explorer.prototype.fold = function(id) { this.allLeaves[id].open = false this.draw() } explorer.prototype.unfold = function(id) { this.allLeaves[id].open = true this.draw() } explorer.prototype.setCurrent = function(id) { this.currentPos = id this.currentUrl = this.allLeaves[id].url this.draw() this.invokeEvent("select") } explorer.prototype.unfoldTo = function(id) { this.allLeaves[this.firstOne].unfoldTo(id) this.currentPos = id } explorer.prototype.init = function() { for(var i in this.allLeaves) { var el = this.allLeaves[i] var pat = el.parent if(pat) { this.allLeaves[pat].children[this.allLeaves[pat].children.length] = el this.allLeaves[pat].count++ } } this.initiated = true } explorer.prototype.draw = function() { this.setHTML("<table border=0 cellpadding=0 cellspacing=0>"+this.root.getHTML()+"</table>") this.setSize(this.getContentWidth(),this.getContentHeight()) } // Leave setup leave.line = DynAPI.librarypath+"dynapi/images/explorer/line.gif" leave.white = DynAPI.librarypath+"dynapi/images/explorer/shim.gif" leave.open = DynAPI.librarypath+"dynapi/images/explorer/mas_n.gif" leave.openlast = DynAPI.librarypath+"dynapi/images/explorer/mas_u.gif" leave.close = DynAPI.librarypath+"dynapi/images/explorer/menos_n.gif" leave.closelast = DynAPI.librarypath+"dynapi/images/explorer/menos_u.gif" leave.noChildren = DynAPI.librarypath+"dynapi/images/explorer/nimasnimenos_n.gif" leave.noChildrenlast = DynAPI.librarypath+"dynapi/images/explorer/nimasnimenos_u.gif" leave.style_link = "linkS" leave.style_home = "homeS" leave.style_current = "currentS" // Tree setup explorer.homeLink = "home.html" explorer.homeText = "Ein ?" |
From: Jordi M. <do...@us...> - 2002-02-28 17:59:28
|
Update of /cvsroot/dynapi/dynapi/src/lib/dynapi/images/explorer In directory usw-pr-cvs1:/tmp/cvs-serv14347 Added Files: trash.gif shim.gif nimasnimenos_u.gif nimasnimenos_n.gif network.gif menos_u.gif menos_n.gif menos.gif mas_u.gif mas_n.gif mas.gif line.gif carpeta_cerrada.gif carpeta_abierta.gif carpeta.gif Log Message: images used in new explorer widget --- NEW FILE --- GIF89a fdzR àá=~Á 0 [¿ roS³Å ìYóÞ |{ --- NEW FILE --- GIF89a --- NEW FILE --- GIF89a --- NEW FILE --- GIF89a --- NEW FILE --- GIF89a ÉMl{¨* á(l·^ 0x±bõѨÛ'l>¡YÐ2Y54;b --- NEW FILE --- GIF89a --- NEW FILE --- GIF89a --- NEW FILE --- GIF89a Ç --- NEW FILE --- GIF89a --- NEW FILE --- GIF89a --- NEW FILE --- GIF89a --- NEW FILE --- GIF89a --- NEW FILE --- GIF89a --- NEW FILE --- GIF89a --- NEW FILE --- GIF89a |
From: Jordi M. <do...@us...> - 2002-02-28 17:58:31
|
Update of /cvsroot/dynapi/dynapi/src/lib/dynapi/images/explorer In directory usw-pr-cvs1:/tmp/cvs-serv14042/explorer Log Message: Directory /cvsroot/dynapi/dynapi/src/lib/dynapi/images/explorer added to the repository |
From: Jordi M. <do...@us...> - 2002-02-26 17:58:48
|
Update of /cvsroot/dynapi/dynapi/src/lib/dynapi/event In directory usw-pr-cvs1:/tmp/cvs-serv30892 Modified Files: mouse.js Log Message: coordinate fixes. ( IE & relative layers, god bless the day I introduced them :( ) Index: mouse.js =================================================================== RCS file: /cvsroot/dynapi/dynapi/src/lib/dynapi/event/mouse.js,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** mouse.js 15 Jan 2002 12:30:37 -0000 1.25 --- mouse.js 26 Feb 2002 17:58:43 -0000 1.26 *************** *** 81,86 **** } else { // standard DynAPI coordinate calculation ! evt.pageX=is.ie?e.x+document.body.scrollLeft:e.pageX; ! evt.pageY=is.ie?e.y+document.body.scrollTop:e.pageY; evt.x=is.ie?evt.pageX-evt.src.getPageX():e.layerX evt.y=is.ie?evt.pageY-evt.src.getPageY():e.layerY --- 81,86 ---- } else { // standard DynAPI coordinate calculation ! evt.pageX=is.ie?e.clientX+document.body.scrollLeft:e.pageX; ! evt.pageY=is.ie?e.clientY+document.body.scrollTop:e.pageY; evt.x=is.ie?evt.pageX-evt.src.getPageX():e.layerX evt.y=is.ie?evt.pageY-evt.src.getPageY():e.layerY *************** *** 94,99 **** }; evt.button=b; ! if (evt.button==2 && (type=='mousedown' || type=='mouseup' || type=='mouseclick')) type=evt.type='md'+type; ! if (evt.button==3 && (type=='mousedown' || type=='mouseup' || type=='mouseclick')) type=evt.type='rt'+type; // Step four: modifiers --- 94,99 ---- }; evt.button=b; ! if (evt.button==2 && (type=='mousedown' || type=='mouseup' || type=='click')) type=evt.type='md'+type; ! if (evt.button==3 && (type=='mousedown' || type=='mouseup' || type=='click')) type=evt.type='rt'+type; // Step four: modifiers |
From: Jordi M. <do...@us...> - 2002-02-26 17:58:01
|
Update of /cvsroot/dynapi/dynapi/src/lib/dynapi/api In directory usw-pr-cvs1:/tmp/cvs-serv30587 Modified Files: dynlayer.js Log Message: small coordinate fixes ( affecting only relative layers ) Index: dynlayer.js =================================================================== RCS file: /cvsroot/dynapi/dynapi/src/lib/dynapi/api/dynlayer.js,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -r1.73 -r1.74 *** dynlayer.js 24 Jan 2002 17:43:04 -0000 1.73 --- dynlayer.js 26 Feb 2002 17:57:58 -0000 1.74 *************** *** 232,241 **** if (this.css==null) return null; if (is.ns4) return this.css.pageX; ! else return (this.isChild)? this.parent.getPageX()+this.x : this.x; }; DynLayer.prototype.getPageY=function() { if (this.css==null) return null; if (is.ns4) return this.css.pageY; ! else return (this.isChild)? this.parent.getPageY()+this.y : this.y; }; DynLayer.prototype.setPageX=function(x) { --- 232,241 ---- if (this.css==null) return null; if (is.ns4) return this.css.pageX; ! else return Methods.getAbsoluteCoords(this.elm).x }; DynLayer.prototype.getPageY=function() { if (this.css==null) return null; if (is.ns4) return this.css.pageY; ! else return Methods.getAbsoluteCoords(this.elm).y }; DynLayer.prototype.setPageX=function(x) { |
From: Jordi M. <do...@us...> - 2002-02-26 17:57:03
|
Update of /cvsroot/dynapi/dynapi/src In directory usw-pr-cvs1:/tmp/cvs-serv30236 Modified Files: dynapi.js Log Message: added Methods.getAbsoluteCoords() which gives absolute coordinates of an element using DOM scripting Index: dynapi.js =================================================================== RCS file: /cvsroot/dynapi/dynapi/src/dynapi.js,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -r1.46 -r1.47 *** dynapi.js 4 Jan 2002 14:25:18 -0000 1.46 --- dynapi.js 26 Feb 2002 17:56:59 -0000 1.47 *************** *** 137,140 **** --- 137,148 ---- else if(is.ie) while (!element.lyrobj && element.parentElement && element.parentElement!=element) element=element.parentElement; return element.lyrobj + }, + getAbsoluteCoords : function(element) { + // Not to be used in NS. Needed when adding inflow layers + var a + if(!element) return { x:0, y:0 } + else { a = this.getAbsoluteCoords(element.offsetParent) + return { x: a.x+element.offsetLeft, y: a.y+element.offsetTop } + } } }; |
From: Jordi M. <do...@us...> - 2002-02-26 17:54:32
|
Update of /cvsroot/dynapi/dynapi/tests In directory usw-pr-cvs1:/tmp/cvs-serv29431 Modified Files: inflow_scrollbar.html Log Message: shows event fix Index: inflow_scrollbar.html =================================================================== RCS file: /cvsroot/dynapi/dynapi/tests/inflow_scrollbar.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** inflow_scrollbar.html 4 Jan 2002 14:25:18 -0000 1.1 --- inflow_scrollbar.html 26 Feb 2002 17:54:27 -0000 1.2 *************** *** 56,60 **** box.addEventListener(blistener); - </script> </head> --- 56,59 ---- *************** *** 109,112 **** --- 108,116 ---- Note: some problems while sliding the knob in the inline scrollbar, but must be something about the event coordinate calculation. Mozilla resizes the table cell while dragging the knob. Oh my. Anyway. + <p> + <b>Update: 26/2/2002</b> + IE is fine now. + <br> + </body> </html> |
From: Robert R. <rai...@us...> - 2002-01-25 19:28:48
|
Update of /cvsroot/dynapi/dynapi2x/src/dynapi/api In directory usw-pr-cvs1:/tmp/cvs-serv20834/src/dynapi/api Modified Files: dynlayer.js Log Message: Added ie6 to event bug per Jordi's fix in 2.5.x codebase Index: dynlayer.js =================================================================== RCS file: /cvsroot/dynapi/dynapi2x/src/dynapi/api/dynlayer.js,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** dynlayer.js 2002/01/11 20:51:55 1.1 --- dynlayer.js 2002/01/25 19:28:45 1.2 *************** *** 261,265 **** if (this.bgImage!=null) s+=' background-image:url('+this.bgImage+');'; if (this.bgColor!=null) s+=' background-color:'+this.bgColor+';'; ! if (dynapi.ua.ie55 && this.bgImage==null && this.html==null) s+=' background-image:url(javascript:null);'; if (this._cursor!=null) s+=' cursor:'+this._cursor+';'; s+=' position:absolute;">'; --- 261,265 ---- if (this.bgImage!=null) s+=' background-image:url('+this.bgImage+');'; if (this.bgColor!=null) s+=' background-color:'+this.bgColor+';'; ! if ((dynapi.ua.ie55||dynapi.ua.ie6) && this.bgImage==null && this.html==null) s+=' background-image:url(javascript:null);'; if (this._cursor!=null) s+=' cursor:'+this._cursor+';'; s+=' position:absolute;">'; |
From: Robert R. <rai...@us...> - 2002-01-25 19:25:08
|
Update of /cvsroot/dynapi/dynapi2x/src In directory usw-pr-cvs1:/tmp/cvs-serv18669/src Modified Files: dynapi.js Log Message: We need to unescape both sides of the url Index: dynapi.js =================================================================== RCS file: /cvsroot/dynapi/dynapi2x/src/dynapi.js,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** dynapi.js 2002/01/25 14:15:54 1.2 --- dynapi.js 2002/01/25 19:25:04 1.3 *************** *** 192,196 **** for (var i=0;i<a.length;i++) { var b = a[i].split('='); ! list[b[0]] = unescape(b[1]); } return list; --- 192,196 ---- for (var i=0;i<a.length;i++) { var b = a[i].split('='); ! list[unescape(b[0])] = unescape(b[1]); } return list; |
From: Robert R. <rai...@us...> - 2002-01-25 14:15:56
|
Update of /cvsroot/dynapi/dynapi2x/src In directory usw-pr-cvs1:/tmp/cvs-serv7039/src Modified Files: dynapi.js Log Message: Need to unescape url arguments Index: dynapi.js =================================================================== RCS file: /cvsroot/dynapi/dynapi2x/src/dynapi.js,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** dynapi.js 2002/01/11 20:51:55 1.1 --- dynapi.js 2002/01/25 14:15:54 1.2 *************** *** 192,196 **** for (var i=0;i<a.length;i++) { var b = a[i].split('='); ! list[b[0]] = b[1]; } return list; --- 192,196 ---- for (var i=0;i<a.length;i++) { var b = a[i].split('='); ! list[b[0]] = unescape(b[1]); } return list; |
From: Robert R. <rai...@us...> - 2002-01-24 18:01:06
|
Update of /cvsroot/dynapi/dynapi2x/src/dynapi/gui In directory usw-pr-cvs1:/tmp/cvs-serv2633/src/dynapi/gui Modified Files: dynimage.js Log Message: I hate DynImage :) But atleast it works a little better now Index: dynimage.js =================================================================== RCS file: /cvsroot/dynapi/dynapi2x/src/dynapi/gui/dynimage.js,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** dynimage.js 2002/01/24 17:02:35 1.2 --- dynimage.js 2002/01/24 18:01:03 1.3 *************** *** 37,49 **** DynImage.ItemsDone=0; var max=DynImage.image.length; ! for (var i=0; i<max; i++) if (DynImage.image[i].img.complete) DynImage.ItemsDone+=1; ! if (DynImage.ItemsDone<max) DynImage.timerId=setTimeout('DynImage.loadercheck()',25); ! else { ! if (DynAPI.ua.def&&(!DynAPI.ua.ie||(DynAPI.ua.ie&&DynAPI.ua.platform=="mac"))) { ! DynImage.image[i].img.width = DynImage.image[i].img.w; ! DynImage.image[i].img.height = DynImage.image[i].img.h; ! } ! DynImage.timerId=null; } }; dynapi.onLoad(DynImage.loadercheck); --- 37,46 ---- DynImage.ItemsDone=0; var max=DynImage.image.length; ! for (var i=0; i<max; i++) if (DynImage.image[i].img.complete) { ! DynImage.ItemsDone+=1; ! if(DynImage.image[i].img.w) DynImage.image[i].img.width=DynImage.image[i].img.w; ! if(DynImage.image[i].img.h) DynImage.image[i].img.height=DynImage.image[i].img.h; } + if (DynImage.ItemsDone<max) DynImage.timerId=setTimeout('DynImage.loadercheck()',25); }; dynapi.onLoad(DynImage.loadercheck); |
From: Jordi M. <do...@us...> - 2002-01-24 17:43:08
|
Update of /cvsroot/dynapi/dynapi/src/lib/dynapi/api In directory usw-pr-cvs1:/tmp/cvs-serv29635 Modified Files: dynlayer.js Log Message: Fixed IE6 bug ( not receiving events on empty layers ) Index: dynlayer.js =================================================================== RCS file: /cvsroot/dynapi/dynapi/src/lib/dynapi/api/dynlayer.js,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -r1.72 -r1.73 *** dynlayer.js 2002/01/04 14:25:18 1.72 --- dynlayer.js 2002/01/24 17:43:04 1.73 *************** *** 95,100 **** child.assignChildren(); if (child.z) child.css.zIndex=child.z; ! if (child.w==null && child.getContentWidth()>0) child.setWidth(child.getContentWidth(), false); ! if (child.h==null && child.getContentHeight()>0) child.setHeight(child.getContentHeight(), false); } } else if(is.ns4) { --- 95,100 ---- child.assignChildren(); if (child.z) child.css.zIndex=child.z; ! //if (child.w==null && child.getContentWidth()>0) child.setWidth(child.getContentWidth(), false); ! //if (child.h==null && child.getContentHeight()>0) child.setHeight(child.getContentHeight(), false); } } else if(is.ns4) { *************** *** 112,117 **** child.assignChildren(); if (child.z) child.css.zIndex=child.z; ! if (child.w==null && child.getContentWidth()>0) child.setWidth(child.getContentWidth(), false); ! if (child.h==null && child.getContentHeight()>0) child.setHeight(child.getContentHeight(), false); } } --- 112,117 ---- child.assignChildren(); if (child.z) child.css.zIndex=child.z; ! //if (child.w==null && child.getContentWidth()>0) child.setWidth(child.getContentWidth(), false); ! //if (child.h==null && child.getContentHeight()>0) child.setHeight(child.getContentHeight(), false); } } *************** *** 160,164 **** if (this.bgImage!=null) s+=' background-image:url('+this.bgImage+');'; if (this.bgColor!=null) s+=' background-color:'+this.bgColor+';'; ! if (is.ie55 && this.bgImage==null && this.html==null) s+=' background-image:url('+DynAPI.librarypath+'dynapi/images/common/transparent.gif);'; if(!inflow) s+=' position:absolute;'; else s+=' position:relative;'; s+=' overflow:hidden">'; --- 160,164 ---- if (this.bgImage!=null) s+=' background-image:url('+this.bgImage+');'; if (this.bgColor!=null) s+=' background-color:'+this.bgColor+';'; ! if ((is.ie55 ||is.ie6) && this.bgImage==null && this.html==null) s+=' background-image:url('+DynAPI.librarypath+'dynapi/images/common/transparent.gif);'; if(!inflow) s+=' position:absolute;'; else s+=' position:relative;'; s+=' overflow:hidden">'; |
From: Robert R. <rai...@us...> - 2002-01-24 17:02:38
|
Update of /cvsroot/dynapi/dynapi2x/src/dynapi/gui In directory usw-pr-cvs1:/tmp/cvs-serv17952/src/dynapi/gui Modified Files: dynimage.js Log Message: Added constructor to dynimage to return img string (toString()) Index: dynimage.js =================================================================== RCS file: /cvsroot/dynapi/dynapi2x/src/dynapi/gui/dynimage.js,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** dynimage.js 2002/01/11 20:51:55 1.1 --- dynimage.js 2002/01/24 17:02:35 1.2 *************** *** 6,10 **** */ ! DynImage = {}; DynImage.image = []; DynImage.getImage = function(src,w,h) { --- 6,19 ---- */ ! function DynImage(img,id) { ! this.img = img; ! this.id = id; ! }; ! DynImage.prototype.toString = function() { ! return "<img src=\""+this.img.src+"\""+ ! (this.id?" id=\""+this.id+"\"":"")+ ! (this.img.width?" width=\""+this.img.width+"\"":"")+ ! (this.img.height?" height=\""+this.img.height+"\"":"")+">"; ! }; DynImage.image = []; DynImage.getImage = function(src,w,h) { |