Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-12-2009, 03:31 PM
Wordplay Wordplay is offline
 
Join Date: Nov 2001
Location: Dengoku
Posts: 864
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default conflict loading 2 different javascripts on one page

this is my html header... which seems to have a conflict... right where the < script > begins...

Code:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<style type="text/css">
<!--
body {
	background-image: url();
	background-color: #BFB999;
}
.roundclass { background: #BFB999; padding: 5px; border: solid 1px #666666; color: #FFFFFF }
-->
</style>

<link rel="stylesheet" type="text/css" href="navm.css" />

<script type="text/javascript" src="navm.js">
<script type="text/javascript" type="text/javascript" src="cssquery2-p.js"></script>
<script type="text/javascript" type="text/javascript" src="ruzeeborders.js"></script>
<script type="text/javascript" type="text/javascript"><!--

RUZEE.Borders.add({
  '.roundclass': { borderType:'simple', cornerRadius:10, height:100 },
});

window.onload=function(){
//alert("sd");
  RUZEE.Borders.render();
};

//-->
</script></head>
i need to load 2 different javascript on one page...

navbar includes:
navm.js
navm.css

rounded borders include:
cssquery2-p.js
ruzeeborders.js


i will post the codes for the js files if needed... right now i'm thinking hopefully it's just a conflict because i messed up in my head, because dreamweaver doesn't color the script tags below navm.js, it leaves them as text, rather than coloring them red which it usually does with scripts.


if i delete the 2 lines about the navbar, the borders work fine, if i leave them in there, i get the error message saying:
Don't know what to do with '.roundclass' Did you forget to include cssquery?
Reply With Quote
  #2  
Old 01-12-2009, 03:53 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why do you have "type="text/javascript"" twice in your tag for cssquery2-p.js and ruzeeborders.js and the next tag also ?
Reply With Quote
  #3  
Old 01-12-2009, 03:57 PM
Wordplay Wordplay is offline
 
Join Date: Nov 2001
Location: Dengoku
Posts: 864
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i copied it from the original, but yeah i had already noticed that and after taking it out there was no difference.

--------------- Added [DATE]1231783689[/DATE] at [TIME]1231783689[/TIME] ---------------

i guess it must be the javascripts themselfs, so here are the 3 javascripts, i hope somebody can lend a helping hand.


navm.js
Code:
var cssdropdown={
disappeardelay: 250, //set delay in miliseconds before menu disappears onmouseout
dropdownindicator: '<img src="down.gif" border="0" />', //specify full HTML to add to end of each menu item with a drop down menu
enablereveal: [true, 5], //enable swipe effect? [true/false, steps (Number of animation steps. Integer between 1-20. Smaller=faster)]
enableiframeshim: 1, //enable "iframe shim" in IE5.5 to IE7? (1=yes, 0=no)

//No need to edit beyond here////////////////////////

dropmenuobj: null, asscmenuitem: null, domsupport: document.all || document.getElementById, standardbody: null, iframeshimadded: false, revealtimers: {},

getposOffset:function(what, offsettype){
	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
},

css:function(el, targetclass, action){
	var needle=new RegExp("(^|\\s+)"+targetclass+"($|\\s+)", "ig")
	if (action=="check")
		return needle.test(el.className)
	else if (action=="remove")
		el.className=el.className.replace(needle, "")
	else if (action=="add" && !needle.test(el.className))
		el.className+=" "+targetclass
},

showmenu:function(dropmenu, e){
	if (this.enablereveal[0]){
		if (!dropmenu._trueheight || dropmenu._trueheight<10)
			dropmenu._trueheight=dropmenu.offsetHeight
		clearTimeout(this.revealtimers[dropmenu.id])
		dropmenu.style.height=dropmenu._curheight=0
		dropmenu.style.overflow="hidden"
		dropmenu.style.visibility="visible"
		this.revealtimers[dropmenu.id]=setInterval(function(){cssdropdown.revealmenu(dropmenu)}, 10)
	}
	else{
		dropmenu.style.visibility="visible"
	}
	this.css(this.asscmenuitem, "selected", "add")
},

revealmenu:function(dropmenu, dir){
	var curH=dropmenu._curheight, maxH=dropmenu._trueheight, steps=this.enablereveal[1]
	if (curH<maxH){
		var newH=Math.min(curH, maxH)
		dropmenu.style.height=newH+"px"
		dropmenu._curheight= newH + Math.round((maxH-newH)/steps) + 1
	}
	else{ //if done revealing menu
		dropmenu.style.height="auto"
		dropmenu.style.overflow="hidden"
		clearInterval(this.revealtimers[dropmenu.id])
	}
},

clearbrowseredge:function(obj, whichedge){
	var edgeoffset=0
	if (whichedge=="rightedge"){
		var windowedge=document.all && !window.opera? this.standardbody.scrollLeft+this.standardbody.clientWidth-15 : window.pageXOffset+window.innerWidth-15
		var dropmenuW=this.dropmenuobj.offsetWidth
		if (windowedge-this.dropmenuobj.x < dropmenuW)  //move menu to the left?
			edgeoffset=dropmenuW-obj.offsetWidth
	}
	else{
		var topedge=document.all && !window.opera? this.standardbody.scrollTop : window.pageYOffset
		var windowedge=document.all && !window.opera? this.standardbody.scrollTop+this.standardbody.clientHeight-15 : window.pageYOffset+window.innerHeight-18
		var dropmenuH=this.dropmenuobj._trueheight
		if (windowedge-this.dropmenuobj.y < dropmenuH){ //move up?
			edgeoffset=dropmenuH+obj.offsetHeight
			if ((this.dropmenuobj.y-topedge)<dropmenuH) //up no good either?
				edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
		}
	}
	return edgeoffset
},

dropit:function(obj, e, dropmenuID){
	if (this.dropmenuobj!=null) //hide previous menu
		this.hidemenu() //hide menu
	this.clearhidemenu()
	this.dropmenuobj=document.getElementById(dropmenuID) //reference drop down menu
	this.asscmenuitem=obj //reference associated menu item
	this.showmenu(this.dropmenuobj, e)
	this.dropmenuobj.x=this.getposOffset(obj, "left")
	this.dropmenuobj.y=this.getposOffset(obj, "top")
	this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px"
	this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px"
	this.positionshim() //call iframe shim function
},

positionshim:function(){ //display iframe shim function
	if (this.iframeshimadded){
		if (this.dropmenuobj.style.visibility=="visible"){
			this.shimobject.style.width=this.dropmenuobj.offsetWidth+"px"
			this.shimobject.style.height=this.dropmenuobj._trueheight+"px"
			this.shimobject.style.left=parseInt(this.dropmenuobj.style.left)+"px"
			this.shimobject.style.top=parseInt(this.dropmenuobj.style.top)+"px"
			this.shimobject.style.display="block"
		}
	}
},

hideshim:function(){
	if (this.iframeshimadded)
		this.shimobject.style.display='none'
},

isContained:function(m, e){
	var e=window.event || e
	var c=e.relatedTarget || ((e.type=="mouseover")? e.fromElement : e.toElement)
	while (c && c!=m)try {c=c.parentNode} catch(e){c=m}
	if (c==m)
		return true
	else
		return false
},

dynamichide:function(m, e){
	if (!this.isContained(m, e)){
		this.delayhidemenu()
	}
},

delayhidemenu:function(){
	this.delayhide=setTimeout("cssdropdown.hidemenu()", this.disappeardelay) //hide menu
},

hidemenu:function(){
	this.css(this.asscmenuitem, "selected", "remove")
	this.dropmenuobj.style.visibility='hidden'
	this.dropmenuobj.style.left=this.dropmenuobj.style.top="-1000px"
	this.hideshim()
},

clearhidemenu:function(){
	if (this.delayhide!="undefined")
		clearTimeout(this.delayhide)
},

addEvent:function(target, functionref, tasktype){
	if (target.addEventListener)
		target.addEventListener(tasktype, functionref, false);
	else if (target.attachEvent)
		target.attachEvent('on'+tasktype, function(){return functionref.call(target, window.event)});
},

startchrome:function(){
	if (!this.domsupport)
		return
	this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
	for (var ids=0; ids<arguments.length; ids++){
		var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a")
		for (var i=0; i<menuitems.length; i++){
			if (menuitems[i].getAttribute("rel")){
				var relvalue=menuitems[i].getAttribute("rel")
				var asscdropdownmenu=document.getElementById(relvalue)
				this.addEvent(asscdropdownmenu, function(){cssdropdown.clearhidemenu()}, "mouseover")
				this.addEvent(asscdropdownmenu, function(e){cssdropdown.dynamichide(this, e)}, "mouseout")
				this.addEvent(asscdropdownmenu, function(){cssdropdown.delayhidemenu()}, "click")
				try{
					menuitems[i].innerHTML=menuitems[i].innerHTML+" "+this.dropdownindicator
				}catch(e){}
				this.addEvent(menuitems[i], function(e){ //show drop down menu when main menu items are mouse over-ed
					if (!cssdropdown.isContained(this, e)){
						var evtobj=window.event || e
						cssdropdown.dropit(this, evtobj, this.getAttribute("rel"))
					}
				}, "mouseover")
				this.addEvent(menuitems[i], function(e){cssdropdown.dynamichide(this, e)}, "mouseout") //hide drop down menu when main menu items are mouse out
				this.addEvent(menuitems[i], function(){cssdropdown.delayhidemenu()}, "click") //hide drop down menu when main menu items are clicked on
			}
		} //end inner for
	} //end outer for
	if (this.enableiframeshim && document.all && !window.XDomainRequest && !this.iframeshimadded){ //enable iframe shim in IE5.5 thru IE7?
		document.write('<IFRAME id="iframeshim" src="about:blank" frameBorder="0" scrolling="no" style="left:0; top:0; position:absolute; display:none;z-index:90; background: transparent;"></IFRAME>')
		this.shimobject=document.getElementById("iframeshim") //reference iframe object
		this.shimobject.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)'
		this.iframeshimadded=true
	}
} //end startchrome

}
--------------- Added [DATE]1231783736[/DATE] at [TIME]1231783736[/TIME] ---------------

cssquery2-p.js
Code:
/*
cssQuery, version 2.0.2 (2005-08-19)
Copyright: 2004-2005, Dean Edwards (http://dean.edwards.name/)
License: http://creativecommons.org/licenses/LGPL/2.1/
Packed by Steffen Rusitschka; included modules: css level2 and standard.
*/
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[(function(e){return d[e]})];e=(function(){return'\\w+'});c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('6 B=7(){6 1j="2.0.2ruzee";6 $23=/\\s*,\\s*/;6 B=7($9,$$a){6 $c=[];6 $1h=o.2q.1Q&&!$$a;6 $1k=($$a)?($$a.2g==1t)?$$a:[$$a]:[z];6 $$u=14($9).1w($23),i;m(i=0;i<$$u.p;i++){$9=1q($$u[i]);b(P&&$9.Z(0,3).1R("")==" *#"){$9=$9.Z(2);$$a=24([],$1k,$9[1])}1s $$a=$1k;6 j=0,$I,$x,$o,$M="";H(j<$9.p){$I=$9[j++];$x=$9[j++];$M+=$I+$x;$o="";b($9[j]=="("){H($9[j++]!=")"&&j<$9.p){$o+=$9[j]}$o=$o.Z(0,-1);$M+="("+$o+")"}$$a=($1h&&O[$M])?O[$M]:1u($$a,$I,$x,$o);b($1h)O[$M]=$$a}$c=$c.2i($$a)}1S B.2k;8 $c};B.1B=7(){8"7 B() {\\n  [1j "+1j+"]\\n}"};6 O={};B.1Q=R;B.2l=7($9){b($9){$9=1q($9).1R("");1S O[$9]}1s O={}};6 28={};6 1g=R;B.2m=7($J,$15){b(1g)1f("$15="+21($15));28[$J]=17 $15()};B.2n=7($F){8 $F?1f($F):l};6 u={};6 L={};6 t={c:/\\[([\\w-]+(\\|[\\w-]+)?)\\s*(\\W?=)?\\s*([^\\]]*)\\]/};6 E=[];u[" "]=7($f,$a,$k,$h){6 $5,i,j;m(i=0;i<$a.p;i++){6 $10=T($a[i],$k,$h);m(j=0;($5=$10[j]);j++){b(D($5)&&16($5,$h))$f.q($5)}}};u["#"]=7($f,$a,$v){6 $5,j;m(j=0;($5=$a[j]);j++)b($5.v==$v)$f.q($5)};u["."]=7($f,$a,$N){$N=17 1M("(^|\\\\s)"+$N+"(\\\\s|$)");6 $5,i;m(i=0;($5=$a[i]);i++)b($N.d($5.N))$f.q($5)};u[":"]=7($f,$a,$1V,$o){6 $d=L[$1V],$5,i;b($d)m(i=0;($5=$a[i]);i++)b($d($5,$o))$f.q($5)};L["2p"]=7($5){6 $z=X($5);b($z.1m)m(6 i=0;i<$z.1m.p;i++){b($z.1m[i]==$5)8 18}};L["2B"]=7($5){};6 D=7($5){8($5&&$5.1v==1&&$5.k!="!")?$5:1T};6 1d=7($5){H($5&&($5=$5.2s)&&!D($5))1W;8 $5};6 12=7($5){H($5&&($5=$5.2t)&&!D($5))1W;8 $5};6 1Z=7($5){8 D($5.1Y)||12($5.1Y)};6 2v=7($5){8 D($5.1X)||1d($5.1X)};6 U=7($5){6 $U=[];$5=1Z($5);H($5){$U.q($5);$5=12($5)}8 $U};6 P=18;6 1o=7($5){6 $z=X($5);8(2y $z.20=="2A")?/\\.26$/i.d($z.2C):2D($z.20=="2F 2G")};6 X=7($5){8 $5.2H||$5.z};6 T=7($5,$k){8($k=="*"&&$5.1l)?$5.1l:$5.T($k)};6 1b=7($5,$k,$h){b($k=="*")8 D($5);b(!16($5,$h))8 R;b(!1o($5))$k=$k.2J();8 $5.k==$k};6 16=7($5,$h){8!$h||($h=="*")||($5.2K==$h)};6 1J=7($5){8 $5.1K};7 24($f,$a,v){6 $c,i,j;m(i=0;i<$a.p;i++){b($c=$a[i].1l.2L(v)){b($c.v==v)$f.q($c);1s b($c.p!=1T){m(j=0;j<$c.p;j++){b($c[j].v==v)$f.q($c[j])}}}}8 $f};b(![].q)1t.29.q=7(){m(6 i=0;i<o.p;i++){l[l.p]=o[i]}8 l.p};6 $19=/\\|/;7 1u($$a,$I,$x,$o){b($19.d($x)){$x=$x.1w($19);$o=$x[0];$x=$x[1]}6 $f=[];b(u[$I]){u[$I]($f,$$a,$x,$o)}8 $f};6 $1y=/^[^\\s>+~]/;6 $$1z=/[\\s#.:>+~()@]|[^\\s#.:>+~()@]+/g;7 1q($9){b($1y.d($9))$9=" "+$9;8 $9.c($$1z)||[]};6 $1A=/\\s*([\\s>+~(),]|^|$)\\s*/g;6 $22=/([\\s>+~,]|[^(]\\+|^)([#.:@])/g;6 14=7($9){8 $9.C($1A,"$1").C($22,"$1*$2")};6 1p={1B:7(){8"\'"},c:/^(\'[^\']*\')|("[^"]*")$/,d:7($y){8 l.c.d($y)},1D:7($y){8 l.d($y)?$y:l+$y+l},1C:7($y){8 l.d($y)?$y.Z(1,-1):$y}};6 1U=7($1F){8 1p.1C($1F)};6 $1G=/([\\/()[\\]?{}|*+-])/g;7 1a($y){8 $y.C($1G,"\\\\$1")};u[">"]=7($f,$a,$k,$h){6 $5,i,j;m(i=0;i<$a.p;i++){6 $10=U($a[i]);m(j=0;($5=$10[j]);j++)b(1b($5,$k,$h))$f.q($5)}};u["+"]=7($f,$a,$k,$h){m(6 i=0;i<$a.p;i++){6 $5=12($a[i]);b($5&&1b($5,$k,$h))$f.q($5)}};u["@"]=7($f,$a,$1H){6 $d=E[$1H].d;6 $5,i;m(i=0;($5=$a[i]);i++)b($d($5))$f.q($5)};L["2c-2d"]=7($5){8!1d($5)};L["1e"]=7($5,$F){$F=17 1M("^"+$F,"i");H($5&&!$5.Q("1e"))$5=$5.2e;8 $5&&$F.d($5.Q("1e"))};t.1O=/\\\\:/g;t.1i="@";t.K={};t.C=7($c,$r,$h,$1N,$A){6 $13=l.1i+$c;b(!E[$13]){$r=l.1P($r,$1N||"",$A||"");E[$13]=$r;E.q($r)}8 E[$13].v};t.1L=7($9){$9=$9.C(l.1O,"|");6 $c;H($c=$9.c(l.c)){6 $C=l.C($c[0],$c[1],$c[2],$c[3],$c[4]);$9=$9.C(l.c,$C)}8 $9};t.1P=7($1n,$d,$A){6 $S={};$S.v=l.1i+E.p;$S.J=$1n;$d=l.K[$d];$d=$d?$d(l.Q($1n),1U($A)):R;$S.d=17 2r("e","8 "+$d);8 $S};t.Q=7($J){27($J.2u()){G"v":8"e.v";G"2z":8"e.N";G"m":8"e.2E";G"25":b(P){8"21((e.2I.c(/25=\\\\1r?([^\\\\s\\\\1r]*)\\\\1r?/)||[])[1]||\'\')"}}8"e.Q(\'"+$J.C($19,":")+"\')"};t.K[""]=7($r){8 $r};t.K["="]=7($r,$A){8 $r+"=="+1p.1D($A)};t.K["~="]=7($r,$A){8"/(^| )"+1a($A)+"( |$)/.d("+$r+")"};t.K["|="]=7($r,$A){8"/^"+1a($A)+"(-|$)/.d("+$r+")"};6 1I=14;14=7($9){8 1I(t.1L($9))};P=1f("R;/*@2f@b(@\\2h)P=18@2j@*/");b(!P){T=7($5,$k,$h){8 $h?$5.2o("*",$k):$5.T($k)};16=7($5,$h){8!$h||($h=="*")||($5.2w==$h)};1o=z.1x?7($5){8/26/i.d(X($5).1x)}:7($5){8 X($5).2a.k!="2b"};1J=7($5){8 $5.Y||$5.1K||1c($5)};7 1c($5){6 $Y="",$V,i;m(i=0;($V=$5.2x[i]);i++){27($V.1v){G 11:G 1:$Y+=1c($V);1E;G 3:$Y+=$V.2M;1E}}8 $Y}}1g=18;8 B}();',62,173,'|||||element|var|function|return|selector|from|if|match|test||results||namespace|||tagName|this|for||arguments|length|push|attribute||AttributeSelector|selectors|id||filter|string|document|value|cssQuery|replace|thisElement|attributeSelectors|code|case|while|token|name|tests|pseudoClasses|cacheSelector|className|cache|isMSIE|getAttribute|false|attributeSelector|getElementsByTagName|childElements|node||getDocument|textContent|slice|subset||nextElementSibling|key|parseSelector|script|compareNamespace|new|true|NAMESPACE|regEscape|compareTagName|_getTextContent|previousElementSibling|lang|eval|loaded|useCache|PREFIX|version|base|all|links|propertyName|isXML|Quote|_toStream|x22|else|Array|select|nodeType|split|contentType|STANDARD_SELECT|STREAM|WHITESPACE|toString|remove|add|break|text|ESCAPE|attributeSelectorID|_parseSelector|getTextContent|innerText|parse|RegExp|compare|NS_IE|create|caching|join|delete|null|getText|pseudoClass|continue|lastChild|firstChild|firstElementChild|mimeType|String|IMPLIED_ALL|COMMA|_msie_selectById|href|xml|switch|modules|prototype|documentElement|HTML|first|child|parentNode|cc_on|constructor|x5fwin32|concat|end|error|clearCache|addModule|valueOf|getElementsByTagNameNS|link|callee|Function|previousSibling|nextSibling|toLowerCase|lastElementChild|prefix|childNodes|typeof|class|unknown|visited|URL|Boolean|htmlFor|XML|Document|ownerDocument|outerHTML|toUpperCase|scopeName|item|nodeValue'.split('|'),0,{}))
Reply With Quote
  #4  
Old 01-12-2009, 04:09 PM
Wordplay Wordplay is offline
 
Join Date: Nov 2001
Location: Dengoku
Posts: 864
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ruzeeborders.js
Code:
/**
 * RUZEE.Borders 0.16.1
 * (c) 2006 Steffen Rusitschka <steffen@rusitschka.de>
 *
 * RUZEE.Borders is freely distributable under the terms of an MIT-style license.
 * For details, see http://www.ruzee.com/
 */

var RUZEE=window.RUZEE||{};
RUZEE.userAgent=navigator.userAgent.toLowerCase();
RUZEE.isIE=typeof window.RUZEE.isIE != 'undefined'
  ?window.RUZEE.isIE
  :RUZEE.userAgent.indexOf('msie')>=0
    && RUZEE.userAgent.indexOf('opera')==-1;

RUZEE.Borders={

  /**
   * Set to false to not draw the borders automatically on
   * domload when RUZEE.Events are available.
   */
  autoRender:true,

  /** Add mapping rules to be executed on render(). */
  add:function(mappings){
    for(rule in mappings){
      var rules=rule.split(',');
      for(var i=0; i<rules.length; ++i){
        var r=rules[i].replace(/^\s+|\s+$/,'');
        var ms=RUZEE.Borders.mappings[r]||{};
        for (m in mappings[rule]) ms[m]=mappings[rule][m];
        RUZEE.Borders.mappings[r]=ms;
      }
    }
  },

  /**
   * Render all added mapping rules into the DOM
   * If RUZEE.Events is not available, this method MUST be called in the
   * window.onload method (or with a similar technique)!
   * Note: Since v0.12, this method is asynchronous! If you need to do
   * stuff AFTER the rendering finished, do it inside the function you passed
   * in via the onfinished parameter.
   */
  render:function(onfinished){
    if(onfinished) RUZEE.Borders.onfinished=onfinished;
    var start=new Date().getTime();
    for(rule in RUZEE.Borders.mappings){
      var e=RUZEE.Borders.cssQuery(rule);
      var b=new RUZEE.Borders.Border(RUZEE.Borders.mappings[rule]);
      delete RUZEE.Borders.mappings[rule];
      b.calc(e);
      // if we are rendering for more than 3 seconds, give Firefox some time to get
      // rid of the "unresponsive script" message.
      if(new Date().getTime()-start>3000){
        setTimeout('RUZEE.Borders.render()',0);
        return;
      }
    }
    RUZEE.Borders.renderCalcs();
    if(RUZEE.Borders.onfinished) RUZEE.Borders.onfinished();
  },

  // ---- internal fields and methods ----

  /** the mappings: 'CSS rule' -> Border */
  mappings:{},

  /** The corner cache */
  cache:{},

  /** The completed calulations to render */
  calcs:[],

  /** if Dean Edward's cssQuery is available, use it */
  cssQuery:function(s){
    var c=s.charAt(0);
    if(c=='#'&&!(/\s/.test(s))) return [ document.getElementById(s.substr(1)) ];
    if(window.cssQuery) return window.cssQuery(s);

    alert("Don't know what to do with '"+s+"' Did you forget to include cssquery?");
    return [];
  },

  /** Add a completed calculation */
  addCalc:function(calc){
    RUZEE.Borders.calcs.push(calc);
  },

  renderCalcs:function(){
    for(var i=0; i<RUZEE.Borders.calcs.length; ++i){
      RUZEE.Borders.calcs[i]();
    }
    RUZEE.Borders.calcs=[];
  }
};

/** The Border class */
RUZEE.Borders.Border=function(d){
  var t=this;

  var _cornerRadius,_shadowRadius,_shadowPadding,_shadowShift,_coShadowS,
      _coBgIn,_coBorder,_coBgOut,
      _imgBgInURL,_imgBgInRepeat,_isL,_isR,_isT,_isB,_imgBgInURL,
      _cacheID,_psT,_psB,_wBorder,_height;

  /** Set the background image for element e to position x,y */
  var setBgImg=function(e,x,y){
    if(!_imgBgInURL) return;
    e.style.backgroundImage=_imgBgInURL;
    x=-x;y=-y;
    e.style.backgroundPosition=x+'px '+y+'px';
    if(_imgBgInRepeat) e.style.backgroundRepeat=_imgBgInRepeat;
  };

  /** Create a DIV with width w, height h, background color bg, overflow o */
  var crDiv=function(w,h,bg,o){
    var d=RUZEE.isXHTML
      ?document.createElementNS('http://www.w3.org/1999/xhtml','div')
      :document.createElement('div');
    d.style.padding=d.style.margin='0px';
    d.style.border='none';
    d.style.width=w?w:'auto';
    if(h) { d.style.height=h; d.style.fontSize="0"; d.style.lineHeight="0px"; }
    if(!bg) bg='transparent';
    d.style.background=bg;
    if(o) d.style.overflow=o;
    return d;
  };

  /** Create wrapper DIV around element c */
  var addLR=function(c,co,w,h,bgx,bgy){
    var e=crDiv(null,h,co);
    if(typeof bgx!='undefined') setBgImg(e,bgx,bgy);
    if(!w) w='1px';
    c.style.margin='0px '+(_isR?w:'0px')+' 0px '+(_isL?w:'0px');
    e.appendChild(c);
    return e;
  };

  /** Create the top (top==true) or bottom (top==false) of the border */
  var crTB=function(top){
    var ca=RUZEE.Borders.cache[_cacheID+'.'+top];
    if(ca){
      if(top){
        _psT=ca.ps;
      }else{
        _psB=ca.ps;
      }
      return ca.el.cloneNode(true);
    }
    var sh=top?-_shadowShift:_shadowShift;
    var cxc=_shadowPadding-_cornerRadius-1;
    var cxb=cxc;
    var cxe=cxc+_cornerRadius;
    var exb=0;
    var exe=cxc-1;
    var syc=_cornerRadius-_shadowPadding+sh+1;
    var yb,ye;
    var cwb=_wBorder;
    if(cwb==0) cwb=1;

    if(top){
      if(!_isT){
        _psT=1;
        return crDiv(null,'1px');
      }
      yb=syc+_shadowRadius-1;
      ye=cwb>_shadowRadius?syc+_shadowRadius-cwb-1:syc-1;
      yi=-1;
      _psT=yb-ye;
    }else{
      if(!_isB) {
        _psB=1;
        return crDiv(null,'1px');;
      }
      yb=cwb>_shadowRadius?syc+_shadowRadius-cwb:syc;
      yb=yb<0?yb:0;
      ye=syc+_shadowRadius;
      yi=1;
      _psB=ye-yb;
    }

    var e=crDiv(null, Math.abs(yb-ye)+'px',null,'hidden');
    for(var y=yb; y!=ye; y+=yi){
      var co;
      if(y<=_cornerRadius-cwb){
        co=_coBgIn;
      }else if(y<=_cornerRadius){
        co=_coBorder;
      }else if(y-syc<0){
        co=_coShadow;
      }else{
        co=rzBlend(_coShadow,_coBgOut,(y-syc)/_shadowRadius);
      }
      var line=crDiv(null,'1px',rzC2S(co),'hidden');
      var fstLine=line;
      var xbg=null;
      for(var x=0; x<_shadowRadius; ++x){
        var isIn=false, doBgImg=false;
        var sd, out=0;
        if(y<syc){
          sd=x;
        }else{
          sd=Math.sqrt(Math.sqr(x)+Math.sqr(y-syc));
        }
        if(_shadowRadius>_cornerRadius && sd<=_shadowRadius){
          co=rzBlend(_coShadow, _coBgOut, sd/_shadowRadius);
        }else{
          co=_coBgOut;
          out++;
        }
        if(y<=_cornerRadius){
          if(x>=exb && x<=exe){
            if(y>_cornerRadius-cwb){
              co=_coBorder;
            }else{
              isIn=true;
            }
          }else if(x>=cxb && x<=cxe){
            var cd=Math.sqrt(Math.sqr(x-cxc)+Math.sqr(y))-_cornerRadius;
            if(y<0){
              if(x-cxc>_cornerRadius-_wBorder){
                co=_coBorder;
              }else{ 
                isIn=true;
              }
            }else if(cd<-cwb){
              isIn=true;
            }else if(cd<-cwb+1){
              // first on border! do bgimg
/*              if(top&&_imgBgInURL){
                setBgImg=true;
              }else*/
                co=rzBlend(_coBgIn,_coBorder,cd+cwb);
            }else if(cd<0){
              co=_coBorder;
            }else if(cd<=1){
              co=rzBlend(_coBorder,co,cd);
            }else{
              out++;
            }
          }
        }else{
          out++;
        }
        if(!isIn&&line==fstLine&&y<=_cornerRadius-cwb&&top){
          setBgImg(fstLine,_shadowRadius-x,yb-y);
        }
        if(out>1){
          line=addLR(line,'transparent',(_shadowRadius-x)+'px');
          x=_shadowRadius; // done
        }else{
          if(!isIn){
            // fix a strange IE bug where the 12ths recursion seems to get lost...
            if(RUZEE.isIE&&x==_shadowRadius-12) line=addLR(line);
            line=addLR(line,rzC2S(co));
          }
          if(doBgImg) setBgImg(line,_shadowRadius-x,yb-y+1);
        }
      }
      e.appendChild(line);
    }
    var ce={ el:e, ps:top?_psT:_psB };
    RUZEE.Borders.cache[_cacheID+'.'+top]=ce;
    return e;
  };

  /** Create the left and right of the border */
  var crLR=function(e){
    var coBgInS=rzC2S(_coBgIn);
    var coBS=rzC2S(_coBorder);
    e.style.position='relative';
    if(_wBorder>0) e=addLR(e,coBS,_wBorder+'px');
    e.style.position='relative';
    for(var x=_shadowPadding; x<_shadowRadius; ++x){
      coS=rzC2S(rzBlend(_coShadow,_coBgOut,x/_shadowRadius));
      e=addLR(e,coS);
      e.style.position='relative';
    }
    return e;
  };

  var setEdges=function(ed){
    ed=ed?ed.toLowerCase():'lrtb';
    _isL=ed.indexOf('l')>=0;
    _isR=ed.indexOf('r')>=0;
    _isT=ed.indexOf('t')>=0;
    _isB=ed.indexOf('b')>=0;
  };

  /** Calculate the border around e */
  var calcP=function(e){
    RUZEE.isXHTML=typeof window.RUZEE.isXHTML != 'undefined'
      ?window.RUZEE.isXHTML
      :(/html\:/.test(document.getElementsByTagName('body')[0].nodeName));

    if(!e) return;
    if(e.constructor==Array){
      for(var i=0; i<e.length; ++i) calcP(e[i]);
      return;
    }

    // Get the bg image
    _imgBgInURL=rzGetStyle(e,'background-image');
    if(_imgBgInURL&&_imgBgInURL=='none') _imgBgInURL=null;
    if(_imgBgInURL){
      _imgBgInRepeat=rzGetStyle(e,'background-repeat');
    }
    _coBgIn=rzS2C(rzGetBg(e));
    _coBgOut=rzS2C(rzGetBg(e.parentNode));
    var borderCSS='border-'+(_isT?'top-':'bottom-');
    var bs=rzGetStyle(e,borderCSS+'style','none');
    if(bs && bs!='' && bs!='none' && bs!='hidden'){
      _coBorder=rzS2C(rzGetStyle(e,borderCSS+'color','black'));
      _wBorder=rzPX2I(rzGetStyle(e,borderCSS+'width','1px'));
    }else{
      _coBorder=_coBgIn;
      _wBorder=0;
    }
    _coShadow=_coShadowS=='.fade'?_coBorder:rzS2C(_coShadowS);

    _cacheID=
      rzC2S(_coBgIn)+'.'+rzC2S(_coBgOut)+'.'+
      rzC2S(_coBorder)+'.'+rzC2S(_coShadow)+'.'+
      _wBorder+'.'+_isL+_isR+_isT+_isB+'.'+
      _cornerRadius+'.'+_shadowRadius+'.'+
      _shadowPadding+'.'+this.shadowShift+'.'+
      _imgBgInURL+'.'+_imgBgInRepeat;

    var eb=crDiv(); // e border (2nd!)
    var elOb=crDiv(); // out border
    var elO=crDiv(); // out
    var elI=crDiv(); // in
    var elCw=crDiv(); // content wrapper
    var elCb=crDiv(); // content border
    var elC=crDiv(); // content

    eb.style.position=elC.style.position=elCw.style.position='relative';
    elC.style.zIndex=2; // Konq fix

    eb.appendChild(elOb);
    elOb.appendChild(crDiv(null,'1px')); // filler div (1)
    elOb.appendChild(elO);
    elOb.appendChild(crDiv(null,'1px')); // filler div (2)
    elI.appendChild(elCw);
    elCw.appendChild(elCb);
    elCb.appendChild(elC);

    elO.appendChild(crTB(true));
    var elTB=crLR(elI);
    elO.appendChild(elTB);
    elO.appendChild(crTB(false));
    var psLR=_shadowRadius-_shadowPadding+_wBorder;
    var psL=_isL?psLR:0;
    var psR=_isR?psLR:0;
    var isTB=_isT&&_isB;
    var psT=_psT;
    var psB=_psB;

    var bgImgY=_psT;
    setBgImg(elI,psL,bgImgY);
    elI.style.backgroundColor=rzC2S(_coBgIn);

    // work around for other browsers for sebs problem TODO:check it's working
    // add clearer DIVs
    var end=crDiv('1px','1px');
    elI.insertBefore(end,elCw);
    elI.appendChild(end.cloneNode(true));
    psT++; psB++;

    if(_height){
      elC.style.height=_height+'px';
    }
    var update=function(l,ps){
      var padL='padding-'+l; var padCC=rzCC(padL);
      var marL='margin-'+l; var marCC=rzCC(marL);
      var borL='border-'+l+'-width'; var borCC=rzCC(borL);

      var pad=rzGetStyle(e,padL);
      var borPx=rzPX2I(rzGetStyle(e,borL));
      var borPxNeg=(l=='top'||l=='bottom')?-borPx-1:-borPx; // -1 because of filler div (1) and (2)
      if(!_isB && l=='bottom') borPx-=2; // why???
      if(!_isT && l=='top') borPx-=2; // why???

      eb.style[marCC]=borPx+'px';
      elO.style[marCC]='-'+pad;
      elOb.style[marCC]=borPxNeg+'px';
      elCw.style[marCC]=(-ps)+'px';
      elC.style[marCC]=pad;
      elCb.style[marCC]=borPx+'px';

      return function(){
        // IE quirks... why oh why?
        if(RUZEE.isIE){
           if(l=='top') elOb.style[marCC]='-1px'; // remove top border
           if(l=='bottom') e.style[padCC]='1px'; // reduce bottom padding
        }
      };
    };

    var funcs=[update('top',psT),update('bottom',psB),
               update('left',psL),update('right',psR)];
    RUZEE.Borders.addCalc(function(){
      for(var i=0; i<funcs.length; ++i) funcs[i]();
      e.style.border='none';
      e.style.background='transparent';
      e.style.backgroundImage='none';
      if(RUZEE.isIE){
        e.style.height='1%';
      }
      e.style.position='relative';
      e.appendChild(eb);
      while (e.childNodes.length>1){
        elC.appendChild(e.removeChild(e.childNodes[0]));
      }
    });
  };

  var pub={
    init:function(d){
      var rad=d.cornerRadius||8;
      _height=d.height||0;
      _shadowShift=0;
      setEdges(d.edges||'lrtb');
      switch(d.borderType){
        case 'simple':
          _cornerRadius=_shadowRadius=_shadowPadding=rad;
          _coShadowS='000';
          break;
        case 'shadow':
          var sw=d.shadowWidth||8;
          _cornerRadius=rad;
          _shadowRadius=rad+sw*2;
          _shadowPadding=rad+sw;
          _shadowShift=Math.round(sw/2);
          _coShadowS=d.shadowColor||'000';
          break;
        case 'fade':
          _cornerRadius=_shadowPadding=1;
          _shadowRadius=rad;
          _coShadowS='.fade';
          break;
        case 'glow':
          _cornerRadius=_shadowPadding=rad;
          _shadowRadius=rad+(d.glowWidth||rad);
          _coShadowS=d.glowColor||'fff';
          break;
        default:
          alert('Unknown borderType: '+d.borderType);
      }
    },

    calc:calcP,

    /** Render the border around e */
    render:function(e){
      t.calc(e);
      RUZEE.Borders.renderCalcs();
    },

    // DEPRECATED STUFF - WILL BE REMOVED IN ONE OF THE NEXT RELEASES!
    draw:function(e,edges){
      setEdges(edges?edges.toLowerCase():'lrtb');
      if(typeof e=='string'){
        if(e.charAt(0)!='.') e='#'+e;
        e=RUZEE.Borders.cssQuery(e);
      }
      t.render(e);
    }
  };

  pub.init(d);
  delete pub.init;
  for(m in pub) t[m]=pub[m];
}; // of Border class

// add an event handler for render() if RUZEE.Events are available
if(RUZEE.Events){
  RUZEE.Events.add(window,'domload',function(){
    if(RUZEE.Borders.autoRender) RUZEE.Borders.render();
  });
}

// internal tools

Math.sqr=function(x){
  return x*x;
};

function rzCC(s){
  for(var exp=/-([a-z])/; exp.test(s); s=s.replace(exp,RegExp.$1.toUpperCase()));
  return s;
};

function rzGetStyle(e,a,d){
  if(e==null) return d;
  var v=null;
  if(document.defaultView && document.defaultView.getComputedStyle){
    var cs=document.defaultView.getComputedStyle(e,null);
    if(cs && cs.getPropertyValue) v=cs.getPropertyValue(a);
  }
  if(!v && e.currentStyle) v=e.currentStyle[rzCC(a)];
  return v?v:d?d:null;
};

function rzGetBg(e){
  var v=rzGetStyle(e,'background-color');
  // KHTML bug fix: transparent is #000000 - if you want black, use #010101 in your CSS.
  // Safari work around: transparent is 'rgba(0, 0, 0, 0)'
  while (!v || v=='transparent' || v=='#000000' || v=='rgba(0, 0, 0, 0)'){
    if(e==document.body) v='fff'; else {
      e=e.parentNode;
      v=rzGetStyle(e,'background-color');
    }
  }
  return v;
};

function rzPX2I(px){
  if(!px) return 0;
  var p=/\s*(\d\d*)px/.exec(px);
  if(p) return parseInt(p[1]);
  return 0;
};

function rzS2C(s,d){
    if (!s) return d?rzS2C(d):[0,0,0,0];
    if (s.charAt(0)=='#') s=s.substr(1,6);
    s=s.replace(/ /g,'').toLowerCase();
    // The CSS 2.1 colors
    var COLORS = {
         aqua:'00ffff', black:'000000', blue:'0000ff', fuchsia:'ff00ff',
         gray:'808080', green:'008000', lime:'00ff00', maroon:'800000',
         navy:'000080', olive:'808000', orange:'ffa500', purple:'800080',
         red:'ff0000', silver:'c0c0c0', teal:'008080', white:'ffffff',
         yellow:'ffff00'
    };
    for (var key in COLORS) if (s==key) s=COLORS[key];

    var p=/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(s);
    if(p) return [parseInt(p[1]),parseInt(p[2]),parseInt(p[3]),parseInt(p[4])];
    var p=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(s);
    if(p) return [parseInt(p[1]),parseInt(p[2]),parseInt(p[3]),255];
    p=/^(\w{2})(\w{2})(\w{2})$/.exec(s);
    if(p) return [parseInt(p[1],16),parseInt(p[2],16),parseInt(p[3],16),255];
    p=/^(\w{1})(\w{1})(\w{1})$/.exec(s);
    if(p) return [parseInt(p[1]+p[1],16),parseInt(p[2]+p[2],16),parseInt(p[3]+p[3],16),255];
    return d?rzS2C(d):[0,0,0,0];
};

function rzC2S(c){
  if(typeof c=='string') return c;
  r='0'+c[0].toString(16);
  g='0'+c[1].toString(16);
  b='0'+c[2].toString(16);
  return '#'
    +r.substring(r.length-2)
    +g.substring(g.length-2)
    +b.substring(b.length-2);
};

function rzBlend(a,b,w){
  return Array(
    Math.round(a[0]+(b[0]-a[0])*w),
    Math.round(a[1]+(b[1]-a[1])*w),
    Math.round(a[2]+(b[2]-a[2])*w),
    Math.round(a[3]+(b[3]-a[3])*w));
};

// DEPRECATED STUFF - WILL BE REMOVED IN ONE OF THE NEXT RELEASES!
function rzCrSimpleBorder(rad){
  return new RUZEE.Borders.Border({ borderType:'simple', cornerRadius:rad });
};

function rzCrShadowBorder(rad,smar,coShadowS){
  return new RUZEE.Borders.Border({
    borderType:'shadow', cornerRadius:rad, shadowWidth:smar, shadowColor:coShadowS });
};

function rzCrFadeBorder(rad){
  return new RUZEE.Borders.Border({ borderType:'fade', cornerRadius:rad });
};

function rzCrGlowBorder(rad,gmar,coGlowS){
  return new RUZEE.Borders.Border({ borderType:'glow', cornerRadius:rad, glowWidth:gmar, glowColor:coGlowS });
};
Reply With Quote
  #5  
Old 01-12-2009, 05:10 PM
Bellardia Bellardia is offline
 
Join Date: Jul 2007
Location: Hamilton, Ontario
Posts: 378
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would assume you implemented one of the scripts wrong because it's what is giving you there error message.

Are you sure you're using them correctly? They're far too long to read through and determine what they do...Perhaps refer to where you got them.
Reply With Quote
  #6  
Old 01-12-2009, 05:30 PM
Wordplay Wordplay is offline
 
Join Date: Nov 2001
Location: Dengoku
Posts: 864
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i don't think i implemented them incorrectly, because as i said, if i take out one of them the other one works.

if i place the navm above the roundcorners, the navm works, if i place the roundcorners above, only that one works.

navm:
http://www.dynamicdrive.com/dynamici...rome/index.htm

roundcorners:
http://webdesign.html.it/articoli/le...fty-corners/1/

--------------- Added [DATE]1231789691[/DATE] at [TIME]1231789691[/TIME] ---------------

is it natural that you can't load 2 different js scripts on the same page?

i copied out the script from the 2 round.js files and pasted everything into my navm.js file, now it works.

strange, kind of sucks though, because i only want to load that script on my memberinfo page.

good enough though, i can work from here.
Reply With Quote
Reply


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 On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:40 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04109 seconds
  • Memory Usage 2,274KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete