implemented a mentions view
This commit is contained in:
parent
1e92b50515
commit
da7cc71f4e
9 changed files with 215 additions and 89 deletions
16
Controller.h
16
Controller.h
|
@ -8,23 +8,23 @@
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import <Webkit/Webkit.h>
|
#import <Webkit/Webkit.h>
|
||||||
#import "StatusView.h"
|
|
||||||
#import "ViewDelegate.h"
|
#import "ViewDelegate.h"
|
||||||
#import <Carbon/Carbon.h>
|
#import <Carbon/Carbon.h>
|
||||||
|
|
||||||
@interface Controller : NSObject {
|
@interface Controller : NSObject {
|
||||||
IBOutlet WebView *webView;
|
IBOutlet WebView *timelineView;
|
||||||
id<StatusView> viewDelegate;
|
IBOutlet WebView *mentionsView;
|
||||||
NSString *username;
|
ViewDelegate *viewDelegate;
|
||||||
NSString *password;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (retain, nonatomic) IBOutlet WebView *webView;
|
@property (retain, nonatomic) IBOutlet WebView *timelineView;
|
||||||
@property (retain, nonatomic) IBOutlet id<StatusView> viewDelegate;
|
@property (retain, nonatomic) IBOutlet WebView *mentionsView;
|
||||||
|
@property (retain, nonatomic) IBOutlet ViewDelegate *viewDelegate;
|
||||||
|
|
||||||
- (void)initWebView;
|
- (void)initWebViews;
|
||||||
- (void)openNewTweetWindowInReplyTo:(NSString *)userName statusId:(NSString *)statusId;
|
- (void)openNewTweetWindowInReplyTo:(NSString *)userName statusId:(NSString *)statusId;
|
||||||
- (NSString *)pluginURL;
|
- (NSString *)pluginURL;
|
||||||
|
|
||||||
OSStatus handler(EventHandlerCallRef nextHandler, EventRef theEvent, void* userData);
|
OSStatus handler(EventHandlerCallRef nextHandler, EventRef theEvent, void* userData);
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
32
Controller.m
32
Controller.m
|
@ -12,10 +12,10 @@
|
||||||
|
|
||||||
@implementation Controller
|
@implementation Controller
|
||||||
|
|
||||||
@synthesize webView, viewDelegate;
|
@synthesize timelineView, mentionsView, viewDelegate;
|
||||||
|
|
||||||
- (void)awakeFromNib {
|
- (void)awakeFromNib {
|
||||||
[self initWebView];
|
[self initWebViews];
|
||||||
|
|
||||||
|
|
||||||
/* CARBON from http://github.com/Xjs/drama-button/blob/carbon/Drama_ButtonAppDelegate.m */
|
/* CARBON from http://github.com/Xjs/drama-button/blob/carbon/Drama_ButtonAppDelegate.m */
|
||||||
|
@ -49,19 +49,27 @@
|
||||||
[appleEventManager setEventHandler:self andSelector:@selector(handleGetURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL];
|
[appleEventManager setEventHandler:self andSelector:@selector(handleGetURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)initWebView {
|
- (void)initWebViews {
|
||||||
|
|
||||||
NSString *path = [[NSBundle mainBundle] resourcePath];
|
NSString *path = [[NSBundle mainBundle] resourcePath];
|
||||||
NSURL *url = [NSURL fileURLWithPath:path];
|
NSURL *url = [NSURL fileURLWithPath:path];
|
||||||
NSString *index_string = [NSString stringWithContentsOfFile:[NSString stringWithFormat:@"%@/index.html", path] encoding:NSUTF8StringEncoding error:nil];
|
NSString *index_string = [NSString stringWithContentsOfFile:[NSString stringWithFormat:@"%@/index.html", path] encoding:NSUTF8StringEncoding error:nil];
|
||||||
NSLog(@"%@", url);
|
|
||||||
[[webView mainFrame] loadHTMLString:index_string baseURL:url];
|
|
||||||
|
|
||||||
viewDelegate = [[ViewDelegate alloc] initWithWebView:webView];
|
viewDelegate = [[ViewDelegate alloc] init];
|
||||||
[webView setFrameLoadDelegate:viewDelegate];
|
|
||||||
[webView setPolicyDelegate:viewDelegate];
|
viewDelegate.timelineView = timelineView;
|
||||||
[webView setUIDelegate:viewDelegate];
|
[[timelineView mainFrame] loadHTMLString:index_string baseURL:url];
|
||||||
|
[timelineView setFrameLoadDelegate:viewDelegate];
|
||||||
[[webView windowScriptObject] setValue:self forKey:@"controller"];
|
[timelineView setPolicyDelegate:viewDelegate];
|
||||||
|
[timelineView setUIDelegate:viewDelegate];
|
||||||
|
[[timelineView windowScriptObject] setValue:self forKey:@"controller"];
|
||||||
|
|
||||||
|
viewDelegate.mentionsView = mentionsView;
|
||||||
|
[[mentionsView mainFrame] loadHTMLString:index_string baseURL:url];
|
||||||
|
[mentionsView setFrameLoadDelegate:viewDelegate];
|
||||||
|
[mentionsView setPolicyDelegate:viewDelegate];
|
||||||
|
[mentionsView setUIDelegate:viewDelegate];
|
||||||
|
[[mentionsView windowScriptObject] setValue:self forKey:@"controller"];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector {
|
+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector {
|
||||||
|
@ -97,7 +105,7 @@
|
||||||
|
|
||||||
- (IBAction)sendTweet:(id)sender {
|
- (IBAction)sendTweet:(id)sender {
|
||||||
NSString *encodedString = [[[sender object] objectAtIndex:0] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
NSString *encodedString = [[[sender object] objectAtIndex:0] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||||
[webView stringByEvaluatingJavaScriptFromString:
|
[timelineView stringByEvaluatingJavaScriptFromString:
|
||||||
[NSString stringWithFormat:@"twittia_instance.sendNewTweet(\"%@\", \"%@\")",
|
[NSString stringWithFormat:@"twittia_instance.sendNewTweet(\"%@\", \"%@\")",
|
||||||
[encodedString stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""],
|
[encodedString stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""],
|
||||||
[[sender object] objectAtIndex:1]]];
|
[[sender object] objectAtIndex:1]]];
|
||||||
|
|
|
@ -21,8 +21,9 @@
|
||||||
</object>
|
</object>
|
||||||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
<integer value="535"/>
|
<integer value="559"/>
|
||||||
<integer value="29"/>
|
<integer value="81"/>
|
||||||
|
<integer value="536"/>
|
||||||
</object>
|
</object>
|
||||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
@ -229,6 +230,15 @@
|
||||||
<reference key="NSOnImage" ref="1033313550"/>
|
<reference key="NSOnImage" ref="1033313550"/>
|
||||||
<reference key="NSMixedImage" ref="310636482"/>
|
<reference key="NSMixedImage" ref="310636482"/>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="NSMenuItem" id="295904906">
|
||||||
|
<reference key="NSMenu" ref="720053764"/>
|
||||||
|
<string key="NSTitle">Mentions</string>
|
||||||
|
<string key="NSKeyEquiv">m</string>
|
||||||
|
<int key="NSKeyEquivModMask">1048576</int>
|
||||||
|
<int key="NSMnemonicLoc">2147483647</int>
|
||||||
|
<reference key="NSOnImage" ref="1033313550"/>
|
||||||
|
<reference key="NSMixedImage" ref="310636482"/>
|
||||||
|
</object>
|
||||||
<object class="NSMenuItem" id="776162233">
|
<object class="NSMenuItem" id="776162233">
|
||||||
<reference key="NSMenu" ref="720053764"/>
|
<reference key="NSMenu" ref="720053764"/>
|
||||||
<string key="NSTitle">Close</string>
|
<string key="NSTitle">Close</string>
|
||||||
|
@ -806,24 +816,16 @@
|
||||||
<string key="FrameName"/>
|
<string key="FrameName"/>
|
||||||
<string key="GroupName"/>
|
<string key="GroupName"/>
|
||||||
<object class="WebPreferences" key="Preferences">
|
<object class="WebPreferences" key="Preferences">
|
||||||
<string key="Identifier"/>
|
<string key="Identifier">13</string>
|
||||||
<object class="NSMutableDictionary" key="Values">
|
<object class="NSMutableDictionary" key="Values">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
<object class="NSArray" key="dict.sortedKeys">
|
<reference key="dict.sortedKeys" ref="0"/>
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
|
||||||
<string>WebKitDefaultFixedFontSize</string>
|
|
||||||
<string>WebKitDefaultFontSize</string>
|
|
||||||
<string>WebKitMinimumFontSize</string>
|
|
||||||
</object>
|
|
||||||
<object class="NSMutableArray" key="dict.values">
|
<object class="NSMutableArray" key="dict.values">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
<integer value="12"/>
|
|
||||||
<integer value="12"/>
|
|
||||||
<integer value="1"/>
|
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<bool key="UseBackForwardList">YES</bool>
|
<bool key="UseBackForwardList">NO</bool>
|
||||||
<bool key="AllowsUndo">YES</bool>
|
<bool key="AllowsUndo">YES</bool>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
|
@ -837,6 +839,70 @@
|
||||||
<object class="NSCustomObject" id="751227585">
|
<object class="NSCustomObject" id="751227585">
|
||||||
<string key="NSClassName">SUUpdater</string>
|
<string key="NSClassName">SUUpdater</string>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="NSWindowTemplate" id="134415325">
|
||||||
|
<int key="NSWindowStyleMask">15</int>
|
||||||
|
<int key="NSWindowBacking">2</int>
|
||||||
|
<string key="NSWindowRect">{{235, -22}, {376, 581}}</string>
|
||||||
|
<int key="NSWTFlags">1685586944</int>
|
||||||
|
<string key="NSWindowTitle">Mentions</string>
|
||||||
|
<string key="NSWindowClass">NSWindow</string>
|
||||||
|
<nil key="NSViewClass"/>
|
||||||
|
<string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
|
||||||
|
<object class="NSView" key="NSWindowView" id="438898709">
|
||||||
|
<reference key="NSNextResponder"/>
|
||||||
|
<int key="NSvFlags">256</int>
|
||||||
|
<object class="NSMutableArray" key="NSSubviews">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<object class="WebView" id="126069112">
|
||||||
|
<reference key="NSNextResponder" ref="438898709"/>
|
||||||
|
<int key="NSvFlags">274</int>
|
||||||
|
<object class="NSMutableSet" key="NSDragTypes">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<object class="NSArray" key="set.sortedObjects">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<string>Apple HTML pasteboard type</string>
|
||||||
|
<string>Apple PDF pasteboard type</string>
|
||||||
|
<string>Apple PICT pasteboard type</string>
|
||||||
|
<string>Apple URL pasteboard type</string>
|
||||||
|
<string>Apple Web Archive pasteboard type</string>
|
||||||
|
<string>NSColor pasteboard type</string>
|
||||||
|
<string>NSFilenamesPboardType</string>
|
||||||
|
<string>NSStringPboardType</string>
|
||||||
|
<string>NeXT RTFD pasteboard type</string>
|
||||||
|
<string>NeXT Rich Text Format v1.0 pasteboard type</string>
|
||||||
|
<string>NeXT TIFF v4.0 pasteboard type</string>
|
||||||
|
<string>WebURLsWithTitlesPboardType</string>
|
||||||
|
<string>public.png</string>
|
||||||
|
<string>public.url</string>
|
||||||
|
<string>public.url-name</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<string key="NSFrameSize">{376, 581}</string>
|
||||||
|
<reference key="NSSuperview" ref="438898709"/>
|
||||||
|
<reference key="NSNextKeyView"/>
|
||||||
|
<string key="FrameName"/>
|
||||||
|
<string key="GroupName"/>
|
||||||
|
<object class="WebPreferences" key="Preferences">
|
||||||
|
<string key="Identifier">12</string>
|
||||||
|
<object class="NSMutableDictionary" key="Values">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<reference key="dict.sortedKeys" ref="0"/>
|
||||||
|
<object class="NSMutableArray" key="dict.values">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<bool key="UseBackForwardList">NO</bool>
|
||||||
|
<bool key="AllowsUndo">YES</bool>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<string key="NSFrameSize">{376, 581}</string>
|
||||||
|
<reference key="NSSuperview"/>
|
||||||
|
</object>
|
||||||
|
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
|
||||||
|
<string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
|
||||||
|
<string key="NSFrameAutosaveName">mentions</string>
|
||||||
|
</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">
|
||||||
|
@ -1177,14 +1243,6 @@
|
||||||
</object>
|
</object>
|
||||||
<int key="connectionID">494</int>
|
<int key="connectionID">494</int>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBConnectionRecord">
|
|
||||||
<object class="IBOutletConnection" key="connection">
|
|
||||||
<string key="label">webView</string>
|
|
||||||
<reference key="source" ref="408500656"/>
|
|
||||||
<reference key="destination" ref="690752143"/>
|
|
||||||
</object>
|
|
||||||
<int key="connectionID">538</int>
|
|
||||||
</object>
|
|
||||||
<object class="IBConnectionRecord">
|
<object class="IBConnectionRecord">
|
||||||
<object class="IBActionConnection" key="connection">
|
<object class="IBActionConnection" key="connection">
|
||||||
<string key="label">newDocument:</string>
|
<string key="label">newDocument:</string>
|
||||||
|
@ -1209,6 +1267,30 @@
|
||||||
</object>
|
</object>
|
||||||
<int key="connectionID">547</int>
|
<int key="connectionID">547</int>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="IBConnectionRecord">
|
||||||
|
<object class="IBOutletConnection" key="connection">
|
||||||
|
<string key="label">timelineView</string>
|
||||||
|
<reference key="source" ref="408500656"/>
|
||||||
|
<reference key="destination" ref="690752143"/>
|
||||||
|
</object>
|
||||||
|
<int key="connectionID">553</int>
|
||||||
|
</object>
|
||||||
|
<object class="IBConnectionRecord">
|
||||||
|
<object class="IBOutletConnection" key="connection">
|
||||||
|
<string key="label">mentionsView</string>
|
||||||
|
<reference key="source" ref="408500656"/>
|
||||||
|
<reference key="destination" ref="126069112"/>
|
||||||
|
</object>
|
||||||
|
<int key="connectionID">562</int>
|
||||||
|
</object>
|
||||||
|
<object class="IBConnectionRecord">
|
||||||
|
<object class="IBActionConnection" key="connection">
|
||||||
|
<string key="label">makeKeyAndOrderFront:</string>
|
||||||
|
<reference key="source" ref="134415325"/>
|
||||||
|
<reference key="destination" ref="295904906"/>
|
||||||
|
</object>
|
||||||
|
<int key="connectionID">563</int>
|
||||||
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||||
<object class="NSArray" key="orderedObjects">
|
<object class="NSArray" key="orderedObjects">
|
||||||
|
@ -1297,6 +1379,7 @@
|
||||||
<reference ref="776162233"/>
|
<reference ref="776162233"/>
|
||||||
<reference ref="425164168"/>
|
<reference ref="425164168"/>
|
||||||
<reference ref="281587867"/>
|
<reference ref="281587867"/>
|
||||||
|
<reference ref="295904906"/>
|
||||||
</object>
|
</object>
|
||||||
<reference key="parent" ref="379814623"/>
|
<reference key="parent" ref="379814623"/>
|
||||||
</object>
|
</object>
|
||||||
|
@ -1804,6 +1887,7 @@
|
||||||
<int key="objectID">537</int>
|
<int key="objectID">537</int>
|
||||||
<reference key="object" ref="690752143"/>
|
<reference key="object" ref="690752143"/>
|
||||||
<reference key="parent" ref="332867700"/>
|
<reference key="parent" ref="332867700"/>
|
||||||
|
<string key="objectName">timeline</string>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBObjectRecord">
|
<object class="IBObjectRecord">
|
||||||
<int key="objectID">541</int>
|
<int key="objectID">541</int>
|
||||||
|
@ -1820,6 +1904,35 @@
|
||||||
<reference key="object" ref="281587867"/>
|
<reference key="object" ref="281587867"/>
|
||||||
<reference key="parent" ref="720053764"/>
|
<reference key="parent" ref="720053764"/>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">551</int>
|
||||||
|
<reference key="object" ref="295904906"/>
|
||||||
|
<reference key="parent" ref="720053764"/>
|
||||||
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">559</int>
|
||||||
|
<reference key="object" ref="134415325"/>
|
||||||
|
<object class="NSMutableArray" key="children">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<reference ref="438898709"/>
|
||||||
|
</object>
|
||||||
|
<reference key="parent" ref="0"/>
|
||||||
|
<string key="objectName">Mentions</string>
|
||||||
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">560</int>
|
||||||
|
<reference key="object" ref="438898709"/>
|
||||||
|
<object class="NSMutableArray" key="children">
|
||||||
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
<reference ref="126069112"/>
|
||||||
|
</object>
|
||||||
|
<reference key="parent" ref="134415325"/>
|
||||||
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">561</int>
|
||||||
|
<reference key="object" ref="126069112"/>
|
||||||
|
<reference key="parent" ref="438898709"/>
|
||||||
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="NSMutableDictionary" key="flattenedProperties">
|
<object class="NSMutableDictionary" key="flattenedProperties">
|
||||||
|
@ -1970,8 +2083,15 @@
|
||||||
<string>537.IBPluginDependency</string>
|
<string>537.IBPluginDependency</string>
|
||||||
<string>542.IBPluginDependency</string>
|
<string>542.IBPluginDependency</string>
|
||||||
<string>544.IBPluginDependency</string>
|
<string>544.IBPluginDependency</string>
|
||||||
|
<string>551.IBPluginDependency</string>
|
||||||
|
<string>559.IBEditorWindowLastContentRect</string>
|
||||||
|
<string>559.IBPluginDependency</string>
|
||||||
|
<string>559.IBWindowTemplateEditedContentRect</string>
|
||||||
|
<string>559.NSWindowTemplate.visibleAtLaunch</string>
|
||||||
<string>56.IBPluginDependency</string>
|
<string>56.IBPluginDependency</string>
|
||||||
<string>56.ImportedFromIB2</string>
|
<string>56.ImportedFromIB2</string>
|
||||||
|
<string>560.IBPluginDependency</string>
|
||||||
|
<string>561.IBPluginDependency</string>
|
||||||
<string>57.IBEditorWindowLastContentRect</string>
|
<string>57.IBEditorWindowLastContentRect</string>
|
||||||
<string>57.IBPluginDependency</string>
|
<string>57.IBPluginDependency</string>
|
||||||
<string>57.ImportedFromIB2</string>
|
<string>57.ImportedFromIB2</string>
|
||||||
|
@ -2133,16 +2253,23 @@
|
||||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<integer value="1"/>
|
<integer value="1"/>
|
||||||
<string>{{907, 115}, {397, 581}}</string>
|
<string>{{42, 357}, {397, 581}}</string>
|
||||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<string>{{907, 115}, {397, 581}}</string>
|
<string>{{42, 357}, {397, 581}}</string>
|
||||||
<boolean value="YES"/>
|
<boolean value="YES"/>
|
||||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<string>com.apple.WebKitIBPlugin</string>
|
<string>com.apple.WebKitIBPlugin</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>{{460, 356}, {376, 581}}</string>
|
||||||
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
|
<string>{{460, 356}, {376, 581}}</string>
|
||||||
|
<boolean value="NO"/>
|
||||||
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<integer value="1"/>
|
<integer value="1"/>
|
||||||
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
|
<string>com.apple.WebKitIBPlugin</string>
|
||||||
<string>{{1089, 312}, {229, 173}}</string>
|
<string>{{1089, 312}, {229, 173}}</string>
|
||||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<integer value="1"/>
|
<integer value="1"/>
|
||||||
|
@ -2155,7 +2282,7 @@
|
||||||
<integer value="1"/>
|
<integer value="1"/>
|
||||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<integer value="1"/>
|
<integer value="1"/>
|
||||||
<string>{{771, 861}, {181, 93}}</string>
|
<string>{{771, 841}, {182, 113}}</string>
|
||||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||||
<integer value="1"/>
|
<integer value="1"/>
|
||||||
<string>{{155, 774}, {199, 203}}</string>
|
<string>{{155, 774}, {199, 203}}</string>
|
||||||
|
@ -2183,7 +2310,7 @@
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<nil key="sourceID"/>
|
<nil key="sourceID"/>
|
||||||
<int key="maxID">547</int>
|
<int key="maxID">563</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">
|
||||||
|
@ -2195,13 +2322,17 @@
|
||||||
<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>mentionsView</string>
|
||||||
|
<string>timelineView</string>
|
||||||
<string>viewDelegate</string>
|
<string>viewDelegate</string>
|
||||||
<string>webView</string>
|
<string>viewDelegate2</string>
|
||||||
</object>
|
</object>
|
||||||
<object class="NSMutableArray" key="dict.values">
|
<object class="NSMutableArray" key="dict.values">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
<string>id</string>
|
|
||||||
<string>WebView</string>
|
<string>WebView</string>
|
||||||
|
<string>WebView</string>
|
||||||
|
<string>id</string>
|
||||||
|
<string>id</string>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
|
16
StatusView.h
16
StatusView.h
|
@ -1,16 +0,0 @@
|
||||||
//
|
|
||||||
// Viewer.h
|
|
||||||
// Twittia 2
|
|
||||||
//
|
|
||||||
// Created by Jeena on 15.04.10.
|
|
||||||
// Licence: BSD (see attached LICENCE.txt file).
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
|
||||||
#import <WebKit/WebKit.h>
|
|
||||||
|
|
||||||
@protocol StatusView
|
|
||||||
|
|
||||||
-(id)initWithWebView:(WebView *) webView;
|
|
||||||
|
|
||||||
@end
|
|
|
@ -72,7 +72,6 @@
|
||||||
1FFA36D31177D879006C8562 /* Controller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Controller.m; sourceTree = "<group>"; };
|
1FFA36D31177D879006C8562 /* Controller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Controller.m; sourceTree = "<group>"; };
|
||||||
1FFA36D41177D879006C8562 /* ViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewDelegate.h; sourceTree = "<group>"; };
|
1FFA36D41177D879006C8562 /* ViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewDelegate.h; sourceTree = "<group>"; };
|
||||||
1FFA36D51177D879006C8562 /* ViewDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewDelegate.m; sourceTree = "<group>"; };
|
1FFA36D51177D879006C8562 /* ViewDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewDelegate.m; sourceTree = "<group>"; };
|
||||||
1FFA36D61177D879006C8562 /* StatusView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatusView.h; sourceTree = "<group>"; };
|
|
||||||
1FFA37061177DAF4006C8562 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
|
1FFA37061177DAF4006C8562 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
|
||||||
2564AD2C0F5327BB00F57823 /* Twittia_2_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Twittia_2_Prefix.pch; sourceTree = "<group>"; };
|
2564AD2C0F5327BB00F57823 /* Twittia_2_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Twittia_2_Prefix.pch; sourceTree = "<group>"; };
|
||||||
2A37F4ACFDCFA73011CA2CEA /* MyDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyDocument.m; sourceTree = "<group>"; };
|
2A37F4ACFDCFA73011CA2CEA /* MyDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyDocument.m; sourceTree = "<group>"; };
|
||||||
|
@ -165,7 +164,6 @@
|
||||||
1FFA36D31177D879006C8562 /* Controller.m */,
|
1FFA36D31177D879006C8562 /* Controller.m */,
|
||||||
1FFA36D41177D879006C8562 /* ViewDelegate.h */,
|
1FFA36D41177D879006C8562 /* ViewDelegate.h */,
|
||||||
1FFA36D51177D879006C8562 /* ViewDelegate.m */,
|
1FFA36D51177D879006C8562 /* ViewDelegate.m */,
|
||||||
1FFA36D61177D879006C8562 /* StatusView.h */,
|
|
||||||
2A37F4AEFDCFA73011CA2CEA /* MyDocument.h */,
|
2A37F4AEFDCFA73011CA2CEA /* MyDocument.h */,
|
||||||
2A37F4ACFDCFA73011CA2CEA /* MyDocument.m */,
|
2A37F4ACFDCFA73011CA2CEA /* MyDocument.m */,
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
function Twittia() {
|
function Twittia(action, oauth_key, oauth_secret) {
|
||||||
this.body = document.getElementById("body");
|
this.body = document.getElementById("body");
|
||||||
this.max_length = 100;
|
this.max_length = 100;
|
||||||
this.since_id;
|
this.since_id;
|
||||||
this.getNewData();
|
|
||||||
this.timeout = 2 * 60 * 1000;
|
this.timeout = 2 * 60 * 1000;
|
||||||
|
this.action = action;
|
||||||
|
this.oauth_key = oauth_key;
|
||||||
|
this.oauth_secret = oauth_secret;
|
||||||
|
this.getNewData();
|
||||||
|
setTimeout(function() { loadPlugin(controller.pluginURL()) }, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Twittia.prototype.newStatus = function(status, supress_new_with_timeout) {
|
Twittia.prototype.newStatus = function(status, supress_new_with_timeout) {
|
||||||
if(status != null) {
|
if(status != null) {
|
||||||
for(var i = status.length-1, c=0; i>=c; --i) {
|
for(var i = status.length-1, c=0; i>=c; --i) {
|
||||||
|
@ -161,7 +166,8 @@ Twittia.prototype.getTemplate = function() {
|
||||||
|
|
||||||
Twittia.prototype.getNewData = function(supress_new_with_timeout) {
|
Twittia.prototype.getNewData = function(supress_new_with_timeout) {
|
||||||
|
|
||||||
var url = "http://api.twitter.com/1/statuses/home_timeline.json?count=100";
|
var url = "http://api.twitter.com/1/statuses/" + this.action + ".json"
|
||||||
|
url += "?count=" + this.max_length;
|
||||||
if(this.since_id) url += "&since_id=" + this.since_id;
|
if(this.since_id) url += "&since_id=" + this.since_id;
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
|
@ -241,3 +247,5 @@ function loadPlugin(url) {
|
||||||
plugin.src = url;
|
plugin.src = url;
|
||||||
document.getElementsByTagName("head")[0].appendChild(plugin);
|
document.getElementsByTagName("head")[0].appendChild(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var twittia_instance;
|
|
@ -8,12 +8,13 @@
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import <WebKit/WebKit.h>
|
#import <WebKit/WebKit.h>
|
||||||
#import "StatusView.h"
|
|
||||||
|
|
||||||
@interface ViewDelegate : NSObject<StatusView> {
|
@interface ViewDelegate : NSObject {
|
||||||
WebView *webView;
|
WebView *timelineView;
|
||||||
|
WebView *mentionsView;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(id)initWithWebView:(WebView *) webView;
|
@property (nonatomic, assign) WebView *timelineView;
|
||||||
|
@property (nonatomic, assign) WebView *mentionsView;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -11,17 +11,9 @@
|
||||||
|
|
||||||
@implementation ViewDelegate
|
@implementation ViewDelegate
|
||||||
|
|
||||||
-(id)initWithWebView:(WebView *) view {
|
@synthesize timelineView, mentionsView;
|
||||||
|
|
||||||
if ( self = [super init] ) {
|
|
||||||
webView = view;
|
|
||||||
}
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
- (void)webView:(WebView *)sender addMessageToConsole:(NSDictionary *)message;{
|
||||||
- (void)webView:(WebView *)_webView addMessageToConsole:(NSDictionary *)message;{
|
|
||||||
|
|
||||||
if (![message isKindOfClass:[NSDictionary class]]) return;
|
if (![message isKindOfClass:[NSDictionary class]]) return;
|
||||||
|
|
||||||
|
@ -41,4 +33,15 @@
|
||||||
[[NSWorkspace sharedWorkspace] openURL:[request URL]];
|
[[NSWorkspace sharedWorkspace] openURL:[request URL]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
|
||||||
|
NSString *action = @"home_timeline";
|
||||||
|
|
||||||
|
if (sender == mentionsView) {
|
||||||
|
action = @"mentions";
|
||||||
|
}
|
||||||
|
|
||||||
|
[sender stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:
|
||||||
|
@"setTimeout(function(){ twittia_instance = new Twittia('%@'); }, 1);", action]];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -10,12 +10,5 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<ol id="body" class="messages"></ol>
|
<ol id="body" class="messages"></ol>
|
||||||
<script type="text/javascript">
|
|
||||||
var twittia_instance;
|
|
||||||
$(document).ready(function() {
|
|
||||||
twittia_instance = new Twittia();
|
|
||||||
loadPlugin(controller.pluginURL());
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Reference in a new issue