2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 var PREPREND_CRUMBS=new Array();
18 var link1="@skinconfig.trail.link1.name@";
19 var link2="@skinconfig.trail.link2.name@";
20 var link3="@skinconfig.trail.link3.name@";
21 if(!(link1=="")&&!link1.indexOf( "@" ) == 0){
22 PREPREND_CRUMBS.push( new Array( link1, @skinconfig.trail.link1.href@ ) ); }
23 if(!(link2=="")&&!link2.indexOf( "@" ) == 0){
24 PREPREND_CRUMBS.push( new Array( link2, @skinconfig.trail.link2.href@ ) ); }
25 if(!(link3=="")&&!link3.indexOf( "@" ) == 0){
26 PREPREND_CRUMBS.push( new Array( link3, @skinconfig.trail.link3.href@ ) ); }
27 var DISPLAY_SEPARATOR=" > ";
28 var DISPLAY_PREPREND=" > ";
29 var DISPLAY_POSTPREND=":";
30 var CSS_CLASS_CRUMB="breadcrumb";
31 var CSS_CLASS_TRAIL="breadcrumbTrail";
32 var CSS_CLASS_SEPARATOR="crumbSeparator";
33 var FILE_EXTENSIONS=new Array( ".html", ".htm", ".jsp", ".php", ".php3", ".php4" );
34 var PATH_SEPARATOR="/";
37 var l=s.toLowerCase();
38 return l.substr(0,1).toUpperCase()+l.substr(1);
41 var t=document.location.pathname.split(PATH_SEPARATOR);
43 for(var i=0;i < FILE_EXTENSIONS.length;i++)
45 if(lc.indexOf(FILE_EXTENSIONS[i]))
46 return t.slice(1,t.length-1); }
47 return t.slice(1,t.length);
49 function getcrumbs( d )
56 for(var i=0;i < d.length;i++) {
58 c.push(new Array(d[i],pre)); }
60 if(PREPREND_CRUMBS.length > 0 )
61 return PREPREND_CRUMBS.concat( c );
64 function gettrail( c )
66 var h=DISPLAY_PREPREND;
67 for(var i=0;i < c.length;i++)
69 h+='<a href="'+c[i][1]+'" >'+sc(c[i][0])+'</a>';
71 h+=DISPLAY_SEPARATOR; }
72 return h+DISPLAY_POSTPREND;
75 function gettrailXHTML( c )
77 var h='<span class="'+CSS_CLASS_TRAIL+'">'+DISPLAY_PREPREND;
78 for(var i=0;i < c.length;i++)
80 h+='<a href="'+c[i][1]+'" class="'+CSS_CLASS_CRUMB+'">'+sc(c[i][0])+'</a>';
82 h+='<span class="'+CSS_CLASS_SEPARATOR+'">'+DISPLAY_SEPARATOR+'</span>'; }
83 return h+DISPLAY_POSTPREND+'</span>';
86 if(document.location.href.toLowerCase().indexOf("http://")==-1)
87 document.write(gettrail(getcrumbs()));
89 document.write(gettrail(getcrumbs(getdirs())));