|
|
Line 4: |
Line 4: |
| <html> | | <html> |
| <body style="background-color:#F6661F"> | | <body style="background-color:#F6661F"> |
- | <script language="JavaScript"> | + | <div style="position:absolute;color:black" id="test"></div> |
| | | |
- | //Watching Eyes script- By Kurt (kurt.grigg@virgin.net)
| + | <script> |
- | //Script featured on Dynamic Drive
| + | |
- | //Visit http://www.dynamicdrive.com for this script and more
| + | |
| | | |
- | pic0=new Image();
| + | //This script created by Steve Bomer (steveb03@yahoo.com) |
- | pic0.src="https://static.igem.org/mediawiki/2014/1/1b/Eye.gif";
| + | //Modified by Dynamic Drive for NS6, additional features |
- | pic1=new Image();
| + | //Visit Dynamicdrive.com to get it! |
- | pic1.src="https://static.igem.org/mediawiki/2014/d/d3/Pupils.gif";
| + | |
| | | |
- | var n4=(document.layers);
| + | //Change the message below |
- | var n6=(document.getElementById&&!document.all); | + | var themessage="Welcome to Dynamic Drive!" |
- | var ie=(document.all); | + | var fontsize=10 |
- | var O=(navigator.appName.indexOf("Opera") != -1)?true:false; | + | //Below determines how long the message will appear before disappearing. 3000=3 seconds |
- | var _d=(n4||ie)?'document.':'document.getElementById("';
| + | var appearfor=3000 |
- | var _a=(n4||n6)?'':'all.';
| + | |
- | var _r=(n6)?'")':'';
| + | function position_at_top(){ |
- | var _s=(n4)?'':'.style';
| + | if (document.layers) |
- | if (n4){
| + | document.test.top=pageYOffset |
- | document.write('<layer name="eyeball" top=0 left=0 width="69" height="34"><img src="https://static.igem.org/mediawiki/2014/1/1b/Eye.gif" width="69" height="34"></layer>');
| + | else if (document.all){ |
- | document.write('<layer name="pupil1" top=0 left=0 width="13" height="13"><img src="https://static.igem.org/mediawiki/2014/d/d3/Pupils.gif" width="13" height="13"></layer>');
| + | test.innerHTML='<div align=center><font face="Arial">'+themessage+'</font></div>' |
- | document.write('<layer name="pupil2" top:0 left=0 width="13" height="13"><img src="https://static.igem.org/mediawiki/2014/d/d3/Pupils.gif" width="13" height="13"></layer>');
| + | setTimeout("test.style.top=document.body.scrollTop+10;test.style.left=document.body.scrollLeft+10",100) |
| } | | } |
- | else{ | + | else if (document.getElementById){ |
- | if (ie) | + | document.getElementById("test").innerHTML='<div align=center><font face="Arial">'+themessage+'</font></div>' |
- | document.write('<div id="ic" style="position:absolute;top:0;left:0"><div style="position:relative">'); | + | document.getElementById("test").style.top=pageYOffset |
- | document.write('<div id="eyeball" style="position:absolute;top:100px;left:100px;width:69px;height:34px"><img src="https://static.igem.org/mediawiki/2014/1/1b/Eye.gif" width="69" height="34"></div>');
| + | |
- | document.write('<div id="pupil1" style="position:absolute;top:0px;left:0px;width:12px;height:13px"><img src="https://static.igem.org/mediawiki/2014/d/d3/Pupils.gif" width="13" height="13"></div>');
| + | |
- | document.write('<div id="pupil2" style="position:absolute;top:0px;left:0px;width:12px;height:13px"><img src="https://static.igem.org/mediawiki/2014/d/d3/Pupils.gif" width="13" height="13"></div>'); | + | |
- | if (ie)
| + | |
- | document.write('</div></div>');
| + | |
| } | | } |
- | var ym=0;
| |
- | var xm=0;
| |
- | if (n4||n6){
| |
- | window.captureEvents(Event.MOUSEMOVE);
| |
- | function mouseNS(e){
| |
- | ym = e.pageY-window.pageYOffset;
| |
- | xm = e.pageX;
| |
- | }
| |
- | if (n4)window.onMouseMove=mouseNS;
| |
- | if (n6)document.onmousemove=mouseNS;
| |
| } | | } |
- | if (ie||O){
| + | |
- | function mouseIEO(){
| + | function expand(){ |
- | ym = (ie)?event.clientY:event.clientY-window.pageYOffset;
| + | if (document.layers){ |
- | xm = event.clientX;
| + | document.test.document.write('<div align=center style="font-size:'+fontsize+'px"><font face="Arial">'+themessage+'</font></div>') |
- | }
| + | document.test.document.close() |
- | document.onmousemove=mouseIEO; | + | |
| } | | } |
- | var etemp=eval(_d+_a+"eyeball"+_r+_s);
| + | else if (document.all) |
- | var p1temp=eval(_d+_a+"pupil1"+_r+_s);
| + | test.style.fontSize=fontsize+'px' |
- | var p2temp=eval(_d+_a+"pupil2"+_r+_s);
| + | else if (document.getElementById) |
- | dy=0;
| + | document.getElementById("test").style.fontSize=fontsize+'px' |
- | dx=0;
| + | fontsize+=5 |
- | fy=0;
| + | if (fontsize>90){ |
- | fx=0;
| + | if (document.layers) |
- | angle1=0;
| + | setTimeout("document.test.visibility='hide'",appearfor) |
- | angle2=0;
| + | else if (document.all) |
- | d1=0;
| + | setTimeout("test.style.visibility='hidden'",appearfor) |
- | d2=0;
| + | else if (document.getElementById) |
- | function makefollow(){
| + | setTimeout("document.getElementById('test').style.visibility='hidden'",appearfor) |
- | sy=(!ie)?window.pageYOffset:0;
| + | return |
- | wy=(ie)?document.body.clientHeight:window.innerHeight;
| + | |
- | wx=(ie)?document.body.clientWidth:window.innerWidth;
| + | |
- | //Keep eyes on screen. Netscape 6 plays up otherwise!
| + | |
- | var chy=Math.floor(fy-34);
| + | |
- | if (chy <= 0) chy = 0;
| + | |
- | if (chy >= wy-34) chy = wy-34; | + | |
- | var chx=Math.floor(fx-34);
| + | |
- | if (chx <= 0) chx = 0; | + | |
- | if (chx >= wx-69) chx = wx-69;
| + | |
- | etemp.top=chy+sy;
| + | |
- | etemp.left=chx;
| + | |
- | //eyeball1 centre.
| + | |
- | c1y=parseInt(etemp.top)+17;
| + | |
- | c1x=parseInt(etemp.left)+17;
| + | |
- | //eyeball2 centre.
| + | |
- | c2y=parseInt(etemp.top)+17;
| + | |
- | c2x=parseInt(etemp.left)+52;
| + | |
- | dy1 = ym+sy - c1y;
| + | |
- | dx1 = xm - c1x;
| + | |
- | d1 = Math.sqrt(dy1*dy1 + dx1*dx1);
| + | |
- | dy2 = ym+sy - c2y;
| + | |
- | dx2 = xm - c2x;
| + | |
- | d2 = Math.sqrt(dy2*dy2 + dx2*dx2);
| + | |
- | ay1 = ym+sy - c1y;
| + | |
- | ax1 = xm - c1x;
| + | |
- | angle1 = Math.atan2(ay1,ax1)*180/Math.PI;
| + | |
- | ay2 = ym+sy - c2y;
| + | |
- | ax2 = xm - c2x;
| + | |
- | angle2 = Math.atan2(ay2,ax2)*180/Math.PI;
| + | |
- | dv=1.7;
| + | |
- | p1temp.top=(d1 < 17)?(c1y-6+d1/dv*Math.sin(angle1*Math.PI/180)):(c1y-6+10*Math.sin(angle1*Math.PI/180));
| + | |
- | p1temp.left=(d1 < 17)?(c1x-6+d1/dv*Math.cos(angle1*Math.PI/180)):(c1x-6+10*Math.cos(angle1*Math.PI/180));
| + | |
- | p2temp.top=(d2 < 17)?(c2y-6+d2/dv*Math.sin(angle2*Math.PI/180)):(c2y-6+10*Math.sin(angle2*Math.PI/180));
| + | |
- | p2temp.left=(d2 < 17)?(c2x-6+d2/dv*Math.cos(angle2*Math.PI/180)):(c2x-6+10*Math.cos(angle2*Math.PI/180));
| + | |
| } | | } |
- | function move(){
| + | else |
- | if (ie)ic.style.top=document.body.scrollTop;
| + | setTimeout("expand()",50) |
- | dy=fy+=(ym-fy)*0.12-2;
| + | |
- | dx=fx+=(xm-fx)*0.12;
| + | |
- | makefollow();
| + | |
- | setTimeout('move()',10); | + | |
| } | | } |
- | window.onload=move;
| + | |
- | //-->
| + | |
| </script> | | </script> |
| <!--main content --> | | <!--main content --> |