+ },
+ loadLatest: function() {
+ var req = new enyo.Ajax({
+ url: baseURL + '/latest.json'
+ });
+ req.response(function(inSender, inResponse) {
+ this.$.latestTags.destroyComponents();
+ for (var i = 0; i < inResponse.tags.length; i++) {
+ var v = inResponse.tags[i];
+ this.$.latestTags.createComponent({
+ kind: "blerg.Link",
+ href: baseURL + "/#/tag/" + v,
+ content: "#" + v,
+ classes: "ref"
+ });
+ this.$.latestTags.createComponent({noDom: true, content: " "});
+ }
+ this.$.latestTags.render();
+
+ this.$.latestPosts.destroyComponents();
+ for (var i = 0; i < inResponse.records.length; i++) {
+ var v = inResponse.records[i];
+ this.$.latestPosts.createComponent({kind: "blerg.BriefRecord"}, v);
+ }
+ this.$.latestPosts.render();
+ this.startTickerCycle();
+ }.bind(this));
+ req.go();
+ },
+ startTickerCycle: function() {
+ this.tickerTimeout = setTimeout(function() {
+ this.$.latestPosts.node.scrollTop = 0;
+ this.startTicker();
+ }.bind(this), 2500);
+ },
+ startTicker: function() {
+ if (this.tickerInterval)
+ return;
+ this.tickerInterval = setInterval(this.ticker.bind(this), 100);
+ },
+ pauseTicker: function() {
+ clearInterval(this.tickerInterval);
+ this.tickerInterval = null;
+ },
+ stopTicker: function() {
+ clearTimeout(this.tickerTimeout);
+ this.tickerTimeout = null;
+ clearInterval(this.tickerInterval);
+ this.tickerInterval = null;
+ },
+ ticker: function() {
+ var n = this.$.latestPosts.node;
+ if (n.scrollTop < n.scrollHeight - n.clientHeight) {
+ n.scrollTop += 2;
+ } else {
+ this.stopTicker();
+ this.startTickerCycle();
+ }