ai4r 1.2 → 1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +12 -25
- data/examples/decision_trees/id3_example.rb +6 -9
- data/examples/decision_trees/results.txt +2 -0
- data/examples/genetic_algorithm/genetic_algorithm_example.rb +11 -13
- data/examples/neural_network/xor_example.rb +25 -0
- data/lib/ai4r.rb +10 -0
- data/lib/ai4r/classifiers/classifier.rb +46 -0
- data/lib/ai4r/classifiers/id3.rb +27 -58
- data/lib/ai4r/classifiers/one_r.rb +19 -58
- data/lib/ai4r/classifiers/prism.rb +21 -57
- data/lib/ai4r/classifiers/zero_r.rb +16 -48
- data/lib/ai4r/clusterers/bisecting_k_means.rb +115 -0
- data/lib/ai4r/clusterers/clusterer.rb +55 -0
- data/lib/ai4r/clusterers/k_means.rb +164 -0
- data/lib/ai4r/data/data_set.rb +250 -0
- data/lib/ai4r/genetic_algorithm/genetic_algorithm.rb +19 -19
- data/lib/ai4r/neural_network/backpropagation.rb +23 -24
- data/site/build/site/en/broken-links.xml +2 -0
- data/site/build/site/en/downloads.html +200 -0
- data/site/build/site/en/downloads.pdf +151 -0
- data/site/build/site/en/forum.html +197 -0
- data/site/build/site/en/forum.pdf +151 -0
- data/site/build/site/en/geneticAlgorithms.html +591 -0
- data/site/build/site/en/geneticAlgorithms.pdf +934 -0
- data/site/build/site/en/images/ai4r-logo.png +0 -0
- data/site/build/site/en/images/built-with-forrest-button.png +0 -0
- data/site/build/site/en/images/c.png +0 -0
- data/site/build/site/en/images/c_wbn.png +0 -0
- data/site/build/site/en/images/c_wn.png +0 -0
- data/site/build/site/en/images/ero.gif +0 -0
- data/site/build/site/en/images/europe2.png +0 -0
- data/site/build/site/en/images/europe3.png +0 -0
- data/site/build/site/en/images/fitness.png +0 -0
- data/site/build/site/en/images/genetic_algorithms_example.png +0 -0
- data/site/build/site/en/images/instruction_arrow.png +0 -0
- data/site/build/site/en/images/jadeferret.png +0 -0
- data/site/build/site/en/images/my_email.png +0 -0
- data/site/build/site/en/images/neural_network_example.png +0 -0
- data/site/build/site/en/images/rubyforge.png +0 -0
- data/site/build/site/en/images/s.png +0 -0
- data/site/build/site/en/images/s_wbn.png +0 -0
- data/site/build/site/en/images/s_wn.png +0 -0
- data/site/build/site/en/images/sigmoid.png +0 -0
- data/site/build/site/en/images/t.png +0 -0
- data/site/build/site/en/images/t_wbn.png +0 -0
- data/site/build/site/en/images/t_wn.png +0 -0
- data/site/build/site/en/index.html +336 -0
- data/site/build/site/en/index.pdf +508 -0
- data/site/build/site/en/linkmap.html +263 -0
- data/site/build/site/en/linkmap.pdf +94 -0
- data/site/build/site/en/locationmap.xml +72 -0
- data/site/build/site/en/machineLearning.html +339 -0
- data/site/build/site/en/machineLearning.pdf +337 -0
- data/site/build/site/en/neuralNetworks.html +484 -0
- data/site/build/site/en/neuralNetworks.pdf +604 -0
- data/site/build/site/en/skin/CommonMessages_de.xml +23 -0
- data/site/build/site/en/skin/CommonMessages_en_US.xml +23 -0
- data/site/build/site/en/skin/CommonMessages_es.xml +23 -0
- data/site/build/site/en/skin/CommonMessages_fr.xml +23 -0
- data/site/build/site/en/skin/basic.css +166 -0
- data/site/build/site/en/skin/breadcrumbs-optimized.js +90 -0
- data/site/build/site/en/skin/breadcrumbs.js +237 -0
- data/site/build/site/en/skin/fontsize.js +166 -0
- data/site/build/site/en/skin/getBlank.js +40 -0
- data/site/build/site/en/skin/getMenu.js +45 -0
- data/site/build/site/en/skin/images/README.txt +1 -0
- data/site/build/site/en/skin/images/add.jpg +0 -0
- data/site/build/site/en/skin/images/built-with-forrest-button.png +0 -0
- data/site/build/site/en/skin/images/chapter.gif +0 -0
- data/site/build/site/en/skin/images/chapter_open.gif +0 -0
- data/site/build/site/en/skin/images/current.gif +0 -0
- data/site/build/site/en/skin/images/error.png +0 -0
- data/site/build/site/en/skin/images/external-link.gif +0 -0
- data/site/build/site/en/skin/images/fix.jpg +0 -0
- data/site/build/site/en/skin/images/forrest-credit-logo.png +0 -0
- data/site/build/site/en/skin/images/hack.jpg +0 -0
- data/site/build/site/en/skin/images/header_white_line.gif +0 -0
- data/site/build/site/en/skin/images/info.png +0 -0
- data/site/build/site/en/skin/images/instruction_arrow.png +0 -0
- data/site/build/site/en/skin/images/label.gif +0 -0
- data/site/build/site/en/skin/images/page.gif +0 -0
- data/site/build/site/en/skin/images/pdfdoc.gif +0 -0
- data/site/build/site/en/skin/images/poddoc.png +0 -0
- data/site/build/site/en/skin/images/printer.gif +0 -0
- data/site/build/site/en/skin/images/rc-b-l-15-1body-2menu-3menu.png +0 -0
- data/site/build/site/en/skin/images/rc-b-r-15-1body-2menu-3menu.png +0 -0
- data/site/build/site/en/skin/images/rc-b-r-5-1header-2tab-selected-3tab-selected.png +0 -0
- data/site/build/site/en/skin/images/rc-t-l-5-1header-2searchbox-3searchbox.png +0 -0
- data/site/build/site/en/skin/images/rc-t-l-5-1header-2tab-selected-3tab-selected.png +0 -0
- data/site/build/site/en/skin/images/rc-t-l-5-1header-2tab-unselected-3tab-unselected.png +0 -0
- data/site/build/site/en/skin/images/rc-t-r-15-1body-2menu-3menu.png +0 -0
- data/site/build/site/en/skin/images/rc-t-r-5-1header-2searchbox-3searchbox.png +0 -0
- data/site/build/site/en/skin/images/rc-t-r-5-1header-2tab-selected-3tab-selected.png +0 -0
- data/site/build/site/en/skin/images/rc-t-r-5-1header-2tab-unselected-3tab-unselected.png +0 -0
- data/site/build/site/en/skin/images/remove.jpg +0 -0
- data/site/build/site/en/skin/images/rss.png +0 -0
- data/site/build/site/en/skin/images/spacer.gif +0 -0
- data/site/build/site/en/skin/images/success.png +0 -0
- data/site/build/site/en/skin/images/txtdoc.png +0 -0
- data/site/build/site/en/skin/images/update.jpg +0 -0
- data/site/build/site/en/skin/images/valid-html401.png +0 -0
- data/site/build/site/en/skin/images/vcss.png +0 -0
- data/site/build/site/en/skin/images/warning.png +0 -0
- data/site/build/site/en/skin/images/xmldoc.gif +0 -0
- data/site/build/site/en/skin/menu.js +48 -0
- data/site/build/site/en/skin/note.txt +50 -0
- data/site/build/site/en/skin/print.css +54 -0
- data/site/build/site/en/skin/profile.css +163 -0
- data/site/build/site/en/skin/prototype.js +1257 -0
- data/site/build/site/en/skin/screen.css +587 -0
- data/site/build/site/en/svn.html +252 -0
- data/site/build/site/en/svn.pdf +306 -0
- data/site/build/site/en/wholesite.pdf +1915 -0
- data/site/build/tmp/brokenlinks.xml +2 -0
- data/site/build/tmp/cocoon-work/cache-dir/cocoon-ehcache-1.data +0 -0
- data/site/build/tmp/cocoon-work/cache-dir/cocoon-ehcache-1.index +0 -0
- data/site/build/tmp/locationmap.xml +14 -14
- data/site/build/tmp/output.xmap +23 -23
- data/site/build/tmp/pluginlist2fetchbuild.xml +144 -144
- data/site/build/tmp/projfilters.properties +41 -41
- data/site/build/webapp/WEB-INF/logs/core.log +593 -679
- data/site/build/webapp/WEB-INF/logs/error.log +362 -279
- data/site/build/webapp/WEB-INF/logs/sitemap.log +368 -1015
- data/site/src/documentation/content/xdocs/index.xml +18 -10
- data/site/src/documentation/content/xdocs/machineLearning.xml +4 -3
- data/site/src/documentation/content/xdocs/site.xml +2 -1
- data/site/src/documentation/resources/images/sigmoid.png +0 -0
- data/test/classifiers/id3_test.rb +45 -44
- data/test/classifiers/one_r_test.rb +19 -17
- data/test/classifiers/prism_test.rb +22 -20
- data/test/classifiers/zero_r_test.rb +15 -12
- data/test/clusterers/bisecting_k_means_test.rb +59 -0
- data/test/clusterers/k_means_test.rb +93 -0
- data/test/data/data_set_test.rb +92 -0
- metadata +252 -128
- data/lib/ai4r/classifiers/classifier_helper.rb +0 -54
- data/site/src/documentation/content/xdocs/forum.html +0 -9
- data/site/src/documentation/resources/images/Thumbs.db +0 -0
- data/site/src/documentation/resources/images/sub-dir/Thumbs.db +0 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
2
|
+
<!--
|
3
|
+
Licensed to the Apache Software Foundation (ASF) under one or more
|
4
|
+
contributor license agreements. See the NOTICE file distributed with
|
5
|
+
this work for additional information regarding copyright ownership.
|
6
|
+
The ASF licenses this file to You under the Apache License, Version 2.0
|
7
|
+
(the "License"); you may not use this file except in compliance with
|
8
|
+
the License. You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing, software
|
13
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
See the License for the specific language governing permissions and
|
16
|
+
limitations under the License.
|
17
|
+
-->
|
18
|
+
<catalogue>
|
19
|
+
<message key="Font size:">Schriftgr�sse:</message>
|
20
|
+
<message key="Last Published:">Zuletzt ver�ffentlicht:</message>
|
21
|
+
<message key="Search">Suche:</message>
|
22
|
+
<message key="Search the site with">Suche auf der Seite mit</message>
|
23
|
+
</catalogue>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
2
|
+
<!--
|
3
|
+
Licensed to the Apache Software Foundation (ASF) under one or more
|
4
|
+
contributor license agreements. See the NOTICE file distributed with
|
5
|
+
this work for additional information regarding copyright ownership.
|
6
|
+
The ASF licenses this file to You under the Apache License, Version 2.0
|
7
|
+
(the "License"); you may not use this file except in compliance with
|
8
|
+
the License. You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing, software
|
13
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
See the License for the specific language governing permissions and
|
16
|
+
limitations under the License.
|
17
|
+
-->
|
18
|
+
<catalogue>
|
19
|
+
<message key="Font size:">Font size:</message>
|
20
|
+
<message key="Last Published:">Last Published:</message>
|
21
|
+
<message key="Search">Search</message>
|
22
|
+
<message key="Search the site with">Search site with</message>
|
23
|
+
</catalogue>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
2
|
+
<!--
|
3
|
+
Licensed to the Apache Software Foundation (ASF) under one or more
|
4
|
+
contributor license agreements. See the NOTICE file distributed with
|
5
|
+
this work for additional information regarding copyright ownership.
|
6
|
+
The ASF licenses this file to You under the Apache License, Version 2.0
|
7
|
+
(the "License"); you may not use this file except in compliance with
|
8
|
+
the License. You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing, software
|
13
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
See the License for the specific language governing permissions and
|
16
|
+
limitations under the License.
|
17
|
+
-->
|
18
|
+
<catalogue>
|
19
|
+
<message key="Font size:">Tama�o del texto:</message>
|
20
|
+
<message key="Last Published:">Fecha de publicaci�n:</message>
|
21
|
+
<message key="Search">Buscar</message>
|
22
|
+
<message key="Search the site with">Buscar en</message>
|
23
|
+
</catalogue>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
2
|
+
<!--
|
3
|
+
Licensed to the Apache Software Foundation (ASF) under one or more
|
4
|
+
contributor license agreements. See the NOTICE file distributed with
|
5
|
+
this work for additional information regarding copyright ownership.
|
6
|
+
The ASF licenses this file to You under the Apache License, Version 2.0
|
7
|
+
(the "License"); you may not use this file except in compliance with
|
8
|
+
the License. You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing, software
|
13
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
See the License for the specific language governing permissions and
|
16
|
+
limitations under the License.
|
17
|
+
-->
|
18
|
+
<catalogue>
|
19
|
+
<message key="Font size:">Taille :</message>
|
20
|
+
<message key="Last Published:">Derni�re publication :</message>
|
21
|
+
<message key="Search">Rechercher</message>
|
22
|
+
<message key="Search the site with">Rechercher sur le site avec</message>
|
23
|
+
</catalogue>
|
@@ -0,0 +1,166 @@
|
|
1
|
+
/*
|
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
|
8
|
+
*
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
*
|
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.
|
16
|
+
*/
|
17
|
+
/**
|
18
|
+
* General
|
19
|
+
*/
|
20
|
+
|
21
|
+
img { border: 0; }
|
22
|
+
|
23
|
+
#content table {
|
24
|
+
border: 0;
|
25
|
+
width: 100%;
|
26
|
+
}
|
27
|
+
/*Hack to get IE to render the table at 100%*/
|
28
|
+
* html #content table { margin-left: -3px; }
|
29
|
+
|
30
|
+
#content th,
|
31
|
+
#content td {
|
32
|
+
margin: 0;
|
33
|
+
padding: 0;
|
34
|
+
vertical-align: top;
|
35
|
+
}
|
36
|
+
|
37
|
+
.clearboth {
|
38
|
+
clear: both;
|
39
|
+
}
|
40
|
+
|
41
|
+
.note, .warning, .fixme {
|
42
|
+
border: solid black 1px;
|
43
|
+
margin: 1em 3em;
|
44
|
+
}
|
45
|
+
|
46
|
+
.note .label {
|
47
|
+
background: #369;
|
48
|
+
color: white;
|
49
|
+
font-weight: bold;
|
50
|
+
padding: 5px 10px;
|
51
|
+
}
|
52
|
+
.note .content {
|
53
|
+
background: #F0F0FF;
|
54
|
+
color: black;
|
55
|
+
line-height: 120%;
|
56
|
+
font-size: 90%;
|
57
|
+
padding: 5px 10px;
|
58
|
+
}
|
59
|
+
.warning .label {
|
60
|
+
background: #C00;
|
61
|
+
color: white;
|
62
|
+
font-weight: bold;
|
63
|
+
padding: 5px 10px;
|
64
|
+
}
|
65
|
+
.warning .content {
|
66
|
+
background: #FFF0F0;
|
67
|
+
color: black;
|
68
|
+
line-height: 120%;
|
69
|
+
font-size: 90%;
|
70
|
+
padding: 5px 10px;
|
71
|
+
}
|
72
|
+
.fixme .label {
|
73
|
+
background: #C6C600;
|
74
|
+
color: black;
|
75
|
+
font-weight: bold;
|
76
|
+
padding: 5px 10px;
|
77
|
+
}
|
78
|
+
.fixme .content {
|
79
|
+
padding: 5px 10px;
|
80
|
+
}
|
81
|
+
|
82
|
+
/**
|
83
|
+
* Typography
|
84
|
+
*/
|
85
|
+
|
86
|
+
body {
|
87
|
+
font-family: verdana, "Trebuchet MS", arial, helvetica, sans-serif;
|
88
|
+
font-size: 100%;
|
89
|
+
}
|
90
|
+
|
91
|
+
#content {
|
92
|
+
font-family: Georgia, Palatino, Times, serif;
|
93
|
+
font-size: 95%;
|
94
|
+
}
|
95
|
+
#tabs {
|
96
|
+
font-size: 70%;
|
97
|
+
}
|
98
|
+
#menu {
|
99
|
+
font-size: 80%;
|
100
|
+
}
|
101
|
+
#footer {
|
102
|
+
font-size: 70%;
|
103
|
+
}
|
104
|
+
|
105
|
+
h1, h2, h3, h4, h5, h6 {
|
106
|
+
font-family: "Trebuchet MS", verdana, arial, helvetica, sans-serif;
|
107
|
+
font-weight: bold;
|
108
|
+
margin-top: 1em;
|
109
|
+
margin-bottom: .5em;
|
110
|
+
}
|
111
|
+
|
112
|
+
h1 {
|
113
|
+
margin-top: 0;
|
114
|
+
margin-bottom: 1em;
|
115
|
+
font-size: 1.4em;
|
116
|
+
}
|
117
|
+
#content h1 {
|
118
|
+
font-size: 160%;
|
119
|
+
margin-bottom: .5em;
|
120
|
+
}
|
121
|
+
#menu h1 {
|
122
|
+
margin: 0;
|
123
|
+
padding: 10px;
|
124
|
+
background: #336699;
|
125
|
+
color: white;
|
126
|
+
}
|
127
|
+
h2 { font-size: 120%; }
|
128
|
+
h3 { font-size: 100%; }
|
129
|
+
h4 { font-size: 90%; }
|
130
|
+
h5 { font-size: 80%; }
|
131
|
+
h6 { font-size: 75%; }
|
132
|
+
|
133
|
+
p {
|
134
|
+
line-height: 120%;
|
135
|
+
text-align: left;
|
136
|
+
margin-top: .5em;
|
137
|
+
margin-bottom: 1em;
|
138
|
+
}
|
139
|
+
|
140
|
+
#content li,
|
141
|
+
#content th,
|
142
|
+
#content td,
|
143
|
+
#content li ul,
|
144
|
+
#content li ol{
|
145
|
+
margin-top: .5em;
|
146
|
+
margin-bottom: .5em;
|
147
|
+
}
|
148
|
+
|
149
|
+
|
150
|
+
#content li li,
|
151
|
+
#minitoc-area li{
|
152
|
+
margin-top: 0em;
|
153
|
+
margin-bottom: 0em;
|
154
|
+
}
|
155
|
+
|
156
|
+
#content .attribution {
|
157
|
+
text-align: right;
|
158
|
+
font-style: italic;
|
159
|
+
font-size: 85%;
|
160
|
+
margin-top: 1em;
|
161
|
+
}
|
162
|
+
|
163
|
+
.codefrag {
|
164
|
+
font-family: "Courier New", Courier, monospace;
|
165
|
+
font-size: 110%;
|
166
|
+
}
|
@@ -0,0 +1,90 @@
|
|
1
|
+
/*
|
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
|
8
|
+
*
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
*
|
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.
|
16
|
+
*/
|
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="/";
|
35
|
+
|
36
|
+
function sc(s) {
|
37
|
+
var l=s.toLowerCase();
|
38
|
+
return l.substr(0,1).toUpperCase()+l.substr(1);
|
39
|
+
}
|
40
|
+
function getdirs() {
|
41
|
+
var t=document.location.pathname.split(PATH_SEPARATOR);
|
42
|
+
var lc=t[t.length-1];
|
43
|
+
for(var i=0;i < FILE_EXTENSIONS.length;i++)
|
44
|
+
{
|
45
|
+
if(lc.indexOf(FILE_EXTENSIONS[i]))
|
46
|
+
return t.slice(1,t.length-1); }
|
47
|
+
return t.slice(1,t.length);
|
48
|
+
}
|
49
|
+
function getcrumbs( d )
|
50
|
+
{
|
51
|
+
var pre = "/";
|
52
|
+
var post = "/";
|
53
|
+
var c = new Array();
|
54
|
+
if( d != null )
|
55
|
+
{
|
56
|
+
for(var i=0;i < d.length;i++) {
|
57
|
+
pre+=d[i]+postfix;
|
58
|
+
c.push(new Array(d[i],pre)); }
|
59
|
+
}
|
60
|
+
if(PREPREND_CRUMBS.length > 0 )
|
61
|
+
return PREPREND_CRUMBS.concat( c );
|
62
|
+
return c;
|
63
|
+
}
|
64
|
+
function gettrail( c )
|
65
|
+
{
|
66
|
+
var h=DISPLAY_PREPREND;
|
67
|
+
for(var i=0;i < c.length;i++)
|
68
|
+
{
|
69
|
+
h+='<a href="'+c[i][1]+'" >'+sc(c[i][0])+'</a>';
|
70
|
+
if(i!=(c.length-1))
|
71
|
+
h+=DISPLAY_SEPARATOR; }
|
72
|
+
return h+DISPLAY_POSTPREND;
|
73
|
+
}
|
74
|
+
|
75
|
+
function gettrailXHTML( c )
|
76
|
+
{
|
77
|
+
var h='<span class="'+CSS_CLASS_TRAIL+'">'+DISPLAY_PREPREND;
|
78
|
+
for(var i=0;i < c.length;i++)
|
79
|
+
{
|
80
|
+
h+='<a href="'+c[i][1]+'" class="'+CSS_CLASS_CRUMB+'">'+sc(c[i][0])+'</a>';
|
81
|
+
if(i!=(c.length-1))
|
82
|
+
h+='<span class="'+CSS_CLASS_SEPARATOR+'">'+DISPLAY_SEPARATOR+'</span>'; }
|
83
|
+
return h+DISPLAY_POSTPREND+'</span>';
|
84
|
+
}
|
85
|
+
|
86
|
+
if(document.location.href.toLowerCase().indexOf("http://")==-1)
|
87
|
+
document.write(gettrail(getcrumbs()));
|
88
|
+
else
|
89
|
+
document.write(gettrail(getcrumbs(getdirs())));
|
90
|
+
|
@@ -0,0 +1,237 @@
|
|
1
|
+
/*
|
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
|
8
|
+
*
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
*
|
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.
|
16
|
+
*/
|
17
|
+
/**
|
18
|
+
* This script, when included in a html file, builds a neat breadcrumb trail
|
19
|
+
* based on its url. That is, if it doesn't contains bugs (I'm relatively
|
20
|
+
* sure it does).
|
21
|
+
*
|
22
|
+
* Typical usage:
|
23
|
+
* <script type="text/javascript" language="JavaScript" src="breadcrumbs.js"></script>
|
24
|
+
*/
|
25
|
+
|
26
|
+
/**
|
27
|
+
* IE 5 on Mac doesn't know Array.push.
|
28
|
+
*
|
29
|
+
* Implement it - courtesy to fritz.
|
30
|
+
*/
|
31
|
+
var abc = new Array();
|
32
|
+
if (!abc.push) {
|
33
|
+
Array.prototype.push = function(what){this[this.length]=what}
|
34
|
+
}
|
35
|
+
|
36
|
+
/* ========================================================================
|
37
|
+
CONSTANTS
|
38
|
+
======================================================================== */
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Two-dimensional array containing extra crumbs to place at the front of
|
42
|
+
* the trail. Specify first the name of the crumb, then the URI that belongs
|
43
|
+
* to it. You'll need to modify this for every domain or subdomain where
|
44
|
+
* you use this script (you can leave it as an empty array if you wish)
|
45
|
+
*/
|
46
|
+
var PREPREND_CRUMBS = new Array();
|
47
|
+
|
48
|
+
var link1 = "@skinconfig.trail.link1.name@";
|
49
|
+
var link2 = "@skinconfig.trail.link2.name@";
|
50
|
+
var link3 = "@skinconfig.trail.link3.name@";
|
51
|
+
|
52
|
+
var href1 = "@skinconfig.trail.link1.href@";
|
53
|
+
var href2 = "@skinconfig.trail.link2.href@";
|
54
|
+
var href3 = "@skinconfig.trail.link3.href@";
|
55
|
+
|
56
|
+
if(!(link1=="")&&!link1.indexOf( "@" ) == 0){
|
57
|
+
PREPREND_CRUMBS.push( new Array( link1, href1 ) );
|
58
|
+
}
|
59
|
+
if(!(link2=="")&&!link2.indexOf( "@" ) == 0){
|
60
|
+
PREPREND_CRUMBS.push( new Array( link2, href2 ) );
|
61
|
+
}
|
62
|
+
if(!(link3=="")&&!link3.indexOf( "@" ) == 0){
|
63
|
+
PREPREND_CRUMBS.push( new Array( link3, href3 ) );
|
64
|
+
}
|
65
|
+
|
66
|
+
/**
|
67
|
+
* String to include between crumbs:
|
68
|
+
*/
|
69
|
+
var DISPLAY_SEPARATOR = " > ";
|
70
|
+
/**
|
71
|
+
* String to include at the beginning of the trail
|
72
|
+
*/
|
73
|
+
var DISPLAY_PREPREND = " > ";
|
74
|
+
/**
|
75
|
+
* String to include at the end of the trail
|
76
|
+
*/
|
77
|
+
var DISPLAY_POSTPREND = "";
|
78
|
+
|
79
|
+
/**
|
80
|
+
* CSS Class to use for a single crumb:
|
81
|
+
*/
|
82
|
+
var CSS_CLASS_CRUMB = "breadcrumb";
|
83
|
+
|
84
|
+
/**
|
85
|
+
* CSS Class to use for the complete trail:
|
86
|
+
*/
|
87
|
+
var CSS_CLASS_TRAIL = "breadcrumbTrail";
|
88
|
+
|
89
|
+
/**
|
90
|
+
* CSS Class to use for crumb separator:
|
91
|
+
*/
|
92
|
+
var CSS_CLASS_SEPARATOR = "crumbSeparator";
|
93
|
+
|
94
|
+
/**
|
95
|
+
* Array of strings containing common file extensions. We use this to
|
96
|
+
* determine what part of the url to ignore (if it contains one of the
|
97
|
+
* string specified here, we ignore it).
|
98
|
+
*/
|
99
|
+
var FILE_EXTENSIONS = new Array( ".html", ".htm", ".jsp", ".php", ".php3", ".php4" );
|
100
|
+
|
101
|
+
/**
|
102
|
+
* String that separates parts of the breadcrumb trail from each other.
|
103
|
+
* When this is no longer a slash, I'm sure I'll be old and grey.
|
104
|
+
*/
|
105
|
+
var PATH_SEPARATOR = "/";
|
106
|
+
|
107
|
+
/* ========================================================================
|
108
|
+
UTILITY FUNCTIONS
|
109
|
+
======================================================================== */
|
110
|
+
/**
|
111
|
+
* Capitalize first letter of the provided string and return the modified
|
112
|
+
* string.
|
113
|
+
*/
|
114
|
+
function sentenceCase( string )
|
115
|
+
{ return string;
|
116
|
+
//var lower = string.toLowerCase();
|
117
|
+
//return lower.substr(0,1).toUpperCase() + lower.substr(1);
|
118
|
+
}
|
119
|
+
|
120
|
+
/**
|
121
|
+
* Returns an array containing the names of all the directories in the
|
122
|
+
* current document URL
|
123
|
+
*/
|
124
|
+
function getDirectoriesInURL()
|
125
|
+
{
|
126
|
+
var trail = document.location.pathname.split( PATH_SEPARATOR );
|
127
|
+
|
128
|
+
// check whether last section is a file or a directory
|
129
|
+
var lastcrumb = trail[trail.length-1];
|
130
|
+
for( var i = 0; i < FILE_EXTENSIONS.length; i++ )
|
131
|
+
{
|
132
|
+
if( lastcrumb.indexOf( FILE_EXTENSIONS[i] ) )
|
133
|
+
{
|
134
|
+
// it is, remove it and send results
|
135
|
+
return trail.slice( 1, trail.length-1 );
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
139
|
+
// it's not; send the trail unmodified
|
140
|
+
return trail.slice( 1, trail.length );
|
141
|
+
}
|
142
|
+
|
143
|
+
/* ========================================================================
|
144
|
+
BREADCRUMB FUNCTIONALITY
|
145
|
+
======================================================================== */
|
146
|
+
/**
|
147
|
+
* Return a two-dimensional array describing the breadcrumbs based on the
|
148
|
+
* array of directories passed in.
|
149
|
+
*/
|
150
|
+
function getBreadcrumbs( dirs )
|
151
|
+
{
|
152
|
+
var prefix = "/";
|
153
|
+
var postfix = "/";
|
154
|
+
|
155
|
+
// the array we will return
|
156
|
+
var crumbs = new Array();
|
157
|
+
|
158
|
+
if( dirs != null )
|
159
|
+
{
|
160
|
+
for( var i = 0; i < dirs.length; i++ )
|
161
|
+
{
|
162
|
+
prefix += dirs[i] + postfix;
|
163
|
+
crumbs.push( new Array( dirs[i], prefix ) );
|
164
|
+
}
|
165
|
+
}
|
166
|
+
|
167
|
+
// preprend the PREPREND_CRUMBS
|
168
|
+
if(PREPREND_CRUMBS.length > 0 )
|
169
|
+
{
|
170
|
+
return PREPREND_CRUMBS.concat( crumbs );
|
171
|
+
}
|
172
|
+
|
173
|
+
return crumbs;
|
174
|
+
}
|
175
|
+
|
176
|
+
/**
|
177
|
+
* Return a string containing a simple text breadcrumb trail based on the
|
178
|
+
* two-dimensional array passed in.
|
179
|
+
*/
|
180
|
+
function getCrumbTrail( crumbs )
|
181
|
+
{
|
182
|
+
var xhtml = DISPLAY_PREPREND;
|
183
|
+
|
184
|
+
for( var i = 0; i < crumbs.length; i++ )
|
185
|
+
{
|
186
|
+
xhtml += '<a href="' + crumbs[i][1] + '" >';
|
187
|
+
xhtml += unescape( crumbs[i][0] ) + '</a>';
|
188
|
+
if( i != (crumbs.length-1) )
|
189
|
+
{
|
190
|
+
xhtml += DISPLAY_SEPARATOR;
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
194
|
+
xhtml += DISPLAY_POSTPREND;
|
195
|
+
|
196
|
+
return xhtml;
|
197
|
+
}
|
198
|
+
|
199
|
+
/**
|
200
|
+
* Return a string containing an XHTML breadcrumb trail based on the
|
201
|
+
* two-dimensional array passed in.
|
202
|
+
*/
|
203
|
+
function getCrumbTrailXHTML( crumbs )
|
204
|
+
{
|
205
|
+
var xhtml = '<span class="' + CSS_CLASS_TRAIL + '">';
|
206
|
+
xhtml += DISPLAY_PREPREND;
|
207
|
+
|
208
|
+
for( var i = 0; i < crumbs.length; i++ )
|
209
|
+
{
|
210
|
+
xhtml += '<a href="' + crumbs[i][1] + '" class="' + CSS_CLASS_CRUMB + '">';
|
211
|
+
xhtml += unescape( crumbs[i][0] ) + '</a>';
|
212
|
+
if( i != (crumbs.length-1) )
|
213
|
+
{
|
214
|
+
xhtml += '<span class="' + CSS_CLASS_SEPARATOR + '">' + DISPLAY_SEPARATOR + '</span>';
|
215
|
+
}
|
216
|
+
}
|
217
|
+
|
218
|
+
xhtml += DISPLAY_POSTPREND;
|
219
|
+
xhtml += '</span>';
|
220
|
+
|
221
|
+
return xhtml;
|
222
|
+
}
|
223
|
+
|
224
|
+
/* ========================================================================
|
225
|
+
PRINT BREADCRUMB TRAIL
|
226
|
+
======================================================================== */
|
227
|
+
|
228
|
+
// check if we're local; if so, only print the PREPREND_CRUMBS
|
229
|
+
if( document.location.href.toLowerCase().indexOf( "http://" ) == -1 )
|
230
|
+
{
|
231
|
+
document.write( getCrumbTrail( getBreadcrumbs() ) );
|
232
|
+
}
|
233
|
+
else
|
234
|
+
{
|
235
|
+
document.write( getCrumbTrail( getBreadcrumbs( getDirectoriesInURL() ) ) );
|
236
|
+
}
|
237
|
+
|