Skip to contentSkip to conversation

website: Remove debug message

PATCH New Maxime Hadjinlian 2 participants 4 messages Nov 2, 2014 – Dec 9, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 website: Remove debug message

---
 docs/js/buildroot.js | 1 -
 1 file changed, 1 deletion(-)
docs/js/buildroot.js +0 -1
index 03c3968..6e0d97a 100644
@@ -28,7 +28,6 @@ function load_activity(feedurl, divid) {
         for (var i = 0; i < empty; i++) {
           container.appendChild(document.createElement("p"));
         }
-        console.log(loaded);
       }
     });
 }
Signature · 1 line
2.1.1
#1 lore raw

PATCH 2/3 website: Fix indent

---
 docs/js/buildroot.js | 80 +++++++++++++++++++++++++++-------------------------
 1 file changed, 41 insertions(+), 39 deletions(-)
docs/js/buildroot.js +41 -39
index 6e0d97a..dd6ca6e 100644
@@ -2,61 +2,63 @@ function load_activity(feedurl, divid) {
     var feed = new google.feeds.Feed(feedurl);
     feed.setNumEntries(30);
     feed.load(function(result) {
-      if (!result.error) {
-        var container = document.getElementById(divid);
-        var loaded = 0;
-        var nb_display = 8;
-        for (var i = 0; i < result.feed.entries.length; i++) {
-          var entry = result.feed.entries[i];
-          if (entry.title.indexOf("git commit") != -1)
-            continue;
-          loaded += 1;
-          if (loaded > nb_display)
-            break;
-          var div = document.createElement("p");
-          var link = document.createElement("a");
-          var d = new Date(entry.publishedDate);
-          var data = '[' + d.toLocaleDateString() + '] ' + entry.title
-          var text = document.createTextNode(data);
-          link.appendChild(text);
-          link.title = entry.title;
-          link.href = entry.link
-          div.appendChild(link);
-          container.appendChild(div);
+        if (!result.error) {
+            var container = document.getElementById(divid);
+            var loaded = 0;
+            var nb_display = 8;
+            for (var i = 0; i < result.feed.entries.length; i++) {
+                var entry = result.feed.entries[i];
+                if (entry.title.indexOf("git commit") != -1)
+                    continue;
+                loaded += 1;
+                if (loaded > nb_display)
+                    break;
+                var div = document.createElement("p");
+                var link = document.createElement("a");
+                var d = new Date(entry.publishedDate);
+                var data = '[' + d.toLocaleDateString() + '] ' + entry.title
+                var text = document.createTextNode(data);
+                link.appendChild(text);
+                link.title = entry.title;
+                link.href = entry.link
+                div.appendChild(link);
+                container.appendChild(div);
+            }
+            var empty = nb_display - loaded;
+            for (var i = 0; i < empty; i++) {
+                container.appendChild(document.createElement("p"));
+            }
         }
-        var empty = nb_display - loaded;
-        for (var i = 0; i < empty; i++) {
-          container.appendChild(document.createElement("p"));
-        }
-      }
     });
 }
 
 function initialize() {
-  load_activity("http://rss.gmane.org/topics/excerpts/gmane.comp.lib.uclibc.buildroot", "mailing-list-activity");
-  load_activity("http://git.buildroot.org/buildroot/atom/?h=master", "commit-activity");
+    load_activity("http://rss.gmane.org/topics/excerpts/gmane.comp.lib.uclibc.buildroot", "mailing-list-activity");
+    load_activity("http://git.buildroot.org/buildroot/atom/?h=master", "commit-activity");
 }
 
 function google_analytics() {
-  var _gaq = _gaq || [];
-  _gaq.push(['_setAccount', 'UA-21761074-1']);
-  _gaq.push(['_setDomainName', 'none']);
-  _gaq.push(['_setAllowLinker', true]);
-  _gaq.push(['_trackPageview']);
+    var _gaq = _gaq || [];
+    _gaq.push(['_setAccount', 'UA-21761074-1']);
+    _gaq.push(['_setDomainName', 'none']);
+    _gaq.push(['_setAllowLinker', true]);
+    _gaq.push(['_trackPageview']);
 
-  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
-  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
-  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+    var ga = document.createElement('script');
+    ga.type = 'text/javascript';
+    ga.async = true;
+    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+    var s = document.getElementsByTagName('script')[0];
+    s.parentNode.insertBefore(ga, s);
 }
 
 google.load("feeds", "1");
 google.setOnLoadCallback(initialize);
 google_analytics();
 
-jQuery(document).ready(function($){
+jQuery(document).ready(function($) {
     var url = window.location.href;
     // Get the basename of the URL
     url = url.split(/[\\/]/).pop()
-    $('.nav a[href="/'+url+'"]').parent().addClass('active');
+    $('.nav a[href="/' + url + '"]').parent().addClass('active');
 });
-
Signature · 1 line
2.1.1
#2 lore raw

PATCH 3/3 website: Tidy up code

In reply to Maxime Hadjinlian

By inversing the "if (!result.error)" we gain one level of indent. Also moving variable declarations into a more correct block of code.

---
 docs/js/buildroot.js | 53 ++++++++++++++++++++++++++--------------------------
 1 file changed, 27 insertions(+), 26 deletions(-)
docs/js/buildroot.js +27 -26
index dd6ca6e..83a3ac0 100644
@@ -1,33 +1,34 @@
 function load_activity(feedurl, divid) {
     var feed = new google.feeds.Feed(feedurl);
+    var container = document.getElementById(divid);
+    var loaded = 0;
+    var nb_display = 8;
     feed.setNumEntries(30);
     feed.load(function(result) {
-        if (!result.error) {
-            var container = document.getElementById(divid);
-            var loaded = 0;
-            var nb_display = 8;
-            for (var i = 0; i < result.feed.entries.length; i++) {
-                var entry = result.feed.entries[i];
-                if (entry.title.indexOf("git commit") != -1)
-                    continue;
-                loaded += 1;
-                if (loaded > nb_display)
-                    break;
-                var div = document.createElement("p");
-                var link = document.createElement("a");
-                var d = new Date(entry.publishedDate);
-                var data = '[' + d.toLocaleDateString() + '] ' + entry.title
-                var text = document.createTextNode(data);
-                link.appendChild(text);
-                link.title = entry.title;
-                link.href = entry.link
-                div.appendChild(link);
-                container.appendChild(div);
-            }
-            var empty = nb_display - loaded;
-            for (var i = 0; i < empty; i++) {
-                container.appendChild(document.createElement("p"));
-            }
+        if (result.error) {
+        	return;
+        }
+        for (var i = 0; i < result.feed.entries.length; i++) {
+            var entry = result.feed.entries[i];
+            if (entry.title.indexOf("git commit") != -1)
+                continue;
+            loaded += 1;
+            if (loaded > nb_display)
+                break;
+            var div = document.createElement("p");
+            var link = document.createElement("a");
+            var d = new Date(entry.publishedDate);
+            var data = '[' + d.toLocaleDateString() + '] ' + entry.title
+            var text = document.createTextNode(data);
+            link.appendChild(text);
+            link.title = entry.title;
+            link.href = entry.link
+            div.appendChild(link);
+            container.appendChild(div);
+        }
+        var empty = nb_display - loaded;
+        for (var i = 0; i < empty; i++) {
+            container.appendChild(document.createElement("p"));
         }
     });
 }
Signature · 1 line
2.1.1
#3 lore raw

PATCH 1/3 website: Remove debug message

In reply to Maxime Hadjinlian

Dear Maxime Hadjinlian,

Quoted 1 line · Maxime Hadjinlian

All three patches applied. On the last two, I've made some minor edits to the commit title.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com