// Config
var baseURL = '';
var recordTemplate = new Template(
- '<div class="record">#{data}<div class="info">Posted #{date}. <a href="/\##{author}/#{record}">[permalink]</a></div></div>'
+ '<div class="record">#{data}<div class="info">Posted #{date}. <a href="/\##{author}/#{record}">[permalink]</a> <a href="#" onclick="postPopup(\'@#{author}/#{record}: \'); return false">[reply]</a></div></div>'
);
var tagRecordTemplate = new Template(
- '<div class="record">#{data}<div class="info">Posted by <a class="author ref" href="/\##{author}" onclick="return qlink()">@#{author}</a> on #{date}</div></div>'
+ '<div class="record">#{data}<div class="info">Posted by <a class="author ref" href="/\##{author}" onclick="return qlink()">@#{author}</a> on #{date}. <a href="/\##{author}/#{record}">[permalink]</a> <a href="#" onclick="postPopup(\'@#{author}/#{record}: \'); return false">[reply]</a></div></div>'
);
var latestRecordsTemplate = new Template(
'<div class="record"><a class="author ref" href="/\##{author}" onclick="return qlink()">@#{author}</a> #{data}</div>'
parameters: {
username: this.username
},
- onSuccess: function(r) {
+ onComplete: function(r) {
this.loggedIn = false;
document.cookie = "auth=; expires=1-Jan-1970 00:00:00 GMT";
this.update();
}
}
+Pager.prototype.loadItems = function(from, to, continuation) { }
+
// Object to render user pages
function User(username) {
$$('[name=user.unsubscribelink]').each(Element.hide);
if (loginStatus.loggedIn) {
- new Ajax.Request(baseURL + '/feedinfo/' + username, {
+ new Ajax.Request(baseURL + '/feedinfo/' + this.username, {
method: 'post',
parameters: {
username: loginStatus.username
l = l.replace(/([^\w\\]|^)\*\*(\w[^*]*)\*\*(\W|$)/g, '$1<b>$2</b>$3');
l = l.replace(/([^\w\\]|^)\*(\w[^*]*)\*(\W|$)/g, '$1<i>$2</i>$3');
- // Remove backslashes from escaped metachars
- l = l.replace(/\\([*\[\]])/g, '$1');
-
// Turn refs and tags into links
l = l.replace(/(\s|^)#([A-Za-z0-9_-]+)/g, '$1<a href="#/tag/$2" class="ref" onclick="return qlink()">#$2</a>');
- l = l.replace(/(\s|^)@([A-Za-z0-9_-]+)/g, '$1<a href="#$2" class="ref" onclick="return qlink()">@$2</a>');
+ l = l.replace(/(\s|^)@([A-Za-z0-9_-]+)(\/\d+)?/g, '$1<a href="#$2$3" class="ref" onclick="return qlink()">@$2</a>');
// Create lists when lines begin with *
if (l[0] == '*') {
}
}
+ // Remove backslashes from escaped metachars
+ l = l.replace(/\\([*\[\]@#])/g, '$1');
+
out.push(l);
if (endpush) {
out.push(endpush);
}
-function postPopup() {
- if (loginStatus.loggedIn) {
+function postPopup(initial) {
+ if (loginStatus.loggedIn || initial) {
var post = $('post');
if (post.visible()) {
post.hide();
} else {
post.show();
- if (currentPager.username && currentPager.username != loginStatus.username && !$('post.content').value) {
+ if (initial) {
+ $('post.content').value = initial;
+ } else if (!$('post.content').value && currentPager.username && currentPager.username != loginStatus.username) {
$('post.content').value = '@' + currentPager.username + ': ';
}
$('post.content').focus();
if (m[3]) {
var r = parseInt(m[3]);
currentPager.showPageAt(r);
+ } else {
+ currentPager.showPageAt(currentPager.itemCount - 1);
}
} else if (m = location.hash.match(/^#\/feed(?:\/p(\d+))?$/)) {
if (loginStatus.loggedIn) {
if (m[3]) {
var r = parseInt(m[3]);
currentPager.showPageAt(r);
+ } else {
+ currentPager.showPageAt(currentPager.itemCount - 1);
}
} else {
location.href = baseURL;