]> git.parisson.com Git - pdf.js.git/commitdiff
Fixing 'compatibility.js' load order; add Object.keys emulation
authornotmasteryet <async.processingjs@yahoo.com>
Sat, 29 Oct 2011 21:00:13 +0000 (16:00 -0500)
committernotmasteryet <async.processingjs@yahoo.com>
Sat, 29 Oct 2011 21:00:13 +0000 (16:00 -0500)
web/compatibility.js
web/viewer.html

index ad4c8f8a997e3ee5a215d847f20f9702fea36ca9..7d1d72553667e38ed62f6a6106a44dd5d5f0a642 100644 (file)
   };
 })();
 
+// Object.keys() ?
+(function checkObjectKeysCompatibility() {
+  if (typeof Object.keys !== 'undefined')
+    return;
+
+  Object.keys = function objectKeys(obj) {
+    var result = [];
+    for (var i in obj) {
+      if (obj.hasOwnProperty(i))
+        result.push(i);
+    }
+    return result;
+  };
+})();
+
 // No XMLHttpRequest.response ?
 (function checkXMLHttpRequestResponseCompatibility() {
   var xhrPrototype = XMLHttpRequest.prototype;
index f7a5378ed39a7e0b334e1447fce6253587ff8586..0c6ab385e114d98a72f635cf6a6ace5e5827ba67 100644 (file)
@@ -3,6 +3,7 @@
     <head>
         <title>Simple pdf.js page viewer</title>
         <link rel="stylesheet" href="viewer.css"/>
+        <script type="text/javascript" src="compatibility.js"></script>
         
         <!-- PDFJSSCRIPT_INCLUDE_BUILD -->
         
@@ -25,7 +26,6 @@
         <script type="text/javascript" src="../src/stream.js"></script>  <!-- PDFJSSCRIPT_REMOVE -->
         <script type="text/javascript" src="../src/worker.js"></script>  <!-- PDFJSSCRIPT_REMOVE -->
 
-        <script type="text/javascript" src="compatibility.js"></script>
         <script type="text/javascript" src="viewer.js"></script>
   </head>