5 pathHandlers: [ blerg.User, blerg.Tag, blerg.Feed, blerg.ExternalURLPost, blerg.Welcome ],
7 onStartSignup: "showSignupDialog",
8 onTryLogin: "tryLogin",
9 onTryLogout: "tryLogout",
10 onSetTitle: "setTitle",
11 onPostVisibility: "postVisibilityUpdate"
14 {classes: "blerg-header", components: [
15 {name: "title", kind: "blerg.Title"},
16 {name: "controls", kind: "blerg.Controls"},
17 {style: "clear: both"},
18 {name: "post", kind: "blerg.Post", showing: false},
19 {name: "help", kind: "blerg.Help"}
21 {name: "main", kind: "blerg.Main"},
22 {name: "signupDialog", kind: "blerg.SignupDialog"},
23 {name: "passwdDialog", kind: "blerg.PasswdDialog"},
24 {name: "api", kind: "blerg.API",
25 onLoginSuccessful: "loginSuccessful",
26 onLoginFailed: "loginFailed",
27 onLogoutSuccessful: "logout"}
29 rendered: function() {
30 this.inherited(arguments);
32 this.lastHash = location.hash;
35 setInterval(this.hashCheck.bind(this), 250);
37 document.body.addEventListener('keyup', function(event) {
38 if (event.shiftKey && event.keyCode == 32) {
40 event.stopPropagation();
44 hashCheck: function() {
45 if (location.hash != this.lastHash) {
46 this.lastHash = location.hash;
50 urlSwitch: function() {
54 for (var i = 0; i < this.pathHandlers.length; i++) {
55 var handler = this.pathHandlers[i];
56 objdef = handler.locationDetect(window.location);
61 objdef = {classes: "blerg-error", content: "No handler found"}
63 this.$.main.updateView(objdef);
65 showSignupDialog: function() {
66 this.$.signupDialog.show();
68 setTitle: function(inSender, inEvent) {
69 this.$.title.waterfall('onSetTitle', inEvent);
71 tryLogin: function(inSender, inEvent) {
72 this.$.api.login(inEvent.username, inEvent.password);
74 tryLogout: function(inSender, inEvent) {
77 loginSuccessful: function(inSender, inEvent) {
78 this.waterfall('onLogin', inEvent);
80 loginFailed: function(inSender, inEvent) {
81 alert('Login failed');
84 logout: function(inSender, inEvent) {
85 clearInterval(this.feedStatusUpdateInterval);
86 this.waterfall('onLogout');
88 postVisibilityUpdate: function(inSender, inEvent) {
89 this.$.post.waterfall('onPostVisibility', inEvent);
90 this.$.controls.waterfall('onPostVisibility', inEvent);