From 3331dc20ec6c4fb2c6bff0d80557ae58054d210c Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Mon, 12 Feb 2018 15:42:48 -0500 Subject: [PATCH] Show text in spinner if defined in argument. --- app/www/static/css/index.css | 16 ++++++++++++++++ app/www/static/js/intval.core.js | 20 +++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/app/www/static/css/index.css b/app/www/static/css/index.css index 8cdf602..f64cdcb 100644 --- a/app/www/static/css/index.css +++ b/app/www/static/css/index.css @@ -412,4 +412,20 @@ body.mobile footer{ #reset{ margin-top: 60px; +} +#msg{ + display: none; + width: 200px; + height: 44px; + border-radius: 6px; + position: fixed; + left: 50%; + margin-left: -100px; + margin-top: 45px; + background: rgba(100, 100, 100, 0.5); + color: #fff; + text-shadow: 1px 1px 0px #000; +} +#msg.active{ + display: block; } \ No newline at end of file diff --git a/app/www/static/js/intval.core.js b/app/www/static/js/intval.core.js index 50f6ff7..b0a1c59 100644 --- a/app/www/static/js/intval.core.js +++ b/app/www/static/js/intval.core.js @@ -275,15 +275,33 @@ UI.spinner.opts = { UI.spinner.init = function () { const spinner = new Spinner(UI.spinner.opts).spin(UI.spinner.elem); }; -UI.spinner.show = function () { +UI.spinner.show = function (text) { if (!UI.spinner.elem.classList.contains('active')) { UI.spinner.elem.classList.add('active'); } + if (text) { + UI.message.show(text) + } }; UI.spinner.hide = function () { if (UI.spinner.elem.classList.contains('active')) { UI.spinner.elem.classList.remove('active'); } + +}; +UI.message = { + elem : document.getElementById('msg') +}; +UI.message.show = function (text) { + UI.message.elem.innerHTML = text + if (!UI.message.elem.classList.contains('active')) { + UI.message.elem.classList.add('active'); + } +}; +UI.message.hide = function () { + if (UI.message.elem.classList.contains('active')) { + UI.message.elem.classList.remove('active'); + } }; var init = function () {