photos
This commit is contained in:
parent
c3d1ce7d24
commit
f4443c3289
5 changed files with 126 additions and 14 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@ Mac/Tentia.xcodeproj/project.xcworkspace/xcuserdata/jeena.xcuserdatad/UserInterf
|
|||
dsa_priv.pem
|
||||
*.pyc
|
||||
Mac/.DS_Store
|
||||
build
|
||||
|
|
|
@ -164,6 +164,7 @@
|
|||
<string key="NSFrame">{{258, 2}, {38, 16}}</string>
|
||||
<reference key="NSSuperview" ref="568628114"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:9</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="978913593">
|
||||
|
@ -212,15 +213,23 @@
|
|||
<string key="NSTitle">Add current location</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<object class="NSCustomResource" key="NSOnImage">
|
||||
<object class="NSCustomResource" key="NSOnImage" id="906499654">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">NSMenuCheckmark</string>
|
||||
</object>
|
||||
<object class="NSCustomResource" key="NSMixedImage">
|
||||
<object class="NSCustomResource" key="NSMixedImage" id="261764861">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">NSMenuMixedState</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="486389227">
|
||||
<reference key="NSMenu" ref="723763594"/>
|
||||
<string key="NSTitle">Add photo</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="906499654"/>
|
||||
<reference key="NSMixedImage" ref="261764861"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSButton" id="108971841">
|
||||
|
@ -377,6 +386,14 @@ A</bytes>
|
|||
</object>
|
||||
<int key="connectionID">100070</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">addImage:</string>
|
||||
<reference key="source" ref="512844837"/>
|
||||
<reference key="destination" ref="486389227"/>
|
||||
</object>
|
||||
<int key="connectionID">100073</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
|
@ -493,6 +510,7 @@ A</bytes>
|
|||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="921309347"/>
|
||||
<reference ref="486389227"/>
|
||||
</object>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
|
@ -529,6 +547,11 @@ A</bytes>
|
|||
<reference key="object" ref="978913593"/>
|
||||
<reference key="parent" ref="647941004"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">100071</int>
|
||||
<reference key="object" ref="486389227"/>
|
||||
<reference key="parent" ref="723763594"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="flattenedProperties">
|
||||
|
@ -550,6 +573,7 @@ A</bytes>
|
|||
<string>100060.IBPluginDependency</string>
|
||||
<string>100065.IBPluginDependency</string>
|
||||
<string>100066.IBPluginDependency</string>
|
||||
<string>100071.IBPluginDependency</string>
|
||||
<string>5.IBPluginDependency</string>
|
||||
<string>5.IBWindowTemplateEditedContentRect</string>
|
||||
<string>6.IBPluginDependency</string>
|
||||
|
@ -572,6 +596,7 @@ A</bytes>
|
|||
<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>{{127, 736}, {299, 113}}</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
</object>
|
||||
|
@ -588,11 +613,78 @@ A</bytes>
|
|||
<reference key="dict.values" ref="0"/>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">100070</int>
|
||||
<int key="maxID">100073</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSDocument</string>
|
||||
<object class="NSMutableDictionary" key="actions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>printDocument:</string>
|
||||
<string>revertDocumentToSaved:</string>
|
||||
<string>runPageLayout:</string>
|
||||
<string>saveDocument:</string>
|
||||
<string>saveDocumentAs:</string>
|
||||
<string>saveDocumentTo:</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="actionInfosByName">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>printDocument:</string>
|
||||
<string>revertDocumentToSaved:</string>
|
||||
<string>runPageLayout:</string>
|
||||
<string>saveDocument:</string>
|
||||
<string>saveDocumentAs:</string>
|
||||
<string>saveDocumentTo:</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">printDocument:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">revertDocumentToSaved:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">runPageLayout:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">saveDocument:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">saveDocumentAs:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">saveDocumentTo:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/NSDocument.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NewMessageWindow</string>
|
||||
<string key="superclassName">NSDocument</string>
|
||||
|
@ -604,6 +696,7 @@ A</bytes>
|
|||
<string>addImage:</string>
|
||||
<string>openAddMenu:</string>
|
||||
<string>sendPost:</string>
|
||||
<string>sendPostButtonPressed:</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
|
@ -611,6 +704,7 @@ A</bytes>
|
|||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>NSControl</string>
|
||||
<string>id</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="actionInfosByName">
|
||||
|
@ -621,6 +715,7 @@ A</bytes>
|
|||
<string>addImage:</string>
|
||||
<string>openAddMenu:</string>
|
||||
<string>sendPost:</string>
|
||||
<string>sendPostButtonPressed:</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
|
@ -640,6 +735,10 @@ A</bytes>
|
|||
<string key="name">sendPost:</string>
|
||||
<string key="candidateClassName">NSControl</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">sendPostButtonPressed:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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(","));
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Reference in a new issue