4 listKind: "blerg.Record",
6 onLogin: "getStalkStatus",
7 onLogout: "getStalkStatus"
15 {classes: "blerg-user-controls", components: [
16 {name: "chatterLink", kind: "blerg.Link", content: "[chatter]"},
17 {name: "stalkLink", kind: "blerg.Link", content: "[stalk]", showing: false, onclick: "startStalking"},
18 {name: "unstalkLink", kind: "blerg.Link", content: "[stop stalking]", showing: false, onclick: "stopStalking"},
19 {name: "rssLink", kind: "blerg.Link", components: [
20 {noDom: true, content: "["},
21 {kind: "Image", src: "/images/rss.png", attributes: {width: 16, height: 16}},
22 {noDom: true, content: "RSS]"}
26 {name: "loadMoreButton", kind: "onyx.Button", onclick: "loadMore", content: "Load More"},
27 {name: "api", kind: "blerg.API",
28 onItemsLoaded: "itemsLoaded"}
31 locationDetect: function(l) {
32 var m = l.hash.match(/^#([A-Za-z0-9_-]+)(?:\/(\d+))?$/);
37 permalink: m[2] != undefined,
38 record: parseInt(m[2])
44 this.inherited(arguments);
45 this.usernameChanged();
47 usernameChanged: function() {
48 this.bubble('onSetTitle', {section: '@' + this.username});
49 this.$.records.destroyComponents();
50 this.lastRecord = null;
51 this.$.loadMoreButton.hide();
52 this.$.chatterLink.setHref('/#/ref/' + this.username);
53 this.$.rssLink.setHref('/rss/' + this.username);
54 this.getStalkStatus();
57 this.loadItems(this.record, this.record);
62 loadItems: function(from, to) {
63 this.inherited(arguments);
64 this.$.api.loadUserRecords(this.username, from, to);
66 itemsLoaded: function(inSender, inEvent) {
68 this.$.loadMoreButton.hide();
70 this.$.loadMoreButton.show();
73 for (var i = 0; i < inEvent.entries.length; i++) {
74 inEvent.entries[i].author = this.username;
77 this.addItems(inEvent.entries);
79 getStalkStatus: function() {
80 if (!blerg.API.loggedIn) {
81 this.$.stalkLink.hide();
82 this.$.unstalkLink.hide();
85 // Make an API call to determine status