Connecting Tech Pros Worldwide Help | Site Map

GoLive JS is a mess - Need help

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 20th, 2005, 11:52 AM
wrrn
Guest
 
Posts: n/a
Default GoLive JS is a mess - Need help

Hi -

I'm beginning work on an existing web site which was created with Adobe Golive.
The page in question has CSACTIONS which is part of Golive's CyberStudio.

Anyway, the code below has this CSaction stuff and a bunch of Javascript. If
somebody would please take a very brief peek at the code and give me a basic
idea of what it does. Presumably something to do with pausing the page before
redirecting to another URL. But it seems like so much code just to do that;
surely it
does more ...

TIA,
warren



BEGIN CODE >>>


<csactions>
<csaction name="B46F6EE63" class="Idle" type="ONLOAD" val0="true"
val1="B46F6F114,,B46F6F545">
<csaction name="B46F6F114" class="Timeout" type="ONEVENT" val0="2.500000">
<csaction name="B46F6F545" class="Goto Link" type="ONEVENT"
val0="home/fs1.html" val1>
</csactions>
<csactionitem name="B46F6EE63"></csactionitem>
<csscriptdict>
<script><!--
CSStopExecution = false;
CSInit = new Array;
function CSScriptInit() {
if(typeof(skipPage) != "undefined") { if(skipPage) return; }
idxArray = new Array;
for(var i=0;i<CSInit.length;i++)
idxArray[i] = i;
CSAction2(CSInit, idxArray);
}
CSStopExecution = false;

function CSAction(array) {
return CSAction2(CSAct, array);
}
function CSAction2(fct, array) {
var result;
for (var i=0;i<array.length;i++) {
if(CSStopExecution) return false;
var actArray = fct[array[i]];
if(actArray == null) return false;

var tempArray = new Array;
for(var j=1;j<actArray.length;j++) {
if((actArray[j] != null) && (typeof(actArray[j]) == "object") &&
(actArray[j].length == 2)) {
if(actArray[j][0] == "VAR") {
tempArray[j] = CSStateArray[actArray[j][1]];
}
else {
if(actArray[j][0] == "ACT") {
tempArray[j] = CSAction(new Array(new String(actArray[j][1])));
}
else
tempArray[j] = actArray[j];
}
}
else
tempArray[j] = actArray[j];
}
result = actArray[0](tempArray);
}
return result;
}
CSAct = new Object;
CSAg = window.navigator.userAgent; CSBVers =
parseInt(CSAg.charAt(CSAg.indexOf("/")+1),10);
function IsIE() { return CSAg.indexOf("MSIE") > 0;}
function CSIEStyl(s) { return document.all.tags("div")[s].style; }
function CSNSStyl(s) { return CSFindElement(s,0); }
function CSFindElement(n,ly) { if (CSBVers < 4) return document[n];
var curDoc = ly ? ly.document : document; var elem = curDoc[n];
if (!elem) { for (var i=0;i<curDoc.layers.length;i++) {
elem = CSFindElement(n,curDoc.layers[i]); if (elem) return elem; }}
return elem;
}
function CSSetStylePos(s,d,p) { if (IsIE()) { if (d == 0) CSIEStyl(s).posLeft =
p; else CSIEStyl(s).posTop = p; }
else { if (d == 0) CSNSStyl(s).left = p; else CSNSStyl(s).top = p; } }
function CSGetStylePos(s,d) { if (IsIE()) { if (d == 0) return
CSIEStyl(s).posLeft; else return CSIEStyl(s).posTop; }
else { if (d == 0) return CSNSStyl(s).left; else return CSNSStyl(s).top; }}
CSLoopIsRunning = false; CSFctArray = new Array; CSTimeoutID = null;
function CSLoop() {
CSLoopIsRunning = false;
for (i=0;i<CSFctArray.length;i++) {
var curFct = CSFctArray[i];
if (curFct) {
if (curFct.DoFunction(curFct)) { CSLoopIsRunning = true; curFct.counter++; }
else CSFctArray[i] = 0;
}
}
if (CSLoopIsRunning) CSTimeoutID = setTimeout("CSLoop()", 1);
}
function CSStartFunction(fct,data) {
if (!CSLoopIsRunning) { CSFctArray = 0; CSFctArray = new Array; }
var fctInfo = new Object;
fctInfo.DoFunction = fct; fctInfo.counter = 0; fctInfo.data = data;
CSFctArray[CSFctArray.length] = fctInfo;
if (!CSLoopIsRunning) CSLoop();
}
function CSStopFunction(sceneName) {
var i;
for (i=0;i<CSFctArray.length;i++) {
var curFct = CSFctArray[i];
if (curFct){ if (curFct.data.name == sceneName){ CSFctArray[i] = 0;
return; } }
}
}
function CSStopComplete() {
if (CSTimeoutID == null) return;
clearTimeout (CSTimeoutID); CSLoopIsRunning = false; CSTimeoutID = null;
}
function CSMoveLoop(fInf) {
var ticks = 60 * (((new Date()).getTime()) - fInf.data.startTime)/1000;
var f = ticks/fInf.data.ticks;
if (f < 1) { CSSetStylePos(fInf.data.layer,0,fInf.data.start[0] * (1-f) +
fInf.data.end[0] * f);
CSSetStylePos(fInf.data.layer,1,fInf.data.start[1] * (1-f) + fInf.data.end[1]
* f); return true; }
else { CSSetStylePos(fInf.data.layer,0,fInf.data.end[0]);
CSSetStylePos(fInf.data.layer,1,fInf.data.end[1]); }
return false;
}
function CSSlideObj (layer,start,end,ticks,startTime) {

this.layer=layer;this.start=start;this.end=end;thi s.ticks=ticks;this.startTime=s
tartTime;
}
function CSSlideLayer(l,pos,anim,ticks) {
var x = pos[0]; var y = pos[1];

if (l == '') return;
if (!anim) { CSSetStylePos(l,0,x); CSSetStylePos(l,1,y); }
else { var fctData = new CSSlideObj(l,new
Array(CSGetStylePos(l,0),CSGetStylePos(l,1)),new Array(x,y),ticks,(new
Date()).getTime()); CSStartFunction(CSMoveLoop,fctData); }
}
function CSIdleObject (action) {
this.conditionAction = action[2];
this.trueAction = action[3];
this.falseAction = action[4];
this.exitIdleIfTrue = action[1];
this.lastState = false;
}
function CSIdleAction(action) {
idleObj = new CSIdleObject (action);
CSStartFunction (CSDoIdle,idleObj);
}
function CSDoIdle (param) {
idleObject=param.data;
if (idleObject.conditionAction) {
gCurrentIdleObject = idleObject;
var result = CSAction(new Array(idleObject.conditionAction));
if (result == true && idleObject.lastState==false) {
idleObject.lastState = result;
if (idleObject.trueAction) {
CSAction(new Array(idleObject.trueAction));
if (idleObject.exitIdleIfTrue == true) return false;
}
} else if (result == false && idleObject.lastState == true) {
idleObject.lastState = false;
if (idleObject.falseAction) {
CSAction(new Array(idleObject.falseAction));
}
}
}
return true;
}function CSTimeout (condition) {
var result = false;
if (typeof (gCurrentIdleObject) == "undefined") return result;
if (gCurrentIdleObject.lastTime) {
var t=new Date();
if (t.getTime() >= gCurrentIdleObject.lastTime) {
if (t.getTime() >= gCurrentIdleObject.nextTime) {
gCurrentIdleObject.lastTime = t.getTime() + condition[1]*1000;
gCurrentIdleObject.nextTime = gCurrentIdleObject.lastTime +
condition[1]*1000;
return false;
}
return true;
}
} else {
var t=new Date();
gCurrentIdleObject.lastTime = t.getTime() + condition[1]*1000;
gCurrentIdleObject.nextTime = gCurrentIdleObject.lastTime + condition[1]*1000;
}
return result;
}function CSGotoLink(action) {
if (action[2].length) {
var hasFrame=false;
for(i=0;i<parent.frames.length;i++) { if (parent.frames[i].name==action[2])
{ hasFrame=true; break;}}
if (hasFrame==true)
parent.frames[action[2]].location = action[1];
else
window.open (action[1],action[2],"");
}
else location = action[1];
}
// --></script>
</csscriptdict>
<csactiondict>
<script><!--
CSInit[CSInit.length] = new Array(CSIdleAction,true,/*CMP*/ 'B46F6F114', /*CMP*/
'', /*CMP*/ 'B46F6F545');
CSAct[/*CMP*/ 'B46F6F114'] = new Array(CSTimeout,2.500000);
CSAct[/*CMP*/ 'B46F6F545'] = new Array(CSGotoLink,/*URL*/ 'home/fs1.html','');

// --></script>
</csactiondict>
</head>





  #2  
Old July 20th, 2005, 11:53 AM
Graham J
Guest
 
Posts: n/a
Default Re: GoLive JS is a mess - Need help

> Anyway, the code below has this CSaction stuff and a bunch of
Javascript. If[color=blue]
> somebody would please take a very brief peek at the code and give me[/color]
a basic[color=blue]
> idea of what it does. Presumably something to do with pausing the[/color]
page before[color=blue]
> redirecting to another URL.[/color]

Yes I think that is what it does.
[color=blue]
> But it seems like so much code just to do that; surely it does more[/color]
....

You may find much of it isn't needed. It is there to potentially
support other actions but when you use one you cop for the lot. GoLive
gives the option of having this code in each page or maintaining a
common external library of code on the site and it looks like you are
seeing the former. I think there is also an option to strip the
unneeded bits but I may have made that up as I don't tend to use the
actions. As you can see they can be a sledgehammer to crack a nut.



  #3  
Old July 20th, 2005, 11:53 AM
wrrn
Guest
 
Posts: n/a
Default Re: GoLive JS is a mess - Need help

Thanks Graham.
w


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.