From eef7c52c7ee516a3afea192389723bfdef739e7f Mon Sep 17 00:00:00 2001 From: raphael Date: Wed, 13 May 2020 18:14:59 +0200 Subject: [PATCH] fix basicAlert bug --- src/js/main.js | 94 +++++++++++++++++++++++++------------------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/src/js/main.js b/src/js/main.js index fc007e1..80a9bab 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -80,6 +80,53 @@ function main() { }); } +function showBasicAlert(html, newOptions) { + var options = { + header: "INFO MESSAGE", + okBtnText: "Ok", + headercolor: "#d25d5d", + hideAfter: false, + onOkClick: false, + }; + if (newOptions) { + for (var i in newOptions) { + options[i] = newOptions[i]; + } + } + var alertHtml = $( + '
' + + '
' + + '
' + + options["header"] + + '
x
' + + '
' + + '
" + + "
" + + "
" + ); + alertHtml.find(".htmlcontent").append(html); + $("body").append(alertHtml); + alertHtml.find(".okbtn").click(function () { + if (options.onOkClick) { + options.onOkClick(); + } + alertHtml.remove(); + }); + alertHtml.find(".closeAlert").click(function () { + alertHtml.remove(); + }); + + if (options.hideAfter) { + setTimeout(function () { + alertHtml.find(".okbtn").click(); + }, 1000 * options.hideAfter); + } +} + function initWhiteboard() { $(document).ready(function () { // by default set in readOnly mode @@ -757,53 +804,6 @@ function initWhiteboard() { } } }); - - function showBasicAlert(html, newOptions) { - var options = { - header: "INFO MESSAGE", - okBtnText: "Ok", - headercolor: "#d25d5d", - hideAfter: false, - onOkClick: false, - }; - if (newOptions) { - for (var i in newOptions) { - options[i] = newOptions[i]; - } - } - var alertHtml = $( - '
' + - '
' + - '
' + - options["header"] + - '
x
' + - '
' + - '
" + - "
" + - "
" - ); - alertHtml.find(".htmlcontent").append(html); - $("body").append(alertHtml); - alertHtml.find(".okbtn").click(function () { - if (options.onOkClick) { - options.onOkClick(); - } - alertHtml.remove(); - }); - alertHtml.find(".closeAlert").click(function () { - alertHtml.remove(); - }); - - if (options.hideAfter) { - setTimeout(function () { - alertHtml.find(".okbtn").click(); - }, 1000 * options.hideAfter); - } - } } export default main;