fixed problem with reply button

This commit is contained in:
Jeena Paradies 2012-11-07 19:44:41 +01:00
parent d99ff86520
commit 8e4d54f68b
5 changed files with 30 additions and 9 deletions

4
.gitignore vendored
View file

@ -1,3 +1,3 @@
build/
Tentia.xcodeproj/project.xcworkspace/xcuserdata/jeena.xcuserdatad/UserInterfaceState.xcuserstate
Mac/build/
Mac/Tentia.xcodeproj/project.xcworkspace/xcuserdata/jeena.xcuserdatad/UserInterfaceState.xcuserstate
dsa_priv.pem

View file

@ -9,10 +9,12 @@ function(HostApp, Timeline) {
function Mentions() {
this.is_not_init = false;
this.action = "mentions";
this.unread_mentions = 0;
Timeline.call(this);
this.action = "mentions";
this.body.className = this.action;
}
Mentions.prototype = Object.create(Timeline.prototype);
@ -21,16 +23,16 @@ function(HostApp, Timeline) {
Timeline.prototype.newStatus.call(this, status);
if(this.action == "mentions" && this.is_not_init) {
if(this.is_not_init) {
this.unread_mentions += status.length;
HostApp.unreadMentions(this.unread_mentions);
}
this.is_not_init = true;
}
Mentions.prototype.getNewData = function(add_to_search) {
add_to_search = add_to_search || {};
if (!add_to_search["mentioned_entity"]) {

View file

@ -2,10 +2,11 @@ define([
"jquery",
"helper/Paths",
"lib/URI",
"helper/HostApp",
"lib/vendor/jquery.plugins"
],
function(jQuery, Paths, URI) {
function(jQuery, Paths, URI, HostApp) {
function Core() {
@ -122,13 +123,15 @@ function(jQuery, Paths, URI) {
template.reply_to.onclick = function() {
var mentions = [];
for (var i = 0; i < status.mentions.length; i++) {
var mention = status.mentions[i];
if(mention.entity != HostApp.stringForKey("entity"))
mentions.push(mention);
}
this.replyTo(status.entity, status.id, mentions);
_this.replyTo(status.entity, status.id, mentions);
return false;
}
@ -344,13 +347,14 @@ function(jQuery, Paths, URI) {
return text.replace(hash, "$1$2<a href='http://search.twitter.com/search?q=%23$3'>$3</a>");
}
Core.prototype.replyTo = function(entity, status_id, mentions) {
Core.prototype.replyTo = function(entity, status_id, mentions) {
var string = "^" + entity.replace("https://", "") + " ";
for (var i = 0; i < mentions.length; i++) {
var e = mentions[i].entity.replace("https://", "");
if(string.indexOf(e) == -1) string += "^" + e + " ";
}
controller.openNewMessageWindowInReplyTo_statusId_withString_(entity, status_id, string);
debug("a")
HostApp.openNewMessageWidow(entity, status_id, string);
}
return Core;

View file

@ -3,6 +3,7 @@ define(function() {
var HostApp = {};
HostApp.setStringForKey = function(string, key) {
if (OS_TYPE == "mac") {
controller.setString_forKey_(string, key);
} else {
@ -11,6 +12,7 @@ define(function() {
}
HostApp.stringForKey = function(key) {
if (OS_TYPE == "mac") {
return controller.stringForKey_(key);
} else {
@ -19,6 +21,7 @@ define(function() {
}
HostApp.openURL = function(url) {
if (OS_TYPE == "mac") {
controller.openURL_(url);
} else {
@ -27,10 +30,12 @@ define(function() {
}
HostApp.loggedIn = function() {
controller.loggedIn();
}
HostApp.logout = function() {
if (OS_TYPE == "mac") {
controller.logout_(self);
} else {
@ -39,6 +44,7 @@ define(function() {
}
HostApp.unreadMentions = function(i) {
if (OS_TYPE == "mac") {
controller.unreadMentions_(i);
} else {
@ -46,6 +52,15 @@ define(function() {
}
}
HostApp.openNewMessageWidow = function(entity, status_id, string) {
if (OS_TYPE == "mac") {
controller.openNewMessageWindowInReplyTo_statusId_withString_(entity, status_id, string);
} else {
controller.openNewMessageWindowInReplyTostatusIdwithString(entity, status_id, string);
}
}
return HostApp;
});