W3C home > Mailing lists > Public > public-dap-commits@w3.org > September 2011

2009/dap/system-info battery-status-patch.js,NONE,1.1 battery-status.html,1.48,1.49

From: Anssi Kostiainen via cvs-syncmail <cvsmail@w3.org>
Date: Mon, 12 Sep 2011 07:46:59 +0000
To: public-dap-commits@w3.org
Message-Id: <E1R31EJ-000350-Gp@lionel-hutz.w3.org>
Update of /sources/public/2009/dap/system-info
In directory hutz:/tmp/cvs-serv11819

Modified Files:
	battery-status.html 
Added Files:
	battery-status-patch.js 
Log Message:
dictionary patch: make external

Index: battery-status.html
===================================================================
RCS file: /sources/public/2009/dap/system-info/battery-status.html,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- battery-status.html	12 Sep 2011 07:14:21 -0000	1.48
+++ battery-status.html	12 Sep 2011 07:46:57 -0000	1.49
@@ -25,39 +25,6 @@
           wgPatentURI:  "http://www.w3.org/2004/01/pp-impl/43696/status",
       };
     </script>
-    <script class="remove">
-      // a monkey patch to move BatteryStatusEventInit dictionary into the
-      // same WebIDL block with BatteryStatusEvent interface, and to rename
-      // Members to Dictionary Members
-      var _dictionary = setTimeout (function () {
-        var idlbsei = document.querySelector('#idl-def-BatteryStatusEventInit'),
-            idlbse = document.querySelector('#idl-def-BatteryStatusEvent'),
-            ifbse = document.querySelector('#batterystatusevent-interface'),
-            members = document.querySelector('#members'),
-            members_header = document.querySelector('#members > h3'),
-            toc = document.querySelectorAll('#toc .tocxref'),
-            i;
-        
-        if (typeof idlbsei === 'object' && typeof idlbse === 'object' &&
-            typeof members === 'object' && typeof members_header === 'object' &&
-            idlbsei.textContent.indexOf('dictionary') != -1 &&
-            idlbse.textContent.indexOf('interface') != -1 &&
-            typeof Object.keys(berjon.biblio).length === 'number') {
-          clearTimeout(_dictionary);
-          
-          ifbse.removeChild(idlbsei.parentNode);
-          idlbse.parentNode.appendChild(document.createElement('br'));
-          idlbse.parentNode.appendChild(idlbsei);
-          members_header.textContent = members_header.textContent.replace(/Members/, 'Dictionary Members');
-          
-          for (i in toc) {
-            if (toc[i].textContent && toc[i].textContent.indexOf('Members') !== -1) {
-              toc[i].textContent = toc[i].textContent.replace(/Members/, 'Dictionary Members');
-            }
-          }
-        }
-      }, 100);
-    </script>
     <style type='text/css'>
       .event {
         font-family: monospace;
@@ -754,5 +721,6 @@
         everyone while doing so.
       </p>
     </section>
+    <script src='battery-status-patch.js' class='remove'></script>
   </body>
 </html>

--- NEW FILE: battery-status-patch.js ---
// a monkey patch to move BatteryStatusEventInit dictionary into the
// same WebIDL block with BatteryStatusEvent interface, and to rename
// Members to Dictionary Members
window.addEventListener('load', function () {
  var _dictionary = setTimeout (function () {
    var idlbsei = document.querySelector('#idl-def-BatteryStatusEventInit'),
        idlbse = document.querySelector('#idl-def-BatteryStatusEvent'),
        ifbse = document.querySelector('#batterystatusevent-interface'),
        members = document.querySelector('#members'),
        members_header = document.querySelector('#members > h3'),
        toc = document.querySelectorAll('#toc .tocxref'),
        document_ready = false, i;

    try {
      if (typeof idlbsei === 'object' && typeof idlbse === 'object' &&
          typeof members === 'object' && typeof members_header === 'object' &&
          idlbsei.textContent.indexOf('dictionary') !== -1 &&
          idlbse.textContent.indexOf('interface') !== -1 &&
          typeof Object.keys(berjon.biblio).length === 'number') {
        document_ready = true;
        clearTimeout(_dictionary);
      }
    } catch (ex) { }

    if (document_ready) {
      ifbse.removeChild(idlbsei.parentNode);
      idlbse.parentNode.appendChild(document.createElement('br'));
      idlbse.parentNode.appendChild(idlbsei);
      members_header.textContent = members_header.textContent.replace(/Members/, 'Dictionary Members');

      for (i in toc) {
        if (toc[i].textContent && toc[i].textContent.indexOf('Members') !== -1) {
          toc[i].textContent = toc[i].textContent.replace(/Members/, 'Dictionary Members');
        }
      }
    }
  }, 2000);
}, false);
Received on Monday, 12 September 2011 07:47:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 12 September 2011 07:47:05 GMT