fixed #165 by adding a inline preview like on Facebook
This commit is contained in:
parent
9c5818511e
commit
e6e1ed9bbf
4 changed files with 79 additions and 71 deletions
|
@ -830,7 +830,7 @@
|
|||
<nil key="NSViewClass"/>
|
||||
<nil key="NSUserInterfaceItemIdentifier"/>
|
||||
<object class="NSView" key="NSWindowView" id="332867700">
|
||||
<nil key="NSNextResponder"/>
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
|
@ -860,6 +860,7 @@
|
|||
</object>
|
||||
<string key="NSFrameSize">{397, 581}</string>
|
||||
<reference key="NSSuperview" ref="332867700"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="FrameName"/>
|
||||
<string key="GroupName"/>
|
||||
|
@ -867,10 +868,18 @@
|
|||
<string key="Identifier">13</string>
|
||||
<object class="NSMutableDictionary" key="Values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys" id="0">
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>13WebKitJavaEnabled</string>
|
||||
<string>13WebKitJavaScriptCanOpenWindowsAutomatically</string>
|
||||
<string>13WebKitPluginsEnabled</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<boolean value="NO"/>
|
||||
<boolean value="NO"/>
|
||||
<boolean value="NO"/>
|
||||
</object>
|
||||
<reference key="dict.values" ref="0"/>
|
||||
</object>
|
||||
</object>
|
||||
<bool key="UseBackForwardList">NO</bool>
|
||||
|
@ -878,6 +887,8 @@
|
|||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{397, 581}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="690752143"/>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
|
||||
|
@ -898,7 +909,7 @@
|
|||
<nil key="NSViewClass"/>
|
||||
<nil key="NSUserInterfaceItemIdentifier"/>
|
||||
<object class="NSView" key="NSWindowView" id="438898709">
|
||||
<nil key="NSNextResponder"/>
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
|
@ -928,6 +939,7 @@
|
|||
</object>
|
||||
<string key="NSFrameSize">{376, 581}</string>
|
||||
<reference key="NSSuperview" ref="438898709"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="FrameName"/>
|
||||
<string key="GroupName"/>
|
||||
|
@ -935,8 +947,18 @@
|
|||
<string key="Identifier">12</string>
|
||||
<object class="NSMutableDictionary" key="Values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference key="dict.sortedKeys" ref="0"/>
|
||||
<reference key="dict.values" ref="0"/>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>12WebKitJavaEnabled</string>
|
||||
<string>12WebKitJavaScriptCanOpenWindowsAutomatically</string>
|
||||
<string>12WebKitPluginsEnabled</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<boolean value="NO"/>
|
||||
<boolean value="NO"/>
|
||||
<boolean value="NO"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<bool key="UseBackForwardList">NO</bool>
|
||||
|
@ -944,6 +966,8 @@
|
|||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{376, 581}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="126069112"/>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
|
||||
|
@ -961,7 +985,7 @@
|
|||
<nil key="NSViewClass"/>
|
||||
<nil key="NSUserInterfaceItemIdentifier"/>
|
||||
<object class="NSView" key="NSWindowView" id="469460548">
|
||||
<nil key="NSNextResponder"/>
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
|
@ -991,6 +1015,7 @@
|
|||
</object>
|
||||
<string key="NSFrameSize">{376, 581}</string>
|
||||
<reference key="NSSuperview" ref="469460548"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="FrameName"/>
|
||||
<string key="GroupName"/>
|
||||
|
@ -1000,6 +1025,8 @@
|
|||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{376, 581}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="352293288"/>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
|
||||
|
@ -1017,7 +1044,7 @@
|
|||
<nil key="NSViewClass"/>
|
||||
<nil key="NSUserInterfaceItemIdentifier"/>
|
||||
<object class="NSView" key="NSWindowView" id="352860314">
|
||||
<nil key="NSNextResponder"/>
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
|
@ -1047,6 +1074,7 @@
|
|||
</object>
|
||||
<string key="NSFrameSize">{376, 581}</string>
|
||||
<reference key="NSSuperview" ref="352860314"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="FrameName"/>
|
||||
<string key="GroupName"/>
|
||||
|
@ -1056,6 +1084,8 @@
|
|||
</object>
|
||||
</object>
|
||||
<string key="NSFrameSize">{376, 581}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="106985301"/>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
|
||||
|
@ -1918,7 +1948,9 @@
|
|||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">0</int>
|
||||
<reference key="object" ref="0"/>
|
||||
<object class="NSArray" key="object" id="0">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<reference key="children" ref="1048"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
|
@ -3087,11 +3119,7 @@
|
|||
<string>clearCache:</string>
|
||||
<string>login:</string>
|
||||
<string>logout:</string>
|
||||
<string>openNewMessageWindow:</string>
|
||||
<string>sendPost:</string>
|
||||
<string>showConversationForPostId:andEntity:</string>
|
||||
<string>showProfile:</string>
|
||||
<string>showProfileForEntity:</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
|
@ -3099,10 +3127,6 @@
|
|||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>NSString</string>
|
||||
<string>id</string>
|
||||
<string>NSString</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="actionInfosByName">
|
||||
|
@ -3112,11 +3136,7 @@
|
|||
<string>clearCache:</string>
|
||||
<string>login:</string>
|
||||
<string>logout:</string>
|
||||
<string>openNewMessageWindow:</string>
|
||||
<string>sendPost:</string>
|
||||
<string>showConversationForPostId:andEntity:</string>
|
||||
<string>showProfile:</string>
|
||||
<string>showProfileForEntity:</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
|
@ -3132,26 +3152,10 @@
|
|||
<string key="name">logout:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">openNewMessageWindow:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">sendPost:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">showConversationForPostId:andEntity:</string>
|
||||
<string key="candidateClassName">NSString</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">showProfile:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">showProfileForEntity:</string>
|
||||
<string key="candidateClassName">NSString</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
@synthesize timelineView, mentionsView, conversationView, profileView, oauthView;
|
||||
|
||||
- (void)webView:(WebView *)sender addMessageToConsole:(NSDictionary *)message;{
|
||||
- (void)webView:(WebView *)sender addMessageToConsole:(NSDictionary *)message {
|
||||
|
||||
if (![message isKindOfClass:[NSDictionary class]]) return;
|
||||
|
||||
|
@ -51,8 +51,16 @@
|
|||
}
|
||||
|
||||
- (void)webView:(WebView *)sender decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id <WebPolicyDecisionListener>)listener {
|
||||
[listener ignore];
|
||||
[[NSWorkspace sharedWorkspace] openURL:[request URL]];
|
||||
|
||||
NSArray *frames = [NSArray arrayWithObjects:timelineView.mainFrame, mentionsView.mainFrame, conversationView.mainFrame, oauthView.mainFrame, profileView.mainFrame, nil];
|
||||
|
||||
// If it is clicked from one of the views the open default browser
|
||||
if ([frames indexOfObject:frame] != NSNotFound) {
|
||||
[listener ignore];
|
||||
[[NSWorkspace sharedWorkspace] openURL:[request URL]];
|
||||
} else { // otherwies load the iframe stuff like YouTube or vimeo
|
||||
[listener use];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame {
|
||||
|
|
|
@ -154,10 +154,6 @@ p {
|
|||
box-shadow: 0 0 1px black;
|
||||
}
|
||||
|
||||
.images img.photo {
|
||||
|
||||
}
|
||||
|
||||
.data {
|
||||
margin-left: 62px;
|
||||
}
|
||||
|
|
|
@ -328,14 +328,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
template.geo.href = href;
|
||||
template.geo.style.display = "";
|
||||
|
||||
var a = document.createElement("a");
|
||||
a.className = "map";
|
||||
a.href = href;
|
||||
var img = document.createElement("img");
|
||||
img.src = this.mapSrc(lat, lng);
|
||||
a.appendChild(img);
|
||||
|
||||
template.images.appendChild(a);
|
||||
this.addMap(lat, lng, template.images);
|
||||
}
|
||||
|
||||
if (typeof status.__repost != "undefined") {
|
||||
|
@ -802,7 +795,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
|
||||
Core.prototype.parseForMedia = function(text, images) {
|
||||
|
||||
var words = text.split(" ");
|
||||
var words = text.split(/\s/);
|
||||
|
||||
for (var i = 0; i < words.length; i++) {
|
||||
|
||||
|
@ -811,6 +804,7 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
if (word.startsWith("http")) {
|
||||
|
||||
var src = null;
|
||||
var type = "img";
|
||||
|
||||
if (word.startsWith("http") && (word.endsWith(".jpg") || word.endsWith(".jpeg") || word.endsWith(".gif") || word.endsWith(".png"))) {
|
||||
|
||||
|
@ -819,12 +813,12 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
} else if(word.startsWith("http://youtube.com/") || word.startsWith("http://www.youtube.com/") || word.startsWith("https://youtube.com/") || word.startsWith("https://www.youtube.com/")) {
|
||||
|
||||
var v = Paths.getUrlVars(word)["v"];
|
||||
if (v) src = "http://img.youtube.com/vi/" + v + "/0.jpg";
|
||||
this.addYouTube(v, images);
|
||||
|
||||
} else if (word.startsWith("http://youtu.be/") || word.startsWith("https://youtu.be/")) {
|
||||
|
||||
var v = word.replace(/https?:\/\/youtu\.be\//, "");
|
||||
src = "http://img.youtube.com/vi/" + v + "/0.jpg";
|
||||
this.addYouTube(v, images);
|
||||
|
||||
} else if (word.startsWith("http://twitpic.com/") || word.startsWith("https://twitpic.com/")) {
|
||||
|
||||
|
@ -850,26 +844,13 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
} else if (word.startsWith("http://vimeo.com/") || word.startsWith("http://vimeo.com/")) {
|
||||
|
||||
var video_id = word.replace(/https?:\/\/vimeo\.com\//, "");
|
||||
|
||||
var a = document.createElement("a");
|
||||
a.href = word;
|
||||
var img = document.createElement("img");
|
||||
a.appendChild(img);
|
||||
images.appendChild(a);
|
||||
|
||||
$.ajax({
|
||||
type:'GET',
|
||||
url: 'http://vimeo.com/api/v2/video/' + video_id + '.json',
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
img.src = data[0].thumbnail_large;
|
||||
}
|
||||
});
|
||||
this.addVimeo(video_id, images);
|
||||
}
|
||||
|
||||
if (src) {
|
||||
var a = document.createElement("a");
|
||||
a.href = word;
|
||||
a.className = type;
|
||||
var img = document.createElement("img");
|
||||
img.src = src;
|
||||
a.appendChild(img);
|
||||
|
@ -932,10 +913,29 @@ function(jQuery, Paths, URI, HostApp, Cache) {
|
|||
}
|
||||
|
||||
Core.prototype.mapSrc = function(lat, lng) {
|
||||
var width = $("p.message").width();
|
||||
var width = $("p.message").width();
|
||||
return "http://staticmap.openstreetmap.de/staticmap.php?center=" + lat + "," + lng + "&zoom=3&size=" + width + "x75&markers=" + lat + "," + lng + ",red-pushpin";
|
||||
}
|
||||
|
||||
Core.prototype.addMap = function(lat, lng, images) {
|
||||
var a = document.createElement("a");
|
||||
a.className = "map";
|
||||
a.href = this.mapHref(lat, lng);
|
||||
var img = document.createElement("img");
|
||||
img.src = this.mapSrc(lat, lng);
|
||||
a.appendChild(img);
|
||||
images.appendChild(a);
|
||||
}
|
||||
|
||||
Core.prototype.addYouTube = function(id, images) {
|
||||
$(images).append('<iframe class="youtube" type="text/html" width="100%" height="200" src="http://www.youtube.com/embed/' + id + '?rel=0&showsearch=0&version=3&modestbranding=1" frameborder="0" webkitAllowFullScreen allowFullScreen />')
|
||||
}
|
||||
|
||||
Core.prototype.addVimeo = function(id, images) {
|
||||
$(images).append('<iframe class="vimeo" src="http://player.vimeo.com/video/' + id + '?byline=0&portrait=0" width="100%" height="200" frameborder="0" webkitAllowFullScreen allowFullScreen />');
|
||||
// <iframe src="http://player.vimeo.com/video/59735637?byline=0&portrait=0" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
|
||||
}
|
||||
|
||||
|
||||
|
||||
return Core;
|
||||
|
|
Reference in a new issue