1 |
wakaba |
1.1 |
<!-- Show list of heading elements
|
2 |
wakaba |
1.2 |
#name Show list of headings
|
3 |
wakaba |
1.1 |
#context default
|
4 |
|
|
-->
|
5 |
|
|
<script language="JScript" defer="defer">
|
6 |
|
|
var doc = external.menuArguments.document;
|
7 |
|
|
var myself = replace_specials (doc.location.href);
|
8 |
|
|
var itext = '';
|
9 |
|
|
for (var i = 0; i < doc.body.all.length; i++) {
|
10 |
|
|
var el = doc.body.all(i);
|
11 |
|
|
var tn = el.tagName;
|
12 |
|
|
if (tn == 'H1' || tn == 'H2' || tn == 'H3'
|
13 |
|
|
|| tn == 'H4' || tn == 'H5' || tn == 'H6') {
|
14 |
|
|
var hid = '';
|
15 |
|
|
if (el.id) hid = el.id
|
16 |
|
|
else {
|
17 |
|
|
el.id = 'x-f-heading-' + i;
|
18 |
|
|
hid = el.id;
|
19 |
|
|
}
|
20 |
|
|
var htext = el.innerText
|
21 |
|
|
htext = htext.replace(/&/g,'&');
|
22 |
|
|
htext = htext.replace(/</g,'<');
|
23 |
|
|
htext = htext.replace(/>/g,'>');
|
24 |
|
|
itext += '<li class="x-f-heading-' + tn + '">'
|
25 |
|
|
+ '<a href="' + myself + '#' + hid
|
26 |
|
|
+ '" target="_self">' + tn + ': '
|
27 |
|
|
+ htext + '</a></li>';
|
28 |
|
|
}
|
29 |
|
|
}
|
30 |
|
|
// insert comments before BODY element
|
31 |
|
|
if (itext) {
|
32 |
|
|
itext = '<ins class="x-f-heading"><ul>' + itext + '</ul></ins>';
|
33 |
|
|
doc.body.all(0).outerHTML = itext + doc.body.all(0).outerHTML;
|
34 |
|
|
}
|
35 |
|
|
function replace_specials (rt) {
|
36 |
|
|
rt = rt.replace(/&/g,'&');
|
37 |
|
|
rt = rt.replace(/</g,'<');
|
38 |
|
|
rt = rt.replace(/>/g,'>');
|
39 |
|
|
return rt;
|
40 |
|
|
}
|
41 |
|
|
</script>
|
42 |
|
|
<!--
|
43 |
|
|
Copyright 2002 wakaba E<lt>w@suika.fam.cxE<gt>.
|
44 |
|
|
|
45 |
|
|
This program is free software; you can redistribute it and/or modify
|
46 |
|
|
it under the terms of the GNU General Public License as published by
|
47 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
48 |
|
|
(at your option) any later version.
|
49 |
|
|
|
50 |
|
|
This program is distributed in the hope that it will be useful,
|
51 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
52 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
53 |
|
|
GNU General Public License for more details.
|
54 |
|
|
|
55 |
|
|
You should have received a copy of the GNU General Public License
|
56 |
|
|
along with this program; see the file COPYING. If not, write to
|
57 |
|
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
58 |
|
|
Boston, MA 02111-1307, USA.
|
59 |
|
|
|
60 |
wakaba |
1.2 |
$Date: 2002/03/30 13:47:56 $
|
61 |
wakaba |
1.1 |
-->
|