Show text in spinner if defined in argument.

This commit is contained in:
mmcwilliams 2018-02-12 15:42:48 -05:00
parent e200b6bf0c
commit 3331dc20ec
2 changed files with 35 additions and 1 deletions

View File

@ -413,3 +413,19 @@ 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;
}

View File

@ -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 () {