1 |
wakaba |
1.1 |
<!-- Show list of link elements and meta information
|
2 |
|
|
#name Show <head> information
|
3 |
|
|
#context default
|
4 |
|
|
-->
|
5 |
|
|
<script language="JScript" defer="defer">
|
6 |
|
|
var doc = external.menuArguments.document;
|
7 |
|
|
var head = doc.getElementsByTagName('head').item(0);
|
8 |
|
|
var itext = ''; var mtext = '';
|
9 |
|
|
for (var i = 0; i < head.all.length; i++) {
|
10 |
|
|
var el = head.all(i); var tn = el.tagName;
|
11 |
|
|
if (tn == 'LINK') {
|
12 |
wakaba |
1.1.1.1.2.1 |
var Ahref = replace_specials (el.href); var htext = '';
|
13 |
wakaba |
1.1 |
if (el.title) htext = el.title + ' ';
|
14 |
|
|
if (el.hreflang) htext += '{language=' + el.hreflang + '} ';
|
15 |
|
|
if (el.media) htext += '{media=' + el.media + '} ';
|
16 |
|
|
if (el.type) htext += '{media-type=' + el.type + '} ';
|
17 |
|
|
if (el.charset) htext += '{charset=' + el.charset + '} ';
|
18 |
|
|
htext += '(' + el.href + ')';
|
19 |
|
|
var lrel = '';
|
20 |
|
|
if (el.rel) lrel += el.rel + ' ';
|
21 |
|
|
if (el.rev) lrel += '<-' + el.rev;
|
22 |
|
|
itext += '<li class="x-f-link">';
|
23 |
|
|
itext += '<a href="' + Ahref + '" class="x-f-link-rel"'
|
24 |
|
|
+ ' title="' + htext + '" target="_self">'
|
25 |
|
|
+ lrel + '</a></li>';
|
26 |
|
|
} else if (tn == 'META') {
|
27 |
|
|
var mname = ''; var mlang = el.lang;
|
28 |
|
|
var mvalue = el.content; var mtitle = el.title;
|
29 |
|
|
if (el.name) {mname = el.name + ' = '}
|
30 |
|
|
else if (el.httpEquiv) mname = el.httpEquiv + ': ';
|
31 |
|
|
mtext += '<li class="x-f-meta"'
|
32 |
|
|
if (mlang) {
|
33 |
|
|
mtext += ' lang="' + mlang + '"';
|
34 |
|
|
mname += ' {' + mlang + '}';
|
35 |
|
|
}
|
36 |
|
|
if (mtitle) mtext += ' title="' + replace_specials (mtitle) + '"';
|
37 |
wakaba |
1.1.1.1.2.1 |
if (el.scheme) mname += ' {scheme=' + el.scheme + '}';
|
38 |
|
|
mtext += '>' + replace_specials (mname) + ' ';
|
39 |
wakaba |
1.1 |
mtext += replace_specials (mvalue) + '</li>';
|
40 |
|
|
} else if (tn == 'TITLE') {
|
41 |
|
|
var mlang = el.lang;
|
42 |
|
|
var mvalue = el.text; var mtitle = el.title;
|
43 |
|
|
mtext += '<li class="x-f-title"';
|
44 |
|
|
if (mlang)
|
45 |
|
|
mtext += ' lang="' + mlang + '"';
|
46 |
|
|
if (mtitle) mtext += ' title="' + replace_specials (mtitle) + '"';
|
47 |
|
|
mtext += '><title> = ';
|
48 |
|
|
mtext += replace_specials (mvalue) + '</li>';
|
49 |
|
|
} else if (tn == 'BASE') {
|
50 |
|
|
var mtitle = el.title;
|
51 |
|
|
mtext += '<li class="x-f-base"';
|
52 |
|
|
if (mtitle) mtext += ' title="' + replace_specials (mtitle) + '"';
|
53 |
|
|
mtext += '><base> =';
|
54 |
|
|
if (el.href) { /* base URI */
|
55 |
|
|
var mvalue = replace_specials (el.href);
|
56 |
|
|
mtext += ' <<a href="' + mvalue + '" target="_self">';
|
57 |
|
|
mtext += mvalue + '</a>>';
|
58 |
|
|
}
|
59 |
|
|
if (el.target) {
|
60 |
|
|
var mvalue = replace_specials (el.target);
|
61 |
|
|
mtext += ' {target=' + mvalue + '}';
|
62 |
|
|
}
|
63 |
|
|
mtext += '</li>';
|
64 |
|
|
}
|
65 |
|
|
}
|
66 |
wakaba |
1.1.1.1.2.1 |
|
67 |
|
|
// profile attribute of HEAD element
|
68 |
|
|
var head = doc.getElementsByTagName('head').item(0);
|
69 |
|
|
if (head.outerHTML.indexOf ('profile=')) {
|
70 |
|
|
var profileURI = head.outerHTML.replace (/^.+profile="?/, '');
|
71 |
|
|
profileURI = profileURI.replace (head.innerHTML, '');
|
72 |
|
|
profileURI = profileURI.replace (/"?[> ].+$/, '');
|
73 |
|
|
var Ahref = replace_specials (profileURI);
|
74 |
|
|
var htext = '';
|
75 |
|
|
if (head.title) htext = head.title + ' ';
|
76 |
|
|
htext += '(' + profileURI + ')';
|
77 |
|
|
var lrel = '[profile]';
|
78 |
|
|
itext += '<li class="x-f-link">';
|
79 |
|
|
itext += '<a href="' + Ahref + '" class="x-f-link-rel"'
|
80 |
|
|
+ ' title="' + htext + '" target="_self">'
|
81 |
|
|
+ lrel + '</a></li>';
|
82 |
|
|
}
|
83 |
|
|
|
84 |
wakaba |
1.1 |
// insert
|
85 |
|
|
if (mtext) {
|
86 |
|
|
mtext = '<ins class="x-f-meta"><ul>' + mtext + '</ul></ins>';
|
87 |
|
|
doc.body.all(0).outerHTML = mtext + doc.body.all(0).outerHTML;
|
88 |
|
|
}
|
89 |
|
|
if (itext) {
|
90 |
|
|
itext = '<ins class="x-f-link"><ul>' + itext + '</ul></ins>';
|
91 |
|
|
doc.body.all(0).outerHTML = itext + doc.body.all(0).outerHTML;
|
92 |
|
|
}
|
93 |
|
|
function replace_specials (rt) {
|
94 |
|
|
rt = rt.replace(/&/g,'&');
|
95 |
|
|
rt = rt.replace(/</g,'<');
|
96 |
|
|
rt = rt.replace(/>/g,'>');
|
97 |
wakaba |
1.1.1.1.2.1 |
rt = rt.replace(/"/g,'"');
|
98 |
wakaba |
1.1 |
return rt;
|
99 |
|
|
}
|
100 |
|
|
</script>
|
101 |
|
|
<!--
|
102 |
|
|
Copyright 2002 wakaba E<lt>w@suika.fam.cxE<gt>.
|
103 |
|
|
|
104 |
|
|
This program is free software; you can redistribute it and/or modify
|
105 |
|
|
it under the terms of the GNU General Public License as published by
|
106 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
107 |
|
|
(at your option) any later version.
|
108 |
|
|
|
109 |
|
|
This program is distributed in the hope that it will be useful,
|
110 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
111 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
112 |
|
|
GNU General Public License for more details.
|
113 |
|
|
|
114 |
|
|
You should have received a copy of the GNU General Public License
|
115 |
|
|
along with this program; see the file COPYING. If not, write to
|
116 |
|
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
117 |
|
|
Boston, MA 02111-1307, USA.
|
118 |
|
|
|
119 |
wakaba |
1.1.1.1.2.1 |
$Date: 2002/03/30 13:47:56 $
|
120 |
wakaba |
1.1 |
-->
|