diff --git a/.babelrc b/.babelrc
new file mode 100644
index 0000000..b207aef
--- /dev/null
+++ b/.babelrc
@@ -0,0 +1,5 @@
+{
+ "presets": [
+ "env"
+ ]
+}
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d53af24
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+node_modules
+build
+.idea
+.github
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index 051ec8e..0000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,13 +0,0 @@
-Feel free to contribute in any of the ways outlined:
-
-- Request features
-- Submit bug reports
-- Submit pull requests
-- Help by answering issues
-- Tell us if you are using the plugin in your project (it helps!)
-
-Just a few guidelines (for now):
-
-- Follow the existing conventions (if unsure, make an issue)
-- Ensure dist and js/css dirs are kept uptodate with each other
-- Minify using https://closure-compiler.appspot.com/home (no custom options)
diff --git a/README.md b/README.md
index 5c148ce..d0d0c14 100644
--- a/README.md
+++ b/README.md
@@ -2,9 +2,6 @@
* [About](#about)
* [Usage](#usage)
- * [Live Example](https://jsfiddle.net/e4nyhsL6/)
-* [Caveats](#caveats)
-* [Roadmap](#roadmap)
* [Contributing](#contributing)
### About
@@ -13,112 +10,59 @@ As of Bootstrap 4.2, [toasts](https://getbootstrap.com/docs/4.2/components/toast
### Usage
-You can pass to the `$.toast` function an object with the settings for your toast which are as follows:
+#### Gloabls
-| Parameter |Description| Default | Values |
-| ------------- |-----------| ------- |---------|
-| title | Shows in the top left corner of the toast header | 'Notice!'| |
-| subtitle | Shows in the top right corner of the toast header | N/A | |
-| content | Shows in the toast body | N/A | |
-| type | Determines the style of the toast based on Bootstrap styles | 'info' | 'info', 'success', 'warning', 'error' |
-| delay | Determines how long the Toast shoud be shown for. The default, -1, will show the toast until the user clicks close. | -1 | omit or set to -1 to disable auto close, or timeout value in milliseconds
-| img | Shows an image before the title | N/A | { src: '', class: '', title: '', alt: '' }
-| pause_on_hover| true/false respectively to pause on hover | false | true/false |
-| container | Set the container inside which the toasts will be displayed | $("body") | A JQuery selector |
-
-**Note:** If content is omitted, the toast will not have a `.toast-body` and can be used as a small snack which will be shown below in the examples. By default toasts will be positioned in the top right corner and will in the future (hopefully) have other position options.
+Modify the global variables to apply specific rules/styles to all your toasts.
```javascript
-$.toast({
- title: 'Toast',
- subtitle: '11 mins ago',
- content: 'Hello, world! This is a toast message.',
- type: 'info',
- delay: 5000
-});
+$.toastDefaults = {
+ position: 'top-right', /** top-left/top-right/bottom-left/bottom-right - Where the toast will show up **/
+ dismissible: true, /** true/false - If you want to show the button to dismiss the toast manually **/
+ stackable: true, /** true/false - If you want the toasts to be stackable **/
+ pauseDelayOnHover: true, /** true/false - If you want to pause the delay of toast when hovering over the toast **/
+ style: {
+ toast: '', /** Classes you want to apply separated my a space to each created toast element (.toast) **/
+ info: '', /** Classes you want to apply separated my a space to modify the "info" type style **/
+ success: '', /** Classes you want to apply separated my a space to modify the "success" type style **/
+ warning: '', /** Classes you want to apply separated my a space to modify the "warning" type style **/
+ error: '', /** Classes you want to apply separated my a space to modify the "error" type style **/
+ }
+};
```
-![Example #1](https://i.gyazo.com/20fbdf05b57af4a76e28f66047fe6591.png)
-
-The respective markdown for the above would be:
-
-```
-
-
- Toast
- 11 mins ago
-
-
-
Hello, world! This is a toast message.
-
-```
+#### Snack
-To show a "snack" (a small version of the toast), simply omit the content property:
+A "snack" is a bitesized "toast".
```javascript
-$.toast({
- title: 'A small bitesize snack, not a toast!',
- type: 'info',
- delay: 5000
-});
+$.snack(type, title, delay)
```
+
-![Example Snack](https://i.gyazo.com/e707a35836553aa9dec96025eb332ac1.png)
-
-Now, onto the different types:
-
-![Example #2](https://i.gyazo.com/20fbdf05b57af4a76e28f66047fe6591.png)
-
-An 'info' toast
-
-![Example #3](https://i.gyazo.com/51b708cb610e603f61b80a6008a45729.png)
+**Note:** The final argument `delay` is omitable. If omitted, the toast will remain forever.
-A 'success' toast
-
-![Example #4](https://i.gyazo.com/0844e5f70f1e73416fb38be134144844.png)
-
-A 'warning' toast
-
-![Example #5](https://i.gyazo.com/8ee70ce1203d112a9a30ac53e350d54d.png)
-
-An 'error' toast
-
-The toasts are stackable:
-
-![Example #6](https://i.gyazo.com/da0e40283269c3c38de605b7c938fa95.png)
-
-### Caveats
-
-* ~~The toast will remain in the DOM when hidden, I am working on a way to incorperate removing them from the DOM or reusing existing ones if left in, however, for the time being, you can use the following to remove the toast once it is hidden from the DOM:~~ - As of 2019-03-16, the toasts will be removed automatically from the DOM.
+#### Toast
```javascript
-$('body').on('hidden.bs.toast', '.toast', function () {
- $(this).remove();
+$.toast({
+ type: 'info',
+ title: 'Notice!',
+ subtitle: '11 mins ago',
+ content: 'Hello, world! This is a toast message.',
+ delay: 5000,
+ img: {
+ src: 'https://via.placeholder.com/20',
+ class: 'rounded-0', /** Classes you want to apply separated my a space to modify the image **/
+ alt: 'Image'
+ }
});
```
-### Roadmap
-
-* ~~Allow img in toast as is shown in the Bootstrap 4 documentation~~ - 2019-03-16
-* Allow the option to prevent stacking
-* ~~Autoremove toast from DOM once hidden~~ - 2019-03-16
-* Custom styling (rounded toasts, blocky toasts, custom background colours)
-* Positioning of the actual toast
+
### Contributing
Feel free to contribute in any of the ways outlined:
-- Request features
-- Submit bug reports
-- Submit pull requests
-- Help by answering issues
-- Tell us if you are using the plugin in your project (it helps!)
-
-Just a few guidelines (for now):
-
-- Follow the existing conventions (if unsure, make an issue)
-- Ensure dist and js/css dirs are kept uptodate with each other
-- Minify using https://closure-compiler.appspot.com/home (no custom options)
+- Submit issues/pull requests
+- Tell us how you're using this plugin in *your* project
diff --git a/css/toast.css b/css/toast.css
deleted file mode 100644
index fbab545..0000000
--- a/css/toast.css
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * @author Script47 (https://github.com/Script47/Toast)
- * @description Toast - A Bootstrap 4.2+ jQuery plugin for the toast component
- * @version 0.7.1
- **/
-.toast-container {
- position: sticky;
- z-index: 1055;
- top: 0
-}
-
-.toast-wrapper {
- position: absolute;
- z-index: 1055;
- top: 0;
- right: 0;
- margin: 5px
-}
-
-.toast-container>.toast-wrapper>.toast {
- min-width: 150px;
- background-color: rgb(255, 255, 255);
- border-top: none;
-}
-
-.toast-container>.toast-wrapper>.toast>.toast-header strong {
- padding-right: 20px;
-}
diff --git a/dist/toast.min.css b/dist/toast.min.css
index 6fa9ca2..a6fe570 100644
--- a/dist/toast.min.css
+++ b/dist/toast.min.css
@@ -1,6 +1 @@
-/**
- * @author Script47 (https://github.com/Script47/Toast)
- * @description Toast - A Bootstrap 4.2+ jQuery plugin for the toast component
- * @version 0.7.1
- **/
-.toast-container{position:sticky;z-index:1055;top:0}.toast-wrapper{position:absolute;z-index:1055;top:0;right:0;margin:5px}.toast-container > .toast-wrapper > .toast{min-width:150px;background-color:rgb(255, 255, 255);border-top:none}.toast-container > .toast-wrapper > .toast > .toast-header strong{padding-right:20px}
+.toast-container{position:fixed;z-index:1055;margin:5px}.top-right{top:0;right:0}.top-left{top:0;left:0}.bottom-right{right:0;bottom:0}.bottom-left{left:0;bottom:0}.toast-container>.toast{min-width:150px;background:0 0;border:none}.toast-container>.toast>.toast-header{border:none}.toast-container>.toast>.toast-header strong{padding-right:20px}.toast-container>.toast>.toast-body{background:#fff}
diff --git a/dist/toast.min.js b/dist/toast.min.js
index 96838c7..3e3c088 100644
--- a/dist/toast.min.js
+++ b/dist/toast.min.js
@@ -1,9 +1,6 @@
-/**
- * @author Script47 (https://github.com/Script47/Toast)
- * @description Toast - A Bootstrap 4.2+ jQuery plugin for the toast component
- * @version 0.7.1
- **/
- (function(c){c.toast=function(b){var d=c("body");b.container&&1===b.container.length&&(d=b.container);d.children(".toast-container").length||(d.prepend(''),d.children(".toast-container").append(''),d.on("hidden.bs.toast",".toast",function(){c(this).remove()}));d=d.children(".toast-container").children(".toast-wrapper");var k="toast-"+(c(".toast").length+1),a="",f=a="",g="text-muted",h="",r=b.title||
- "Notice!",t=b.subtitle||"",q=b.content||"",l=b.delay||-1,e=b.img,m=b.pause_on_hover||!1,n=!1,p="";switch(b.type||"info"){case "info":a="bg-info";h=g=f="text-white";break;case "success":a="bg-success";h=g=f="text-white";break;case "warning":case "warn":a="bg-warning";h=g=f="text-white";break;case "error":case "danger":a="bg-danger",h=g=f="text-white"}!1!==m?(b=Math.floor(Date.now()/1E3)+l/1E3,p='data-autohide="false"',m='data-hide-timestamp="'+b+'"'):p=-1===l?'data-autohide="false"':'data-delay="'+
- l+'"';a='