avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leo Simons <m...@leosimons.com>
Subject RE: Docs Cleanup
Date Fri, 12 Jul 2002 15:28:08 GMT
On Fri, 2002-07-12 at 17:10, Berin Loritsch wrote:
> > From: Leo Simons [mailto:leosimons@apache.org] 
> > 
> > On Fri, 2002-07-12 at 16:48, Berin Loritsch wrote:
> > 
> > I wrote a little javascript to do just that based on the URL, 
> > but for some reason it doesn't make it into the final pages. 
> > Some XSLT stuff I can't figure out.
> > 
> > Of course it'd be better if cocoon would generate it...
> 
> 
> If it is in a separate file (even better), all we have to do
> is add the tag line:
> 
> <script language="javascript" src="breadcrumb.js"/>
> 
> or whatever the construct is.  The display would be
> 
> <script>breadcrumb()</script>
> 
> If you have something that almost works, let me know.

http://cvs.apache.org/viewcvs.cgi/jakarta-avalon/src/documentation/skins/avalon-site/xslt/html/site2xhtml.xsl?rev=1.1&content-type=text/vnd.viewcvs-markup

has the right script; it just gets lost. I think I've just figured out
why: the script is in comment tags!

creating a new file breadcrumbs.js with this content:

function sentenceCase(str) {
	var lower = str.toLowerCase();
	return lower.substr(0,1).toUpperCase() + lower.substr(1);
}
function getDirsAsArray() {
	var trail = document.location.pathname.split("/");
	var lastdir = (trail[trail.length-1].indexOf(".html") != -1)?
trail.length-2 : trail.length-1;
	var urlprefix = "/avalon/";
	var postfix = " &gt"; 
	for(var i = 1; i <= lastdir; i++) {
		document.writeln('<a href=' + urlprefix + trail[i] + ' class="menu">'
+ sentenceCase(trail[i]) + '</a>'+postfix);
		urlprefix += trail[i] + "/";
		if(i == lastdir-1) postfix = ":";
	}
}
getDirsAsArray();

and simply including it:

<script type="text/javascript" language="JavaScript"
src="/avalon/breadcrumb.js"/>

should do the trick. Note my mail client wraps the lines improperly.
Don't have access to cvs atm so I can't try myself.

cheers,

- Leo


--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message