1 |
wakaba |
1.1 |
<!-- Show comments (<!- - ... - ->), <!DOCTYPE ...>,
|
2 |
|
|
<?...?>, etc.
|
3 |
|
|
#name Show comments
|
4 |
|
|
#context default
|
5 |
|
|
-->
|
6 |
|
|
<script language="JScript" defer="defer">
|
7 |
|
|
var doc = external.menuArguments.document;
|
8 |
|
|
var itext = '';
|
9 |
|
|
// comments before HEAD element
|
10 |
|
|
for (var i = 0; i < doc.all.length; i++) {
|
11 |
|
|
var el = doc.all(i);
|
12 |
|
|
if (el.tagName == "!") {
|
13 |
|
|
if (el.parentElement == null) {
|
14 |
|
|
var ot = el.text;
|
15 |
|
|
ot = ot.replace(/&/g,'&');
|
16 |
|
|
ot = ot.replace(/</g,'<');
|
17 |
|
|
ot = ot.replace(/>/g,'>');
|
18 |
|
|
itext += '<pre class="x-f-comment">' + ot + '</pre>';
|
19 |
|
|
}
|
20 |
|
|
}
|
21 |
|
|
}
|
22 |
|
|
// comments before BODY element
|
23 |
|
|
var head = doc.getElementsByTagName('head').item(0);
|
24 |
|
|
for (var i = 0; i < head.all.length; i++) {
|
25 |
|
|
var el = head.all(i);
|
26 |
|
|
if (el.tagName == "!") {
|
27 |
wakaba |
1.2 |
var ot = replace_specials (el.text);
|
28 |
wakaba |
1.1 |
itext += '<pre class="x-f-comment">' + ot + '</pre>';
|
29 |
wakaba |
1.2 |
} else if (el.tagName == "SCRIPT") {
|
30 |
|
|
var ot = replace_specials (el.outerHTML);
|
31 |
|
|
itext += '<pre class="x-f-script">' + ot + '</pre>';
|
32 |
|
|
} else if (el.tagName == "STYLE") {
|
33 |
|
|
var ot = replace_specials (el.outerHTML);
|
34 |
|
|
itext += '<pre class="x-f-style">' + ot + '</pre>';
|
35 |
wakaba |
1.1 |
}
|
36 |
|
|
}
|
37 |
|
|
// comments after start tag of BODY element
|
38 |
|
|
for (var i = 0; i < doc.body.all.length; i++) {
|
39 |
|
|
var el = doc.body.all(i);
|
40 |
|
|
if (el.tagName == "!") {
|
41 |
wakaba |
1.2 |
var ot = replace_specials (el.text);
|
42 |
wakaba |
1.1 |
ot = ot.replace(/ /g,' ');
|
43 |
|
|
el.outerHTML = '<ins class="x-f-comment">' + ot + '</ins>';
|
44 |
wakaba |
1.2 |
i += 1;
|
45 |
|
|
} else if (el.tagName == "SCRIPT") {
|
46 |
|
|
var ot = replace_specials (el.outerHTML);
|
47 |
|
|
ot = ot.replace(/ /g,' ');
|
48 |
|
|
el.outerHTML = '<ins class="x-f-script">' + ot + '</ins>';
|
49 |
|
|
i += 1;
|
50 |
|
|
} else if (el.tagName == "NOSCRIPT"
|
51 |
|
|
|| el.tagName == "NOFRAMES" /* instead of IFRAME */
|
52 |
|
|
|| el.tagName == "NOEMBED" /* non-standard */
|
53 |
|
|
) {
|
54 |
|
|
var ot = replace_specials (el.outerHTML);
|
55 |
|
|
el.outerHTML = '<ins class="x-f-no-elements">' + ot + '</ins>';
|
56 |
|
|
i += 1;
|
57 |
|
|
} else if (el.tagName == "COMMENT") { /* IE extension */
|
58 |
|
|
var ot = replace_specials (el.outerHTML);
|
59 |
|
|
ot = ot.replace(/ /g,' ');
|
60 |
|
|
el.outerHTML = '<ins class="x-f-comment">' + ot + '</ins>';
|
61 |
|
|
i += 1;
|
62 |
wakaba |
1.1 |
}
|
63 |
|
|
}
|
64 |
|
|
// insert comments before BODY element
|
65 |
|
|
if (itext) {
|
66 |
|
|
itext = '<ins class="x-f-header-comments">' + itext + '</ins>';
|
67 |
|
|
doc.body.all(0).outerHTML = itext + doc.body.all(0).outerHTML;
|
68 |
|
|
}
|
69 |
wakaba |
1.2 |
function replace_specials (rt) {
|
70 |
|
|
rt = rt.replace(/&/g,'&');
|
71 |
|
|
rt = rt.replace(/</g,'<');
|
72 |
|
|
rt = rt.replace(/>/g,'>');
|
73 |
|
|
return rt;
|
74 |
|
|
}
|
75 |
wakaba |
1.1 |
</script>
|
76 |
|
|
<!--
|
77 |
|
|
Copyright 2002 wakaba E<lt>w@suika.fam.cxE<gt>.
|
78 |
|
|
|
79 |
|
|
This program is free software; you can redistribute it and/or modify
|
80 |
|
|
it under the terms of the GNU General Public License as published by
|
81 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
82 |
|
|
(at your option) any later version.
|
83 |
|
|
|
84 |
|
|
This program is distributed in the hope that it will be useful,
|
85 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
86 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
87 |
|
|
GNU General Public License for more details.
|
88 |
|
|
|
89 |
|
|
You should have received a copy of the GNU General Public License
|
90 |
|
|
along with this program; see the file COPYING. If not, write to
|
91 |
|
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
92 |
|
|
Boston, MA 02111-1307, USA.
|
93 |
|
|
|
94 |
wakaba |
1.2 |
$Date: 2002/03/30 13:47:56 $
|
95 |
wakaba |
1.1 |
-->
|