fixed initial mentions

This commit is contained in:
jeena 2013-07-22 07:02:26 +02:00
parent 0eeffcf7f6
commit ec43a38b86
4 changed files with 33 additions and 33 deletions

View file

@ -10,7 +10,6 @@ function(HostApp, Timeline, URI, APICalls, Core) {
function Mentions() {
return // FIXME
this.is_not_init = false;
this.unread_mentions = 0;
@ -37,7 +36,7 @@ function(HostApp, Timeline, URI, APICalls, Core) {
Mentions.prototype.newStatus = function(statuses, append) {
Timeline.prototype.newStatus.call(this, statuses, append);
/*
if(this.is_not_init) {
for (var i = 0; i < statuses.length; i++) {
@ -52,7 +51,7 @@ function(HostApp, Timeline, URI, APICalls, Core) {
if(!append) HostApp.notificateUserAboutMention(status.content.text, name || status.entity, status.id, status.entity);
}
}
*/
this.is_not_init = true;
}
@ -60,13 +59,13 @@ function(HostApp, Timeline, URI, APICalls, Core) {
add_to_search = add_to_search || {};
if (!add_to_search["mentioned_entity"]) {
add_to_search["mentioned_entity"] = HostApp.stringForKey("entity");
if (!add_to_search["mentions"]) {
add_to_search["mentions"] = HostApp.stringForKey("entity");
}
Timeline.prototype.getNewData.call(this, add_to_search, append);
this.getLatestMentionRead();
//this.getLatestMentionRead();
}
Mentions.prototype.mentionRead = function(id, entity) {

View file

@ -114,7 +114,6 @@ function(HostApp, APICalls) {
}
}
}});
}
Sidebar.prototype.removeEntityAvatar = function() {

View file

@ -32,7 +32,7 @@ function(jQuery, HostApp, Hmac, Cache) {
var content_type = null;
if(options.http_method == "POST" && !options.content_type) {
if((options.http_method == "POST" || options.http_method == "PUT") && !options.content_type) {
console.error("No content type for " + options.url);
return;
} else if(options.content_type != "AAA") {
@ -136,6 +136,20 @@ function(jQuery, HostApp, Hmac, Cache) {
APICalls.http_call(settings);
}
APICalls.put = function(url, data, options) {
var settings = {
url: url,
http_method: "PUT",
data: data
};
for (var key in options) {
settings[key] = options[key];
}
APICalls.http_call(settings);
}
APICalls.postMultipart = function(url, callback, data, boundary, accepts) {

View file

@ -3,16 +3,16 @@ define([
"helper/APICalls",
"lib/URI",
"helper/HostApp",
"helper/Cache",
"lib/Showdown",
"lib/Timeago",
"lib/SingleDoubleClick"
],
function(jQuery, APICalls, URI, HostApp, Cache) {
function(jQuery, APICalls, URI, HostApp, Showdown) {
function Core() {
this.cache = new Cache();
this.saveScrollTop = 0;
this.markdown = new Showdown.converter();
}
@ -279,6 +279,7 @@ function(jQuery, APICalls, URI, HostApp, Cache) {
template.message.innerHTML = this.replaceURLWithHTMLLinks(text, entities, template.message);
this.afterChangingTextinMessageHTML(template.message)
/*
if (status.type == "https://tent.io/types/post/photo/v0.1.0") {
for (var i = 0; i < status.attachments.length; i++) {
@ -306,7 +307,7 @@ function(jQuery, APICalls, URI, HostApp, Cache) {
})();
}
}
*/
this.findMentions(template.message, status.mentions);
/*
@ -667,27 +668,14 @@ function(jQuery, APICalls, URI, HostApp, Cache) {
}
Core.prototype.replaceURLWithHTMLLinks = function(text, entities, message_node) {
var callback = function(url) {
var result;
if (entities && entities.some(function(x) { return x == url })) {
result = url;
} else {
result = url;
if (url.startsWith("http://") || url.startsWith("https://")) {
result = '<a href="' + url + '">' + url + '</a>';
}
}
return result;
}
var hash = /(^|\s)(#)(\w+)/ig;
return URI.withinString(text, callback).replace(hash, "$1<a class='hash' href='https://skate.io/search?q=%23$3'>$2$3</a>");
// FIXME: this has to be done better so one can nest that stuff and escape with \
return text.replace(/_([^_]+)_/g, "<em>$1</em> ")
.replace(/\*([^\*]+)\*/g, "<strong>$1</strong> ")
.replace(/`([^`]+)`/g, "<code>$1</code> ")
.replace(/~([^~]+)~/g, "<del>$1</del> ")
.replace(/\#[^\s]+/, "<a href='javascript:controller.search(\'$1\')'>#$1</a>")
.replace(/[^\^]\[([^\]]+)\]\(([^\)]+)\)/g, "<a href='$2'>$1</a> ")
.replace(/\^\[([^\]]+)\]\(([^\)]+)\)/g, "<a class='name' href='javascript:controller.showEntity(this, $2);'>$1</a> ");
}
Core.prototype.parseForMedia = function(text, images) {