/[suikacvs]/webroot/www/2006/open-in-live-dom-viewer.js
Suika

Contents of /webroot/www/2006/open-in-live-dom-viewer.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download) (as text)
Sun Nov 12 06:21:51 2006 UTC (18 years ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
File MIME type: application/javascript
New

1 /*
2 Open linked document with Live DOM Viewer, for WinIE
3
4 See also: <http://suika.fam.cx/gate/2005/sw/Bookmarklet#anchor-53>
5
6 License: Public Domain
7 */
8
9 window.OpenInLiveDOMViewer = function (uri) {
10 var xhr = window.XMLHttpRequest
11 ? new XMLHttpRequest ()
12 : new ActiveXObject ('Microsoft.XMLHTTP');
13 xhr.open ("GET", uri, false);
14 xhr.send (null);
15 location.href =
16 'http://software.hixie.ch/utilities/js/live-dom-viewer/?'
17 + encodeURIComponent (xhr.responseText);
18 };
19
20 var links = [];
21 var linksLength = document.links.length;
22 for (var i = 0; i < linksLength; i++) {
23 links[i] = document.links[i];
24 }
25
26 for (var i = 0; i < linksLength; i++) {
27 var link = links[i];
28 var container = document.createDocumentFragment ();
29 container.appendChild
30 (document.createTextNode (' ['));
31 var a = container.appendChild
32 (document.createElement ('a'));
33 a.href = link.href;
34 a.appendChild (document.createTextNode ('Live DOM Viewer'));
35 a.onclick = function () {
36 window.OpenInLiveDOMViewer (this.href);
37 return false;
38 };
39 container.appendChild
40 (document.createTextNode (']'));
41 link.parentNode.insertBefore
42 (container, link.nextSibling);
43 }

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24