From 51121cd67db2faf393862fd50a0807342a5395da Mon Sep 17 00:00:00 2001 From: Chip Black Date: Thu, 3 Mar 2011 02:10:46 -0800 Subject: [PATCH] Fix reload between permalink and user page --- www/js/blerg.js | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/www/js/blerg.js b/www/js/blerg.js index d227a7a..f5ef431 100644 --- a/www/js/blerg.js +++ b/www/js/blerg.js @@ -215,6 +215,24 @@ function User(username) { this.initPager(); this.username = username; this.baseFrag = username; +} +User.prototype = new Pager(); +User.prototype.constructor = User; + +User.prototype.show = function() { + $$('[name=section]').each(function(v) { v.update(' @' + this.username) }.bind(this)); + $('welcome').hide(); + items.show(); + $('rss').show(); + $('rsslink').href = '/rss/' + this.username; + $$('[name=user.reflink]').each(function(e) { + e.href = '/#/ref/' + this.username; + }.bind(this)); + $('usercontrols').show(); +} + +User.prototype.reload = function() { + this.pageStart = null; $$('[name=user.subscribelink]').each(Element.hide); $$('[name=user.unsubscribelink]').each(Element.hide); @@ -238,7 +256,7 @@ function User(username) { }); } - new Ajax.Request(baseURL + '/info/' + username, { + new Ajax.Request(baseURL + '/info/' + this.username, { method: 'get', onSuccess: function(r) { var j = r.responseText.evalJSON(); @@ -250,20 +268,6 @@ function User(username) { }.bind(this) }); } -User.prototype = new Pager(); -User.prototype.constructor = User; - -User.prototype.show = function() { - $$('[name=section]').each(function(v) { v.update(' @' + this.username) }.bind(this)); - $('welcome').hide(); - items.show(); - $('rss').show(); - $('rsslink').href = '/rss/' + this.username; - $$('[name=user.reflink]').each(function(e) { - e.href = '/#/ref/' + this.username; - }.bind(this)); - $('usercontrols').show(); -} User.prototype.loadItems = function(from, to, continuation) { var url; @@ -740,8 +744,9 @@ function hashSwitch() { } else { currentPager.showRecord(r); } + } else { + currentPager.reload(); } - // Do nothing otherwise, the User constructor takes care of it } else { $$('[name=section]').each(function(v) { v.update('Welcome') }); $('signup').hide(); -- 2.34.1