X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=www%2Fjssrc%2Fblerg%2FControls.js;h=8c91c2951d857876a4408be27f2ef78753cbf38f;hb=73a1174eca9932fa03220d13222b6a62eda2bfa1;hp=1bbfd2dbfce858917bb609ce2c610a296c592e70;hpb=80ad774f55998cc11e08694245dfd6cb1b49a86f;p=blerg.git diff --git a/www/jssrc/blerg/Controls.js b/www/jssrc/blerg/Controls.js index 1bbfd2d..8c91c29 100644 --- a/www/jssrc/blerg/Controls.js +++ b/www/jssrc/blerg/Controls.js @@ -17,13 +17,13 @@ enyo.kind({ {tag: "form", onsubmit: "loginClicked", classes: "login", components: [ {kind: "onyx.Groupbox", components: [ {kind: "onyx.InputDecorator", components: [ - {name: "username", kind: "onyx.Input", placeholder: "Username"} + {name: "username", kind: "onyx.Input", placeholder: "Username", attributes: {tabindex: 1}} ]}, {kind: "onyx.InputDecorator", components: [ - {name: "password", kind: "onyx.Input", placeholder: "Password", type: "password"} + {name: "password", kind: "onyx.Input", placeholder: "Password", type: "password", attributes: {tabindex: 2}} ]}, ]}, - {kind: "onyx.Button", content: "Login", onclick: "loginClicked"} + {kind: "onyx.Button", content: "Login", onclick: "loginClicked", attributes: {tabindex: 3}} ]} ]}, {name: "loggedInControls", showing: false, components: [ @@ -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; @@ -93,5 +101,21 @@ enyo.kind({ postVisibilityUpdate: function(inSender, inEvent) { 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'); + }, + feedClicked: function() { + window.location.href = '/#/feed'; + this.bubble('onNavigate'); } });