PageSourceSearch

https://rikxplatform.nl/Resources/Plugins/toasts.js/toasts.min.js

js rikxplatform.nl collected 2026-10-07 07:05:23 UTC 9,209 bytes, 113 lines download raw bytes

1/*
2 * Toasts.js
3 * Copyright 2020
4 * Authors: Wessel Kok.
5 * All Rights Reserved.
6 * Use, reproduction, distribution, and modification of this code is subject to the terms and
7 * conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
8 *
9 * Project: https://github.com/wesselkok/Toasts.js
10 */
11class Toast {
12    constructor(t) {
13        var o = $.extend({
14            title: "",
15            description: "",
16            type: "success",
17            html: null,
18            closeButton: !0,
19            closeButtonHtml: null,
20            button: null,
21            buttonHtml: null,
22            position: "bottom-left",
23            newestOnTop: !0,
24            showMethod: "slideDown",
25            hideMethod: "fadeOut",
26            showEasing: "linear",
27            hideEasing: "linear",
28            showDuration: 300,
29            hideDuration: 300,
30            timeOut: 5e3,
31            onShown: null,
32            onHidden: null,
33            onClick: null,
34            onCloseClick: null,
35            hideOnClick: false
36        }, t);
37        this.options = o, $(".toast-container." + this.options.position).length <= 0 && $('<div class="toast-container ' + this.options.position + '"></div>').appendTo("body");
38        var n = '<div class="toast ' + this.options.type + '"><div class="toast-content">';
39        null !== this.options.html ? n += this.options.html : ("success" !== this.options.type && "info" !== this.options.type && "warning" !== this.options.type && "error" !== this.options.type || (n += '<div class="icon">', "success" === this.options.type ? n += '<svg aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"></path></svg>' : "info" === this.options.type ? n += '<svg aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 8C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8zm0 110c23.196 0 42 18.804 42 42s-18.804 42-42 42-42-18.804-42-42 18.804-42 42-42zm56 254c0 6.627-5.373 12-12 12h-88c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h12v-64h-12c-6.627 0-12-5.373-12-12v-24c0-6.627 5.373-12 12-12h64c6.627 0 12 5.373 12 12v100h12c6.627 0 12 5.373 12 12v24z"></path></svg>' : "warning" === this.options.type ? n += '<svg aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"></path></svg>' : "error" === this.options.type && (n += '<svg aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zm-248 50c-25.405 0-46 20.595-46 46s20.595 46 46 46 46-20.595 46-46-20.595-46-46-46zm-43.673-165.346l7.418 136c.347 6.364 5.609 11.346 11.982 11.346h48.546c6.373 0 11.635-4.982 11.982-11.346l7.418-136c.375-6.874-5.098-12.654-11.982-12.654h-63.383c-6.884 0-12.356 5.78-11.981 12.654z"></path></svg>'), n += "</div>"), n += '<div class="content ' + ("" !== this.options.title && "" !== this.options.description ? "margin" : "") + '">', "" !== this.options.title && (n += '<div class="title">' + this.options.title + "</div>
39"), "" !== this.options.description && (n += '<div class="description">' + this.options.description + "</div>"), n += "</div>", this.options.closeButtonHtml ? n += this.options.closeButtonHtml : this.options.button && this.options.button.label ? n += '<div class="button" ' + (this.options.button.attributes ? this.options.button.attributes : "") + ">" + this.options.button.label + "</div>" : this.options.buttonHtml ? n += this.options.buttonHtml : this.options.closeButton && (n += '<div class="close"><svg aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M193.94 256L296.5 153.44l21.15-21.15c3.12-3.12 3.12-8.19 0-11.31l-22.63-22.63c-3.12-3.12-8.19-3.12-11.31 0L160 222.06 36.29 98.34c-3.12-3.12-8.19-3.12-11.31 0L2.34 120.97c-3.12 3.12-3.12 8.19 0 11.31L126.06 256 2.34 379.71c-3.12 3.12-3.12 8.19 0 11.31l22.63 22.63c3.12 3.12 8.19 3.12 11.31 0L160 289.94 262.56 392.5l21.15 21.15c3.12 3.12 8.19 3.12 11.31 0l22.63-22.63c3.12-3.12 3.12-8.19 0-11.31L193.94 256z" class=""></path></svg></div>')), n += "</div></div>", this.options.newestOnTop ? this.content = $(n).prependTo(".toast-container." + this.options.position) : this.content = $(n).appendTo(".toast-container." + this.options.position);
40        var i = this;
41        this.content.find(".close").click(function () {
42            i.hide(), null !== i.options.onCloseCallback && i.options.onCloseCallback instanceof Function && i.options.onCloseCallback()
43        }), this.content.click(function () {
44            i.options.hideOnClick && i.hide(), null !== i.options.onClick && i.options.onClick instanceof Function && i.options.onClick()
45        })
46    }
47    static success(t, o, n) {
48        var i = Toast.extendOptions(n);
49        return i.title = t, i.description = o, i.type = "success", new Toast(i).show()
50    }
51    static info(t, o, n) {
52        var i = Toast.extendOptions(n);
53        return i.title = t, i.description = o, i.type = "info", new Toast(i).show()
54    }
55    static warning(t, o, n) {
56        var i = Toast.extendOptions(n);
57        return i.title = t, i.description = o, i.type = "warning", new Toast(i).show()
58    }
59    static error(t, o, n) {
60        var i = Toast.extendOptions(n);
61        return i.title = t, i.description = o, i.type = "error", new Toast(i).show()
62    }
63    static custom(t, o, n) {
64        var i = Toast.extendOptions(n);
65        return i.html = t, i.type = o, new Toast(i).show()
66    }
67    static extendOptions(t) {
68        return $.extend({
69            title: "",
70            description: "",
71            type: "success",
72            html: null,
73            closeButton: !0,
74            closeButtonHtml: null,
75            button: null,
76            buttonHtml: null,
77            position: "bottom-left",
78            newestOnTop: !0,
79            showMethod: "slideDown",
80            hideMethod: "fadeOut",
81            showEasing: "linear",
82            hideEasing: "linear",
83            showDuration: 300,
84            hideDuration: 300,
85            timeOut: 5e3,
86            onShown: null,
87            onHidden: null,
88            onClick: null,
89            onCloseClick: null,
90            hideOnClick: false
91        }, t)
92    }
93    show() {
94        var t = this;
95        "slideDown" === this.options.showMethod ? $(this.content).slideDown(this.options.showDuration, this.options.showEasing, function () {
96            t.options.timeOut > 0 && setTimeout(t.hide.bind(t), t.options.timeOut), null !== t.options.onShown && t.options.onShown instanceof Function && t.options.onShown()
97        }) : "fadeIn" === this.options.showMethod ? $(this.content).fadeIn(this.options.showDuration, this.options.showEasing, function () {
98            t.options.timeOut > 0 && setTimeout(t.hide.bind(t), t.options.timeOut), null !== t.options.onShown && t.options.onShown instanceof Function && t.options.onShown()
99        }) : $(this.content).show(this.options.showDuration, this.options.showEasing, function () {
100            t.options.timeOut > 0 && setTimeout(t.hide.bind(t), t.options.timeOut), null !== t.options.onShown && t.options.onShown instanceof Function && t.options.onShown()
101        })
102    }
103    hide() {
104        var t = this;
105        "slideUp" === this.options.hideMethod ? $(this.content).slide
105Up(this.options.hideDuration, this.options.hideEasing, function () {
106            $(t.content).remove(), null !== t.options.onHidden && t.options.onHidden instanceof Function && t.options.onHidden()
107        }) : "fadeOut" === this.options.hideMethod ? $(this.content).fadeOut(this.options.hideDuration, this.options.hideEasing, function () {
108            $(t.content).remove(), null !== t.options.onHidden && t.options.onHidden instanceof Function && t.options.onHidden()
109        }) : $(this.content).hide(this.options.hideDuration, this.options.hideEasing, function () {
110            $(t.content).remove(), null !== t.options.onHidden && t.options.onHidden instanceof Function && t.options.onHidden()
111        })
112    }
113}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.