Skip to content

Instantly share code, notes, and snippets.

@trmcnvn
Last active August 29, 2015 14:08
Show Gist options
  • Save trmcnvn/f44ffbb8087e8e9bcfc0 to your computer and use it in GitHub Desktop.
Save trmcnvn/f44ffbb8087e8e9bcfc0 to your computer and use it in GitHub Desktop.
function confirm() {
CustomEvent.observe(LiveEvents.LIVE_BEFORE_WINDOW_LOAD, function(win) {
if (win.toString() !== "LiveWindowChatFloating") return;
win.box.setToolbarCloseOnClick(function() {
var confirm = window.confirm("Are you sure?");
if (confirm !== false) {
CustomEvent.fire(LiveEvents.LIVE_EVENT, LiveEvents.LIVE_LEAVE_CHANNEL, this);
this.fire(LiveEvents.WINDOW_CLOSE);
}
}.bind(win));
});
}
var script = document.createElement("script");
script.textContent = "(" + confirm.toString() + ")();";
document.body.appendChild(script);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment