Skip to content

Commit

Permalink
slicker msgbox styling
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Witzel committed Mar 18, 2019
1 parent 1c1692c commit 532dc90
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
Binary file modified img/wait.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 12 additions & 5 deletions lib/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,30 @@ h1 {
font-size: 1.2em;
}
.msgbox {
display: none;
visibility: hidden;
transition: visibility 0.09s, opacity 0.1s linear;
opacity: 0;
box-sizing: border-box;
position: fixed;
width: 450px;
height: auto;
left: 50%;
top: 20%;
/* margin-top: -100px; */
margin-left: -225px;
background: #eee linear-gradient(#eee, #ddd);
color: #000;
border: 6px solid #000;
border: 1px solid #000;
border-radius: 4px;
box-shadow: 0 0 8px #000;
padding: 10px;
overflow: auto;
font-size: .8em;
}
.msgbox.visible {
transition: visibility 0s, opacity 0.25s linear;
opacity: 1;
visibility: visible;
}
.msgbox.error {
border-color:#f33;
background: #ffe8d8 linear-gradient(#fff, #ffe8d8);
Expand All @@ -34,7 +41,7 @@ h1 {
#mboxtemp.msgbox.processing {
background-image: url('../img/wait.gif');
background-repeat: no-repeat;
background-position: center center;
background-position: center 70%;
min-height: 200px;
}
.msgbox h2 {
Expand Down Expand Up @@ -63,7 +70,7 @@ h1 {
border: none;
}
#mboxtemp {
background: #F0FBD7 linear-gradient(#fff, #F0FBD7);
background: #ccc linear-gradient(#eee, #ccc);
}
#mboxtemp button,
#mbox button.close {
Expand Down
12 changes: 9 additions & 3 deletions lib/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ let DOM = {
show: function(selector) {
DOM.all(selector, function(el){ el.style.display = 'block' });
},
unvisible: function(selector) {
DOM.removeClass(selector, 'visible');
},
visible: function(selector) {
DOM.addClass(selector, 'visible');
},
addClass: function(selector, className) {
DOM.all(selector, function(el){ el.classList.add(className) });
},
Expand Down Expand Up @@ -167,7 +173,7 @@ MBox.prototype.show = function(title, msg, props) {
if (props.hideAfter) {
MBox._lastTimeout = setTimeout(function() {MBox.hideTemp()}, props.hideAfter);
}
DOM.show(box);
DOM.visible(box);
DOM.all('#mbox input[type=text]', function(el) {el.focus()});
}
else {
Expand All @@ -177,11 +183,11 @@ MBox.prototype.show = function(title, msg, props) {
}

MBox.prototype.hide = function() {
if (this.initialized) DOM.hide(this._element);
if (this.initialized) DOM.unvisible(this._element);
}

MBox.prototype.hideTemp = function() {
if (this.initialized) DOM.hide(this._elementTemp);
if (this.initialized) DOM.unvisible(this._elementTemp);
}

MBox.show = function(title, msg, props) {
Expand Down

0 comments on commit 532dc90

Please sign in to comment.