diff --git a/WebKit/scripts/controller/NewPost.js b/WebKit/scripts/controller/NewPost.js index 63144ff..61b2f3a 100644 --- a/WebKit/scripts/controller/NewPost.js +++ b/WebKit/scripts/controller/NewPost.js @@ -277,28 +277,31 @@ function(APICalls, HostApp) { }; var mentions = []; - if (this.status) { - mentions.push({ - entity: this.status.entity, - post: this.status.id, - type: this.status.type - }); - } - for (var i = 0; i < this.mentions.length; i++) { var mention = this.mentions[i]; - mentions.push({ - entity: mention.entity - }); + if(this.status && this.status.entity == mention.entity) { + mentions.push({ + entity: this.status.entity, + post: this.status.id, + type: this.status.type + }); + } else { + mentions.push({ + entity: mention.entity + }); + } } data.mentions = mentions; + debug(data.mentions) + // Make tent flavored markdown mentions for (var i = 0; i < this.mentions.length; i++) { var mention = this.mentions[i]; data.content.text = this.replaceAll(data.content.text, mention.name, "^[" + mention.name + "](" + i + ")") } + debug(data.content.text) APICalls.post(HostApp.serverUrl("new_post"), JSON.stringify(data), { content_type: data.type, diff --git a/WebKit/scripts/controller/Profile.js b/WebKit/scripts/controller/Profile.js index f36e915..98b21bd 100644 --- a/WebKit/scripts/controller/Profile.js +++ b/WebKit/scripts/controller/Profile.js @@ -23,8 +23,8 @@ function(HostApp, Core, APICalls, URI) { this.initProfileTemplate(); this.hide(); - var _this = this; - setTimeout(function() { _this.showProfileForEntity() }, 500); // Load users profile on start + //var _this = this; + //setTimeout(function() { _this.showProfileForEntity() }, 500); // Load users profile on start } Profile.prototype = Object.create(Core.prototype); @@ -47,13 +47,19 @@ function(HostApp, Core, APICalls, URI) { $(this.followingsBody).hide(); $(this.followersBody).hide(); $(list).show(); + } + + Profile.prototype.showEntity = function(a, i) { + var entity = $(a).closest("li").get(0).status.mentions[i].entity; + this.showProfileForEntity(entity); + bungloo.sidebar.onEntityProfile(); }; Profile.prototype.showProfileForEntity = function(entity) { if (!entity) { entity = HostApp.stringForKey("entity"); - }; + } this.clear(); this.entity = entity; @@ -249,7 +255,6 @@ function(HostApp, Core, APICalls, URI) { APICalls.get(url, {callback: function(resp) { var json = JSON.parse(resp.responseText); - debug(json) var count = json.posts.length; if (count > 0) { diff --git a/WebKit/scripts/controller/Timeline.js b/WebKit/scripts/controller/Timeline.js index 78998b4..3f0bf11 100644 --- a/WebKit/scripts/controller/Timeline.js +++ b/WebKit/scripts/controller/Timeline.js @@ -14,7 +14,7 @@ function(Core, APICalls, HostApp, URI) { this.action = "timeline"; this.reload_blocked = false; - this.posts_limit = 4; + this.posts_limit = 25; this.max_length = 200; this.timeout = 10 * 1000; // every 10 seconds this.since_id = null; diff --git a/WebKit/scripts/helper/Core.js b/WebKit/scripts/helper/Core.js index 58f54df..a003ae1 100644 --- a/WebKit/scripts/helper/Core.js +++ b/WebKit/scripts/helper/Core.js @@ -3,16 +3,14 @@ define([ "helper/APICalls", "lib/URI", "helper/HostApp", - "lib/Showdown", "lib/Timeago", "lib/SingleDoubleClick" ], -function(jQuery, APICalls, URI, HostApp, Showdown) { +function(jQuery, APICalls, URI, HostApp) { function Core() { this.saveScrollTop = 0; - this.markdown = new Showdown.converter(); } @@ -669,13 +667,13 @@ function(jQuery, APICalls, URI, HostApp, Showdown) { Core.prototype.replaceURLWithHTMLLinks = function(text, entities, message_node) { // FIXME: this has to be done better so one can nest that stuff and escape with \ - return text.replace(/_([^_]+)_/g, "$1 ") - .replace(/\*([^\*]+)\*/g, "$1 ") - .replace(/`([^`]+)`/g, "$1 ") - .replace(/~([^~]+)~/g, "$1 ") - .replace(/\#[^\s]+/, "#$1") - .replace(/[^\^]\[([^\]]+)\]\(([^\)]+)\)/g, "$1 ") - .replace(/\^\[([^\]]+)\]\(([^\)]+)\)/g, "$1 "); + return text.replace(/_([^_]+)_/g, "$1") + .replace(/\*([^\*]+)\*/g, "$1") + .replace(/`([^`]+)`/g, "$1") + .replace(/~([^~]+)~/g, "$1") + .replace(/\#([^\s]+)/g, "#$1") + .replace(/(^|[^\^])\[([^\]]+)\]\(([^\)]+)\)/g, "$2") + .replace(/\^\[([^\]]+)\]\(([^\)]+)\)/g, "$1"); } Core.prototype.parseForMedia = function(text, images) { @@ -849,17 +847,19 @@ function(jQuery, APICalls, URI, HostApp, Showdown) { Core.prototype.afterChangingTextinMessageHTML = function(message_node) { // adding show search on click hash + /* $(message_node).find("a.hash").click(function(e) { if(bungloo.search) bungloo.search.searchFor(e.target.innerHTML); return false; }); - + */ // adding show profile on click + /* $(message_node).find("a.name").click(function(e) { HostApp.showProfileForEntity(e.target.title); return false; - }); + });*/ }