/[suikacvs]/www/ie/iemenu/show-comment.html
Suika

Contents of /www/ie/iemenu/show-comment.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1.2.1 - (hide annotations) (download) (as text) (vendor branch)
Sun Mar 31 04:45:19 2002 UTC (22 years, 7 months ago) by wakaba
Branch: experimental
Changes since 1.1.1.1: +33 -10 lines
File MIME type: text/html
2002-03-31  wakaba <w@suika.fam.cx>

	* show-tag-all.html, show-tag-current.html: New files.

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,'&amp;');
16     ot = ot.replace(/</g,'&lt;');
17     ot = ot.replace(/>/g,'&gt;');
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.1.1.1.2.1 var ot = replace_specials (el.text);
28 wakaba 1.1 itext += '<pre class="x-f-comment">' + ot + '</pre>';
29 wakaba 1.1.1.1.2.1 } 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.1.1.1.2.1 var ot = replace_specials (el.text);
42 wakaba 1.1 ot = ot.replace(/ /g,' &nbsp;');
43     el.outerHTML = '<ins class="x-f-comment">' + ot + '</ins>';
44 wakaba 1.1.1.1.2.1 i += 1;
45     } else if (el.tagName == "SCRIPT") {
46     var ot = replace_specials (el.outerHTML);
47     ot = ot.replace(/ /g,' &nbsp;');
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,' &nbsp;');
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.1.1.1.2.1 function replace_specials (rt) {
70     rt = rt.replace(/&/g,'&amp;');
71     rt = rt.replace(/</g,'&lt;');
72     rt = rt.replace(/>/g,'&gt;');
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.1.1.1.2.1 $Date: 2002/03/30 13:47:56 $
95 wakaba 1.1 -->

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24