24 |
for (var i = 0; i < head.all.length; i++) { |
for (var i = 0; i < head.all.length; i++) { |
25 |
var el = head.all(i); |
var el = head.all(i); |
26 |
if (el.tagName == "!") { |
if (el.tagName == "!") { |
27 |
var ot = el.text; |
var ot = replace_specials (el.text); |
|
ot = ot.replace(/&/g,'&'); |
|
|
ot = ot.replace(/</g,'<'); |
|
|
ot = ot.replace(/>/g,'>'); |
|
28 |
itext += '<pre class="x-f-comment">' + ot + '</pre>'; |
itext += '<pre class="x-f-comment">' + ot + '</pre>'; |
29 |
|
} 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 |
} |
} |
36 |
} |
} |
37 |
// comments after start tag of BODY element |
// comments after start tag of BODY element |
38 |
for (var i = 0; i < doc.body.all.length; i++) { |
for (var i = 0; i < doc.body.all.length; i++) { |
39 |
var el = doc.body.all(i); |
var el = doc.body.all(i); |
40 |
if (el.tagName == "!") { |
if (el.tagName == "!") { |
41 |
var ot = el.text; |
var ot = replace_specials (el.text); |
|
ot = ot.replace(/&/g,'&'); |
|
|
ot = ot.replace(/</g,'<'); |
|
|
ot = ot.replace(/>/g,'>'); |
|
42 |
ot = ot.replace(/ /g,' '); |
ot = ot.replace(/ /g,' '); |
43 |
el.outerHTML = '<ins class="x-f-comment">' + ot + '</ins>'; |
el.outerHTML = '<ins class="x-f-comment">' + ot + '</ins>'; |
44 |
i += 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 |
} |
} |
63 |
} |
} |
64 |
// insert comments before BODY element |
// insert comments before BODY element |
66 |
itext = '<ins class="x-f-header-comments">' + itext + '</ins>'; |
itext = '<ins class="x-f-header-comments">' + itext + '</ins>'; |
67 |
doc.body.all(0).outerHTML = itext + doc.body.all(0).outerHTML; |
doc.body.all(0).outerHTML = itext + doc.body.all(0).outerHTML; |
68 |
} |
} |
69 |
|
function replace_specials (rt) { |
70 |
|
rt = rt.replace(/&/g,'&'); |
71 |
|
rt = rt.replace(/</g,'<'); |
72 |
|
rt = rt.replace(/>/g,'>'); |
73 |
|
return rt; |
74 |
|
} |
75 |
</script> |
</script> |
76 |
<!-- |
<!-- |
77 |
Copyright 2002 wakaba E<lt>w@suika.fam.cxE<gt>. |
Copyright 2002 wakaba E<lt>w@suika.fam.cxE<gt>. |