fixed mentions
This commit is contained in:
parent
2b925dec34
commit
0d39948c7e
9 changed files with 357 additions and 23 deletions
|
@ -40,7 +40,7 @@
|
||||||
- (void)authentificationSucceded:(id)sender;
|
- (void)authentificationSucceded:(id)sender;
|
||||||
- (void)initWebViews;
|
- (void)initWebViews;
|
||||||
- (void)initHotKeys;
|
- (void)initHotKeys;
|
||||||
- (void)openNewMessageWindowInReplyTo:(NSString *)userName statusId:(NSString *)statusId;
|
- (void)openNewMessageWindowInReplyTo:(NSString *)userName statusId:(NSString *)statusId withString:(NSString *)string;
|
||||||
- (NSString *)pluginURL;
|
- (NSString *)pluginURL;
|
||||||
- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent;
|
- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent;
|
||||||
- (void)unreadMentions:(NSInteger)count;
|
- (void)unreadMentions:(NSInteger)count;
|
||||||
|
|
|
@ -175,10 +175,10 @@
|
||||||
[[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:nil];
|
[[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)openNewMessageWindowInReplyTo:(NSString *)userName statusId:(NSString *)statusId {
|
- (void)openNewMessageWindowInReplyTo:(NSString *)userName statusId:(NSString *)statusId withString:(NSString *)string {
|
||||||
[NSApp activateIgnoringOtherApps:YES];
|
[NSApp activateIgnoringOtherApps:YES];
|
||||||
NewMessageWindow *newTweet = (NewMessageWindow *)[[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:nil];
|
NewMessageWindow *newTweet = (NewMessageWindow *)[[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:nil];
|
||||||
[newTweet inReplyTo:userName statusId:statusId];
|
[newTweet inReplyTo:userName statusId:statusId withString:string];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)openNewMessageWindowWithString:(NSString *)aString {
|
- (void)openNewMessageWindowWithString:(NSString *)aString {
|
||||||
|
@ -202,7 +202,10 @@
|
||||||
|
|
||||||
- (IBAction)sendTweet:(id)sender {
|
- (IBAction)sendTweet:(id)sender {
|
||||||
TweetModel *tweet = (TweetModel *)[sender object];
|
TweetModel *tweet = (TweetModel *)[sender object];
|
||||||
NSString *func = [NSString stringWithFormat:@"tentia_instance.sendNewMessage(\"%@\", \"%@\")", [tweet.text stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""], tweet.inReplyTostatusId];
|
NSString *func = [NSString stringWithFormat:@"tentia_instance.sendNewMessage(\"%@\", \"%@\", \"%@\")",
|
||||||
|
[tweet.text stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""],
|
||||||
|
tweet.inReplyTostatusId,
|
||||||
|
tweet.inReplyToEntity];
|
||||||
[timelineView stringByEvaluatingJavaScriptFromString:func];
|
[timelineView stringByEvaluatingJavaScriptFromString:func];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
72
Core.js
72
Core.js
|
@ -73,7 +73,16 @@ Core.prototype.getItem = function(status) {
|
||||||
|
|
||||||
var template = this.getTemplate();
|
var template = this.getTemplate();
|
||||||
|
|
||||||
template.reply_to.onclick = function() { replyTo(status.entity, status.id); return false; }
|
template.reply_to.onclick = function() {
|
||||||
|
var mentions = [];
|
||||||
|
for (var i = 0; i < status.mentions.length; i++) {
|
||||||
|
var mention = status.mentions[i];
|
||||||
|
if(mention.entity != controller.stringForKey_("entity"))
|
||||||
|
mentions.push(mention);
|
||||||
|
};
|
||||||
|
replyTo(status.entity, status.id, mentions);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
//template.retweet.onclick = function() { template.retweet.className = "hidden"; _this.retweet(status.id_str, template.item); return false; }
|
//template.retweet.onclick = function() { template.retweet.className = "hidden"; _this.retweet(status.id_str, template.item); return false; }
|
||||||
|
|
||||||
//template.image.src = status.user.profile_image_url;
|
//template.image.src = status.user.profile_image_url;
|
||||||
|
@ -87,7 +96,10 @@ Core.prototype.getItem = function(status) {
|
||||||
var basic = profile["https://tent.io/types/info/basic/v0.1.0"];
|
var basic = profile["https://tent.io/types/info/basic/v0.1.0"];
|
||||||
|
|
||||||
if (profile && basic) {
|
if (profile && basic) {
|
||||||
if(basic.name) template.username.innerText = basic.name;
|
if(basic.name) {
|
||||||
|
template.username.title = template.username.innerText;
|
||||||
|
template.username.innerText = basic.name;
|
||||||
|
}
|
||||||
if(basic.avatar_url) template.image.src = basic.avatar_url;
|
if(basic.avatar_url) template.image.src = basic.avatar_url;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -113,7 +125,7 @@ Core.prototype.getItem = function(status) {
|
||||||
else */template.in_reply.parentNode.className = "hidden";
|
else */template.in_reply.parentNode.className = "hidden";
|
||||||
//template.in_reply.href = WEBSITE_PATH + status.in_reply_to_screen_name + "/status/" + status.in_reply_to_status_id_str;
|
//template.in_reply.href = WEBSITE_PATH + status.in_reply_to_screen_name + "/status/" + status.in_reply_to_status_id_str;
|
||||||
|
|
||||||
template.message.innerHTML = replaceTwitterLinks(replaceURLWithHTMLLinks(status.content.text, status.entities, template.message));
|
template.message.innerHTML = replaceUsernamesWithLinks(replaceURLWithHTMLLinks(status.content.text, status.entities, template.message));
|
||||||
|
|
||||||
var time = document.createElement("abbr");
|
var time = document.createElement("abbr");
|
||||||
time.innerText = ISODateString(new Date(status.published_at * 1000));
|
time.innerText = ISODateString(new Date(status.published_at * 1000));
|
||||||
|
@ -346,7 +358,7 @@ Core.prototype.getNewData = function(supress_new_with_timeout) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Core.prototype.sendNewMessage = function(content, in_reply_to_status_id) {
|
Core.prototype.sendNewMessage = function(content, in_reply_to_status_id, in_reply_to_entity) {
|
||||||
|
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
|
@ -355,7 +367,7 @@ Core.prototype.sendNewMessage = function(content, in_reply_to_status_id) {
|
||||||
var http_method = "POST";
|
var http_method = "POST";
|
||||||
var callback = function(data) { _this.getNewData(true); }
|
var callback = function(data) { _this.getNewData(true); }
|
||||||
|
|
||||||
var data = JSON.stringify({
|
var data = {
|
||||||
"type": "https://tent.io/types/post/status/v0.1.0",
|
"type": "https://tent.io/types/post/status/v0.1.0",
|
||||||
"published_at": (new Date().getTime() / 1000),
|
"published_at": (new Date().getTime() / 1000),
|
||||||
"permissions": {
|
"permissions": {
|
||||||
|
@ -363,14 +375,19 @@ Core.prototype.sendNewMessage = function(content, in_reply_to_status_id) {
|
||||||
},
|
},
|
||||||
"content": {
|
"content": {
|
||||||
"text": content,
|
"text": content,
|
||||||
}
|
},
|
||||||
});
|
};
|
||||||
|
|
||||||
|
var mentions = parseMentions(content, in_reply_to_status_id, in_reply_to_entity);
|
||||||
|
if (mentions.length > 0) {
|
||||||
|
data["mentions"] = mentions;
|
||||||
|
}
|
||||||
|
|
||||||
getURL(
|
getURL(
|
||||||
url.toString(),
|
url.toString(),
|
||||||
http_method,
|
http_method,
|
||||||
callback,
|
callback,
|
||||||
data,
|
JSON.stringify(data),
|
||||||
makeAuthHeader(
|
makeAuthHeader(
|
||||||
url.toString(),
|
url.toString(),
|
||||||
http_method,
|
http_method,
|
||||||
|
@ -415,6 +432,7 @@ Core.prototype.sendNewMessage = function(content, in_reply_to_status_id) {
|
||||||
}
|
}
|
||||||
});*/
|
});*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Core.prototype.retweet = function(status_id, item) {
|
Core.prototype.retweet = function(status_id, item) {
|
||||||
|
@ -531,7 +549,9 @@ Core.prototype.findUsernamesFor = function(query) {
|
||||||
/* Helper functions */
|
/* Helper functions */
|
||||||
|
|
||||||
function replaceURLWithHTMLLinks(text, entities, message_node) {
|
function replaceURLWithHTMLLinks(text, entities, message_node) {
|
||||||
if(!entities) return text;
|
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_()|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
|
||||||
|
return text.replace(exp, "<a href='$1'>$1</a>");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
var urls = entities.urls;
|
var urls = entities.urls;
|
||||||
|
|
||||||
|
@ -594,7 +614,7 @@ function replaceURLWithHTMLLinks(text, entities, message_node) {
|
||||||
return text;*/
|
return text;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
function replaceTwitterLinks(text) {
|
function replaceUsernamesWithLinks(text, mentions) {
|
||||||
return text; // FIXME!
|
return text; // FIXME!
|
||||||
var username = /(^|\s)(\^)(\w+)/ig;
|
var username = /(^|\s)(\^)(\w+)/ig;
|
||||||
var hash = /(^|\s)(#)(\w+)/ig;
|
var hash = /(^|\s)(#)(\w+)/ig;
|
||||||
|
@ -602,8 +622,12 @@ function replaceTwitterLinks(text) {
|
||||||
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>");
|
||||||
}
|
}
|
||||||
|
|
||||||
function replyTo(username, status_id) {
|
function replyTo(entity, status_id, mentions) {
|
||||||
controller.openNewMessageWindowInReplyTo_statusId_(username, status_id);
|
var string = "^" + entity + " ";
|
||||||
|
for (var i = 0; i < mentions.length; i++) {
|
||||||
|
string += "^" + mentions[i].entity + " ";
|
||||||
|
}
|
||||||
|
controller.openNewMessageWindowInReplyTo_statusId_withString_(entity, status_id, string);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadPlugin(url) {
|
function loadPlugin(url) {
|
||||||
|
@ -659,6 +683,30 @@ function replaceShortened(url, message_node) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseMentions(text, post_id, entity) {
|
||||||
|
var mentions = [];
|
||||||
|
|
||||||
|
if (post_id && entity) {
|
||||||
|
mentions.push({
|
||||||
|
post: post_id,
|
||||||
|
entity: entity
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
var res = text.match(/((\^https?):\/\/\S+)/ig);
|
||||||
|
|
||||||
|
if (res) {
|
||||||
|
for (var i = 0; i < res.length; i++) {
|
||||||
|
var e = res[i].substring(1);
|
||||||
|
if (e != entity) {
|
||||||
|
mentions.push({entity:e});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mentions;
|
||||||
|
}
|
||||||
|
|
||||||
function ISODateString(d){
|
function ISODateString(d){
|
||||||
function pad(n){return n<10 ? '0'+n : n}
|
function pad(n){return n<10 ? '0'+n : n}
|
||||||
return d.getUTCFullYear()+'-'
|
return d.getUTCFullYear()+'-'
|
||||||
|
|
|
@ -21,9 +21,15 @@
|
||||||
</object>
|
</object>
|
||||||
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
|
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<string>NSButton</string>
|
||||||
|
<string>NSButtonCell</string>
|
||||||
<string>NSCustomObject</string>
|
<string>NSCustomObject</string>
|
||||||
|
<string>NSImageCell</string>
|
||||||
|
<string>NSImageView</string>
|
||||||
<string>NSMenu</string>
|
<string>NSMenu</string>
|
||||||
<string>NSMenuItem</string>
|
<string>NSMenuItem</string>
|
||||||
|
<string>NSTextField</string>
|
||||||
|
<string>NSTextFieldCell</string>
|
||||||
<string>NSView</string>
|
<string>NSView</string>
|
||||||
<string>NSWindowTemplate</string>
|
<string>NSWindowTemplate</string>
|
||||||
<string>WebView</string>
|
<string>WebView</string>
|
||||||
|
@ -903,6 +909,168 @@
|
||||||
<string key="NSFrameAutosaveName">mentions</string>
|
<string key="NSFrameAutosaveName">mentions</string>
|
||||||
<bool key="NSWindowIsRestorable">YES</bool>
|
<bool key="NSWindowIsRestorable">YES</bool>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="NSWindowTemplate" id="842998572">
|
||||||
|
<int key="NSWindowStyleMask">15</int>
|
||||||
|
<int key="NSWindowBacking">2</int>
|
||||||
|
<string key="NSWindowRect">{{641, 502}, {480, 186}}</string>
|
||||||
|
<int key="NSWTFlags">611845120</int>
|
||||||
|
<string key="NSWindowTitle">Login</string>
|
||||||
|
<string key="NSWindowClass">NSWindow</string>
|
||||||
|
<nil key="NSViewClass"/>
|
||||||
|
<nil key="NSUserInterfaceItemIdentifier"/>
|
||||||
|
<object class="NSView" key="NSWindowView" id="503676418">
|
||||||
|
<reference key="NSNextResponder"/>
|
||||||
|
<int key="NSvFlags">256</int>
|
||||||
|
<object class="NSMutableArray" key="NSSubviews">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<object class="NSImageView" id="433812480">
|
||||||
|
<reference key="NSNextResponder" ref="503676418"/>
|
||||||
|
<int key="NSvFlags">268</int>
|
||||||
|
<object class="NSMutableSet" key="NSDragTypes">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<object class="NSArray" key="set.sortedObjects">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<string>Apple PDF pasteboard type</string>
|
||||||
|
<string>Apple PICT pasteboard type</string>
|
||||||
|
<string>Apple PNG pasteboard type</string>
|
||||||
|
<string>NSFilenamesPboardType</string>
|
||||||
|
<string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
|
||||||
|
<string>NeXT TIFF v4.0 pasteboard type</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<string key="NSFrame">{{20, 20}, {146, 146}}</string>
|
||||||
|
<reference key="NSSuperview" ref="503676418"/>
|
||||||
|
<reference key="NSWindow"/>
|
||||||
|
<reference key="NSNextKeyView" ref="215157023"/>
|
||||||
|
<bool key="NSEnabled">YES</bool>
|
||||||
|
<object class="NSImageCell" key="NSCell" id="266676500">
|
||||||
|
<int key="NSCellFlags">0</int>
|
||||||
|
<int key="NSCellFlags2">33554432</int>
|
||||||
|
<object class="NSCustomResource" key="NSContents">
|
||||||
|
<string key="NSClassName">NSImage</string>
|
||||||
|
<string key="NSResourceName">Icon</string>
|
||||||
|
</object>
|
||||||
|
<int key="NSAlign">0</int>
|
||||||
|
<int key="NSScale">0</int>
|
||||||
|
<int key="NSStyle">0</int>
|
||||||
|
<bool key="NSAnimates">YES</bool>
|
||||||
|
</object>
|
||||||
|
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||||
|
<bool key="NSEditable">YES</bool>
|
||||||
|
</object>
|
||||||
|
<object class="NSTextField" id="643973685">
|
||||||
|
<reference key="NSNextResponder" ref="503676418"/>
|
||||||
|
<int key="NSvFlags">268</int>
|
||||||
|
<string key="NSFrame">{{194, 82}, {266, 22}}</string>
|
||||||
|
<reference key="NSSuperview" ref="503676418"/>
|
||||||
|
<reference key="NSWindow"/>
|
||||||
|
<reference key="NSNextKeyView" ref="251531186"/>
|
||||||
|
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||||
|
<bool key="NSEnabled">YES</bool>
|
||||||
|
<object class="NSTextFieldCell" key="NSCell" id="2007231">
|
||||||
|
<int key="NSCellFlags">-1804599231</int>
|
||||||
|
<int key="NSCellFlags2">272630784</int>
|
||||||
|
<string key="NSContents"/>
|
||||||
|
<object class="NSFont" key="NSSupport" id="528364649">
|
||||||
|
<string key="NSName">LucidaGrande</string>
|
||||||
|
<double key="NSSize">13</double>
|
||||||
|
<int key="NSfFlags">1044</int>
|
||||||
|
</object>
|
||||||
|
<string key="NSPlaceholderString">https://someone.tent.is</string>
|
||||||
|
<string key="NSCellIdentifier">_NS:9</string>
|
||||||
|
<reference key="NSControlView" ref="643973685"/>
|
||||||
|
<bool key="NSDrawsBackground">YES</bool>
|
||||||
|
<object class="NSColor" key="NSBackgroundColor">
|
||||||
|
<int key="NSColorSpace">6</int>
|
||||||
|
<string key="NSCatalogName">System</string>
|
||||||
|
<string key="NSColorName">textBackgroundColor</string>
|
||||||
|
<object class="NSColor" key="NSColor">
|
||||||
|
<int key="NSColorSpace">3</int>
|
||||||
|
<bytes key="NSWhite">MQA</bytes>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="NSColor" key="NSTextColor">
|
||||||
|
<int key="NSColorSpace">6</int>
|
||||||
|
<string key="NSCatalogName">System</string>
|
||||||
|
<string key="NSColorName">textColor</string>
|
||||||
|
<object class="NSColor" key="NSColor" id="90908694">
|
||||||
|
<int key="NSColorSpace">3</int>
|
||||||
|
<bytes key="NSWhite">MAA</bytes>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||||
|
</object>
|
||||||
|
<object class="NSTextField" id="215157023">
|
||||||
|
<reference key="NSNextResponder" ref="503676418"/>
|
||||||
|
<int key="NSvFlags">268</int>
|
||||||
|
<string key="NSFrame">{{191, 112}, {163, 17}}</string>
|
||||||
|
<reference key="NSSuperview" ref="503676418"/>
|
||||||
|
<reference key="NSWindow"/>
|
||||||
|
<reference key="NSNextKeyView" ref="643973685"/>
|
||||||
|
<string key="NSReuseIdentifierKey">_NS:1535</string>
|
||||||
|
<bool key="NSEnabled">YES</bool>
|
||||||
|
<object class="NSTextFieldCell" key="NSCell" id="860986880">
|
||||||
|
<int key="NSCellFlags">68157504</int>
|
||||||
|
<int key="NSCellFlags2">272630784</int>
|
||||||
|
<string key="NSContents">Add your entity to log in:</string>
|
||||||
|
<reference key="NSSupport" ref="528364649"/>
|
||||||
|
<string key="NSCellIdentifier">_NS:1535</string>
|
||||||
|
<reference key="NSControlView" ref="215157023"/>
|
||||||
|
<object class="NSColor" key="NSBackgroundColor">
|
||||||
|
<int key="NSColorSpace">6</int>
|
||||||
|
<string key="NSCatalogName">System</string>
|
||||||
|
<string key="NSColorName">controlColor</string>
|
||||||
|
<object class="NSColor" key="NSColor">
|
||||||
|
<int key="NSColorSpace">3</int>
|
||||||
|
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="NSColor" key="NSTextColor">
|
||||||
|
<int key="NSColorSpace">6</int>
|
||||||
|
<string key="NSCatalogName">System</string>
|
||||||
|
<string key="NSColorName">controlTextColor</string>
|
||||||
|
<reference key="NSColor" ref="90908694"/>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||||
|
</object>
|
||||||
|
<object class="NSButton" id="251531186">
|
||||||
|
<reference key="NSNextResponder" ref="503676418"/>
|
||||||
|
<int key="NSvFlags">268</int>
|
||||||
|
<string key="NSFrame">{{391, 46}, {75, 32}}</string>
|
||||||
|
<reference key="NSSuperview" ref="503676418"/>
|
||||||
|
<reference key="NSWindow"/>
|
||||||
|
<reference key="NSNextKeyView"/>
|
||||||
|
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||||
|
<bool key="NSEnabled">YES</bool>
|
||||||
|
<object class="NSButtonCell" key="NSCell" id="54847478">
|
||||||
|
<int key="NSCellFlags">67108864</int>
|
||||||
|
<int key="NSCellFlags2">134217728</int>
|
||||||
|
<string key="NSContents">Login</string>
|
||||||
|
<reference key="NSSupport" ref="528364649"/>
|
||||||
|
<string key="NSCellIdentifier">_NS:9</string>
|
||||||
|
<reference key="NSControlView" ref="251531186"/>
|
||||||
|
<int key="NSButtonFlags">-2038284288</int>
|
||||||
|
<int key="NSButtonFlags2">129</int>
|
||||||
|
<string key="NSAlternateContents"/>
|
||||||
|
<string key="NSKeyEquivalent"/>
|
||||||
|
<int key="NSPeriodicDelay">200</int>
|
||||||
|
<int key="NSPeriodicInterval">25</int>
|
||||||
|
</object>
|
||||||
|
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<string key="NSFrameSize">{480, 186}</string>
|
||||||
|
<reference key="NSSuperview"/>
|
||||||
|
<reference key="NSWindow"/>
|
||||||
|
<reference key="NSNextKeyView" ref="433812480"/>
|
||||||
|
<string key="NSReuseIdentifierKey">_NS:20</string>
|
||||||
|
</object>
|
||||||
|
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
|
||||||
|
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
|
||||||
|
<bool key="NSWindowIsRestorable">YES</bool>
|
||||||
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||||
<object class="NSMutableArray" key="connectionRecords">
|
<object class="NSMutableArray" key="connectionRecords">
|
||||||
|
@ -1974,6 +2142,83 @@
|
||||||
<reference key="object" ref="126069112"/>
|
<reference key="object" ref="126069112"/>
|
||||||
<reference key="parent" ref="438898709"/>
|
<reference key="parent" ref="438898709"/>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">592</int>
|
||||||
|
<reference key="object" ref="842998572"/>
|
||||||
|
<object class="NSMutableArray" key="children">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<reference ref="503676418"/>
|
||||||
|
</object>
|
||||||
|
<reference key="parent" ref="0"/>
|
||||||
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">593</int>
|
||||||
|
<reference key="object" ref="503676418"/>
|
||||||
|
<object class="NSMutableArray" key="children">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<reference ref="433812480"/>
|
||||||
|
<reference ref="643973685"/>
|
||||||
|
<reference ref="215157023"/>
|
||||||
|
<reference ref="251531186"/>
|
||||||
|
</object>
|
||||||
|
<reference key="parent" ref="842998572"/>
|
||||||
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">594</int>
|
||||||
|
<reference key="object" ref="433812480"/>
|
||||||
|
<object class="NSMutableArray" key="children">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<reference ref="266676500"/>
|
||||||
|
</object>
|
||||||
|
<reference key="parent" ref="503676418"/>
|
||||||
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">595</int>
|
||||||
|
<reference key="object" ref="266676500"/>
|
||||||
|
<reference key="parent" ref="433812480"/>
|
||||||
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">596</int>
|
||||||
|
<reference key="object" ref="643973685"/>
|
||||||
|
<object class="NSMutableArray" key="children">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<reference ref="2007231"/>
|
||||||
|
</object>
|
||||||
|
<reference key="parent" ref="503676418"/>
|
||||||
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">597</int>
|
||||||
|
<reference key="object" ref="2007231"/>
|
||||||
|
<reference key="parent" ref="643973685"/>
|
||||||
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">598</int>
|
||||||
|
<reference key="object" ref="215157023"/>
|
||||||
|
<object class="NSMutableArray" key="children">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<reference ref="860986880"/>
|
||||||
|
</object>
|
||||||
|
<reference key="parent" ref="503676418"/>
|
||||||
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">599</int>
|
||||||
|
<reference key="object" ref="860986880"/>
|
||||||
|
<reference key="parent" ref="215157023"/>
|
||||||
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">600</int>
|
||||||
|
<reference key="object" ref="251531186"/>
|
||||||
|
<object class="NSMutableArray" key="children">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<reference ref="54847478"/>
|
||||||
|
</object>
|
||||||
|
<reference key="parent" ref="503676418"/>
|
||||||
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">601</int>
|
||||||
|
<reference key="object" ref="54847478"/>
|
||||||
|
<reference key="parent" ref="251531186"/>
|
||||||
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="NSMutableDictionary" key="flattenedProperties">
|
<object class="NSMutableDictionary" key="flattenedProperties">
|
||||||
|
@ -2069,6 +2314,17 @@
|
||||||
<string>561.IBPluginDependency</string>
|
<string>561.IBPluginDependency</string>
|
||||||
<string>57.IBPluginDependency</string>
|
<string>57.IBPluginDependency</string>
|
||||||
<string>58.IBPluginDependency</string>
|
<string>58.IBPluginDependency</string>
|
||||||
|
<string>592.IBPluginDependency</string>
|
||||||
|
<string>592.NSWindowTemplate.visibleAtLaunch</string>
|
||||||
|
<string>593.IBPluginDependency</string>
|
||||||
|
<string>594.IBPluginDependency</string>
|
||||||
|
<string>595.IBPluginDependency</string>
|
||||||
|
<string>596.IBPluginDependency</string>
|
||||||
|
<string>597.IBPluginDependency</string>
|
||||||
|
<string>598.IBPluginDependency</string>
|
||||||
|
<string>599.IBPluginDependency</string>
|
||||||
|
<string>600.IBPluginDependency</string>
|
||||||
|
<string>601.IBPluginDependency</string>
|
||||||
<string>72.IBPluginDependency</string>
|
<string>72.IBPluginDependency</string>
|
||||||
<string>73.IBPluginDependency</string>
|
<string>73.IBPluginDependency</string>
|
||||||
<string>79.IBPluginDependency</string>
|
<string>79.IBPluginDependency</string>
|
||||||
|
@ -2169,6 +2425,17 @@
|
||||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
|
<boolean value="YES"/>
|
||||||
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
|
@ -2189,7 +2456,7 @@
|
||||||
<reference key="dict.values" ref="0"/>
|
<reference key="dict.values" ref="0"/>
|
||||||
</object>
|
</object>
|
||||||
<nil key="sourceID"/>
|
<nil key="sourceID"/>
|
||||||
<int key="maxID">591</int>
|
<int key="maxID">601</int>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||||
|
@ -2321,11 +2588,13 @@
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
<object class="NSArray" key="dict.sortedKeys">
|
<object class="NSArray" key="dict.sortedKeys">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<string>Icon</string>
|
||||||
<string>NSMenuCheckmark</string>
|
<string>NSMenuCheckmark</string>
|
||||||
<string>NSMenuMixedState</string>
|
<string>NSMenuMixedState</string>
|
||||||
</object>
|
</object>
|
||||||
<object class="NSArray" key="dict.values">
|
<object class="NSArray" key="dict.values">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<string>{512, 512}</string>
|
||||||
<string>{11, 11}</string>
|
<string>{11, 11}</string>
|
||||||
<string>{10, 3}</string>
|
<string>{10, 3}</string>
|
||||||
</object>
|
</object>
|
||||||
|
|
|
@ -15,13 +15,14 @@
|
||||||
IBOutlet NSTextField *textField;
|
IBOutlet NSTextField *textField;
|
||||||
IBOutlet NSTextField *counter;
|
IBOutlet NSTextField *counter;
|
||||||
NSString *inReplyTostatusId;
|
NSString *inReplyTostatusId;
|
||||||
|
NSString *inReplyToEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (nonatomic, retain) IBOutlet NSTextField *textField;
|
@property (nonatomic, retain) IBOutlet NSTextField *textField;
|
||||||
@property (nonatomic, retain) IBOutlet NSTextField *counter;
|
@property (nonatomic, retain) IBOutlet NSTextField *counter;
|
||||||
|
|
||||||
- (IBAction)sendTweet:(NSControl *)control;
|
- (IBAction)sendTweet:(NSControl *)control;
|
||||||
- (void)inReplyTo:(NSString *)userName statusId:(NSString *)statusId;
|
- (void)inReplyTo:(NSString *)userName statusId:(NSString *)statusId withString:(NSString *)string;
|
||||||
- (void)withString:(NSString *)aString;
|
- (void)withString:(NSString *)aString;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
// Add your subclass-specific initialization here.
|
// Add your subclass-specific initialization here.
|
||||||
// If an error occurs here, send a [self release] message and return nil.
|
// If an error occurs here, send a [self release] message and return nil.
|
||||||
inReplyTostatusId = @"";
|
inReplyTostatusId = @"";
|
||||||
|
inReplyToEntity = @"";
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@ -33,11 +34,11 @@
|
||||||
// If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this method and override -makeWindowControllers instead.
|
// If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this method and override -makeWindowControllers instead.
|
||||||
return @"NewMessageWindow";
|
return @"NewMessageWindow";
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
- (NSString *)displayName {
|
- (NSString *)displayName {
|
||||||
return @"New Tweet";
|
return @"New Tweet";
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
- (void)windowControllerDidLoadNib:(NSWindowController *) aController
|
- (void)windowControllerDidLoadNib:(NSWindowController *) aController
|
||||||
{
|
{
|
||||||
[super windowControllerDidLoadNib:aController];
|
[super windowControllerDidLoadNib:aController];
|
||||||
|
@ -72,13 +73,18 @@
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)inReplyTo:(NSString *)userName statusId:(NSString *)statusId {
|
- (void)inReplyTo:(NSString *)entity statusId:(NSString *)statusId withString:(NSString *)string {
|
||||||
[textField setStringValue:[NSString stringWithFormat:@"^%@ ", userName]];
|
[textField setStringValue:string];
|
||||||
NSRange range = {[[textField stringValue] length] , 0};
|
NSRange range = {[[textField stringValue] length] , 0};
|
||||||
[[textField currentEditor] setSelectedRange:range];
|
[[textField currentEditor] setSelectedRange:range];
|
||||||
|
|
||||||
[inReplyTostatusId release];
|
[inReplyTostatusId release];
|
||||||
inReplyTostatusId = statusId;
|
inReplyTostatusId = statusId;
|
||||||
[inReplyTostatusId retain];
|
[inReplyTostatusId retain];
|
||||||
|
|
||||||
|
[inReplyToEntity release];
|
||||||
|
inReplyToEntity = entity;
|
||||||
|
[inReplyToEntity retain];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)withString:(NSString *)aString {
|
- (void)withString:(NSString *)aString {
|
||||||
|
@ -105,6 +111,7 @@
|
||||||
TweetModel *tweet = [[[TweetModel alloc] init] autorelease];
|
TweetModel *tweet = [[[TweetModel alloc] init] autorelease];
|
||||||
tweet.text = [control stringValue];
|
tweet.text = [control stringValue];
|
||||||
tweet.inReplyTostatusId = inReplyTostatusId;
|
tweet.inReplyTostatusId = inReplyTostatusId;
|
||||||
|
tweet.inReplyToEntity = inReplyToEntity;
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"sendTweet" object:tweet];
|
[[NSNotificationCenter defaultCenter] postNotificationName:@"sendTweet" object:tweet];
|
||||||
[self close];
|
[self close];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -12,9 +12,11 @@
|
||||||
@interface TweetModel : NSObject {
|
@interface TweetModel : NSObject {
|
||||||
NSString *text;
|
NSString *text;
|
||||||
NSString *inReplyTostatusId;
|
NSString *inReplyTostatusId;
|
||||||
|
NSString *inReplyToEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (nonatomic, retain) NSString *text;
|
@property (nonatomic, retain) NSString *text;
|
||||||
@property (nonatomic, retain) NSString *inReplyTostatusId;
|
@property (nonatomic, retain) NSString *inReplyTostatusId;
|
||||||
|
@property (nonatomic, retain) NSString *inReplyToEntity;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -11,11 +11,12 @@
|
||||||
|
|
||||||
@implementation TweetModel
|
@implementation TweetModel
|
||||||
|
|
||||||
@synthesize text, inReplyTostatusId;
|
@synthesize text, inReplyTostatusId, inReplyToEntity;
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
[text release];
|
[text release];
|
||||||
[inReplyTostatusId release];
|
[inReplyTostatusId release];
|
||||||
|
[inReplyToEntity release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,5 +89,8 @@ function findProfileURL(entity, callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function debug(string) {
|
function debug(string) {
|
||||||
|
if (typeof string == "Object") {
|
||||||
|
string = JSON.stirngify(string);
|
||||||
|
}
|
||||||
alert("DEBUG: " + string);
|
alert("DEBUG: " + string);
|
||||||
}
|
}
|
Reference in a new issue