--- /dev/null
+enyo.kind({
+ name: "blerg.User",
+ kind: "blerg.Pager",
+ listKind: "blerg.Record",
+ published: {
+ username: "",
+ permalink: false,
+ firstRecord: null,
+ },
+ statics: {
+ locationDetect: function(l) {
+ var m = l.hash.match(/^#([A-Za-z0-9_-]+)(?:\/(p)?(\d+))?$/);
+ if (m) {
+ return {
+ kind: "blerg.User",
+ username: m[1],
+ permalink: m[2] != 'p',
+ firstRecord: parseInt(m[3])
+ };
+ }
+ }
+ },
+ create: function() {
+ this.inherited(arguments);
+ this.usernameChanged();
+ },
+ usernameChanged: function() {
+ this.bubble('onSetTitle', {section: '@' + this.username});
+ this.$.records.destroyComponents();
+ this.lastRecord = null;
+ this.loadMore();
+ },
+ loadItems: function(from, to) {
+ this.inherited(arguments);
+
+ var url;
+ if (from != undefined && to != undefined) {
+ url = baseURL + '/get/' + this.username + '/' + from + '-' + to;
+ } else {
+ url = baseURL + '/get/' + this.username;
+ }
+
+ var req = new enyo.Ajax({
+ url: url
+ });
+ req.response(function(inSender, inResponse) {
+ for (var i = 0; i < inResponse.length; i++) {
+ inResponse[i].author = this.username;
+ }
+ this.addItems(inResponse);
+ }.bind(this));
+ req.go();
+ }
+});