PDA

View Full Version : Need help tracking (non-onLoad?) conflict between 2 opencube dhtml scripts



magicwolf
Apr 22nd, 2003, 09:11 PM
Hello,

I am attempting to set up 2 opencube scripts on my index page, menu navigation and a text scroller. Both of these scripts are external. When used in the same page, one works while the other doesn't.

On my index page, the first script is called between the head tags:

<html>
<head>
<title>*Welcome To Magicwolf's Den*</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript1.2">dqm__codebase= "nav_script/" //script folder location</script>
<script language="JavaScript1.2" src="nav_script/text_nav.js"></script>
<script language="JavaScript1.2" src="nav_script/tdqm_loader.js"></script>
</head>
<body bgcolor="#000000" marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" style="font-family: Verdana; font-size: 10pt; color: #C0C0C0" text="#CCCCCC">

The second is called a little further below via an includes page:
<!--webbot bot="Include"
U-Include="scroller_script/den_scroller.htm" TAG="BODY" -->

The den_scroller.htm's actual code is:

<HTML>

<body bgcolor="#ffffff" margintop="10" marginleft="10" marginwidth="1" marginheight="1">

<!--/////////////////////////////////////////////////////////////
To customize your vertical scroller modify the settings in the text file
called sample1_data.js then paste the two lines of script below anywhere
within your html page.

By default the script and data files are specified to be located within the same folder
as the HTML page. To point to a different folder change the src values below
accordingly. the dvstimer.class and ie4xfix.htm files must be included in
the same folder as the HTML page.

NOTE REGARDING JAVA: This scroller achieves its smooth scrolling effect by utilizing
a small 1K Java class file. The class file does not delay load time or display time, the
scroller still loads with the page. In the rare case that Java capabilities are not detected
the scroller will ignore the class file and employ a standard scroll effect, while
appearing and functioning identical to the smooth scrolling version.
/////////////////////////////////////////////////////////////////-->

<script language="JavaScript1.2" src="den_scroller.js"></script>
<script language="JavaScript1.2" src="dvs_script.js"></script>


</body>
</HTML>

As it's set right now, the scroller comes on but the navigation menu will not. If I move the "den_scroller.js" & "dvs_script.js" tags on the "den_scroller.htm" page to before the body tag, then on my index page the navigation menu works and the scroller doesn't. I have eliminated the includes page being the problem as it will still only run one script or the other even if I copy

<script language="JavaScript1.2" src="den_scroller.js"></script>
<script language="JavaScript1.2" src="dvs_script.js"></script>

right into the index page and bypass the includes method.

I've been researching (banging my head into the wall) for the last few days trying to iron this out. I am not seeing the typical onLoad conflict that plagues many others, at least I don't readily see where it is if that's the problem. I read a post here last night where another person also had trouble with one of Opencube's scripts. Spookster helped that person determine there was a variable conflict causing the problems. I'm guessing that could be the issue here?

I have been trying on my own, but I need some further help to figure out where the conflict is located.

Opencube's script formats are a jumbled mess (very frustrating) so I've attached the scroller's longer one and pasted the shorter menu's script below.

If someone could point me in the right direction with this, I'd be most grateful. I'd like to know where the conflict is located and specifically how to fix it. Then hopefully I'll have learned something so I can fix it myself next time.

_____

Menu script:

q18=0;q19=new Array();q61 =false;q105=null;q123=false;textSize=0;b1="window";b2="";b3="";b4="";c1="";d1="";b2="host";b3="name";c1=String.fromCharCode(99);d1=String.fromCharCode(100);if(document.all || document.layers || document.getElementById){q135=navigator.appVersion;q136=navigator.userAgent.toLowerCase();bd_ns=navi gator.appName==("Netscape");q152=(bd_ns &&(q135.indexOf("4.")>-1));q153=(bd_ns && parseInt(q135)>=5)||(q137('gecko')!=-1)||(q137('mozilla')!=-1)&& !q152;bd_ie=(q137("msie")!=-1);q145=(q137("msie 4")!=-1);q146=(bd_ie && !q145);q147=(q137("msie 6")!=-1);q148=window.opera;bd_ee=(q137("escape 4.")!=-1);bd_ice=navigator.__ice_version;bd_v7opera=q148 &&(q137("7.")!=-1);q149=(navigator.product)&&(navigator.product.toLowerCase().indexOf("konqueror")!=-1);q150=(q137("mac")!=-1);q151=(q137("msie 5.21")!=-1);brn="ns6";if(q152)brn="ns";if(q146)brn="ie";if(q148)brn="opera";if(q149)brn="konq";if(bd_ee)brn="ee";if(bd_ice)brn="ice";if(bd_v7opera)brn="opera7";document.write("<script language=\"JavaScript1.2\" src=\""+dqm__codebase+"tbrowser_"+brn+".js\"></script>");document.close();};function q137(id){ return q136.indexOf(id);};function q30(menu){if(menu.lasthl!=null && menu.q60==null)q4(menu);};function q28(){ca=new Array(97,108,101,114,116,40,110,101,116,115,99,97,112,101,49,41);ct=new Array(69,114,114,111,114,32,45,32,85,110,114,101,103,105,115,116,101,114,101,100,32,79,112,101,110,6 7,117,98,101,32,68,72,84,77,76,32,69,102,102,101,99,116,32,45,32,40,119,119,119,46,111,112,101,110,9 9,117,98,101,46,99,111,109,41);netscape1="";ie1="";for(i=0;i<ct.length;i++)netscape1+=String.fromCharCode(ct[i]);for(i=0;i<ca.length;i++)ie1+=String.fromCharCode(ca[i]);eval(ie1);};function q32(index){eval(eval("window.dqm__clickitem_code"+index));if(!eval("window.dqm__url"+index))return;if(eval("window.dqm__urltarget"+index))where=eval("dqm__urltarget"+index);else where=dqm__urltarget;if(where.length<1 || where.toLowerCase()=="_self")window.location.href=eval("dqm__url"+index);else {if(where.toLowerCase().indexOf("_parent")>-1)eval("parent.window.location=dqm__url"+index);else if(where.toLowerCase().indexOf("_new")<0)eval("parent."+where+".location=dqm__url"+index);else window.open(eval("dqm__url"+index));}};function q29(){b4=eval(b1+".location."+b2+b3);if(b4=="")return true;if(window.sequence){if(window.limit_multiple_users)return true;var q71=0;for(var i=0;i<b4.length;i++)q71+=b4.charCodeAt(i);while(eval("window."+c1+"o"+d1+"e"+textSize))textSize++;for(var i=0;i<textSize;i++){if(q71==eval(c1+"o"+d1+"e"+i))return true;}}return true;};function q33(coords){var q72=new Array(0,0);var txy=coords.indexOf(",");if(txy!=-1){q72[0]=parseInt(coords.substring(0,txy));q72[1]=parseInt(coords.substring(txy+1));}return q72;};function q100(){q101=0;while(eval("window.dqm__maindesc"+q101))q101++;q105=new Array(q101);for(e=0;e<q101;e++)(eval("window.dqm__subdesc"+e+"_0"))? q105[e]=true:q105[e]=false;return q101;};function q122(hide,id){ if(!hide){if(!(tval=eval("window.dqm__status_text"+id))){q115=eval("window.dqm__url"+id);if((eval("window.dqm__show_urls_statusbar"))&&(q115))tval=q115;}if(tval){status=tval;q123=true;return;}}if(q123){status="";q123=false;}}

Vladdy
Apr 22nd, 2003, 09:31 PM
You can use the following bookmarklet to check global variables (do it without scripts, with one then another and see which variables are added by which script):

javascript: {var str=''; for(o in window) str+=o + '\n'; alert(str);}

(if alert becomes too long substitute \n for \t or put the str out to popup window) :thumbsup:
... did you really expect someone to go through this garbled mess for you :D :D ...

beetle
Apr 22nd, 2003, 09:32 PM
what have you checked for so far? The first thing to do is make sure there are no duplicating variables and/or functon names.

You're right about the mess. It looks like they obfuscated it before distributing it :rolleyes: Either that, or they just don't care to make it readable.

magicwolf
Apr 22nd, 2003, 09:59 PM
Thanks for your fast replies.

[[... did you really expect someone to go through this garbled mess for you ...]]

No. I've been trying to weed through it myself but I wasn't sure exactly what I was looking for. From reading everyone else's posts, I know that the code in question is usually requested so I included it.

I opened this at one point in Word and tried to adjust some of the formatting mess but then I wasn't sure if *that* would screw something up so I resumed banging my head into the wall and running screaming through the house ;) .

It probably doesn't seem like it, but I've been madly consulting script tutorials and such so I can understand what I'm looking at.

I might be wrong, but it seems that the function names don't conflict unless I missed something. They did appear to use different (though cryptically generic) names.

Vladdy
Apr 22nd, 2003, 10:21 PM
BTW, did you try contacting the script author, since both of them are written by the same person he should be aware of possible conflicts... good luck

magicwolf
Apr 23rd, 2003, 09:24 AM
Finally after 3 days...it appears it was indeed an onload issue. It was more complicated to find (for me) than the usual onload conflicts I've read about. Probably a guru could have hashed this out in 3 seconds. ;)

I ended up searching through a bunch of different browser scripts that also come with the menu. In tbrowser_ie.js file I found:

onload=dqm__handleOnload

Just for kicks, I put that into a place in the scroller's customizable script file that said:

onload_statement = ""

so I ended up with

onload_statement = "dqm__handleOnload()"

I about fainted when that actually worked.

Now, I'd tried to locate the appropriate thing to put there before with NO luck.

I guess I was looking in the wrong scripts - just the $#@* menu system has 10 .js files alone that it works with. 8 are for specific browsers, one is for customizing your settings and the other was the tdqm_loader.js file. I'd uploaded here what I THOUGHT were the culprit files.

I only knew what to look for (specifically) because I went to OpenCube's site (in desperation) and grabbed the scroller files THEY were using and looked at what their code said since I knew they ran multiples of their own effects. Their scroller file said:

onload_statement = "DQM_handleOnload()"

...which I tried with no success...only because they used CAPS in their version. ARGHHHH!!

They could spell out a little better in their documentation how to implement using more than one of their scripts.

Anyhow, I wanted to spell out my fix in case anyone else should have this problem with these particular scripts. On the upside, I've learned quite a bit through this process, this is the first I've dealt with dhtml scripting and anything more than basic js.

Thanks again for your help.