X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=www%2Fjssrc%2Fblerg%2FBlerg.js;h=747c0daf050285139da8bda4b23402482c90a241;hb=40104fc72cf62cf93d5dde1cab5dd87e44068cc2;hp=f40a2771e566ace899cbc40acbb0d8d09bff66ed;hpb=80ad774f55998cc11e08694245dfd6cb1b49a86f;p=blerg.git diff --git a/www/jssrc/blerg/Blerg.js b/www/jssrc/blerg/Blerg.js index f40a277..747c0da 100644 --- a/www/jssrc/blerg/Blerg.js +++ b/www/jssrc/blerg/Blerg.js @@ -1,37 +1,36 @@ +// Listen for onsubmit events +enyo.dispatcher.listen(document, "submit"); + enyo.kind({ name: "blerg.Blerg", kind: "Control", lastHash: null, + pathHandlers: [ blerg.User, blerg.Tag, blerg.Feed, blerg.ExternalURLPost, blerg.Welcome, blerg.AccountCenter, blerg.Recovery, blerg.EmailVerify ], handlers: { onStartSignup: "showSignupDialog", onTryLogin: "tryLogin", onTryLogout: "tryLogout", onSetTitle: "setTitle", - onPostVisibility: "postVisibilityUpdate" + onPostVisibility: "postVisibilityUpdate", + onReload: "sendReload", + onShowChangePassword: "showChangePassword", + onAuthFailure: "authFailure" }, components: [ {classes: "blerg-header", components: [ {name: "title", kind: "blerg.Title"}, {name: "controls", kind: "blerg.Controls"}, - {style: "clear: both"}, + {style: "clear: both;"}, {name: "post", kind: "blerg.Post", showing: false}, {name: "help", kind: "blerg.Help"} ]}, {name: "main", kind: "blerg.Main"}, {name: "signupDialog", kind: "blerg.SignupDialog"}, - {name: "passwdDialog", kind: "blerg.PasswdDialog"}, {name: "api", kind: "blerg.API", onLoginSuccessful: "loginSuccessful", onLoginFailed: "loginFailed", onLogoutSuccessful: "logout"} ], - urlmap: [ - ['search', /^\?post\/([^/]+)\/(.+)/, "blerg.ExternalURLPost"], - ['hash', /^#\/(ref|tag)\/([A-Za-z0-9_-]+)(?:\/p(\d+))?$/, "blerg.Tag"], - ['hash', /^#\/feed(?:\/p(\d+))?$/, "blerg.Feed"], - ['hash', /^#([A-Za-z0-9_-]+)(?:\/(p)?(\d+))?$/, "blerg.User"] - ], - pathHandlers: [ blerg.User, blerg.Tag, blerg.Welcome ], rendered: function() { this.inherited(arguments); @@ -42,10 +41,10 @@ enyo.kind({ document.body.addEventListener('keyup', function(event) { if (event.shiftKey && event.keyCode == 32) { - this.$.post.show(); + this.waterfall('onPostVisibility', {showing: true}); event.stopPropagation(); } - }, false); + }.bind(this), false); }, hashCheck: function() { if (location.hash != this.lastHash) { @@ -81,10 +80,6 @@ enyo.kind({ this.$.api.logout(); }, loginSuccessful: function(inSender, inEvent) { - this.$.api.requestFeedStatus(); - this.feedStatusUpdateInterval = setInterval(function() { - this.$.api.requestFeedStatus(); - }.bind(this), 900000); this.waterfall('onLogin', inEvent); }, loginFailed: function(inSender, inEvent) { @@ -98,5 +93,11 @@ enyo.kind({ postVisibilityUpdate: function(inSender, inEvent) { this.$.post.waterfall('onPostVisibility', inEvent); this.$.controls.waterfall('onPostVisibility', inEvent); + }, + sendReload: function() { + this.$.main.waterfall('onReload'); + }, + authFailure: function(inSender, inEvent) { + this.logout(); } });