Skip to content

Commit

Permalink
Update v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelodolza committed Nov 7, 2017
1 parent 4c077de commit df5bbf6
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
20 changes: 19 additions & 1 deletion dist/js/iziToast.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,19 @@
};


/**
* Check if is a Base64 string
* @private
*/
var isBase64 = function(str) {
try {
return btoa(atob(str)) == str;
} catch (err) {
return false;
}
};


/**
* Drag method of toasts
* @private
Expand Down Expand Up @@ -680,7 +693,12 @@
if(settings.image) {
$DOM.cover.classList.add(PLUGIN_NAME + '-cover');
$DOM.cover.style.width = settings.imageWidth + 'px';
$DOM.cover.style.backgroundImage = 'url(' + settings.image + ')';

if(isBase64(settings.image)){
$DOM.cover.style.backgroundImage = 'url(data:image/png;base64,' + settings.image + ')';
} else {
$DOM.cover.style.backgroundImage = 'url(' + settings.image + ')';
}

if(settings.rtl){
$DOM.toastBody.style.marginRight = (settings.imageWidth + 10) + 'px';
Expand Down
Loading

0 comments on commit df5bbf6

Please sign in to comment.