diff --git a/.gitignore b/.gitignore index d458a9f..fde9fb2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ Mac/Tentia.xcodeproj/project.xcworkspace/xcuserdata/jeena.xcuserdatad/UserInterf dsa_priv.pem *.pyc Mac/.DS_Store +build diff --git a/Mac/English.lproj/NewMessageWindow.xib b/Mac/English.lproj/NewMessageWindow.xib index 7c5ddb7..0bc3e7d 100644 --- a/Mac/English.lproj/NewMessageWindow.xib +++ b/Mac/English.lproj/NewMessageWindow.xib @@ -164,6 +164,7 @@ {{258, 2}, {38, 16}} + _NS:9 YES @@ -212,15 +213,23 @@ Add current location 2147483647 - + NSImage NSMenuCheckmark - + NSImage NSMenuMixedState + + + Add photo + + 2147483647 + + + @@ -377,6 +386,14 @@ A 100070 + + + addImage: + + + + 100073 + delegate @@ -493,6 +510,7 @@ A YES + @@ -529,6 +547,11 @@ A + + 100071 + + + @@ -550,6 +573,7 @@ A 100060.IBPluginDependency 100065.IBPluginDependency 100066.IBPluginDependency + 100071.IBPluginDependency 5.IBPluginDependency 5.IBWindowTemplateEditedContentRect 6.IBPluginDependency @@ -572,6 +596,7 @@ A com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin {{127, 736}, {299, 113}} com.apple.InterfaceBuilder.CocoaPlugin @@ -588,11 +613,78 @@ A - 100070 + 100073 YES + + NSDocument + + YES + + YES + printDocument: + revertDocumentToSaved: + runPageLayout: + saveDocument: + saveDocumentAs: + saveDocumentTo: + + + YES + id + id + id + id + id + id + + + + YES + + YES + printDocument: + revertDocumentToSaved: + runPageLayout: + saveDocument: + saveDocumentAs: + saveDocumentTo: + + + YES + + printDocument: + id + + + revertDocumentToSaved: + id + + + runPageLayout: + id + + + saveDocument: + id + + + saveDocumentAs: + id + + + saveDocumentTo: + id + + + + + IBProjectSource + ./Classes/NSDocument.h + + NewMessageWindow NSDocument @@ -604,6 +696,7 @@ A addImage: openAddMenu: sendPost: + sendPostButtonPressed: YES @@ -611,6 +704,7 @@ A id id NSControl + id @@ -621,6 +715,7 @@ A addImage: openAddMenu: sendPost: + sendPostButtonPressed: YES @@ -640,6 +735,10 @@ A sendPost: NSControl + + sendPostButtonPressed: + id + diff --git a/WebKit/css/default.css b/WebKit/css/default.css index b58ec46..547e76b 100644 --- a/WebKit/css/default.css +++ b/WebKit/css/default.css @@ -137,7 +137,7 @@ p { .images img.photo { max-width: 100%; - max-height: auto; + max-height: inherit; margin-right: 0; border-radius: 3px; box-shadow: 0 0 1px black; diff --git a/WebKit/scripts/controller/Timeline.js b/WebKit/scripts/controller/Timeline.js index 6038ef8..85cad22 100644 --- a/WebKit/scripts/controller/Timeline.js +++ b/WebKit/scripts/controller/Timeline.js @@ -86,7 +86,7 @@ function(Core, Paths, HostApp, URI) { "https://tent.io/types/post/repost/v0.1.0", "https://tent.io/types/post/status/v0.1.0", "https://tent.io/types/post/delete/v0.1.0", - //"https://tent.io/types/post/photo/v0.1.0" + "https://tent.io/types/post/photo/v0.1.0" ]; url.addSearch("post_types", post_types.join(",")); diff --git a/WebKit/scripts/helper/Core.js b/WebKit/scripts/helper/Core.js index 1c9f8e9..16dc6d2 100644 --- a/WebKit/scripts/helper/Core.js +++ b/WebKit/scripts/helper/Core.js @@ -294,23 +294,35 @@ function(jQuery, Paths, URI, HostApp, Cache) { if (status.type == "https://tent.io/types/post/photo/v0.1.0") { + debug(status.attachments) + for (var i = 0; i < status.attachments.length; i++) { // closure needed for the callback (function() { + var attachment = status.attachments[i]; - var img = new Image(); - img.className = "photo"; - template.images.append(img); - var url = Paths.mkApiRootPath("/posts/" + status.id + "/attachments/" + attachment.name); + var img = new Image(); + + img.className = "photo"; + template.images.appendChild(img); var callback = function(resp) { - img.src = "data:image/png;base64," + resp.responseText; - } - })(); + img.src = "data:" + attachment.type + ";base64," + resp.responseText; + } - Paths.getURL(url.toString(), "GET", callback, null, null, attachment.type); - }; + if (status.entity == HostApp.stringForKey("entity")) { + var url = Paths.mkApiRootPath("/posts/" + status.id + "/attachments/" + attachment.name); + Paths.getURL(url, "GET", callback, null, null, attachment.type); + } else { + Paths.findProfileURL(status.entity, function(profile_url) { + var url = profile_url + "/posts/" + status.id + "/attachments/" + attachment.name; + debug(url) + Paths.getURL(url, "GET", callback, null, null, attachment.type); + }); + } + })(); + } } this.findMentions(template.message, status.mentions);