[html5] r3311 - [e] (0) Move the updater code into a separate file.

whatwg at whatwg.org whatwg at whatwg.org
Tue Jun 23 22:52:07 PDT 2009


Author: ianh
Date: 2009-06-23 22:52:06 -0700 (Tue, 23 Jun 2009)
New Revision: 3311

Modified:
   index
Log:
[e] (0) Move the updater code into a separate file.

Modified: index
===================================================================
--- index	2009-06-24 01:12:30 UTC (rev 3310)
+++ index	2009-06-24 05:52:06 UTC (rev 3311)
@@ -20,6 +20,9 @@
    [hidden] { display: none; }
   </style><link href=data:text/css, rel=stylesheet title="Complete specification"><link href=data:text/css,.impl%20{%20display:%20none;%20} rel="alternate stylesheet" title="Author documentation only"><link href=data:text/css,.impl%20{%20background:%20%23FFEEEE;%20} rel="alternate stylesheet" title="Highlight implementation requirements"><link href=status.css rel=stylesheet><script>
    var loadTimer = new Date();
+   var current_revision = "r" + "$Revision$".substr(11);
+   current_revision = current_revision.substr(0, current_revision.length - 2);
+   var last_known_revision = current_revision;
    function load(script) {
      var e = document.createElement('script');
      e.setAttribute('src', script);
@@ -31,6 +34,7 @@
      load('status.js');
      load('dfn.js');
      load('toc.js');
+     load('updater.js');
      if (location.search == '?profile')
        document.getElementsByTagName('h2')[0].textContent += '; load: ' + (new Date() - loadTimer) + 'ms';
    }
@@ -66,6 +70,8 @@
    and create derivative works of this document.</p>
   </div>
 
+  <div id=configUI></div>
+
   <hr><h2 class="no-num no-toc" id=abstract>Abstract</h2>
 
   <p>This specification evolves HTML and its related APIs to ease the
@@ -104,87 +110,10 @@
   <p>This specification is intended to replace (be the new version of)
   what was previously the HTML4, XHTML 1.x, and DOM2 HTML
   specifications.</p>
+<!--START html5-->
 
+  <h3 class="no-num no-toc" id=stability-0>Stability</h3>
 
-  <script>
-   function getCookie(name) {
-     var cookies = document.cookie.split("; ");
-     for (var index = 0; index < cookies.length; index++) {
-       var data = cookies[index].split("=");
-       if (data[0] == name)
-         return unescape(data[1]);
-     }
-     return null;
-   }
-   var current_revision = "r" + "$Revision$".substr(11);
-   current_revision = current_revision.substr(0, current_revision.length - 2);
-   var last_known_revision = current_revision;
-   function getRemoteString(url, callback) {
-     var x = new XMLHttpRequest();
-     x.open('GET', url + "?" + new Date());
-     x.onreadystatechange = function () {
-       if (x.readyState == 4) {
-         if (x.status == 200)
-           callback(x.responseText);
-         else
-           throw 'network error ' + x.status + ': "' + x.statusText + '" while loading ' + url;
-       }
-     };
-     x.send(null);
-   }
-   function doUpdate() {
-     getRemoteString('revision.dat', function (data) {
-       if (data != last_known_revision) {
-         getRemoteString('revision-message.dat', function (message) {
-           last_known_revision = data;
-           var status = document.getElementById('updatesStatus');
-           status.textContent = 'This specification has been updated. You are reading ' + current_revision + ' but the latest revision is ' + data + ' ("' +
-                                message + '") ';
-           var a = document.createElement('a');
-           a.href = '';
-           a.onclick = function () { location.reload(); return false; };
-           a.textContent = "Reload";
-           status.appendChild(a);
-           status.appendChild(document.createTextNode('. '));
-           var d = document.createElement('a');
-           d.href = 'http://html5.org/tools/web-apps-tracker?from=' + current_revision.substr(1) + '&to=' + data.substr(1);
-           d.textContent = "Diffs";
-           status.appendChild(d);
-           status.appendChild(document.createTextNode('. '));
-           var x = document.createElement('a');
-           x.href = '';
-           x.onclick = function () { status.textContent = ''; status.className = ''; return false; };
-           x.textContent = "Close";
-           status.appendChild(x);
-           status.appendChild(document.createTextNode('. '));
-           status.className = 'relevant';
-         });
-       }
-     });
-   }
-   var updater;
-   function configureUpdates(on) {
-     var date = new Date();
-     date.setFullYear(date.getFullYear() + 1);
-     document.cookie = 'updatesEnabled=' + encodeURIComponent(on?'1':'0') + '; expires=' + date.toGMTString();
-     if (updater && !on)
-       clearInterval(updater);
-     if (!updater && on)
-       updater = setInterval(doUpdate, 30000);
-     if (on)
-       doUpdate();
-   }
-  </script><div id=configUI><p id=updatesUI><label><input id=updatesEnabled onchange=configureUpdates(this.checked) type=checkbox> Watch
-  for updates</label></div>
-  <p id=updatesStatus></p>
-
-  <script>
-   if (getCookie('updatesEnabled') == '1') {
-     document.getElementById('updatesEnabled').checked = true;
-     configureUpdates(true);
-   }
-  </script><!--START html5--><h3 class="no-num no-toc" id=stability-0>Stability</h3>
-
   <p>Different parts of this specification are at different levels of
   maturity.</p>
 




More information about the Commit-Watchers mailing list