delete spaces and tabs on line ends
This commit is contained in:
parent
f7240ea2e5
commit
8d89461be7
28 changed files with 222 additions and 222 deletions
|
@ -15,7 +15,7 @@ class Bungloo:
|
|||
self.preferences = Windows.Preferences(self)
|
||||
self.preferences.show()
|
||||
|
||||
self.oauth_implementation = Windows.Oauth(self)
|
||||
self.oauth_implementation = Windows.Oauth(self)
|
||||
|
||||
if self.controller.stringForKey("user_access_token") != "":
|
||||
self.authentification_succeded()
|
||||
|
@ -61,7 +61,7 @@ class Controller(QtCore.QObject):
|
|||
self.app = app
|
||||
|
||||
os.path.expanduser("~/.bungloo/")
|
||||
|
||||
|
||||
self.config_path = os.path.expanduser('~/.bungloo/bungloo.cfg')
|
||||
if os.access(self.config_path, os.R_OK):
|
||||
with open(self.config_path, 'r') as f:
|
||||
|
@ -196,7 +196,7 @@ class Controller(QtCore.QObject):
|
|||
msgBox = QtGui.QMessageBox()
|
||||
msgBox.setText(errorMessage)
|
||||
msgBox.exec_()
|
||||
|
||||
|
||||
@QtCore.pyqtSlot(str, str)
|
||||
def alertTitleWithMessage(self, title, message):
|
||||
msgBox = QtGui.QMessageBox()
|
||||
|
@ -230,6 +230,6 @@ class Console(QtCore.QObject):
|
|||
def debug(self, string):
|
||||
print "<js DEBUG>: " + string
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
Bungloo()
|
||||
|
|
|
@ -33,7 +33,7 @@ class WebViewCreator(QtWebKit.QWebView):
|
|||
self.is_local = local
|
||||
self.connect(self, SIGNAL("linkClicked (const QUrl&)"), self.app.controller.openQURL)
|
||||
self.setPage(WebPage(self, self.app))
|
||||
|
||||
|
||||
def load_local(self, callback=None):
|
||||
self.page().settings().setAttribute(QtWebKit.QWebSettings.LocalContentCanAccessRemoteUrls, True)
|
||||
self.page().settings().setAttribute(QtWebKit.QWebSettings.LocalStorageEnabled, True)
|
||||
|
@ -47,7 +47,7 @@ class WebViewCreator(QtWebKit.QWebView):
|
|||
self.load(QtCore.QUrl(url))
|
||||
|
||||
def load_url(self, url, callback=None):
|
||||
self.loadFinished.connect(lambda ok: self.load_finished(ok, callback))
|
||||
self.loadFinished.connect(lambda ok: self.load_finished(ok, callback))
|
||||
self.load(QtCore.QUrl(url))
|
||||
|
||||
def load_finished(self, ok, callback=None):
|
||||
|
@ -81,14 +81,14 @@ class NetworkAccessManager(QNetworkAccessManager):
|
|||
self.setCookieJar(old_manager.cookieJar())
|
||||
self.setProxy(old_manager.proxy())
|
||||
self.setProxyFactory(old_manager.proxyFactory())
|
||||
|
||||
|
||||
def createRequest(self, operation, request, data):
|
||||
if request.url().scheme() != "bungloo":
|
||||
return QNetworkAccessManager.createRequest(self, operation, request, data)
|
||||
else:
|
||||
self.bungloo_callback(request.url())
|
||||
return QNetworkAccessManager.createRequest(self, QNetworkAccessManager.GetOperation, QNetworkRequest(QtCore.QUrl()))
|
||||
|
||||
|
||||
class PostModel:
|
||||
|
||||
def __init__(self):
|
||||
|
|
|
@ -99,7 +99,7 @@ class Timeline:
|
|||
|
||||
|
||||
def initUI(self):
|
||||
newPostAction = QtGui.QAction("&New Post", self.window)
|
||||
newPostAction = QtGui.QAction("&New Post", self.window)
|
||||
newPostAction.setShortcut("Ctrl+N")
|
||||
newPostAction.setStatusTip("Open new post window")
|
||||
newPostAction.triggered.connect(self.app.controller.openNewMessageWidow)
|
||||
|
@ -253,12 +253,12 @@ class NewPost(Helper.RestorableWindow):
|
|||
self.imageFilePath = None
|
||||
|
||||
def initUI(self):
|
||||
newPostAction = QtGui.QAction("&New Post", self)
|
||||
newPostAction = QtGui.QAction("&New Post", self)
|
||||
newPostAction.setShortcut("Ctrl+N")
|
||||
newPostAction.setStatusTip("Open new post window")
|
||||
newPostAction.triggered.connect(self.app.controller.openNewMessageWidow)
|
||||
|
||||
sendPostAction = QtGui.QAction("&Send Post", self)
|
||||
sendPostAction = QtGui.QAction("&Send Post", self)
|
||||
sendPostAction.setShortcut("Ctrl+Return")
|
||||
sendPostAction.setStatusTip("Send post")
|
||||
sendPostAction.triggered.connect(self.sendMessage)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
d = [NSUserDefaults standardUserDefaults];
|
||||
//[d removeObjectForKey:@"user_access_token"];
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
|||
char *_password = nil;
|
||||
SecKeychainItemRef item = nil;
|
||||
SecKeychainFindGenericPassword(NULL, 6, "Bungloo", 17, "BunglooUserAccount", &_passwordLength, (void **)&_password, &item);
|
||||
|
||||
|
||||
OSStatus status;
|
||||
void * passwordData = (void*)[_secret cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
UInt32 passwordLength = strlen((char*)passwordData);
|
||||
|
@ -85,11 +85,11 @@
|
|||
char *password = nil;
|
||||
SecKeychainItemRef item = nil;
|
||||
SecKeychainFindGenericPassword(NULL, 6, "Bungloo", 17, "BunglooUserAccount", &passwordLength, (void **)&password, &item);
|
||||
|
||||
|
||||
if (!item) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
//Get password
|
||||
NSString *passwordString = [[[NSString alloc] initWithData:[NSData dataWithBytes:password length:passwordLength] encoding:NSUTF8StringEncoding] autorelease];
|
||||
SecKeychainItemFreeContent(NULL, password);
|
||||
|
|
|
@ -213,7 +213,7 @@
|
|||
string = nil;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
|
|
102
Mac/Controller.m
102
Mac/Controller.m
|
@ -26,48 +26,48 @@
|
|||
{
|
||||
[timelineViewWindow setExcludedFromWindowsMenu:YES];
|
||||
[mentionsViewWindow setExcludedFromWindowsMenu:YES];
|
||||
|
||||
|
||||
[self initHotKeys];
|
||||
|
||||
|
||||
[GrowlApplicationBridge setGrowlDelegate:self];
|
||||
|
||||
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
[nc addObserver:self
|
||||
selector:@selector(openNewMessageWindow:)
|
||||
[nc addObserver:self
|
||||
selector:@selector(openNewMessageWindow:)
|
||||
name:@"openNewMessageWindow"
|
||||
object:nil];
|
||||
[nc addObserver:self
|
||||
selector:@selector(sendTweet:)
|
||||
[nc addObserver:self
|
||||
selector:@selector(sendTweet:)
|
||||
name:@"sendTweet"
|
||||
object:nil];
|
||||
[nc addObserver:self
|
||||
selector:@selector(authentificationSucceded:)
|
||||
[nc addObserver:self
|
||||
selector:@selector(authentificationSucceded:)
|
||||
name:@"authentificationSucceded"
|
||||
object:nil];
|
||||
[nc addObserver:self
|
||||
selector:@selector(getTweetUpdates:)
|
||||
[nc addObserver:self
|
||||
selector:@selector(getTweetUpdates:)
|
||||
name:@"getTweetUpdates"
|
||||
object:nil];
|
||||
|
||||
|
||||
NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager];
|
||||
[appleEventManager setEventHandler:self
|
||||
andSelector:@selector(handleGetURLEvent:withReplyEvent:)
|
||||
forEventClass:kInternetEventClass
|
||||
andEventID:kAEGetURL];
|
||||
|
||||
|
||||
|
||||
viewDelegate = [[ViewDelegate alloc] init];
|
||||
accessToken = [[AccessToken alloc] init];
|
||||
|
||||
|
||||
BOOL forceLogin = NO;
|
||||
/*
|
||||
if (![accessToken stringForKey:@"version-0.6.0-new-login"]) {
|
||||
[self logout:self];
|
||||
forceLogin = YES;
|
||||
[accessToken setString:nil forKey:@"entity"];
|
||||
[accessToken setString:nil forKey:@"entity"];
|
||||
[accessToken setString:@"yes" forKey:@"version-0.6.0-new-login"];
|
||||
}*/
|
||||
|
||||
|
||||
if (forceLogin || ![accessToken stringForKey:@"user_access_token"] || ![accessToken secret]) {
|
||||
[timelineViewWindow performClose:self];
|
||||
[mentionsViewWindow performClose:self];
|
||||
|
@ -89,7 +89,7 @@
|
|||
NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Webkit/"];
|
||||
NSURL *url = [NSURL fileURLWithPath:path];
|
||||
NSString *index_string = [NSString stringWithContentsOfFile:[NSString stringWithFormat:@"%@index.html", path] encoding:NSUTF8StringEncoding error:nil];
|
||||
|
||||
|
||||
oauthView = [[WebView alloc] init];
|
||||
viewDelegate.oauthView = oauthView;
|
||||
[[oauthView mainFrame] loadHTMLString:index_string baseURL:url];
|
||||
|
@ -107,11 +107,11 @@
|
|||
if (viewDelegate.timelineView != timelineView)
|
||||
{
|
||||
[self initOauth];
|
||||
|
||||
|
||||
NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/Webkit/"];
|
||||
NSURL *url = [NSURL fileURLWithPath:path];
|
||||
NSString *index_string = [NSString stringWithContentsOfFile:[NSString stringWithFormat:@"%@index.html", path] encoding:NSUTF8StringEncoding error:nil];
|
||||
|
||||
|
||||
viewDelegate.timelineView = timelineView;
|
||||
[[timelineView mainFrame] loadHTMLString:index_string baseURL:url];
|
||||
[timelineView setFrameLoadDelegate:viewDelegate];
|
||||
|
@ -121,7 +121,7 @@
|
|||
//WebPreferences* prefs = [timelineView preferences];
|
||||
//[prefs _setLocalStorageDatabasePath:localStoragePath];
|
||||
//[prefs setLocalStorageEnabled:YES];
|
||||
|
||||
|
||||
viewDelegate.mentionsView = mentionsView;
|
||||
[[mentionsView mainFrame] loadHTMLString:index_string baseURL:url];
|
||||
[mentionsView setFrameLoadDelegate:viewDelegate];
|
||||
|
@ -131,7 +131,7 @@
|
|||
//prefs = [mentionsView preferences];
|
||||
//[prefs _setLocalStorageDatabasePath:localStoragePath];
|
||||
//[prefs setLocalStorageEnabled:YES];
|
||||
|
||||
|
||||
viewDelegate.conversationView = conversationView;
|
||||
[[conversationView mainFrame] loadHTMLString:index_string baseURL:url];
|
||||
[conversationView setFrameLoadDelegate:viewDelegate];
|
||||
|
@ -141,7 +141,7 @@
|
|||
//prefs = [conversationView preferences];
|
||||
//[prefs _setLocalStorageDatabasePath:localStoragePath];
|
||||
//[prefs setLocalStorageEnabled:YES];
|
||||
|
||||
|
||||
viewDelegate.profileView = profileView;
|
||||
[[profileView mainFrame] loadHTMLString:index_string baseURL:url];
|
||||
[profileView setFrameLoadDelegate:viewDelegate];
|
||||
|
@ -166,8 +166,8 @@
|
|||
{
|
||||
|
||||
NSInteger newTweetKey = kVK_ANSI_M; // http://boredzo.org/blog/archives/2007-05-22/virtual-key-codes
|
||||
NSInteger newTweetModifierKey = controlKey + cmdKey + optionKey; // cmdKey 256, shitfKey 512, optionKey 2048, controlKey 4096
|
||||
|
||||
NSInteger newTweetModifierKey = controlKey + cmdKey + optionKey; // cmdKey 256, shitfKey 512, optionKey 2048, controlKey 4096
|
||||
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSInteger defaultsNewTweetKey = (NSInteger)[defaults integerForKey:@"newTweetKey"];
|
||||
|
||||
|
@ -179,7 +179,7 @@
|
|||
{
|
||||
[defaults setInteger:newTweetKey forKey:@"newTweetKey"];
|
||||
}
|
||||
|
||||
|
||||
NSInteger defaultsNewTweetModifierKey = (NSInteger)[defaults integerForKey:@"newTweetModifierKey"];
|
||||
if ([defaults objectForKey:@"newTweetModifierKey"] != nil)
|
||||
{
|
||||
|
@ -189,9 +189,9 @@
|
|||
{
|
||||
[defaults setInteger:newTweetModifierKey forKey:@"newTweetModifierKey"];
|
||||
}
|
||||
|
||||
|
||||
[defaults synchronize];
|
||||
|
||||
|
||||
NSUInteger cocoaModifiers = 0;
|
||||
if (newTweetModifierKey & shiftKey) cocoaModifiers = cocoaModifiers | NSShiftKeyMask;
|
||||
if (newTweetModifierKey & optionKey) cocoaModifiers = cocoaModifiers | NSAlternateKeyMask;
|
||||
|
@ -200,22 +200,22 @@
|
|||
|
||||
[globalHotkeyMenuItem setKeyEquivalent:[Constants stringFromVirtualKeyCode:newTweetKey]];
|
||||
[globalHotkeyMenuItem setKeyEquivalentModifierMask:cocoaModifiers];
|
||||
|
||||
|
||||
/* CARBON from http://github.com/Xjs/drama-button/blob/carbon/Drama_ButtonAppDelegate.m */
|
||||
|
||||
|
||||
EventTypeSpec eventType;
|
||||
eventType.eventClass = kEventClassKeyboard;
|
||||
eventType.eventKind = kEventHotKeyPressed;
|
||||
|
||||
|
||||
InstallApplicationEventHandler(&handler, 1, &eventType, NULL, NULL);
|
||||
|
||||
|
||||
EventHotKeyID g_HotKeyID;
|
||||
g_HotKeyID.id = 1;
|
||||
|
||||
|
||||
EventHotKeyRef g_HotKeyRef;
|
||||
|
||||
|
||||
RegisterEventHotKey(newTweetKey, newTweetModifierKey, g_HotKeyID, GetApplicationEventTarget(), 0, &g_HotKeyRef);
|
||||
|
||||
|
||||
/* end CARBON */
|
||||
}
|
||||
|
||||
|
@ -285,13 +285,13 @@
|
|||
|
||||
- (IBAction)openNewMessageWindow:(id)sender
|
||||
{
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
[[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:nil];
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
[[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:nil];
|
||||
}
|
||||
|
||||
- (void)openNewMessageWindowInReplyTo:(NSString *)userName statusId:(NSString *)statusId withString:(NSString *)string isPrivate:(BOOL)isPrivate
|
||||
{
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
NewMessageWindow *newMessage = (NewMessageWindow *)[[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:nil];
|
||||
[newMessage inReplyTo:userName statusId:statusId withString:string];
|
||||
[newMessage setIsPrivate:isPrivate];
|
||||
|
@ -300,9 +300,9 @@
|
|||
- (void)openNewMessageWindowWithString:(NSString *)aString
|
||||
{
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
|
||||
|
||||
NSRange range = [aString rangeOfString:@"oauthtoken"];
|
||||
|
||||
|
||||
if (range.length > 0)
|
||||
{
|
||||
[oauthView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"bungloo_instance.requestAccessToken('%@')", aString]];
|
||||
|
@ -310,7 +310,7 @@
|
|||
else
|
||||
{
|
||||
NewMessageWindow *newTweet = (NewMessageWindow *)[[NSDocumentController sharedDocumentController] openUntitledDocumentAndDisplay:YES error:nil];
|
||||
[newTweet withString:aString];
|
||||
[newTweet withString:aString];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -325,12 +325,12 @@
|
|||
PostModel *post = (PostModel *)[sender object];
|
||||
NSString *text = [[post.text stringByReplacingOccurrencesOfString:@"\\" withString:@"\\\\"] stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""];
|
||||
text = [text stringByReplacingOccurrencesOfString:@"\n" withString:@"\\n"];
|
||||
|
||||
|
||||
NSString *locationObject = @"null";
|
||||
if (post.location) {
|
||||
locationObject = [NSString stringWithFormat:@"[%f, %f]", post.location.coordinate.latitude, post.location.coordinate.longitude];
|
||||
}
|
||||
|
||||
|
||||
NSString *imageFilePath = @"null";
|
||||
if (post.imageFilePath) {
|
||||
NSError *error;
|
||||
|
@ -340,12 +340,12 @@
|
|||
[data release];
|
||||
imageFilePath = [NSString stringWithFormat:@"\"data:%@;base64,%@\"", mimeType, base64];
|
||||
}
|
||||
|
||||
|
||||
NSString *isPrivate = @"false";
|
||||
if (post.isPrivate) {
|
||||
isPrivate = @"true";
|
||||
}
|
||||
|
||||
|
||||
NSString *func = [NSString stringWithFormat:@"bungloo_instance.sendNewMessage(\"%@\", \"%@\", \"%@\", %@, %@, %@)",
|
||||
text,
|
||||
post.inReplyTostatusId,
|
||||
|
@ -361,7 +361,7 @@
|
|||
{
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSString *pathToPlugin = [@"~/Library/Application Support/Bungloo/Plugin.js" stringByExpandingTildeInPath];
|
||||
|
||||
|
||||
if([fileManager fileExistsAtPath:pathToPlugin])
|
||||
{
|
||||
return [NSString stringWithFormat:@"%@", [NSURL fileURLWithPath:pathToPlugin]];
|
||||
|
@ -432,7 +432,7 @@
|
|||
self.accessToken.userId = userId;
|
||||
self.accessToken.screenName = screenName;
|
||||
[timelineViewWindow makeKeyAndOrderFront:self];
|
||||
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"authentificationSucceded" object:nil];
|
||||
}*/
|
||||
|
||||
|
@ -456,13 +456,13 @@
|
|||
- (IBAction)logout:(id)sender
|
||||
{
|
||||
[oauthView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.logout();"];
|
||||
|
||||
|
||||
[timelineViewWindow performClose:self];
|
||||
[mentionsViewWindow performClose:self];
|
||||
[conversationViewWindow performClose:self];
|
||||
[profileViewWindow performClose:self];
|
||||
[self.loginViewWindow makeKeyAndOrderFront:self];
|
||||
|
||||
|
||||
[timelineView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.logout();"];
|
||||
[mentionsView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.logout();"];
|
||||
}
|
||||
|
@ -474,7 +474,7 @@
|
|||
{
|
||||
//[self unreadMentions:0];
|
||||
[mentionsView stringByEvaluatingJavaScriptFromString:@"bungloo_instance.setAllMentionsRead();"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)getTweetUpdates:(id)sender
|
||||
|
@ -508,9 +508,9 @@
|
|||
NSDictionary *userInfo = (NSDictionary *)clickContext;
|
||||
NSString *postId = [userInfo objectForKey:@"postId"];
|
||||
NSString *entity = [userInfo objectForKey:@"entity"];
|
||||
|
||||
|
||||
[self showConversationForPostId:postId andEntity:entity];
|
||||
|
||||
|
||||
NSString *js = [NSString stringWithFormat:@"bungloo_instance.mentionRead('%@', '%@');", postId, entity];
|
||||
[mentionsView stringByEvaluatingJavaScriptFromString:js];
|
||||
}
|
||||
|
|
|
@ -390,8 +390,8 @@
|
|||
/*! @brief Tries to fill in missing keys in a notification dictionary.
|
||||
* @param notifDict The dictionary to fill in.
|
||||
* @return The dictionary with the keys filled in. This will be a separate instance from \a notifDict.
|
||||
* @discussion This function examines the \a notifDict for missing keys, and
|
||||
* tries to get them from the last known registration dictionary. As of 1.1,
|
||||
* @discussion This function examines the \a notifDict for missing keys, and
|
||||
* tries to get them from the last known registration dictionary. As of 1.1,
|
||||
* the keys that it will look for are:
|
||||
*
|
||||
* \li <code>GROWL_APP_NAME</code>
|
||||
|
@ -410,8 +410,8 @@
|
|||
*@abstract Lets the app know whether growl:// is registered on the system, used for certain methods below this
|
||||
*@return Returns whether growl:// is registered on the system
|
||||
*@discussion Methods such as openGrowlPreferences rely on the growl:// URL scheme to function
|
||||
* Further, this method can provide a check on whether Growl is installed,
|
||||
* however, the framework will not be relying on this method for choosing when/how to notify,
|
||||
* Further, this method can provide a check on whether Growl is installed,
|
||||
* however, the framework will not be relying on this method for choosing when/how to notify,
|
||||
* and it is not recommended that the app rely on it for other than whether to use growl:// methods
|
||||
*@since Growl.framework 1.4
|
||||
*/
|
||||
|
@ -421,7 +421,7 @@
|
|||
* @method openGrowlPreferences:
|
||||
* @abstract Open Growl preferences, optionally to this app's settings, growl:// method
|
||||
* @param showApp Whether to show the application's settings, otherwise just opens to the last position
|
||||
* @return Return's whether opening the URL was succesfull or not.
|
||||
* @return Return's whether opening the URL was succesfull or not.
|
||||
* @discussion Will launch if Growl is installed, but not running, and open the preferences window
|
||||
* Uses growl:// URL scheme
|
||||
* @since Growl.framework 1.4
|
||||
|
|
|
@ -12,15 +12,15 @@
|
|||
|
||||
+(NSString *)mimeTypeForFileAtPath:(NSString *)path error:(NSError **)err {
|
||||
NSString *uti, *mimeType = nil;
|
||||
|
||||
|
||||
if (!(uti = [[NSWorkspace sharedWorkspace] typeOfFile:path error:err]))
|
||||
return nil;
|
||||
if (err)
|
||||
*err = nil;
|
||||
|
||||
|
||||
if ((mimeType = (NSString *)UTTypeCopyPreferredTagWithClass((CFStringRef)uti, kUTTagClassMIMEType)))
|
||||
mimeType = NSMakeCollectable(mimeType);
|
||||
|
||||
|
||||
return mimeType;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
{
|
||||
if ([base64Encoding length] % 4 != 0)
|
||||
return nil;
|
||||
|
||||
|
||||
NSString *plist = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?><plist version=\"1.0\"><data>%@</data></plist>", base64Encoding];
|
||||
return [NSPropertyListSerialization propertyListWithData:[plist dataUsingEncoding:NSASCIIStringEncoding] options:0 format:NULL error:NULL];
|
||||
}
|
||||
|
@ -28,14 +28,14 @@
|
|||
NSRange endRange = [plist rangeOfData:[@"</data>" dataUsingEncoding:NSASCIIStringEncoding] options:NSDataSearchBackwards range:fullRange];
|
||||
if (startRange.location == NSNotFound || endRange.location == NSNotFound)
|
||||
return nil;
|
||||
|
||||
|
||||
NSUInteger base64Location = startRange.location + startRange.length;
|
||||
NSUInteger base64length = endRange.location - base64Location;
|
||||
NSData *base64Data = [NSData dataWithBytesNoCopy:(void *)((uintptr_t)base64Location + (uintptr_t)[plist bytes]) length:base64length freeWhenDone:NO];
|
||||
NSString *base64Encoding = [[NSString alloc] initWithData:base64Data encoding:NSASCIIStringEncoding];
|
||||
base64Encoding = [base64Encoding stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
base64Encoding = [base64Encoding stringByReplacingOccurrencesOfString:@"\n" withString:@""];
|
||||
|
||||
|
||||
#if __has_feature(objc_arc)
|
||||
return base64Encoding;
|
||||
#else
|
||||
|
|
|
@ -88,10 +88,10 @@
|
|||
{
|
||||
// Insert code here to read your document from the given data of the specified type. If the given outError != NULL, ensure that you set *outError when returning NO.
|
||||
|
||||
// You can also choose to override -readFromFileWrapper:ofType:error: or -readFromURL:ofType:error: instead.
|
||||
|
||||
// You can also choose to override -readFromFileWrapper:ofType:error: or -readFromURL:ofType:error: instead.
|
||||
|
||||
// For applications targeted for Panther or earlier systems, you should use the deprecated API -loadDataRepresentation:ofType. In this case you can also choose to override -readFromFile:ofType: or -loadFileWrapperRepresentation:ofType: instead.
|
||||
|
||||
|
||||
if ( outError != NULL )
|
||||
{
|
||||
*outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL];
|
||||
|
@ -102,25 +102,25 @@
|
|||
- (void)inReplyTo:(NSString *)entity statusId:(NSString *)statusId withString:(NSString *)string
|
||||
{
|
||||
[textField setStringValue:string];
|
||||
|
||||
|
||||
NSInteger location = [string rangeOfString:@" "].location;
|
||||
NSInteger length = 0;
|
||||
if (location != NSNotFound) {
|
||||
length = [[textField stringValue] length] - location - 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
NSRange range = {location + 1, length};
|
||||
[[textField currentEditor] setSelectedRange:range];
|
||||
|
||||
|
||||
[inReplyTostatusId release];
|
||||
inReplyTostatusId = statusId;
|
||||
[inReplyTostatusId retain];
|
||||
|
||||
|
||||
[inReplyToEntity release];
|
||||
inReplyToEntity = entity;
|
||||
[inReplyToEntity retain];
|
||||
|
||||
|
||||
[self controlTextDidChange:nil];
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@
|
|||
NSRange range = {[[textField stringValue] length] , 0};
|
||||
[[textField currentEditor] setSelectedRange:range];
|
||||
NSLog(@"BB");
|
||||
|
||||
|
||||
[self controlTextDidChange:nil];
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@
|
|||
{
|
||||
NSRect frame = [(NSButton *)sender frame];
|
||||
NSPoint menuOrigin = [[(NSButton *)sender superview] convertPoint:NSMakePoint(frame.origin.x, frame.origin.y+frame.size.height) toView:nil];
|
||||
|
||||
|
||||
NSEvent *event = [NSEvent mouseEventWithType:NSLeftMouseDown
|
||||
location:menuOrigin
|
||||
modifierFlags:NSLeftMouseDownMask // 0x100
|
||||
|
@ -165,7 +165,7 @@
|
|||
eventNumber:0
|
||||
clickCount:1
|
||||
pressure:1];
|
||||
|
||||
|
||||
[NSMenu popUpContextMenu:self.addMenu withEvent:event forView:self.addMenuButton];
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@
|
|||
if(c < 0) {
|
||||
[counter setTextColor:[NSColor redColor]];
|
||||
} else {
|
||||
[counter setTextColor:[NSColor controlTextColor]];
|
||||
[counter setTextColor:[NSColor controlTextColor]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@
|
|||
|
||||
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error{
|
||||
NSLog(@"CLLocationManager Error: %@", error);
|
||||
|
||||
|
||||
NSMenuItem *menuItem = [self.addMenu itemAtIndex:0];
|
||||
[menuItem setTitle:@"Current location not available"];
|
||||
}
|
||||
|
@ -252,17 +252,17 @@
|
|||
- (BOOL)control:(NSControl *)control textView:(NSTextView *)fieldEditor doCommandBySelector:(SEL)commandSelector
|
||||
{
|
||||
BOOL retval = NO;
|
||||
|
||||
|
||||
BOOL isEnter = [[NSApp currentEvent] keyCode] == 76;
|
||||
|
||||
|
||||
if (commandSelector == @selector(insertNewline:) && !isEnter) {
|
||||
|
||||
|
||||
NSText *text = [[textField window] fieldEditor:YES forObject:nil];
|
||||
|
||||
|
||||
NSRange range = [text selectedRange];
|
||||
NSString *stringBefore = [textField.stringValue substringToIndex:range.location];
|
||||
NSString *stringAfter = [textField.stringValue substringFromIndex:range.location + range.length];
|
||||
|
||||
|
||||
textField.stringValue = [NSString stringWithFormat:@"%@\n%@", stringBefore, stringAfter];
|
||||
|
||||
NSRange r = NSMakeRange(range.location + 1, 0);
|
||||
|
@ -275,7 +275,7 @@
|
|||
retval = YES;
|
||||
[self sendPost:control];
|
||||
}
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -288,17 +288,17 @@
|
|||
if (!self.imageFilePath)
|
||||
{
|
||||
[menuItem setTitle:@"Remove photo"];
|
||||
|
||||
|
||||
NSOpenPanel* openDlg = [NSOpenPanel openPanel];
|
||||
[openDlg setPrompt:@"Select"];
|
||||
[openDlg setDelegate:self];
|
||||
|
||||
|
||||
// Enable the selection of files in the dialog.
|
||||
[openDlg setCanChooseFiles:YES];
|
||||
|
||||
|
||||
// Enable the selection of directories in the dialog.
|
||||
[openDlg setCanChooseDirectories:NO];
|
||||
|
||||
|
||||
// Display the dialog. If the OK button was pressed,
|
||||
// process the files.
|
||||
if ( [openDlg runModalForDirectory:nil file:nil] == NSOKButton )
|
||||
|
@ -306,7 +306,7 @@
|
|||
// Get an array containing the full filenames of all
|
||||
// files and directories selected.
|
||||
NSArray* files = [openDlg filenames];
|
||||
|
||||
|
||||
// Loop through all the files and process them.
|
||||
for( int i = 0; i < [files count]; i++ )
|
||||
{
|
||||
|
@ -327,7 +327,7 @@
|
|||
if ([ext isEqualToString:@""] || [ext isEqualToString:@"/"] || ext == nil || ext == NULL || [ext length] < 1) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
NSEnumerator* tagEnumerator = [[NSArray arrayWithObjects:@"png", @"jpg", @"gif", @"jpeg", nil] objectEnumerator];
|
||||
NSString* allowedExt;
|
||||
while ((allowedExt = [tagEnumerator nextObject]))
|
||||
|
@ -337,7 +337,7 @@
|
|||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,16 +13,16 @@
|
|||
NSString *title;
|
||||
NSDate *date;
|
||||
NSString *itemDescription;
|
||||
|
||||
|
||||
NSURL *releaseNotesURL;
|
||||
|
||||
NSString *DSASignature;
|
||||
|
||||
NSString *DSASignature;
|
||||
NSString *minimumSystemVersion;
|
||||
|
||||
|
||||
NSURL *fileURL;
|
||||
NSString *versionString;
|
||||
NSString *displayVersionString;
|
||||
|
||||
|
||||
NSDictionary *propertiesDictionary;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
@interface SUUpdater : NSObject {
|
||||
NSTimer *checkTimer;
|
||||
SUUpdateDriver *driver;
|
||||
|
||||
|
||||
SUHost *host;
|
||||
IBOutlet id delegate;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
@protocol SUVersionComparison
|
||||
|
||||
/*!
|
||||
@method
|
||||
@method
|
||||
@abstract An abstract method to compare two version strings.
|
||||
@discussion Should return NSOrderedAscending if b > a, NSOrderedDescending if b < a, and NSOrderedSame if they are equivalent.
|
||||
*/
|
||||
|
|
|
@ -16,13 +16,13 @@
|
|||
- (void)webView:(WebView *)sender addMessageToConsole:(NSDictionary *)message;{
|
||||
|
||||
if (![message isKindOfClass:[NSDictionary class]]) return;
|
||||
|
||||
|
||||
NSString *viewName = @"TimelineView";
|
||||
if (sender == mentionsView) viewName = @"MentionsView";
|
||||
if (sender == conversationView) viewName = @"ConversationView";
|
||||
if (sender == oauthView) viewName = @"OauthView";
|
||||
if (sender == profileView) viewName = @"ProfileView";
|
||||
|
||||
|
||||
NSLog(@"js<%@>: %@:%@: %@",
|
||||
viewName,
|
||||
[[message objectForKey:@"sourceURL"] lastPathComponent],
|
||||
|
@ -46,7 +46,7 @@
|
|||
NSLocalizedString(@"OK", @""), // default button
|
||||
NSLocalizedString(@"Cancel", @""), // alt button
|
||||
nil);
|
||||
return NSAlertDefaultReturn == result;
|
||||
return NSAlertDefaultReturn == result;
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
@ -56,45 +56,45 @@
|
|||
}
|
||||
|
||||
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
|
||||
|
||||
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSString *pathToJsPlugin = [@"~/Library/Application Support/bungloo/Plugin.js" stringByExpandingTildeInPath];
|
||||
NSString *pathToCssPlugin = [@"~/Library/Application Support/bungloo/Plugin.css" stringByExpandingTildeInPath];
|
||||
|
||||
|
||||
if([fileManager fileExistsAtPath:pathToCssPlugin])
|
||||
{
|
||||
[sender stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"setTimeout(function() { loadCssPlugin('file://localhost%@') }, 1000);", pathToCssPlugin]];
|
||||
}
|
||||
|
||||
|
||||
if([fileManager fileExistsAtPath:pathToJsPlugin])
|
||||
{
|
||||
[sender stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"setTimeout(function() { loadJsPlugin('file://localhost%@') }, 1000);", pathToJsPlugin]];
|
||||
}
|
||||
|
||||
|
||||
[sender stringByEvaluatingJavaScriptFromString:@"var OS_TYPE = 'mac';"];
|
||||
|
||||
if (sender == oauthView) {
|
||||
|
||||
|
||||
[oauthView stringByEvaluatingJavaScriptFromString:@"function HostAppGo() { start('oauth') }"];
|
||||
|
||||
} else if(sender == conversationView) {
|
||||
|
||||
|
||||
[conversationView stringByEvaluatingJavaScriptFromString:@"function HostAppGo() { start('conversation') }"];
|
||||
|
||||
|
||||
} else if(sender == profileView) {
|
||||
|
||||
|
||||
[profileView stringByEvaluatingJavaScriptFromString:@"function HostAppGo() { start('profile') }"];
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
NSString *action = @"timeline";
|
||||
NSString *delay = @"1";
|
||||
|
||||
|
||||
if (sender == mentionsView) {
|
||||
action = @"mentions";
|
||||
delay = @"1000";
|
||||
}
|
||||
|
||||
|
||||
[sender stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"function HostAppGo() { start('%@') }", action]];
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@
|
|||
// FIXME
|
||||
/*
|
||||
NSMutableArray *menuItems = [NSMutableArray arrayWithArray:defaultMenuItems];
|
||||
|
||||
|
||||
for (NSMenuItem*item in defaultMenuItems) {
|
||||
if ([[item title] isEqualToString:@"Reload"]) {
|
||||
//[item setAction:@selector(reload:)];
|
||||
|
@ -113,7 +113,7 @@
|
|||
[menuItems addObject:item];
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
return defaultMenuItems;
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@
|
|||
{
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSString *pathToPlugin = [@"~/Library/Application Support/Bungloo/Plugin.js" stringByExpandingTildeInPath];
|
||||
|
||||
|
||||
if([fileManager fileExistsAtPath:pathToPlugin])
|
||||
{
|
||||
return [NSString stringWithFormat:@"%@", [NSURL fileURLWithPath:pathToPlugin]];
|
||||
|
|
|
@ -174,7 +174,7 @@
|
|||
<p>Moved reply icon to left so it is easier to use when the scrollbar is shown</p>
|
||||
<p>Login with the [Login] button now works</p>
|
||||
<p>Fixed automatic updates so it will work next time again.</p>
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
<h1>Tentia 0.2.0</h2>
|
||||
|
@ -191,15 +191,15 @@
|
|||
<p>Mentions now appear as realnames</p>
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
<h1>Tentia 0.1.1</h1>
|
||||
<p>Bugfixes</p>
|
||||
<p>Changed to send on Cmd+Enter.</p>
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
<h1>Tentia 0.1.0</h1>
|
||||
<p>First attempt to rewrite the old Twitter client Twittia to a new and shiny Tent client Tentia.</p>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -39,7 +39,7 @@ ol li, .error, header.profile {
|
|||
}
|
||||
|
||||
body > ol > li {
|
||||
|
||||
|
||||
}
|
||||
|
||||
body > ol > li:first-child {
|
||||
|
|
|
@ -47,7 +47,7 @@ function(HostApp, Core, Paths, URI) {
|
|||
var dom_element = _this.getStatusDOMElement(status);
|
||||
|
||||
if (node) {
|
||||
|
||||
|
||||
node.parentNode.insertBefore(dom_element, node);
|
||||
|
||||
} else {
|
||||
|
@ -115,7 +115,7 @@ function(HostApp, Core, Paths, URI) {
|
|||
|
||||
var _this = this;
|
||||
var callback = function(resp) {
|
||||
|
||||
|
||||
var statuses = JSON.parse(resp.responseText);
|
||||
|
||||
for (var i = 0; i < statuses.length; i++) {
|
||||
|
|
|
@ -33,13 +33,13 @@ function(HostApp, Timeline, URI, Paths) {
|
|||
|
||||
for (var i = 0; i < statuses.length; i++) {
|
||||
var status = statuses[i];
|
||||
|
||||
|
||||
var name;
|
||||
var profile = this.cache.profiles.getItem(status.entity);
|
||||
if(profile) {
|
||||
name = profile["https://tent.io/types/info/basic/v0.1.0"].name;
|
||||
}
|
||||
|
||||
|
||||
HostApp.notificateUserAboutMention(status.content.text, name || status.entity, status.id, status.entity);
|
||||
};
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ function(HostApp, Timeline, URI, Paths) {
|
|||
add_to_search = add_to_search || {};
|
||||
|
||||
if (!add_to_search["mentioned_entity"]) {
|
||||
add_to_search["mentioned_entity"] = HostApp.stringForKey("entity");
|
||||
add_to_search["mentioned_entity"] = HostApp.stringForKey("entity");
|
||||
}
|
||||
|
||||
Timeline.prototype.getNewData.call(this, add_to_search);
|
||||
|
|
|
@ -92,7 +92,7 @@ function(HostApp, Paths, Hmac) {
|
|||
// mac_key
|
||||
// mac_algorithm
|
||||
this.register_data = register_data;
|
||||
|
||||
|
||||
// Needed for later App Registration Modification
|
||||
HostApp.setStringForKey(register_data["mac_key"], "app_mac_key");
|
||||
HostApp.setStringForKey(register_data["mac_key_id"], "app_mac_key_id");
|
||||
|
@ -130,9 +130,9 @@ function(HostApp, Paths, Hmac) {
|
|||
};
|
||||
|
||||
var auth_header = Hmac.makeAuthHeader(
|
||||
url,
|
||||
http_method,
|
||||
HostApp.stringForKey("app_mac_key"),
|
||||
url,
|
||||
http_method,
|
||||
HostApp.stringForKey("app_mac_key"),
|
||||
HostApp.stringForKey("app_mac_key_id")
|
||||
);
|
||||
|
||||
|
@ -147,13 +147,13 @@ function(HostApp, Paths, Hmac) {
|
|||
|
||||
Oauth.prototype.requestAccessTokenTicketFinished = function(responseBody) {
|
||||
|
||||
var access = JSON.parse(responseBody);
|
||||
var access = JSON.parse(responseBody);
|
||||
|
||||
HostApp.setStringForKey(access["access_token"], "user_access_token");
|
||||
HostApp.setSecret(access["mac_key"]);
|
||||
HostApp.setStringForKey(access["mac_algorithm"], "user_mac_algorithm");
|
||||
HostApp.setStringForKey(access["token_type"], "user_token_type");
|
||||
|
||||
|
||||
HostApp.loggedIn();
|
||||
}
|
||||
|
||||
|
@ -162,9 +162,9 @@ function(HostApp, Paths, Hmac) {
|
|||
var url = Paths.mkApiRootPath("/apps/" + HostApp.stringForKey("app_id"));
|
||||
var http_method = "DELETE";
|
||||
var auth_header = Hmac.makeAuthHeader(
|
||||
url,
|
||||
http_method,
|
||||
HostApp.stringForKey("app_mac_key"),
|
||||
url,
|
||||
http_method,
|
||||
HostApp.stringForKey("app_mac_key"),
|
||||
HostApp.stringForKey("app_mac_key_id")
|
||||
);
|
||||
|
||||
|
@ -178,10 +178,10 @@ function(HostApp, Paths, Hmac) {
|
|||
HostApp.setStringForKey(null, "user_mac_algorithm");
|
||||
HostApp.setStringForKey(null, "user_token_type");
|
||||
HostApp.setStringForKey(null, "api_root");
|
||||
HostApp.setStringForKey(null, "entity");
|
||||
HostApp.setStringForKey(null, "entity");
|
||||
}, null, auth_header);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return Oauth;
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ function(HostApp, Core, Paths, URI) {
|
|||
this.populate(this.profile_template.location, basic.location);
|
||||
this.populate(this.profile_template.gender, basic.gender);
|
||||
this.populate(this.profile_template.bio, basic.bio);
|
||||
|
||||
|
||||
if(basic.website_url) {
|
||||
|
||||
var url = basic.website_url;
|
||||
|
@ -405,7 +405,7 @@ function(HostApp, Core, Paths, URI) {
|
|||
var _this = this;
|
||||
|
||||
if (this.following_id) {
|
||||
|
||||
|
||||
this.setFollowingButton(false);
|
||||
var url = Paths.mkApiRootPath("/followings/") + this.following_id;
|
||||
Paths.getURL(url, "DELETE", function(resp) {
|
||||
|
@ -566,7 +566,7 @@ function(HostApp, Core, Paths, URI) {
|
|||
|
||||
}, null, false); // do not send auth-headers
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return li;
|
||||
|
|
|
@ -146,7 +146,7 @@ function(Core, Paths, HostApp, URI) {
|
|||
if (!callback) {
|
||||
callback = function(data) { _this.getNewData(); }
|
||||
}
|
||||
Core.prototype.repost.call(this, id, entity, callback);
|
||||
Core.prototype.repost.call(this, id, entity, callback);
|
||||
}
|
||||
|
||||
Timeline.prototype.logout = function() {
|
||||
|
|
|
@ -56,7 +56,7 @@ function(URI, CacheStorage, require) {
|
|||
Cache.prototype.stopGettingFollowings = function() {
|
||||
clearTimeout(this.intervall);
|
||||
}
|
||||
|
||||
|
||||
return Cache;
|
||||
|
||||
});
|
|
@ -17,9 +17,9 @@ function() {
|
|||
|
||||
CacheStorage.prototype.getItem = function(key) {
|
||||
var item = null;
|
||||
|
||||
|
||||
try { // If localStorage doesn't work then just leave it empty
|
||||
item = JSON.parse(localStorage.getItem(this.mkPath(key)));
|
||||
item = JSON.parse(localStorage.getItem(this.mkPath(key)));
|
||||
} catch(e) {}
|
||||
|
||||
return item;
|
||||
|
@ -35,7 +35,7 @@ function() {
|
|||
var length_path = this.mkInternalPath("_length");
|
||||
var length = parseInt(localStorage.getItem(length_path), 10) + 1;
|
||||
localStorage.setItem(length_path, length);
|
||||
}
|
||||
}
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ function() {
|
|||
var length_path = this.mkInternalPath("_length");
|
||||
var length = parseInt(localStorage.getItem(length_path), 10) - 1;
|
||||
localStorage.setItem(length_path, length);
|
||||
}
|
||||
}
|
||||
} catch(e) {}
|
||||
};
|
||||
|
||||
|
@ -62,7 +62,7 @@ function() {
|
|||
}
|
||||
}
|
||||
|
||||
localStorage.setItem(this.mkInternalPath("_length"), 0);
|
||||
localStorage.setItem(this.mkInternalPath("_length"), 0);
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,20 +18,20 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
if(this.template == "undefined") {
|
||||
return jQuery.extend(true, {}, this.template);
|
||||
}
|
||||
|
||||
|
||||
var a = document.createElement("a");
|
||||
|
||||
|
||||
var item = document.createElement("li");
|
||||
|
||||
var aside = document.createElement("aside");
|
||||
item.appendChild(aside);
|
||||
|
||||
|
||||
var reply_to = a.cloneNode();
|
||||
reply_to.className = "reply_to"
|
||||
reply_to.innerText = " ";
|
||||
reply_to.href = "#";
|
||||
aside.appendChild(reply_to);
|
||||
|
||||
|
||||
var repost = a.cloneNode();
|
||||
repost.className = "repost";
|
||||
repost.innerText = " ";
|
||||
|
@ -43,29 +43,29 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
remove.innerText = " ";
|
||||
remove.href = "#";
|
||||
aside.appendChild(remove);
|
||||
|
||||
|
||||
var image = document.createElement("img");
|
||||
image.className = "image";
|
||||
image.src = "img/default-avatar.png";
|
||||
image.onmousedown = function(e) { e.preventDefault(); };
|
||||
item.appendChild(image);
|
||||
|
||||
|
||||
var image_username = a.cloneNode();
|
||||
image.appendChild(image_username);
|
||||
|
||||
|
||||
var data = document.createElement("div");
|
||||
data.className = "data";
|
||||
item.appendChild(data);
|
||||
|
||||
|
||||
var head = document.createElement("h1");
|
||||
data.appendChild(head);
|
||||
|
||||
|
||||
var username = a.cloneNode();
|
||||
head.appendChild(username);
|
||||
|
||||
|
||||
var space = document.createTextNode(" ");
|
||||
head.appendChild(space);
|
||||
|
||||
|
||||
var geo = document.createElement("a");
|
||||
geo.style.display = "none";
|
||||
head.appendChild(geo);
|
||||
|
@ -80,7 +80,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
head.appendChild(is_private);
|
||||
|
||||
head.appendChild(space.cloneNode());
|
||||
|
||||
|
||||
var pin = document.createElement("img");
|
||||
pin.src = "img/pin.png";
|
||||
pin.alt = "Map link";
|
||||
|
@ -102,29 +102,29 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
|
||||
head.appendChild(reposted_by)
|
||||
|
||||
|
||||
|
||||
var message = document.createElement("p");
|
||||
message.className = "message";
|
||||
data.appendChild(message);
|
||||
|
||||
|
||||
var images = document.createElement("p")
|
||||
images.className = "images";
|
||||
data.appendChild(images);
|
||||
|
||||
|
||||
var date = message.cloneNode();
|
||||
date.className = "date";
|
||||
data.appendChild(date);
|
||||
|
||||
|
||||
var ago = a.cloneNode();
|
||||
date.appendChild(ago);
|
||||
|
||||
|
||||
var from = document.createTextNode(" from ");
|
||||
date.appendChild(from)
|
||||
|
||||
|
||||
var source = document.createElement("a");
|
||||
source.className = "source";
|
||||
date.appendChild(source)
|
||||
|
||||
|
||||
this.template = {
|
||||
item: item,
|
||||
reply_to: reply_to,
|
||||
|
@ -238,15 +238,15 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
|
||||
}, null, false); // do not send auth-headers
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (status && status.permissions && !status.permissions.public) {
|
||||
template.is_private.style.display = '';
|
||||
}
|
||||
|
||||
|
||||
var text = "";
|
||||
|
||||
|
||||
if (status.type == "https://tent.io/types/post/photo/v0.1.0") {
|
||||
text = status.content.caption;
|
||||
} else {
|
||||
|
@ -271,7 +271,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
for (var i = 0; i < status.attachments.length; i++) {
|
||||
// closure needed for the callback
|
||||
(function() {
|
||||
|
||||
|
||||
var attachment = status.attachments[i];
|
||||
|
||||
var img = new Image();
|
||||
|
@ -317,7 +317,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
HostApp.showConversation(status.id, status.entity);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// {"type":"Point","coordinates":[57.10803113,12.25854746]}
|
||||
if (status.content && status.content.location && (typeof status.content.location.type == "undefined" || status.content.location.type == "Point")) {
|
||||
var href = "http://www.openstreetmap.org/?mlat=" + status.content.location.coordinates[0] + "&mlon=" + status.content.location.coordinates[1] + "&zoom=12"
|
||||
|
@ -328,7 +328,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
if (typeof status.__repost != "undefined") {
|
||||
template.source.href = status.__repost.app.url;
|
||||
template.source.innerHTML = status.__repost.app.name;
|
||||
template.source.title = status.__repost.app.url;
|
||||
template.source.title = status.__repost.app.url;
|
||||
} else {
|
||||
template.source.href = status.app.url;
|
||||
template.source.innerHTML = status.app.name;
|
||||
|
@ -372,7 +372,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
}
|
||||
|
||||
var reposted_count = $(post).find(".reposted_by ul li").length + 1;
|
||||
|
||||
|
||||
var people_person = reposted_count == 1 ? "person" : "people";
|
||||
|
||||
$(post).find(".reposted_by span").html("by " + reposted_count + " " + people_person);
|
||||
|
@ -381,12 +381,12 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
var li = $("<li/>");
|
||||
li.attr("id", "post-" + repost.id)
|
||||
var a = $("<a/>");
|
||||
|
||||
|
||||
a.attr("href", repost.entity);
|
||||
a.attr("title", repost.entity);
|
||||
a.html(repost.entity);
|
||||
li.append(a);
|
||||
$(post).find(".reposted_by ul").append(li);
|
||||
$(post).find(".reposted_by ul").append(li);
|
||||
|
||||
|
||||
a.click(function(e) {
|
||||
|
@ -600,10 +600,10 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
|
||||
|
||||
Core.prototype.logout = function() {
|
||||
|
||||
|
||||
this.body.innerHTML = "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Helper functions
|
||||
|
||||
|
@ -613,9 +613,9 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
if(url.startsWith("http://j.mp/")) {
|
||||
api = "http://api.j.mp";
|
||||
}
|
||||
|
||||
|
||||
var api_url = api + "/v3/expand?format=json&apiKey=R_4fc2a1aa461d076556016390fa6400f6&login=twittia&shortUrl=" + url; // FIXME: new api key
|
||||
|
||||
|
||||
jQuery.ajax({
|
||||
url: api_url,
|
||||
success: function(data) {
|
||||
|
@ -636,7 +636,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
|
||||
var text = node.innerHTML;
|
||||
var mentions_in_text = [];
|
||||
|
||||
|
||||
var res = text.match(/(\^[\w:/.]+(?:[\w]))/ig);
|
||||
|
||||
if (res) {
|
||||
|
@ -665,7 +665,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
(function(mention) { // need this closure
|
||||
|
||||
var profile = function(profile) {
|
||||
|
||||
|
||||
var basic = profile["https://tent.io/types/info/basic/v0.1.0"];
|
||||
|
||||
if (profile) {
|
||||
|
@ -675,7 +675,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
}
|
||||
|
||||
var new_text = node.innerHTML.replace(
|
||||
mention.text,
|
||||
mention.text,
|
||||
"<a href='" + mention.entity + "' class='name' title='" + mention.entity + "'>"
|
||||
+ name
|
||||
+ "</a>"
|
||||
|
@ -712,7 +712,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
if (resp.status >= 200 && resp.status < 400) {
|
||||
var p = JSON.parse(resp.responseText);
|
||||
_this.cache.profiles.setItem(mention.entity, p);
|
||||
profile(p)
|
||||
profile(p)
|
||||
}
|
||||
}, null, false); // do not send auth-headers
|
||||
}
|
||||
|
@ -726,16 +726,16 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
Core.prototype.parseMentions = function(text, post_id, entity) {
|
||||
|
||||
var mentions = [];
|
||||
|
||||
|
||||
if (post_id && entity && post_id != "(null)" && entity != "(null)") {
|
||||
mentions.push({
|
||||
post: post_id,
|
||||
entity: entity
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
var res = text.match(/(\^[\w:/]+\.[\w:/.]+(?:[\w]))/ig);
|
||||
|
||||
|
||||
if (res) {
|
||||
for (var i = 0; i < res.length; i++) {
|
||||
var e = res[i].substring(1);
|
||||
|
@ -791,7 +791,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
return text.replace(hash, "$1$2<a href='https://skate.io/search?q=%23$3'>$3</a>");
|
||||
}
|
||||
|
||||
Core.prototype.replyTo = function(entity, status_id, mentions, is_private) {
|
||||
Core.prototype.replyTo = function(entity, status_id, mentions, is_private) {
|
||||
|
||||
var string = "^" + entity.replace("https://", "") + " ";
|
||||
for (var i = 0; i < mentions.length; i++) {
|
||||
|
@ -815,7 +815,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
} else {
|
||||
var reposted_by = ul.parent(".reposted_by");
|
||||
var reposted_count = reposted_by.find("ul li").length;
|
||||
|
||||
|
||||
var people_person = reposted_count == 1 ? "person" : "people";
|
||||
|
||||
reposted_by.find("span").html("by " + reposted_count + " " + people_person);
|
||||
|
|
|
@ -18,7 +18,7 @@ function(URI, CryptoJS) {
|
|||
port = url.protocol() == "https" ? "443" : "80";
|
||||
}
|
||||
|
||||
var normalizedRequestString = ""
|
||||
var normalizedRequestString = ""
|
||||
+ time_stamp + '\n'
|
||||
+ nonce + '\n'
|
||||
+ http_method + '\n'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
define(function() {
|
||||
|
||||
|
||||
var HostApp = {};
|
||||
|
||||
HostApp.setStringForKey = function(string, key) {
|
||||
|
@ -10,16 +10,16 @@ define(function() {
|
|||
controller.setStringForKey(string, key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HostApp.setSecret = function(string) {
|
||||
|
||||
|
||||
if (OS_TYPE == "mac") {
|
||||
controller.setSecret_(string);
|
||||
} else {
|
||||
controller.setStringForKey(string, "user_mac_key");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HostApp.secret = function() {
|
||||
if (OS_TYPE == "mac") {
|
||||
return controller.secret();
|
||||
|
@ -140,6 +140,6 @@ define(function() {
|
|||
}
|
||||
}
|
||||
|
||||
return HostApp;
|
||||
return HostApp;
|
||||
|
||||
});
|
|
@ -46,13 +46,13 @@ function(jQuery, HostApp, Hmac, Cache) {
|
|||
if (auth_header !== false && typeof user_access_token != "undefined") {
|
||||
|
||||
auth_header = Hmac.makeAuthHeader(
|
||||
url,
|
||||
http_method,
|
||||
url,
|
||||
http_method,
|
||||
HostApp.secret(),
|
||||
user_access_token
|
||||
);
|
||||
xhr.setRequestHeader("Authorization", auth_header);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
url: url,
|
||||
|
@ -85,14 +85,14 @@ function(jQuery, HostApp, Hmac, Cache) {
|
|||
if (user_access_token) {
|
||||
|
||||
auth_header = Hmac.makeAuthHeader(
|
||||
url,
|
||||
"POST",
|
||||
url,
|
||||
"POST",
|
||||
HostApp.secret(),
|
||||
user_access_token
|
||||
);
|
||||
|
||||
xhr.setRequestHeader("Authorization", auth_header);
|
||||
}
|
||||
}
|
||||
},
|
||||
url: url,
|
||||
contentType: "multipart/form-data;boundary=" + boundary,
|
||||
|
|
|
@ -9,7 +9,7 @@ function start(view) {
|
|||
|
||||
if (view == "oauth") {
|
||||
require(["controller/Oauth"], function(Oauth) {
|
||||
|
||||
|
||||
bungloo_instance = new Oauth();
|
||||
|
||||
});
|
||||
|
@ -17,9 +17,9 @@ function start(view) {
|
|||
} else if (view == "timeline") {
|
||||
|
||||
require(["controller/Timeline"], function(Timeline) {
|
||||
|
||||
|
||||
bungloo_instance = new Timeline();
|
||||
|
||||
|
||||
});
|
||||
|
||||
} else if (view == "mentions") {
|
||||
|
@ -131,7 +131,7 @@ function loadCssPlugin(css_url) {
|
|||
}
|
||||
|
||||
function debug(string) {
|
||||
|
||||
|
||||
if (typeof string != "string") {
|
||||
string = JSON.stringify(string);
|
||||
}
|
||||
|
@ -141,18 +141,18 @@ function debug(string) {
|
|||
|
||||
function go() { // wait untill everything is loaded
|
||||
setTimeout(function() {
|
||||
|
||||
|
||||
if (typeof HostAppGo != typeof __not_defined__) {
|
||||
|
||||
HostAppGo();
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
go();
|
||||
|
||||
}
|
||||
|
||||
}, 500);
|
||||
}, 500);
|
||||
}
|
||||
|
||||
go();
|
Reference in a new issue