Adding Javascript

aviscat

Joined: 2006-05-01
Posts: 16
Posted: Fri, 2009-08-21 06:00

The following information is required to get an answer:
Get this information from the PHP diagnostic (in the configuration wizard).
Gallery URL (optional but very useful): http://www.furdelyscats.com/gallery/gallery
Gallery version: 1.5.3
Apache version: 1.3.33
PHP version (don't just say PHP 4, please): 4.4.9
Graphics Toolkit:
Operating system: Vista, XP
Web browser/version (if applicable):

I am trying to incorporate the script below into the gallery pages. This script is a mouse trails script. I tried put it in as is below in album.header but all I get is the stars in the upper left of the screen and in IE one star connected to the mouse pointer (in Firefox only see the stars in the corners. Can anyone help me get this working?

<script language="JavaScript">
/*
Cross browser cursor trailer script
By Brian Caputo (bcaputo@icdc.com)
Visit Dynamic Depot @ www.dynamic-depot.com
*/
V5=document.getElementById;B=document.all;C=document.layers;D=document.all&&window.print;E=V5&&!document.all;cC=new Array();
T1=new Array("/paw_bl.gif",28,23, "/paw_bl.gif",28,23, "/paw_bl.gif",23,19, "/paw_bl.gif",23,19, "/paw_bl.gif",18,15, "/paw_bl.gif",18,15);
nos=parseInt(T1.length/3);
rate=100;
for (i=0;i<nos;i++)
createCell('CUR'+i,i*10,i*10,T1[i*3+1],T1[i*3+2],'','<img src="'+T1[i*3]+'" width='+T1[(i*3+1)]+' height='+T1[(i*3+2)]+' border=0>')
function cycle(){for (i=0;i<(nos-1);i++){moveCell('CUR'+i,getXpos('CUR'+(i+1)),getYpos('CUR'+(i+1)))}}
function newPos(e){moveCell('CUR'+(nos-1),((B)?event.clientX+document.body.scrollLeft:e.pageX)+2,((B)?event.clientY+document.body.scrollTop:e.pageY)+2)} //Here is the line I changed so both IE & NS move it over 2 pixels off the pointers tip thus allowing linkage!
if(document.layers)document.captureEvents(Event.MOUSEMOVE);
if (B)document.body.onscroll=newPos;
document.onmousemove=newPos;
window.MTIRQ=setInterval('cycle()',rate);
function createCell(N, Xp, Yp,W,H,A,Ht,BG,O,S){
if (B||C||D||E){
with(document){
//NS4
if (C)write("<layer name='"+N+"' left="+Xp+" top="+Yp+" width="+W+" height="+H )
//IE & Gecko
else write("<div id='"+N+"' style='position:absolute; left:"+Xp+"; top:"+Yp+"; width:"+W+"; height:"+H);

//BgColor
if (BG){
X=(C)?" BGColor=":"; background-color:";
write(X+BG)}

//Styles
if(S) write((C)?" style=' "+S+"'":"; "+S+"'")

//Close the Style attribute
else if(!C)write("'");

//Other Attributes
write((A)?" "+A+">":">");
//write Content'
write(Ht)}
//Close the Tag
if(!O)closeCell();
//Add to the Cell Collection array
cC[cC.length]=N;

XX=getObject2(N);
if(!C){XX.moveTo=moveTo;XX.moveBy=moveBy}else{XX.innerHTML=Ht}
//XX.refresh=refresh
}
};
function moveCell(N,Xp,Yp){D=getCell(N);D.left=Xp;D.top=Yp};
function getYpos(N){return (parseInt(getCell(N).top))};
function getXpos(N){return (parseInt(getCell(N).left))};
function closeCell(){document.write((!C)?"</div>":"</layer>")};
function getCell(N){
if (C)D=C[N];
else if (E)D=document.getElementById(N).style
else D=B[N].style;
if(D==null&&C){rr=C.length;for (i=0;i<rr;i++){D=C[i].document.layers;if(D)D=D[N];if(D)return D}}return D}
function refresh(){if(B){document.all[this.id].innerHTML=this.innerHTML}else{changeContent(this.id,this.innerHTML)}}
function getObject2(N){
if (D||E)e=document.getElementById(N)
else e=(C)?C[N]:B[N];
if(!e&&C){rr=C.length;for (i=0;i<rr;i++){e=C[i].document.layers;if(e)e=e[N];if(e) return e;}}return e}
</script>

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Fri, 2009-08-21 10:44

Why are you wrapping your javascript with smarty template code? G1 doesn't use Smarty like G2 does.

{literal}
your javascript
{/literal}

Try removing that first. That's the only error I get when looking at the Error Console (from the Firefox Web Developer Toolbar).
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
aviscat

Joined: 2006-05-01
Posts: 16
Posted: Fri, 2009-08-21 14:26

Sorry. I was trying things I found while searching for an answer. I thought I had removed the {literal} code. I have now done that and it still doesn't work. Do you have any suggestions on how to make the mouse trails work?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Fri, 2009-08-21 15:22

I don't know, now when I try to load the page I get 100s of warnings in the Error Console. So I'd try a different script. Looks like the site you got it from is dead.

Looks like there is a more up to date version of that script right here:
http://www.dynamicdrive.com/dynamicindex13/trailer.htm
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
aviscat

Joined: 2006-05-01
Posts: 16
Posted: Fri, 2009-08-21 15:51

Okay I tried that newer version and still have the same results. This is so frustrating.

Edited to add:
I found another mouse trails script that works in the gallery. Funny that it doesn't work as well in the non-gallery pages. So I am using two different scripts to do the same thing. Thanks for your help.