fixed #69
This commit is contained in:
parent
2badd56b2b
commit
accc5e5286
5 changed files with 51 additions and 12 deletions
|
@ -39,6 +39,16 @@
|
|||
NSLog(@"jsa<%@>: %@", viewName, message);
|
||||
}
|
||||
|
||||
- (BOOL)webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame {
|
||||
NSInteger result = NSRunCriticalAlertPanel(NSLocalizedString(@"Tentia", @""), // title
|
||||
message, // message
|
||||
NSLocalizedString(@"OK", @""), // default button
|
||||
NSLocalizedString(@"Cancel", @""), // alt button
|
||||
nil);
|
||||
return NSAlertDefaultReturn == result;
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)webView:(WebView *)sender decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id <WebPolicyDecisionListener>)listener {
|
||||
[listener ignore];
|
||||
[[NSWorkspace sharedWorkspace] openURL:[request URL]];
|
||||
|
|
|
@ -134,12 +134,6 @@ p {
|
|||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.delete {
|
||||
font-weight: normal;
|
||||
color: #555;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.direct-message {
|
||||
color: #555;
|
||||
}
|
||||
|
@ -231,7 +225,7 @@ li:first-child:hover .date {
|
|||
border-top: 0;
|
||||
}
|
||||
|
||||
.reply_to, .retweet {
|
||||
.reply_to, .retweet, .remove {
|
||||
width: 15px;
|
||||
height: 12px;
|
||||
position: absolute;
|
||||
|
@ -241,7 +235,7 @@ li:first-child:hover .date {
|
|||
display: none;
|
||||
}
|
||||
|
||||
li:hover .reply_to, li:hover .retweet {
|
||||
li:hover .reply_to, li:hover .retweet, li:hover .remove {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
@ -249,3 +243,8 @@ li:hover .reply_to, li:hover .retweet {
|
|||
top: 18px;
|
||||
background-position: -192px 0;
|
||||
}
|
||||
|
||||
.remove {
|
||||
background-position: -128px 0;
|
||||
top: 20px;
|
||||
}
|
||||
|
|
|
@ -154,7 +154,7 @@ function(HostApp, Paths, Hmac) {
|
|||
}
|
||||
|
||||
Oauth.prototype.logout = function() {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return Oauth;
|
||||
|
|
|
@ -113,6 +113,12 @@ function(Core, Paths, HostApp, URI) {
|
|||
Core.prototype.sendNewMessage.call(this, content, in_reply_to_status_id, in_reply_to_entity, callback);
|
||||
}
|
||||
|
||||
Timeline.prototype.remove = function(id) {
|
||||
var _this = this;
|
||||
var callback = function(data) { _this.getNewData(); }
|
||||
Core.prototype.remove.call(this, id, callback);
|
||||
}
|
||||
|
||||
return Timeline;
|
||||
|
||||
});
|
|
@ -36,6 +36,12 @@ function(jQuery, Paths, URI, HostApp, Followings) {
|
|||
retweet.innerText = " ";
|
||||
retweet.href = "#";
|
||||
// item.appendChild(retweet); // FIXME
|
||||
|
||||
var remove = a.cloneNode();
|
||||
remove.className = "remove";
|
||||
remove.innerText = " ";
|
||||
remove.href = "#";
|
||||
item.appendChild(remove);
|
||||
|
||||
|
||||
var image = document.createElement("img");
|
||||
|
@ -124,7 +130,8 @@ function(jQuery, Paths, URI, HostApp, Followings) {
|
|||
ago: ago,
|
||||
source: source,
|
||||
geo: geo,
|
||||
images: images
|
||||
images: images,
|
||||
remove: remove
|
||||
}
|
||||
|
||||
return jQuery.extend(true, {}, this.template);
|
||||
|
@ -135,9 +142,18 @@ function(jQuery, Paths, URI, HostApp, Followings) {
|
|||
var _this = this;
|
||||
|
||||
var template = this.getTemplate();
|
||||
|
||||
|
||||
template.item.id = "post-" + status.id;
|
||||
|
||||
if (HostApp.stringForKey("entity") == status.entity) {
|
||||
template.remove.onclick = function() {
|
||||
_this.remove(status.id);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
template.remove.style.display = "none";
|
||||
}
|
||||
|
||||
template.reply_to.onclick = function() {
|
||||
|
||||
var mentions = [];
|
||||
|
@ -256,7 +272,15 @@ function(jQuery, Paths, URI, HostApp, Followings) {
|
|||
data["mentions"] = mentions;
|
||||
}
|
||||
|
||||
Paths.getURL(url.toString(), http_method, callback, JSON.stringify(data)); // FIXME: error callback
|
||||
Paths.getURL(url.toString(), http_method, callback, JSON.stringify(data));
|
||||
}
|
||||
|
||||
Core.prototype.remove = function(id, callback) {
|
||||
|
||||
if (confirm("Really delete this post?")) {
|
||||
var url = URI(Paths.mkApiRootPath("/posts/" + id));
|
||||
Paths.getURL(url.toString(), "DELETE", callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Reference in a new issue