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/ Mac/build/
Tentia.xcodeproj/project.xcworkspace/xcuserdata/jeena.xcuserdatad/UserInterfaceState.xcuserstate Mac/Tentia.xcodeproj/project.xcworkspace/xcuserdata/jeena.xcuserdatad/UserInterfaceState.xcuserstate
dsa_priv.pem dsa_priv.pem

View file

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

View file

@ -2,10 +2,11 @@ define([
"jquery", "jquery",
"helper/Paths", "helper/Paths",
"lib/URI", "lib/URI",
"helper/HostApp",
"lib/vendor/jquery.plugins" "lib/vendor/jquery.plugins"
], ],
function(jQuery, Paths, URI) { function(jQuery, Paths, URI, HostApp) {
function Core() { function Core() {
@ -122,13 +123,15 @@ function(jQuery, Paths, URI) {
template.reply_to.onclick = function() { template.reply_to.onclick = function() {
var mentions = []; var mentions = [];
for (var i = 0; i < status.mentions.length; i++) { for (var i = 0; i < status.mentions.length; i++) {
var mention = status.mentions[i]; var mention = status.mentions[i];
if(mention.entity != HostApp.stringForKey("entity")) if(mention.entity != HostApp.stringForKey("entity"))
mentions.push(mention); mentions.push(mention);
} }
this.replyTo(status.entity, status.id, mentions);
_this.replyTo(status.entity, status.id, mentions);
return false; 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>"); 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://", "") + " "; var string = "^" + entity.replace("https://", "") + " ";
for (var i = 0; i < mentions.length; i++) { for (var i = 0; i < mentions.length; i++) {
var e = mentions[i].entity.replace("https://", ""); var e = mentions[i].entity.replace("https://", "");
if(string.indexOf(e) == -1) string += "^" + e + " "; 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; return Core;

View file

@ -3,6 +3,7 @@ define(function() {
var HostApp = {}; var HostApp = {};
HostApp.setStringForKey = function(string, key) { HostApp.setStringForKey = function(string, key) {
if (OS_TYPE == "mac") { if (OS_TYPE == "mac") {
controller.setString_forKey_(string, key); controller.setString_forKey_(string, key);
} else { } else {
@ -11,6 +12,7 @@ define(function() {
} }
HostApp.stringForKey = function(key) { HostApp.stringForKey = function(key) {
if (OS_TYPE == "mac") { if (OS_TYPE == "mac") {
return controller.stringForKey_(key); return controller.stringForKey_(key);
} else { } else {
@ -19,6 +21,7 @@ define(function() {
} }
HostApp.openURL = function(url) { HostApp.openURL = function(url) {
if (OS_TYPE == "mac") { if (OS_TYPE == "mac") {
controller.openURL_(url); controller.openURL_(url);
} else { } else {
@ -27,10 +30,12 @@ define(function() {
} }
HostApp.loggedIn = function() { HostApp.loggedIn = function() {
controller.loggedIn(); controller.loggedIn();
} }
HostApp.logout = function() { HostApp.logout = function() {
if (OS_TYPE == "mac") { if (OS_TYPE == "mac") {
controller.logout_(self); controller.logout_(self);
} else { } else {
@ -39,6 +44,7 @@ define(function() {
} }
HostApp.unreadMentions = function(i) { HostApp.unreadMentions = function(i) {
if (OS_TYPE == "mac") { if (OS_TYPE == "mac") {
controller.unreadMentions_(i); controller.unreadMentions_(i);
} else { } 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; return HostApp;
}); });