X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=www%2Fjssrc%2Fblerg%2FControls.js;h=daf06bd2ba94e6eeff2debff0f27033c8594ec93;hb=04a4fdf9d85e0d0b193300abe0c0e433449cd285;hp=e5939762d5656754bed6a1aa1bda20fe862c9b59;hpb=123d2723395955bf2121e0bfeb6c864b70a33448;p=blerg.git diff --git a/www/jssrc/blerg/Controls.js b/www/jssrc/blerg/Controls.js index e593976..daf06bd 100644 --- a/www/jssrc/blerg/Controls.js +++ b/www/jssrc/blerg/Controls.js @@ -42,10 +42,12 @@ enyo.kind({ ]}, {classes: "blerg-controls-toolbar", components: [ {kind: "onyx.Button", content: "Feed Your Vanity", onclick: "chatterClicked"}, - {kind: "onyx.Button", content: "Stalk Your Victims", onclick: "feedClicked"}, + {name: "feedButton", kind: "onyx.Button", classes: "feed-button", content: "Stalk Your Victims", onclick: "feedClicked"}, {name: "spewButton", kind: "onyx.Button", classes: "spew-button", content: "Spew It!", onclick: "spewToggle"} ]}, - ]} + ]}, + {name: "api", kind: "blerg.API", + onFeedInfo: "gotFeedInfo"} ], showRSS: function(url) { this.$.rssButton.show(); @@ -82,9 +84,15 @@ enyo.kind({ this.$.userlink.setAttribute('href', '/#' + inEvent.username); this.$.userlink.setContent('@' + inEvent.username); this.username = inEvent.username; + + this.$.api.getFeedInfo(); + this.feedStatusUpdateInterval = setInterval(function() { + this.$.api.getFeedInfo(); + }.bind(this), 900000); }, logout: function(inSender, inEvent) { this.setLoggedIn(false); + clearInterval(this.feedStatusUpdateInterval); }, spewToggle: function(inSender, inEvent) { this.postShowing = !this.postShowing; @@ -94,6 +102,14 @@ enyo.kind({ this.postShowing = inEvent.showing; this.$.spewButton.addRemoveClass('active', inEvent.showing); }, + gotFeedInfo: function(inSender, inEvent) { + this.$.feedButton.addRemoveClass('new', inEvent.new > 0); + if (inEvent.new > 0) { + this.$.feedButton.setContent('Stalk Your Victims (' + inEvent.new + ')'); + } else { + this.$.feedButton.setContent('Stalk Your Victims'); + } + }, chatterClicked: function() { window.location.href = '/#/ref/' + this.username; this.bubble('onNavigate');