From 3f4c0720e1e3421431e7baa20882a4a4512a7fab Mon Sep 17 00:00:00 2001 From: ivar Date: Sun, 19 Oct 2025 23:41:23 +0200 Subject: Initial --- .../libraries/fomantic/dist/components/toast.js | 870 +++++++++++++++++++++ 1 file changed, 870 insertions(+) create mode 100644 src/wwwroot/libraries/fomantic/dist/components/toast.js (limited to 'src/wwwroot/libraries/fomantic/dist/components/toast.js') diff --git a/src/wwwroot/libraries/fomantic/dist/components/toast.js b/src/wwwroot/libraries/fomantic/dist/components/toast.js new file mode 100644 index 0000000..3463e71 --- /dev/null +++ b/src/wwwroot/libraries/fomantic/dist/components/toast.js @@ -0,0 +1,870 @@ +/*! + * # Fomantic-UI - Toast + * http://github.com/fomantic/Fomantic-UI/ + * + * + * Released under the MIT license + * http://opensource.org/licenses/MIT + * + */ + +;(function ($, window, document, undefined) { + +'use strict'; + +$.isFunction = $.isFunction || function(obj) { + return typeof obj === "function" && typeof obj.nodeType !== "number"; +}; + +window = (typeof window != 'undefined' && window.Math == Math) + ? window + : (typeof self != 'undefined' && self.Math == Math) + ? self + : Function('return this')() +; + +$.fn.toast = function(parameters) { + var + $allModules = $(this), + moduleSelector = $allModules.selector || '', + + time = new Date().getTime(), + performance = [], + + query = arguments[0], + methodInvoked = (typeof query == 'string'), + queryArguments = [].slice.call(arguments, 1), + returnedValue + ; + $allModules + .each(function() { + var + settings = ( $.isPlainObject(parameters) ) + ? $.extend(true, {}, $.fn.toast.settings, parameters) + : $.extend({}, $.fn.toast.settings), + + className = settings.className, + selector = settings.selector, + error = settings.error, + namespace = settings.namespace, + fields = settings.fields, + + eventNamespace = '.' + namespace, + moduleNamespace = namespace + '-module', + + $module = $(this), + $toastBox, + $toast, + $actions, + $progress, + $progressBar, + $animationObject, + $close, + $context = (settings.context) + ? $(settings.context) + : $('body'), + + isToastComponent = $module.hasClass('toast') || $module.hasClass('message') || $module.hasClass('card'), + + element = this, + instance = isToastComponent ? $module.data(moduleNamespace) : undefined, + + module + ; + module = { + + initialize: function() { + module.verbose('Initializing element'); + if (!module.has.container()) { + module.create.container(); + } + if(isToastComponent || settings.message !== '' || settings.title !== '' || module.get.iconClass() !== '' || settings.showImage || module.has.configActions()) { + if(typeof settings.showProgress !== 'string' || [className.top,className.bottom].indexOf(settings.showProgress) === -1 ) { + settings.showProgress = false; + } + module.create.toast(); + if(settings.closeOnClick && (settings.closeIcon || $($toast).find(selector.input).length > 0 || module.has.configActions())){ + settings.closeOnClick = false; + } + if(!settings.closeOnClick) { + $toastBox.addClass(className.unclickable); + } + module.bind.events(); + } + module.instantiate(); + if($toastBox) { + module.show(); + } + }, + + instantiate: function() { + module.verbose('Storing instance of toast'); + instance = module; + $module + .data(moduleNamespace, instance) + ; + }, + + destroy: function() { + if($toastBox) { + module.debug('Removing toast', $toastBox); + module.unbind.events(); + $toastBox.remove(); + $toastBox = undefined; + $toast = undefined; + $animationObject = undefined; + settings.onRemove.call($toastBox, element); + $progress = undefined; + $progressBar = undefined; + $close = undefined; + } + $module + .removeData(moduleNamespace) + ; + }, + + show: function(callback) { + callback = callback || function(){}; + module.debug('Showing toast'); + if(settings.onShow.call($toastBox, element) === false) { + module.debug('onShow callback returned false, cancelling toast animation'); + return; + } + module.animate.show(callback); + }, + + close: function(callback) { + callback = callback || function(){}; + module.remove.visible(); + module.unbind.events(); + module.animate.close(callback); + + }, + + create: { + container: function() { + module.verbose('Creating container'); + $context.append($('
',{class: settings.position + ' ' + className.container})); + }, + toast: function() { + $toastBox = $('
', {class: className.box}); + if (!isToastComponent) { + module.verbose('Creating toast'); + $toast = $('
'); + var $content = $('
', {class: className.content}); + var iconClass = module.get.iconClass(); + if (iconClass !== '') { + $toast.append($('', {class: iconClass + ' ' + className.icon})); + } + + if (settings.showImage) { + $toast.append($('', { + class: className.image + ' ' + settings.classImage, + src: settings.showImage + })); + } + if (settings.title !== '') { + $content.append($('
', { + class: className.title, + text: settings.title + })); + } + + $content.append($('
', {html: module.helpers.escape(settings.message, settings.preserveHTML)})); + + $toast + .addClass(settings.class + ' ' + className.toast) + .append($content) + ; + $toast.css('opacity', settings.opacity); + if (settings.closeIcon) { + $close = $('', {class: className.close + ' ' + (typeof settings.closeIcon === 'string' ? settings.closeIcon : '')}); + if($close.hasClass(className.left)) { + $toast.prepend($close); + } else { + $toast.append($close); + } + } + } else { + $toast = settings.cloneModule ? $module.clone().removeAttr('id') : $module; + $close = $toast.find('> i'+module.helpers.toClass(className.close)); + settings.closeIcon = ($close.length > 0); + } + if ($toast.hasClass(className.compact)) { + settings.compact = true; + } + if ($toast.hasClass('card')) { + settings.compact = false; + } + $actions = $toast.find('.actions'); + if (module.has.configActions()) { + if ($actions.length === 0) { + $actions = $('
', {class: className.actions + ' ' + (settings.classActions || '')}).appendTo($toast); + } + if($toast.hasClass('card') && !$actions.hasClass(className.attached)) { + $actions.addClass(className.extraContent); + if($actions.hasClass(className.vertical)) { + $actions.removeClass(className.vertical); + module.error(error.verticalCard); + } + } + settings.actions.forEach(function (el) { + var icon = el[fields.icon] ? '' : '', + text = module.helpers.escape(el[fields.text] || '', settings.preserveHTML), + cls = module.helpers.deQuote(el[fields.class] || ''), + click = el[fields.click] && $.isFunction(el[fields.click]) ? el[fields.click] : function () {}; + $actions.append($('