From 1e80512ca768eebc519793f6228f2ef8407a4f51 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Mon, 23 Jul 2018 02:43:46 +0000 Subject: [PATCH] Alert when changes may not been saved --- webapp/titanembeds/static/js/usercss.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/webapp/titanembeds/static/js/usercss.js b/webapp/titanembeds/static/js/usercss.js index 15cbd40..5ec18db 100644 --- a/webapp/titanembeds/static/js/usercss.js +++ b/webapp/titanembeds/static/js/usercss.js @@ -1,5 +1,11 @@ /*global $, ace, Materialize, newCSS, CSS_ID, ADMIN*/ (function () { + $(window).bind('beforeunload', function(){ + if ($("#live_preview_warning").is(":visible")) { + return true; + } + }); + if($("#css_editor").length != 0) { var editor = ace.edit("css_editor"); }