Skip to content

Commit

Permalink
Upload v1.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelodolza committed Aug 2, 2017
1 parent 6533cbe commit 9f87adf
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 77 deletions.
12 changes: 8 additions & 4 deletions dist/css/iziToast.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* iziToast | v1.1.4
* iziToast | v1.1.5
* http://izitoast.marcelodolce.com
* by Marcelo Dolce.
*/
Expand All @@ -12,16 +12,19 @@
backface-visibility: hidden;
transition: transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1), height 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.iziToast-capsule,
.iziToast-capsule * {
box-sizing: border-box;
}
.iziToast {
display: inline-block;
clear: both;
position: relative;
font-family: 'Lato', arial;
font-size: 14px;
padding: 8px 42px 9px 0;
padding: 8px 45px 9px 0;
background: rgba(238,238,238,0.9);
border-color: rgba(238,238,238,0.9);
min-height: 54px;
width: 100%;
pointer-events: all;
cursor: default;
Expand All @@ -32,6 +35,7 @@
-moz-user-select: none /* Firefox */;
-ms-user-select: none /* Internet Explorer/Edge */;
user-select: none;
min-height: 54px;
}
.iziToast > .iziToast-progressbar {
position: absolute;
Expand Down Expand Up @@ -167,7 +171,7 @@
height: 24px;
}
.iziToast > .iziToast-body > strong {
padding: 0 10px 0 0;
padding: 0;
margin: 10px 0 -10px 0;
line-height: 16px;
font-size: 14px;
Expand Down
4 changes: 2 additions & 2 deletions dist/css/iziToast.min.css

Large diffs are not rendered by default.

134 changes: 78 additions & 56 deletions dist/js/iziToast.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* iziToast | v1.1.4
* iziToast | v1.1.5
* http://izitoast.marcelodolce.com
* by Marcelo Dolce.
*/
Expand Down Expand Up @@ -337,7 +337,7 @@
}
};

if (settings.timeout > 0) {
if (settings.timeout) {
progressBar.maxHideTime = parseFloat(settings.timeout);
progressBar.hideEta = new Date().getTime() + progressBar.maxHideTime;
timer = setInterval(progressBar.updateProgress, 10);
Expand Down Expand Up @@ -438,7 +438,7 @@

try {
settings.closedBy = closedBy;
var event = new CustomEvent(PLUGIN_NAME+'-closing', {detail: settings, bubles: true, cancelable: true});
var event = new CustomEvent(PLUGIN_NAME+'-closing', {detail: settings, bubbles: true, cancelable: true});
document.dispatchEvent(event);
} catch(ex){
console.warn(ex);
Expand All @@ -454,7 +454,7 @@
$toast.parentNode.remove();
try {
settings.closedBy = closedBy;
var event = new CustomEvent(PLUGIN_NAME+'-closed', {detail: settings, bubles: true, cancelable: true});
var event = new CustomEvent(PLUGIN_NAME+'-closed', {detail: settings, bubbles: true, cancelable: true});
document.dispatchEvent(event);
} catch(ex){
console.warn(ex);
Expand Down Expand Up @@ -496,17 +496,10 @@
toastCapsule: document.createElement("div"),
icon: document.createElement("i"),
cover: document.createElement("div"),
strong: document.createElement("strong"),
p: document.createElement("p"),
progressBar: document.createElement("div"),
progressBarDiv: document.createElement("div"),
buttonClose: document.createElement("button"),
buttons: document.createElement("div"),
wrapper: null
};

$DOM.toastBody.appendChild($DOM.strong);
$DOM.toastBody.appendChild($DOM.p);
$DOM.toast.appendChild($DOM.toastBody);
$DOM.toastCapsule.appendChild($DOM.toast);

Expand Down Expand Up @@ -589,6 +582,9 @@
// Button close
(function(){
if(settings.close){

$DOM.buttonClose = document.createElement("button");

$DOM.buttonClose.classList.add(PLUGIN_NAME + '-close');
$DOM.buttonClose.addEventListener('click', function (e) {
var button = e.target;
Expand All @@ -606,7 +602,11 @@

// Progress Bar
(function(){
if (settings.progressBar) {
if (settings.progressBar && settings.timeout) {

$DOM.progressBar = document.createElement("div");
$DOM.progressBarDiv = document.createElement("div");

$DOM.progressBar.classList.add(PLUGIN_NAME + '-progressbar');
$DOM.progressBarDiv.style.background = settings.progressBarColor;
$DOM.progressBar.appendChild($DOM.progressBarDiv);
Expand All @@ -618,7 +618,7 @@
});
}, 300);
}
else if( settings.progressBar === false && settings.timeout > 0){
else if( settings.progressBar === false && settings.timeout){
setTimeout(function() {
that.hide(settings, $DOM.toast);
}, settings.timeout);
Expand Down Expand Up @@ -649,59 +649,77 @@

// Title
(function(){
if (settings.titleColor) {
$DOM.strong.style.color = settings.titleColor;
}
if (settings.titleSize) {
if( !isNaN(settings.titleSize) ){
$DOM.strong.style.fontSize = settings.titleSize+'px';
} else {
$DOM.strong.style.fontSize = settings.titleSize;
if (settings.title.length > 0) {

$DOM.strong = document.createElement("strong");
$DOM.strong.appendChild(createFragElem(settings.title));
$DOM.toastBody.appendChild($DOM.strong);

if (settings.titleColor) {
$DOM.strong.style.color = settings.titleColor;
}
}
if (settings.titleLineHeight) {
if( !isNaN(settings.titleSize) ){
$DOM.strong.style.lineHeight = settings.titleLineHeight+'px';
} else {
$DOM.strong.style.lineHeight = settings.titleLineHeight;
if (settings.titleSize) {
if( !isNaN(settings.titleSize) ){
$DOM.strong.style.fontSize = settings.titleSize+'px';
} else {
$DOM.strong.style.fontSize = settings.titleSize;
}
}
if (settings.titleLineHeight) {
if( !isNaN(settings.titleSize) ){
$DOM.strong.style.lineHeight = settings.titleLineHeight+'px';
} else {
$DOM.strong.style.lineHeight = settings.titleLineHeight;
}
}
}
$DOM.strong.appendChild(createFragElem(settings.title));
})();

// Message
(function(){
if (settings.messageColor) {
$DOM.p.style.color = settings.messageColor;
}
if (settings.messageSize) {
if( !isNaN(settings.titleSize) ){
$DOM.p.style.fontSize = settings.messageSize+'px';
} else {
$DOM.p.style.fontSize = settings.messageSize;
if (settings.message.length > 0) {

$DOM.p = document.createElement("p");
$DOM.p.appendChild(createFragElem(settings.message));
$DOM.toastBody.appendChild($DOM.p);

if (settings.messageColor) {
$DOM.p.style.color = settings.messageColor;
}
}
if (settings.messageLineHeight) {

if( !isNaN(settings.titleSize) ){
$DOM.p.style.lineHeight = settings.messageLineHeight+'px';
} else {
$DOM.p.style.lineHeight = settings.messageLineHeight;
if (settings.messageSize) {
if( !isNaN(settings.titleSize) ){
$DOM.p.style.fontSize = settings.messageSize+'px';
} else {
$DOM.p.style.fontSize = settings.messageSize;
}
}
if (settings.messageLineHeight) {

if( !isNaN(settings.titleSize) ){
$DOM.p.style.lineHeight = settings.messageLineHeight+'px';
} else {
$DOM.p.style.lineHeight = settings.messageLineHeight;
}
}
}
$DOM.p.appendChild(createFragElem(settings.message));
})();

if (settings.title.length > 0 && settings.message.length > 0) {
$DOM.strong.style.paddingRight = 10+'px';
}

// Buttons
(function(){
if (settings.buttons.length > 0) {

$DOM.buttons.classList.add(PLUGIN_NAME + '-buttons');

if(settings.rtl){
$DOM.p.style.marginLeft = '15px';
} else {
$DOM.p.style.marginRight = '15px';
if (settings.message.length > 0) {
if(settings.rtl){
$DOM.p.style.marginLeft = '15px';
} else {
$DOM.p.style.marginRight = '15px';
}
}

var i = 0;
Expand Down Expand Up @@ -813,13 +831,17 @@
animationTimes = [400, 200, 400];
}

window.setTimeout(function(){
$DOM.strong.classList.add('slideIn');
}, animationTimes[0]);
if (settings.title.length > 0) {
window.setTimeout(function(){
$DOM.strong.classList.add('slideIn');
}, animationTimes[0]);
}

window.setTimeout(function(){
$DOM.p.classList.add('slideIn');
}, animationTimes[1]);
if (settings.message.length > 0) {
window.setTimeout(function(){
$DOM.p.classList.add('slideIn');
}, animationTimes[1]);
}

if (settings.icon) {
window.setTimeout(function(){
Expand All @@ -843,15 +865,15 @@
settings.onOpening.apply(null, [settings, $DOM.toast]);

try {
var event = new CustomEvent(PLUGIN_NAME + '-opening', {detail: settings, bubles: true, cancelable: true});
var event = new CustomEvent(PLUGIN_NAME + '-opening', {detail: settings, bubbles: true, cancelable: true});
document.dispatchEvent(event);
} catch(ex){
console.warn(ex);
}

setTimeout(function() {
try {
var event = new CustomEvent(PLUGIN_NAME + '-opened', {detail: settings, bubles: true, cancelable: true});
var event = new CustomEvent(PLUGIN_NAME + '-opened', {detail: settings, bubbles: true, cancelable: true});
document.dispatchEvent(event);
} catch(ex){
console.warn(ex);
Expand Down
Loading

0 comments on commit 9f87adf

Please sign in to comment.