new pisilinux web sites
This commit is contained in:
+1
File diff suppressed because one or more lines are too long
+337
@@ -0,0 +1,337 @@
|
||||
!(function (e) {
|
||||
e(["jquery"], function (e) {
|
||||
return (function () {
|
||||
function t(e, t, n) {
|
||||
return g({
|
||||
type: O.error,
|
||||
iconClass: m().iconClasses.error,
|
||||
message: e,
|
||||
optionsOverride: n,
|
||||
title: t,
|
||||
});
|
||||
}
|
||||
function n(t, n) {
|
||||
return (
|
||||
t || (t = m()),
|
||||
(v = e("#" + t.containerId)),
|
||||
v.length ? v : (n && (v = d(t)), v)
|
||||
);
|
||||
}
|
||||
function o(e, t, n) {
|
||||
return g({
|
||||
type: O.info,
|
||||
iconClass: m().iconClasses.info,
|
||||
message: e,
|
||||
optionsOverride: n,
|
||||
title: t,
|
||||
});
|
||||
}
|
||||
function s(e) {
|
||||
C = e;
|
||||
}
|
||||
function i(e, t, n) {
|
||||
return g({
|
||||
type: O.success,
|
||||
iconClass: m().iconClasses.success,
|
||||
message: e,
|
||||
optionsOverride: n,
|
||||
title: t,
|
||||
});
|
||||
}
|
||||
function a(e, t, n) {
|
||||
return g({
|
||||
type: O.warning,
|
||||
iconClass: m().iconClasses.warning,
|
||||
message: e,
|
||||
optionsOverride: n,
|
||||
title: t,
|
||||
});
|
||||
}
|
||||
function r(e, t) {
|
||||
var o = m();
|
||||
v || n(o), u(e, o, t) || l(o);
|
||||
}
|
||||
function c(t) {
|
||||
var o = m();
|
||||
return (
|
||||
v || n(o),
|
||||
t && 0 === e(":focus", t).length
|
||||
? void h(t)
|
||||
: void (v.children().length && v.remove())
|
||||
);
|
||||
}
|
||||
function l(t) {
|
||||
for (var n = v.children(), o = n.length - 1; o >= 0; o--) u(e(n[o]), t);
|
||||
}
|
||||
function u(t, n, o) {
|
||||
var s = !(!o || !o.force) && o.force;
|
||||
return (
|
||||
!(!t || (!s && 0 !== e(":focus", t).length)) &&
|
||||
(t[n.hideMethod]({
|
||||
duration: n.hideDuration,
|
||||
easing: n.hideEasing,
|
||||
complete: function () {
|
||||
h(t);
|
||||
},
|
||||
}),
|
||||
!0)
|
||||
);
|
||||
}
|
||||
function d(t) {
|
||||
return (
|
||||
(v = e("<div/>").attr("id", t.containerId).addClass(t.positionClass)),
|
||||
v.appendTo(e(t.target)),
|
||||
v
|
||||
);
|
||||
}
|
||||
function p() {
|
||||
return {
|
||||
tapToDismiss: !0,
|
||||
toastClass: "toast",
|
||||
containerId: "toast-container",
|
||||
debug: !1,
|
||||
showMethod: "fadeIn",
|
||||
showDuration: 300,
|
||||
showEasing: "swing",
|
||||
onShown: void 0,
|
||||
hideMethod: "fadeOut",
|
||||
hideDuration: 1e3,
|
||||
hideEasing: "swing",
|
||||
onHidden: void 0,
|
||||
closeMethod: !1,
|
||||
closeDuration: !1,
|
||||
closeEasing: !1,
|
||||
closeOnHover: !0,
|
||||
extendedTimeOut: 1e3,
|
||||
iconClasses: {
|
||||
error: "toast-error",
|
||||
info: "toast-info",
|
||||
success: "toast-success",
|
||||
warning: "toast-warning",
|
||||
},
|
||||
iconClass: "toast-info",
|
||||
positionClass: "toast-top-right",
|
||||
timeOut: 5e3,
|
||||
titleClass: "toast-title",
|
||||
messageClass: "toast-message",
|
||||
escapeHtml: !1,
|
||||
target: "body",
|
||||
closeHtml: '<button type="button">×</button>',
|
||||
closeClass: "toast-close-button",
|
||||
newestOnTop: !0,
|
||||
preventDuplicates: !1,
|
||||
progressBar: !1,
|
||||
progressClass: "toast-progress",
|
||||
rtl: !1,
|
||||
};
|
||||
}
|
||||
function f(e) {
|
||||
C && C(e);
|
||||
}
|
||||
function g(t) {
|
||||
function o(e) {
|
||||
return (
|
||||
null == e && (e = ""),
|
||||
e
|
||||
.replace(/&/g, "&")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
);
|
||||
}
|
||||
function s() {
|
||||
c(), u(), d(), p(), g(), C(), l(), i();
|
||||
}
|
||||
function i() {
|
||||
var e = "";
|
||||
switch (t.iconClass) {
|
||||
case "toast-success":
|
||||
case "toast-info":
|
||||
e = "polite";
|
||||
break;
|
||||
default:
|
||||
e = "assertive";
|
||||
}
|
||||
I.attr("aria-live", e);
|
||||
}
|
||||
function a() {
|
||||
E.closeOnHover && I.hover(H, D),
|
||||
!E.onclick && E.tapToDismiss && I.click(b),
|
||||
E.closeButton &&
|
||||
j &&
|
||||
j.click(function (e) {
|
||||
e.stopPropagation
|
||||
? e.stopPropagation()
|
||||
: void 0 !== e.cancelBubble &&
|
||||
e.cancelBubble !== !0 &&
|
||||
(e.cancelBubble = !0),
|
||||
E.onCloseClick && E.onCloseClick(e),
|
||||
b(!0);
|
||||
}),
|
||||
E.onclick &&
|
||||
I.click(function (e) {
|
||||
E.onclick(e), b();
|
||||
});
|
||||
}
|
||||
function r() {
|
||||
I.hide(),
|
||||
I[E.showMethod]({
|
||||
duration: E.showDuration,
|
||||
easing: E.showEasing,
|
||||
complete: E.onShown,
|
||||
}),
|
||||
E.timeOut > 0 &&
|
||||
((k = setTimeout(b, E.timeOut)),
|
||||
(F.maxHideTime = parseFloat(E.timeOut)),
|
||||
(F.hideEta = new Date().getTime() + F.maxHideTime),
|
||||
E.progressBar && (F.intervalId = setInterval(x, 10)));
|
||||
}
|
||||
function c() {
|
||||
t.iconClass && I.addClass(E.toastClass).addClass(y);
|
||||
}
|
||||
function l() {
|
||||
E.newestOnTop ? v.prepend(I) : v.append(I);
|
||||
}
|
||||
function u() {
|
||||
if (t.title) {
|
||||
var e = t.title;
|
||||
E.escapeHtml && (e = o(t.title)),
|
||||
M.append(e).addClass(E.titleClass),
|
||||
I.append(M);
|
||||
}
|
||||
}
|
||||
function d() {
|
||||
if (t.message) {
|
||||
var e = t.message;
|
||||
E.escapeHtml && (e = o(t.message)),
|
||||
B.append(e).addClass(E.messageClass),
|
||||
I.append(B);
|
||||
}
|
||||
}
|
||||
function p() {
|
||||
E.closeButton &&
|
||||
(j.addClass(E.closeClass).attr("role", "button"), I.prepend(j));
|
||||
}
|
||||
function g() {
|
||||
E.progressBar && (q.addClass(E.progressClass), I.prepend(q));
|
||||
}
|
||||
function C() {
|
||||
E.rtl && I.addClass("rtl");
|
||||
}
|
||||
function O(e, t) {
|
||||
if (e.preventDuplicates) {
|
||||
if (t.message === w) return !0;
|
||||
w = t.message;
|
||||
}
|
||||
return !1;
|
||||
}
|
||||
function b(t) {
|
||||
var n = t && E.closeMethod !== !1 ? E.closeMethod : E.hideMethod,
|
||||
o = t && E.closeDuration !== !1 ? E.closeDuration : E.hideDuration,
|
||||
s = t && E.closeEasing !== !1 ? E.closeEasing : E.hideEasing;
|
||||
if (!e(":focus", I).length || t)
|
||||
return (
|
||||
clearTimeout(F.intervalId),
|
||||
I[n]({
|
||||
duration: o,
|
||||
easing: s,
|
||||
complete: function () {
|
||||
h(I),
|
||||
clearTimeout(k),
|
||||
E.onHidden && "hidden" !== P.state && E.onHidden(),
|
||||
(P.state = "hidden"),
|
||||
(P.endTime = new Date()),
|
||||
f(P);
|
||||
},
|
||||
})
|
||||
);
|
||||
}
|
||||
function D() {
|
||||
(E.timeOut > 0 || E.extendedTimeOut > 0) &&
|
||||
((k = setTimeout(b, E.extendedTimeOut)),
|
||||
(F.maxHideTime = parseFloat(E.extendedTimeOut)),
|
||||
(F.hideEta = new Date().getTime() + F.maxHideTime));
|
||||
}
|
||||
function H() {
|
||||
clearTimeout(k),
|
||||
(F.hideEta = 0),
|
||||
I.stop(!0, !0)[E.showMethod]({
|
||||
duration: E.showDuration,
|
||||
easing: E.showEasing,
|
||||
});
|
||||
}
|
||||
function x() {
|
||||
var e = ((F.hideEta - new Date().getTime()) / F.maxHideTime) * 100;
|
||||
q.width(e + "%");
|
||||
}
|
||||
var E = m(),
|
||||
y = t.iconClass || E.iconClass;
|
||||
if (
|
||||
("undefined" != typeof t.optionsOverride &&
|
||||
((E = e.extend(E, t.optionsOverride)),
|
||||
(y = t.optionsOverride.iconClass || y)),
|
||||
!O(E, t))
|
||||
) {
|
||||
T++, (v = n(E, !0));
|
||||
var k = null,
|
||||
I = e("<div/>"),
|
||||
M = e("<div/>"),
|
||||
B = e("<div/>"),
|
||||
q = e("<div/>"),
|
||||
j = e(E.closeHtml),
|
||||
F = { intervalId: null, hideEta: null, maxHideTime: null },
|
||||
P = {
|
||||
toastId: T,
|
||||
state: "visible",
|
||||
startTime: new Date(),
|
||||
options: E,
|
||||
map: t,
|
||||
};
|
||||
return s(), r(), a(), f(P), E.debug && console && console.log(P), I;
|
||||
}
|
||||
}
|
||||
function m() {
|
||||
return e.extend({}, p(), b.options);
|
||||
}
|
||||
function h(e) {
|
||||
v || (v = n()),
|
||||
e.is(":visible") ||
|
||||
(e.remove(),
|
||||
(e = null),
|
||||
0 === v.children().length && (v.remove(), (w = void 0)));
|
||||
}
|
||||
var v,
|
||||
C,
|
||||
w,
|
||||
T = 0,
|
||||
O = {
|
||||
error: "error",
|
||||
info: "info",
|
||||
success: "success",
|
||||
warning: "warning",
|
||||
},
|
||||
b = {
|
||||
clear: r,
|
||||
remove: c,
|
||||
error: t,
|
||||
getContainer: n,
|
||||
info: o,
|
||||
options: {},
|
||||
subscribe: s,
|
||||
success: i,
|
||||
version: "2.1.4",
|
||||
warning: a,
|
||||
};
|
||||
return b;
|
||||
})();
|
||||
});
|
||||
})(
|
||||
"function" == typeof define && define.amd
|
||||
? define
|
||||
: function (e, t) {
|
||||
"undefined" != typeof module && module.exports
|
||||
? (module.exports = t(require("jquery")))
|
||||
: (window.toastr = t(window.jQuery));
|
||||
}
|
||||
);
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
@@ -0,0 +1,517 @@
|
||||
/*
|
||||
* Toastr
|
||||
* Copyright 2012-2015
|
||||
* Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
|
||||
* All Rights Reserved.
|
||||
* Use, reproduction, distribution, and modification of this code is subject to the terms and
|
||||
* conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* ARIA Support: Greta Krafsig
|
||||
*
|
||||
* Project: https://github.com/CodeSeven/toastr
|
||||
*/
|
||||
/* global define */
|
||||
(function (define) {
|
||||
define(["jquery"], function ($) {
|
||||
return (function () {
|
||||
var $container;
|
||||
var listener;
|
||||
var toastId = 0;
|
||||
var toastType = {
|
||||
error: "error",
|
||||
info: "info",
|
||||
success: "success",
|
||||
warning: "warning",
|
||||
};
|
||||
|
||||
var toastr = {
|
||||
clear: clear,
|
||||
remove: remove,
|
||||
error: error,
|
||||
getContainer: getContainer,
|
||||
info: info,
|
||||
options: {},
|
||||
subscribe: subscribe,
|
||||
success: success,
|
||||
version: "2.1.4",
|
||||
warning: warning,
|
||||
};
|
||||
|
||||
var previousToast;
|
||||
|
||||
return toastr;
|
||||
|
||||
////////////////
|
||||
|
||||
function error(message, title, optionsOverride) {
|
||||
return notify({
|
||||
type: toastType.error,
|
||||
iconClass: getOptions().iconClasses.error,
|
||||
message: message,
|
||||
optionsOverride: optionsOverride,
|
||||
title: title,
|
||||
});
|
||||
}
|
||||
|
||||
function getContainer(options, create) {
|
||||
if (!options) {
|
||||
options = getOptions();
|
||||
}
|
||||
$container = $("#" + options.containerId);
|
||||
if ($container.length) {
|
||||
return $container;
|
||||
}
|
||||
if (create) {
|
||||
$container = createContainer(options);
|
||||
}
|
||||
return $container;
|
||||
}
|
||||
|
||||
function info(message, title, optionsOverride) {
|
||||
return notify({
|
||||
type: toastType.info,
|
||||
iconClass: getOptions().iconClasses.info,
|
||||
message: message,
|
||||
optionsOverride: optionsOverride,
|
||||
title: title,
|
||||
});
|
||||
}
|
||||
|
||||
function subscribe(callback) {
|
||||
listener = callback;
|
||||
}
|
||||
|
||||
function success(message, title, optionsOverride) {
|
||||
return notify({
|
||||
type: toastType.success,
|
||||
iconClass: getOptions().iconClasses.success,
|
||||
message: message,
|
||||
optionsOverride: optionsOverride,
|
||||
title: title,
|
||||
});
|
||||
}
|
||||
|
||||
function warning(message, title, optionsOverride) {
|
||||
return notify({
|
||||
type: toastType.warning,
|
||||
iconClass: getOptions().iconClasses.warning,
|
||||
message: message,
|
||||
optionsOverride: optionsOverride,
|
||||
title: title,
|
||||
});
|
||||
}
|
||||
|
||||
function clear($toastElement, clearOptions) {
|
||||
var options = getOptions();
|
||||
if (!$container) {
|
||||
getContainer(options);
|
||||
}
|
||||
if (!clearToast($toastElement, options, clearOptions)) {
|
||||
clearContainer(options);
|
||||
}
|
||||
}
|
||||
|
||||
function remove($toastElement) {
|
||||
var options = getOptions();
|
||||
if (!$container) {
|
||||
getContainer(options);
|
||||
}
|
||||
if ($toastElement && $(":focus", $toastElement).length === 0) {
|
||||
removeToast($toastElement);
|
||||
return;
|
||||
}
|
||||
if ($container.children().length) {
|
||||
$container.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// internal functions
|
||||
|
||||
function clearContainer(options) {
|
||||
var toastsToClear = $container.children();
|
||||
for (var i = toastsToClear.length - 1; i >= 0; i--) {
|
||||
clearToast($(toastsToClear[i]), options);
|
||||
}
|
||||
}
|
||||
|
||||
function clearToast($toastElement, options, clearOptions) {
|
||||
var force =
|
||||
clearOptions && clearOptions.force ? clearOptions.force : false;
|
||||
if (
|
||||
$toastElement &&
|
||||
(force || $(":focus", $toastElement).length === 0)
|
||||
) {
|
||||
$toastElement[options.hideMethod]({
|
||||
duration: options.hideDuration,
|
||||
easing: options.hideEasing,
|
||||
complete: function () {
|
||||
removeToast($toastElement);
|
||||
},
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function createContainer(options) {
|
||||
$container = $("<div/>")
|
||||
.attr("id", options.containerId)
|
||||
.addClass(options.positionClass);
|
||||
|
||||
$container.appendTo($(options.target));
|
||||
return $container;
|
||||
}
|
||||
|
||||
function getDefaults() {
|
||||
return {
|
||||
tapToDismiss: true,
|
||||
toastClass: "toast",
|
||||
containerId: "toast-container",
|
||||
debug: false,
|
||||
|
||||
showMethod: "fadeIn", //fadeIn, slideDown, and show are built into jQuery
|
||||
showDuration: 300,
|
||||
showEasing: "swing", //swing and linear are built into jQuery
|
||||
onShown: undefined,
|
||||
hideMethod: "fadeOut",
|
||||
hideDuration: 1000,
|
||||
hideEasing: "swing",
|
||||
onHidden: undefined,
|
||||
closeMethod: false,
|
||||
closeDuration: false,
|
||||
closeEasing: false,
|
||||
closeOnHover: true,
|
||||
|
||||
extendedTimeOut: 1000,
|
||||
iconClasses: {
|
||||
error: "toast-error",
|
||||
info: "toast-info",
|
||||
success: "toast-success",
|
||||
warning: "toast-warning",
|
||||
},
|
||||
iconClass: "toast-info",
|
||||
positionClass: "toast-top-right",
|
||||
timeOut: 5000, // Set timeOut and extendedTimeOut to 0 to make it sticky
|
||||
titleClass: "toast-title",
|
||||
messageClass: "toast-message",
|
||||
escapeHtml: false,
|
||||
target: "body",
|
||||
closeHtml: '<button type="button">×</button>',
|
||||
closeClass: "toast-close-button",
|
||||
newestOnTop: true,
|
||||
preventDuplicates: false,
|
||||
progressBar: false,
|
||||
progressClass: "toast-progress",
|
||||
rtl: false,
|
||||
};
|
||||
}
|
||||
|
||||
function publish(args) {
|
||||
if (!listener) {
|
||||
return;
|
||||
}
|
||||
listener(args);
|
||||
}
|
||||
|
||||
function notify(map) {
|
||||
var options = getOptions();
|
||||
var iconClass = map.iconClass || options.iconClass;
|
||||
|
||||
if (typeof map.optionsOverride !== "undefined") {
|
||||
options = $.extend(options, map.optionsOverride);
|
||||
iconClass = map.optionsOverride.iconClass || iconClass;
|
||||
}
|
||||
|
||||
if (shouldExit(options, map)) {
|
||||
return;
|
||||
}
|
||||
|
||||
toastId++;
|
||||
|
||||
$container = getContainer(options, true);
|
||||
|
||||
var intervalId = null;
|
||||
var $toastElement = $("<div/>");
|
||||
var $titleElement = $("<div/>");
|
||||
var $messageElement = $("<div/>");
|
||||
var $progressElement = $("<div/>");
|
||||
var $closeElement = $(options.closeHtml);
|
||||
var progressBar = {
|
||||
intervalId: null,
|
||||
hideEta: null,
|
||||
maxHideTime: null,
|
||||
};
|
||||
var response = {
|
||||
toastId: toastId,
|
||||
state: "visible",
|
||||
startTime: new Date(),
|
||||
options: options,
|
||||
map: map,
|
||||
};
|
||||
|
||||
personalizeToast();
|
||||
|
||||
displayToast();
|
||||
|
||||
handleEvents();
|
||||
|
||||
publish(response);
|
||||
|
||||
if (options.debug && console) {
|
||||
console.log(response);
|
||||
}
|
||||
|
||||
return $toastElement;
|
||||
|
||||
function escapeHtml(source) {
|
||||
if (source == null) {
|
||||
source = "";
|
||||
}
|
||||
|
||||
return source
|
||||
.replace(/&/g, "&")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">");
|
||||
}
|
||||
|
||||
function personalizeToast() {
|
||||
setIcon();
|
||||
setTitle();
|
||||
setMessage();
|
||||
setCloseButton();
|
||||
setProgressBar();
|
||||
setRTL();
|
||||
setSequence();
|
||||
setAria();
|
||||
}
|
||||
|
||||
function setAria() {
|
||||
var ariaValue = "";
|
||||
switch (map.iconClass) {
|
||||
case "toast-success":
|
||||
case "toast-info":
|
||||
ariaValue = "polite";
|
||||
break;
|
||||
default:
|
||||
ariaValue = "assertive";
|
||||
}
|
||||
$toastElement.attr("aria-live", ariaValue);
|
||||
}
|
||||
|
||||
function handleEvents() {
|
||||
if (options.closeOnHover) {
|
||||
$toastElement.hover(stickAround, delayedHideToast);
|
||||
}
|
||||
|
||||
if (!options.onclick && options.tapToDismiss) {
|
||||
$toastElement.click(hideToast);
|
||||
}
|
||||
|
||||
if (options.closeButton && $closeElement) {
|
||||
$closeElement.click(function (event) {
|
||||
if (event.stopPropagation) {
|
||||
event.stopPropagation();
|
||||
} else if (
|
||||
event.cancelBubble !== undefined &&
|
||||
event.cancelBubble !== true
|
||||
) {
|
||||
event.cancelBubble = true;
|
||||
}
|
||||
|
||||
if (options.onCloseClick) {
|
||||
options.onCloseClick(event);
|
||||
}
|
||||
|
||||
hideToast(true);
|
||||
});
|
||||
}
|
||||
|
||||
if (options.onclick) {
|
||||
$toastElement.click(function (event) {
|
||||
options.onclick(event);
|
||||
hideToast();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function displayToast() {
|
||||
$toastElement.hide();
|
||||
|
||||
$toastElement[options.showMethod]({
|
||||
duration: options.showDuration,
|
||||
easing: options.showEasing,
|
||||
complete: options.onShown,
|
||||
});
|
||||
|
||||
if (options.timeOut > 0) {
|
||||
intervalId = setTimeout(hideToast, options.timeOut);
|
||||
progressBar.maxHideTime = parseFloat(options.timeOut);
|
||||
progressBar.hideEta =
|
||||
new Date().getTime() + progressBar.maxHideTime;
|
||||
if (options.progressBar) {
|
||||
progressBar.intervalId = setInterval(updateProgress, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setIcon() {
|
||||
if (map.iconClass) {
|
||||
$toastElement.addClass(options.toastClass).addClass(iconClass);
|
||||
}
|
||||
}
|
||||
|
||||
function setSequence() {
|
||||
if (options.newestOnTop) {
|
||||
$container.prepend($toastElement);
|
||||
} else {
|
||||
$container.append($toastElement);
|
||||
}
|
||||
}
|
||||
|
||||
function setTitle() {
|
||||
if (map.title) {
|
||||
var suffix = map.title;
|
||||
if (options.escapeHtml) {
|
||||
suffix = escapeHtml(map.title);
|
||||
}
|
||||
$titleElement.append(suffix).addClass(options.titleClass);
|
||||
$toastElement.append($titleElement);
|
||||
}
|
||||
}
|
||||
|
||||
function setMessage() {
|
||||
if (map.message) {
|
||||
var suffix = map.message;
|
||||
if (options.escapeHtml) {
|
||||
suffix = escapeHtml(map.message);
|
||||
}
|
||||
$messageElement.append(suffix).addClass(options.messageClass);
|
||||
$toastElement.append($messageElement);
|
||||
}
|
||||
}
|
||||
|
||||
function setCloseButton() {
|
||||
if (options.closeButton) {
|
||||
$closeElement.addClass(options.closeClass).attr("role", "button");
|
||||
$toastElement.prepend($closeElement);
|
||||
}
|
||||
}
|
||||
|
||||
function setProgressBar() {
|
||||
if (options.progressBar) {
|
||||
$progressElement.addClass(options.progressClass);
|
||||
$toastElement.prepend($progressElement);
|
||||
}
|
||||
}
|
||||
|
||||
function setRTL() {
|
||||
if (options.rtl) {
|
||||
$toastElement.addClass("rtl");
|
||||
}
|
||||
}
|
||||
|
||||
function shouldExit(options, map) {
|
||||
if (options.preventDuplicates) {
|
||||
if (map.message === previousToast) {
|
||||
return true;
|
||||
} else {
|
||||
previousToast = map.message;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function hideToast(override) {
|
||||
var method =
|
||||
override && options.closeMethod !== false
|
||||
? options.closeMethod
|
||||
: options.hideMethod;
|
||||
var duration =
|
||||
override && options.closeDuration !== false
|
||||
? options.closeDuration
|
||||
: options.hideDuration;
|
||||
var easing =
|
||||
override && options.closeEasing !== false
|
||||
? options.closeEasing
|
||||
: options.hideEasing;
|
||||
if ($(":focus", $toastElement).length && !override) {
|
||||
return;
|
||||
}
|
||||
clearTimeout(progressBar.intervalId);
|
||||
return $toastElement[method]({
|
||||
duration: duration,
|
||||
easing: easing,
|
||||
complete: function () {
|
||||
removeToast($toastElement);
|
||||
clearTimeout(intervalId);
|
||||
if (options.onHidden && response.state !== "hidden") {
|
||||
options.onHidden();
|
||||
}
|
||||
response.state = "hidden";
|
||||
response.endTime = new Date();
|
||||
publish(response);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function delayedHideToast() {
|
||||
if (options.timeOut > 0 || options.extendedTimeOut > 0) {
|
||||
intervalId = setTimeout(hideToast, options.extendedTimeOut);
|
||||
progressBar.maxHideTime = parseFloat(options.extendedTimeOut);
|
||||
progressBar.hideEta =
|
||||
new Date().getTime() + progressBar.maxHideTime;
|
||||
}
|
||||
}
|
||||
|
||||
function stickAround() {
|
||||
clearTimeout(intervalId);
|
||||
progressBar.hideEta = 0;
|
||||
$toastElement.stop(true, true)[options.showMethod]({
|
||||
duration: options.showDuration,
|
||||
easing: options.showEasing,
|
||||
});
|
||||
}
|
||||
|
||||
function updateProgress() {
|
||||
var percentage =
|
||||
((progressBar.hideEta - new Date().getTime()) /
|
||||
progressBar.maxHideTime) *
|
||||
100;
|
||||
$progressElement.width(percentage + "%");
|
||||
}
|
||||
}
|
||||
|
||||
function getOptions() {
|
||||
return $.extend({}, getDefaults(), toastr.options);
|
||||
}
|
||||
|
||||
function removeToast($toastElement) {
|
||||
if (!$container) {
|
||||
$container = getContainer();
|
||||
}
|
||||
if ($toastElement.is(":visible")) {
|
||||
return;
|
||||
}
|
||||
$toastElement.remove();
|
||||
$toastElement = null;
|
||||
if ($container.children().length === 0) {
|
||||
$container.remove();
|
||||
previousToast = undefined;
|
||||
}
|
||||
}
|
||||
})();
|
||||
});
|
||||
})(
|
||||
typeof define === "function" && define.amd
|
||||
? define
|
||||
: function (deps, factory) {
|
||||
if (typeof module !== "undefined" && module.exports) {
|
||||
//Node
|
||||
module.exports = factory(require("jquery"));
|
||||
} else {
|
||||
window.toastr = factory(window.jQuery);
|
||||
}
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user