This commit is contained in:
Jeena Paradies 2012-11-22 02:06:55 +01:00
parent 2badd56b2b
commit accc5e5286
5 changed files with 51 additions and 12 deletions

View file

@ -39,6 +39,16 @@
NSLog(@"jsa<%@>: %@", viewName, message); 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 { - (void)webView:(WebView *)sender decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id <WebPolicyDecisionListener>)listener {
[listener ignore]; [listener ignore];
[[NSWorkspace sharedWorkspace] openURL:[request URL]]; [[NSWorkspace sharedWorkspace] openURL:[request URL]];

View file

@ -134,12 +134,6 @@ p {
margin-right: 5px; margin-right: 5px;
} }
.delete {
font-weight: normal;
color: #555;
font-size: 1.2em;
}
.direct-message { .direct-message {
color: #555; color: #555;
} }
@ -231,7 +225,7 @@ li:first-child:hover .date {
border-top: 0; border-top: 0;
} }
.reply_to, .retweet { .reply_to, .retweet, .remove {
width: 15px; width: 15px;
height: 12px; height: 12px;
position: absolute; position: absolute;
@ -241,7 +235,7 @@ li:first-child:hover .date {
display: none; display: none;
} }
li:hover .reply_to, li:hover .retweet { li:hover .reply_to, li:hover .retweet, li:hover .remove {
display: block; display: block;
} }
@ -249,3 +243,8 @@ li:hover .reply_to, li:hover .retweet {
top: 18px; top: 18px;
background-position: -192px 0; background-position: -192px 0;
} }
.remove {
background-position: -128px 0;
top: 20px;
}

View file

@ -154,7 +154,7 @@ function(HostApp, Paths, Hmac) {
} }
Oauth.prototype.logout = function() { Oauth.prototype.logout = function() {
return false;
} }
return Oauth; return Oauth;

View file

@ -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); 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; return Timeline;
}); });

View file

@ -36,6 +36,12 @@ function(jQuery, Paths, URI, HostApp, Followings) {
retweet.innerText = " "; retweet.innerText = " ";
retweet.href = "#"; retweet.href = "#";
// item.appendChild(retweet); // FIXME // item.appendChild(retweet); // FIXME
var remove = a.cloneNode();
remove.className = "remove";
remove.innerText = " ";
remove.href = "#";
item.appendChild(remove);
var image = document.createElement("img"); var image = document.createElement("img");
@ -124,7 +130,8 @@ function(jQuery, Paths, URI, HostApp, Followings) {
ago: ago, ago: ago,
source: source, source: source,
geo: geo, geo: geo,
images: images images: images,
remove: remove
} }
return jQuery.extend(true, {}, this.template); return jQuery.extend(true, {}, this.template);
@ -135,9 +142,18 @@ function(jQuery, Paths, URI, HostApp, Followings) {
var _this = this; var _this = this;
var template = this.getTemplate(); var template = this.getTemplate();
template.item.id = "post-" + status.id; 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() { template.reply_to.onclick = function() {
var mentions = []; var mentions = [];
@ -256,7 +272,15 @@ function(jQuery, Paths, URI, HostApp, Followings) {
data["mentions"] = mentions; 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);
}
} }