X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;ds=sidebyside;f=www%2Fjs%2Fblerg.js;h=dcb56790742476335121b8810d7f304d07d3bce0;hb=bea3e3c083a638dfd2e0e8b95e10731a34b0fe4f;hp=d6081eb7859e4ed8f42e31b8b8dbf880a0451e0b;hpb=bddb3452818c4bb33195452f75c5667c207474a2;p=blerg.git
diff --git a/www/js/blerg.js b/www/js/blerg.js
index d6081eb..dcb5679 100644
--- a/www/js/blerg.js
+++ b/www/js/blerg.js
@@ -39,7 +39,7 @@ LoginStatus.prototype.login = function(username, password) {
new Ajax.Request(baseURL + '/login', {
parameters: {
username: username,
- password: password,
+ password: password
},
onSuccess: function(r) {
var j = r.responseText.evalJSON();
@@ -64,13 +64,13 @@ LoginStatus.prototype.login = function(username, password) {
LoginStatus.prototype.logout = function() {
new Ajax.Request(baseURL + '/logout', {
parameters: {
- username: this.username,
+ username: this.username
},
onSuccess: function(r) {
this.loggedIn = false;
document.cookie = "auth=; expires=1-Jan-1970 00:00:00 GMT";
this.update();
- }.bind(this),
+ }.bind(this)
});
document.cookie = "username=; expires=1-Jan-1970 00:00:00 GMT";
}
@@ -104,7 +104,7 @@ LoginStatus.prototype.post = function(msg) {
if (j && j.status == 'success') {
$('post.content').value = '';
if (location.hash != '#' + this.username) {
- location.hash = this.username;
+ location.href = '/#' + this.username;
hashSwitch();
} else {
currentPager.itemCount++;
@@ -192,7 +192,7 @@ function User(username) {
this.itemCount = parseInt(j.record_count);
this.displayItems();
}
- }.bind(this),
+ }.bind(this)
});
}
User.prototype = new Pager();
@@ -247,10 +247,14 @@ function mangleRecord(record, template) {
record.data = record.data.replace('&', '&').replace('<', '<').replace('>', '>');
// Turn HTTP URLs into links
- record.data = record.data.replace(/(\s|^)(https?:\/\/[a-zA-Z0-9.-]*[a-zA-Z0-9](\/(\S*[^.!,;?()\s])?)?)/g, '$1$2');
+ record.data = record.data.replace(/(\s|^)(https?:\/\/[a-zA-Z0-9.-]*[a-zA-Z0-9](\/([^\s"]*[^.!,;?()\s])?)?)/g, '$1$2');
// Turn markdown links into links
- record.data = record.data.replace(/(\s|^)\[([^\]]+)\]\((https?:\/\/[a-zA-Z0-9.-]*[a-zA-Z0-9](\/[^)]*?)?)\)/, '$1$2');
+ record.data = record.data.replace(/(\s|^)\[([^\]]+)\]\((https?:\/\/[a-zA-Z0-9.-]*[a-zA-Z0-9](\/[^)"]*?)?)\)/, '$1$2');
+
+ // Turn *foo* into italics and **foo** into bold
+ record.data = record.data.replace(/(\s)\*\*([^*]+)\*\*(\s)/, '$1$2$3');
+ record.data = record.data.replace(/(\s)\*([^*]+)\*(\s)/, '$1$2$3');
// Turn refs and tags into links
record.data = record.data.replace(/(\s|^)#(\w+)/g, '$1#$2');
@@ -349,11 +353,11 @@ function signup() {
new Ajax.Request(baseURL + '/create', {
parameters: {
username: username,
- password: password,
+ password: password
},
onSuccess: function(r) {
$('signup').hide();
- location.hash = username;
+ location.href = '/#' + username;
hashSwitch();
loginStatus.login(username, password);
@@ -459,4 +463,7 @@ function init() {
event.stop();
}
});
+ $('post.content').addEventListener('keyup', function(event) {
+ event.stopPropagation();
+ }, true);
}