Display confirmation if zeroid already exists

This commit is contained in:
HelloZeroNet 2016-04-09 19:49:12 +02:00
parent 561bd80aa3
commit 9bb0a0d91b
4 changed files with 40 additions and 6 deletions

View file

@ -56,6 +56,9 @@ class Wrapper
else if cmd == "prompt" # Prompt input
@displayPrompt message.params[0], message.params[1], message.params[2], (res) =>
@ws.response message.id, res
else if cmd == "confirm" # Confirm action
@displayConfirm message.params[0], message.params[1], (res) =>
@ws.response message.id, res
else if cmd == "setSiteInfo"
@sendInner message # Pass to inner frame
if message.params.address == @address # Current page
@ -173,7 +176,9 @@ class Wrapper
displayConfirm: (message, caption, cb) ->
body = $("<span class='message'>"+message+"</span>")
button = $("<a href='##{caption}' class='button button-#{caption}'>#{caption}</a>") # Add confirm button
button.on "click", cb
button.on "click", =>
cb(true)
return false
body.append(button)
@notifications.add("notification-#{caption}", "ask", body)

View file

@ -830,6 +830,12 @@ jQuery.extend( jQuery.easing,
return _this.ws.response(message.id, res);
};
})(this));
} else if (cmd === "confirm") {
return this.displayConfirm(message.params[0], message.params[1], (function(_this) {
return function(res) {
return _this.ws.response(message.id, res);
};
})(this));
} else if (cmd === "setSiteInfo") {
this.sendInner(message);
if (message.params.address === this.address) {
@ -972,7 +978,12 @@ jQuery.extend( jQuery.easing,
var body, button;
body = $("<span class='message'>" + message + "</span>");
button = $("<a href='#" + caption + "' class='button button-" + caption + "'>" + caption + "</a>");
button.on("click", cb);
button.on("click", (function(_this) {
return function() {
cb(true);
return false;
};
})(this));
body.append(button);
this.notifications.add("notification-" + caption, "ask", body);
button.focus();