Sign Up! Login: Password: New User? Forgot? Support
Code 
 
 
Forums 
Forums : General Discussion > New admin in need. Help me Obi-wan, You're my only hope.
Eothon (Applicant) 4/12/2013 9:35 AM EST : New admin in need. Help me Obi-wan, You're my only ho...
Eothon
Posts: 7

0
Like

0
Dislike

ok im new to the site and im a cut and paste type html user. no training at all, just a mild understanding of script. Here's what im trying to do: tlw.guildportal.com   i want to add either a site mod for a custom mouse cursor trailing image OR add it direct to my sites code 

the curent code im using works on http://www.play-hookey.com/htmltest/ with the script tags 
heres the problem: best i can get is the image to show in the top left corner of my site but wont trail the mouse 

A=document.getElementById
B=document.all;
C=document.layers;
T1=new Array

("http://tlw.guildportal.com/GuildFiles/474073/

Navi.gif",50,50)

var offsetx=15 //x offset of trail from mouse 

pointer
var offsety=10 //y offset of trail from mouse 

pointer

nos=parseInt(T1.length/3)
rate=50
ie5fix1=0;
ie5fix2=0;
rightedge=B? document.body.clientWidth-T1[1] : 

window.innerWidth-T1[1]-20
bottomedge=B? document.body.scrollTop

+document.body.clientHeight-T1[2] : 

window.pageYOffset+window.innerHeight-T1[2]

for (i=0;i<nos;i++){
createContainer

("CUR"+i,i*10,i*10,i*3+1,i*3+2,"","<img 

src='"+T1[i*3]+"' width="+T1[(i*3+1)]+" 

height="+T1[(i*3+2)]+" border=0>")
}

function createContainer

(N,Xp,Yp,W,H,At,HT,Op,St){
with (document){
write((!A && !B) ? "<layer id='"+N+"' 

left="+Xp+" top="+Yp+" width="+W+" height="+H : 

"<div id='"+N+"' 

style='position:absolute;left:"+Xp+"; top:"+Yp

+"; width:"+W+"; height:"+H+"; ");
if(St){
if (C)
write(" style='");
write(St+";' ")
}
else write((A ||?"'":"");
write((At)? At+">" : ">");
write((HT) ? HT : "");
if (!Op)
closeContainer(N)
}
}

function closeContainer(){
((A ||?"</div>":"</layer>")
}

function getXpos(N){
if (A)
return parseInt(document.getElementById

(N).style.left)
else if (B)
return parseInt(B[N].style.left)
else
return C[N].left
}

function getYpos(N){
if (A)
return parseInt(document.getElementById

(N).style.top)
else if (B)
return parseInt(B[N].style.top)
else
return C[N].top
}

function moveContainer(N,DX,DY){
c=(A)? document.getElementById(N).style : (B)? 

B[N].style : (C)? C[N] : "";
if (!B){
rightedge=window.innerWidth-T1[1]-20
bottomedge=window.pageYOffset

+window.innerHeight-T1[2]
}
c.left=Math.min(rightedge, DX+offsetx);
c.top=Math.min(bottomedge, DY+offsety);
}
function cycle(){
//if (IE5) 
if (document.all&&window.print){
ie5fix1=document.body.scrollLeft;
ie5fix2=document.body.scrollTop;
}
for (i=0;i<(nos-1);i++){
moveContainer("CUR"+i,getXpos("CUR"+(i

+1)),getYpos("CUR"+(i+1)))
}
}

function newPos(e){
moveContainer("CUR"+(nos-1),(B)?event.clientX

+ie5fix1:e.pageX+2,(B)?event.clientY

+ie5fix2:e.pageY+2)
}

function getedgesIE(){
rightedge=document.body.clientWidth-T1[1]
bottomedge=document.body.scrollHeight-T1[2]
}

if (B){
window.=getedgesIE
window.onresize=getedgesIE
}

if(document.layers)
document.captureEvents(Event.MOUSEMOVE)
document.onmousemove=newPos
setInterval("cycle()",rate)
TopBottom

Mottie (SuperAdmin) 4/13/2013 8:05 AM EST : RE: New admin in need. Help me Obi-wan, You're my onl...
ACK!
Mottie
Posts: 3883

0
Like

0
Dislike

Hi Eothon!

Since GuildPortal uses jQuery, I think it'd be easier to update the script a bit  :P

To have this on every page, add this bit of code to your custom scripting section (Control Panel > Custom HTML & Script > Custom JS/JQuery > Document Ready Event)
var $cur = $('<img width="50" height="50" src="http://tlw.guildportal.com/GuildFiles/474073/Navi.gif">').appendTo('body');
$(document).on('mousemove', function(e){ $cur.offset({ left: e.pageX, top: e.pageY+20 }); });
Seriously, that's all there is to it, if you only want one image.
Characters: Mottie Motty Mortie Ooshiny Mot Fudgems
TopBottom

Eothon (Applicant) 4/13/2013 9:34 AM EST : RE: New admin in need. Help me Obi-wan, You're my onl...
Eothon
Posts: 7

0
Like

0
Dislike

"Aren't you a little short for a storm trooper?"-Eothon
“I’m Luke Skywalker, I’m here to rescue you.”-Mottie

that works great 

... now if only i could figure out how to make the image circle randomly too...
TopBottom

Mottie (SuperAdmin) 4/16/2013 8:27 AM EST : RE: New admin in need. Help me Obi-wan, You're my onl...
ACK!
Mottie
Posts: 3883

0
Like

0
Dislike

Oh, sorry I should have replied... making the image circle will take a lot more coding and I don't have that much time right now. I'll look into it when I do have time.
Characters: Mottie Motty Mortie Ooshiny Mot Fudgems
TopBottom

 
 
Key 
New posts No new posts
New posts ( popular ) No new posts ( popular )
New posts ( sticky ) No new posts ( sticky )
New posts ( locked ) No new posts ( locked )
 
 
Who's Online 
There are   members online.
 
 
So-and-so has logged on!
%title%
%message%