cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject git commit: fixing stats on firefox
Date Fri, 15 Nov 2013 21:28:37 GMT
Updated Branches:
  refs/heads/master 697102ef7 -> 5b22daee1


fixing stats on firefox


Project: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/commit/5b22daee
Tree: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/tree/5b22daee
Diff: http://git-wip-us.apache.org/repos/asf/cordova-registry-web/diff/5b22daee

Branch: refs/heads/master
Commit: 5b22daee170ab98d951e33dc0bcf59534fc7fa97
Parents: 697102e
Author: Anis Kadri <anis@apache.org>
Authored: Fri Nov 15 13:27:38 2013 -0800
Committer: Anis Kadri <anis@apache.org>
Committed: Fri Nov 15 13:27:38 2013 -0800

----------------------------------------------------------------------
 attachments/index.html |  3 ++-
 attachments/stats.html | 62 +-----------------------------------------
 attachments/stats.js   | 66 +++++++++++++++++++++++++++++++++++++++++++++
 push.sh                |  2 +-
 4 files changed, 70 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/5b22daee/attachments/index.html
----------------------------------------------------------------------
diff --git a/attachments/index.html b/attachments/index.html
index 528b133..b4ad7ef 100644
--- a/attachments/index.html
+++ b/attachments/index.html
@@ -12,7 +12,8 @@
     <link rel="alternate" type="application/rss+xml"
       href="/api/_design/app/_rewrite/-/rss?descending=true&limit=50"
       title="npm publish feed (RSS)">
-    <script language="javascript" type="text/javascript" src="jquery-1.4.4.min.js"></script>
+    <script language="javascript" type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
+    <script language="javascript" type="text/javascript" src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
     <script language="javascript" type="text/javascript" src="sammy/sammy.js"></script>
     <script language="javascript" type="text/javascript" src="site.js"></script>
     <link href="images/favicon.ico" rel="shortcut icon" type="image/x-icon">

http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/5b22daee/attachments/stats.html
----------------------------------------------------------------------
diff --git a/attachments/stats.html b/attachments/stats.html
index 8ee2b67..1ce3ead 100644
--- a/attachments/stats.html
+++ b/attachments/stats.html
@@ -1,7 +1,5 @@
 <html>
   <head>
-    <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
-    <script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
     <!-- Latest compiled and minified CSS -->
     <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
 
@@ -10,65 +8,7 @@
 
     <!-- Latest compiled and minified JavaScript -->
     <script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
-    <script type='text/javascript'>
-      function clientStats() {
-        var url = '/downloads/_design/downloads/_view/byClient?group=true'
-        var xhr = new XMLHttpRequest();
-        xhr.open('GET', url, true);
-        xhr.onload = function(e) {
-          var res = JSON.parse(xhr.responseText);
-          if(res) {
-            var data = res.rows;
-            var clientStatsEm = document.getElementById('client_stats');
-            var plugman = cordova_cli = unknown = total = 0;
-            for(var i = 0 ; i < data.length ; i++) {
-              total += data[i].value;
-              if(data[i].key[1] === 'plugman') {
-                plugman += data[i].value;
-              } else if(data[i].key[1] === 'cordova-cli') {
-                cordova_cli += data[i].value;
-              } else {
-                unknown += data[i].value;
-              }
-            }
-            var totalEm = document.getElementById('total');
-            totalEm.innerHTML = '<h1>Total Downloads: '+total+'</h1>';
-            var plugmanPerc = plugman * 100 / total;
-            var cordovaCliPerc = cordova_cli * 100 / total;
-            var unknownPerc = unknown * 100 / total;
-            var html = 'plugman '+Math.round(plugmanPerc)+'%<br/>';
-            html += 'cordova-cli '+Math.round(cordovaCliPerc)+'%<br/>';
-            html += 'unknown '+Math.round(unknownPerc)+'%<br/>';
-            clientStatsEm.innerHTML = html;
-          }
-        };
-        xhr.send();
-      };
-      window.addEventListener('load', function load(event) {
-          window.removeEventListener('load');
-          var url = '/downloads/_design/downloads/_view/byId?group=true';
-          var xhr = new XMLHttpRequest();
-          xhr.open('GET', url, true);
-          xhr.onload = function(e) {
-            var res = JSON.parse(xhr.responseText);
-            if(res) {
-              var downloads = res.rows;
-              var downloadsEm = document.getElementById('downloads');
-              downloads.sort(function(a,b) { return b.value - a.value; });
-              for(var i = 0 ; i < downloads.length ; i++) {
-                var row = document.createElement('tr');
-                var rank = i+1;
-                row.innerHTML = '<td>'+rank+'</td><td>'+downloads[i].key+'</td>'+'<td>'+downloads[i].value+'</td>';
-                downloadsEm.appendChild(row); 
-              }
-              clientStats();
-              } else {
-                document.getElementById('total').innerHTML = "Cannot get download data :-("
-              }
-          };
-          xhr.send();
-      });
-    </script>
+    <script type='text/javascript' src="stats.js"></script>
   </head>
 
   <body>

http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/5b22daee/attachments/stats.js
----------------------------------------------------------------------
diff --git a/attachments/stats.js b/attachments/stats.js
new file mode 100644
index 0000000..9954301
--- /dev/null
+++ b/attachments/stats.js
@@ -0,0 +1,66 @@
+function clientStats() {
+  var url = '/downloads/_design/downloads/_view/byClient?group=true'
+  var xhr = new XMLHttpRequest();
+  xhr.open('GET', url, true);
+  xhr.onload = function(e) {
+    var res = JSON.parse(xhr.responseText);
+    if(res) {
+      var data = res.rows;
+      var clientStatsEm = document.getElementById('client_stats');
+      var plugman = cordova_cli = unknown = total = 0;
+      for(var i = 0 ; i < data.length ; i++) {
+        total += data[i].value;
+        if(data[i].key[1] === 'plugman') {
+          plugman += data[i].value;
+        } else if(data[i].key[1] === 'cordova-cli') {
+          cordova_cli += data[i].value;
+        } else {
+          unknown += data[i].value;
+        }
+      }
+      var totalEm = document.getElementById('total');
+      totalEm.innerHTML = '<h1>Total Downloads: '+total+'</h1>';
+      var plugmanPerc = plugman * 100 / total;
+      var cordovaCliPerc = cordova_cli * 100 / total;
+      var unknownPerc = unknown * 100 / total;
+      var html = 'plugman '+Math.round(plugmanPerc)+'%<br/>';
+      html += 'cordova-cli '+Math.round(cordovaCliPerc)+'%<br/>';
+      html += 'unknown '+Math.round(unknownPerc)+'%<br/>';
+      clientStatsEm.innerHTML = html;
+    }
+  };
+  xhr.send();
+};
+
+function downloadStats() {
+    var url = '/downloads/_design/downloads/_view/byId?group=true';
+    var xhr = new XMLHttpRequest();
+    xhr.open('GET', url, true);
+    xhr.onload = function(e) {
+      var res = JSON.parse(xhr.responseText);
+      if(res) {
+        var downloads = res.rows;
+        var downloadsEm = document.getElementById('downloads');
+        downloads.sort(function(a,b) { return b.value - a.value; });
+        for(var i = 0 ; i < downloads.length ; i++) {
+          var row = document.createElement('tr');
+          var rank = i+1;
+          row.innerHTML = '<td>'+rank+'</td><td>'+downloads[i].key+'</td>'+'<td>'+downloads[i].value+'</td>';
+          downloadsEm.appendChild(row); 
+        }
+        clientStats();
+        } else {
+          document.getElementById('total').innerHTML = "Cannot get download data :-("
+        }
+    };
+    xhr.send();
+}
+
+$(document).ready(function() {
+  downloadStats();
+});
+
+//window.addEventListener('load', function load(event) {
+//  window.removeEventListener('load');
+//  downloadStats();
+//}, false);

http://git-wip-us.apache.org/repos/asf/cordova-registry-web/blob/5b22daee/push.sh
----------------------------------------------------------------------
diff --git a/push.sh b/push.sh
index d1d0848..266079e 100755
--- a/push.sh
+++ b/push.sh
@@ -3,7 +3,7 @@ HOST="localhost:5984"
 
 if [ $# -ne 2 ] && [ $# -ne 0 ]
 then
-    echo 'Usage: drop_registry username:password http://registry_host'
+    echo 'Usage: ./push.sh username:password http://registry_host'
     exit 1
 fi
 


Mime
View raw message