aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorGravatar Maxime Hadjinlian <maxime.hadjinlian@gmail.com>2014-11-03 00:58:16 +0100
committerGravatar Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-12-09 20:50:26 +0100
commitde6d6b945407c6a81396a27cdc8e206706a685d8 (patch)
treeb77b6ec56889dbcfcc7d9c41d259c852de3eee53 /docs
parent4438ccafcbf4b9ad3477e810493ed305e7ab832d (diff)
downloadbuildroot-de6d6b945407c6a81396a27cdc8e206706a685d8.tar.gz
buildroot-de6d6b945407c6a81396a27cdc8e206706a685d8.tar.bz2
website: Javascript code cleanup
By inversing the "if (!result.error)" we gain one level of indent. Also moving variable declarations into a more correct block of code. Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/js/buildroot.js53
1 files changed, 27 insertions, 26 deletions
diff --git a/docs/js/buildroot.js b/docs/js/buildroot.js
index dd6ca6ea1b..83a3ac0305 100644
--- a/docs/js/buildroot.js
+++ b/docs/js/buildroot.js
@@ -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"));
}
});
}