Skip to content

Commit

Permalink
Update v1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelodolza committed Jul 22, 2018
1 parent 37723f7 commit 1b702f7
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 26 deletions.
2 changes: 1 addition & 1 deletion dist/css/iziToast.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* iziToast | v1.3.1
* iziToast | v1.4.0
* http://izitoast.marcelodolce.com
* by Marcelo Dolce.
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/css/iziToast.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 25 additions & 8 deletions dist/js/iziToast.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* iziToast | v1.3.1
* iziToast | v1.4.0
* http://izitoast.marcelodolce.com
* by Marcelo Dolce.
*/
Expand Down Expand Up @@ -198,6 +198,16 @@
};


/**
* Generate new ID
* @private
*/
var generateId = function(params) {
var newId = btoa(encodeURIComponent(params));
return newId.replace(/=/g, "");
};


/**
* Check if is a color
* @private
Expand Down Expand Up @@ -656,20 +666,27 @@
settings.time = {};

if(settings.id === null){
var newId = btoa(encodeURIComponent(settings.title+settings.message+settings.color));
settings.id = newId;
settings.id = generateId(settings.title+settings.message+settings.color);
}

if(settings.displayMode === 1 || settings.displayMode == 'once'){
if(document.querySelectorAll('.'+PLUGIN_NAME+'#'+settings.id).length > 0){
return false;
try {
if(document.querySelectorAll('.'+PLUGIN_NAME+'#'+settings.id).length > 0){
return false;
}
} catch (exc) {
console.warn('['+PLUGIN_NAME+'] Could not find an element with this selector: '+'#'+settings.id+'. Try to set an valid id.');
}
}

if(settings.displayMode === 2 || settings.displayMode == 'replace'){
forEach(document.querySelectorAll('.'+PLUGIN_NAME+'#'+settings.id), function(element, index) {
that.hide(settings, element, 'replaced');
});
try {
forEach(document.querySelectorAll('.'+PLUGIN_NAME+'#'+settings.id), function(element, index) {
that.hide(settings, element, 'replaced');
});
} catch (exc) {
console.warn('['+PLUGIN_NAME+'] Could not find an element with this selector: '+'#'+settings.id+'. Try to set an valid id.');
}
}

settings.ref = new Date().getTime() + Math.floor((Math.random() * 10000000) + 1);
Expand Down
4 changes: 2 additions & 2 deletions dist/js/iziToast.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "izitoast",
"version": "1.3.1",
"version": "1.4.0",
"description": "Elegant, responsive, flexible and lightweight notification plugin with no dependencies.",
"readmeFilename": "README.md",
"main": "dist/js/iziToast.js",
Expand Down
2 changes: 1 addition & 1 deletion src/css/animations.styl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* iziToast | v1.3.1
* iziToast | v1.4.0
* http://izitoast.marcelodolce.com
* by Marcelo Dolce.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/css/layouts.styl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* iziToast | v1.3.1
* iziToast | v1.4.0
* http://izitoast.marcelodolce.com
* by Marcelo Dolce.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/css/style.styl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* iziToast | v1.3.1
* iziToast | v1.4.0
* http://izitoast.marcelodolce.com
* by Marcelo Dolce.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/css/themes.styl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* iziToast | v1.3.1
* iziToast | v1.4.0
* http://izitoast.marcelodolce.com
* by Marcelo Dolce.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/css/toast.styl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* iziToast | v1.3.1
* iziToast | v1.4.0
* http://izitoast.marcelodolce.com
* by Marcelo Dolce.
*/
Expand Down
33 changes: 25 additions & 8 deletions src/js/iziToast.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* iziToast | v1.3.1
* iziToast | v1.4.0
* http://izitoast.marcelodolce.com
* by Marcelo Dolce.
*/
Expand Down Expand Up @@ -198,6 +198,16 @@
};


/**
* Generate new ID
* @private
*/
var generateId = function(params) {
var newId = btoa(encodeURIComponent(params));
return newId.replace(/=/g, "");
};


/**
* Check if is a color
* @private
Expand Down Expand Up @@ -656,20 +666,27 @@
settings.time = {};

if(settings.id === null){
var newId = btoa(encodeURIComponent(settings.title+settings.message+settings.color));
settings.id = newId;
settings.id = generateId(settings.title+settings.message+settings.color);
}

if(settings.displayMode === 1 || settings.displayMode == 'once'){
if(document.querySelectorAll('.'+PLUGIN_NAME+'#'+settings.id).length > 0){
return false;
try {
if(document.querySelectorAll('.'+PLUGIN_NAME+'#'+settings.id).length > 0){
return false;
}
} catch (exc) {
console.warn('['+PLUGIN_NAME+'] Could not find an element with this selector: '+'#'+settings.id+'. Try to set an valid id.');
}
}

if(settings.displayMode === 2 || settings.displayMode == 'replace'){
forEach(document.querySelectorAll('.'+PLUGIN_NAME+'#'+settings.id), function(element, index) {
that.hide(settings, element, 'replaced');
});
try {
forEach(document.querySelectorAll('.'+PLUGIN_NAME+'#'+settings.id), function(element, index) {
that.hide(settings, element, 'replaced');
});
} catch (exc) {
console.warn('['+PLUGIN_NAME+'] Could not find an element with this selector: '+'#'+settings.id+'. Try to set an valid id.');
}
}

settings.ref = new Date().getTime() + Math.floor((Math.random() * 10000000) + 1);
Expand Down

0 comments on commit 1b702f7

Please sign in to comment.