(function($) { $.fn.widget = function(options) { } $.fn.widget.spinnerLoading = function (dom, loading) { if (loading) { $(dom).addClass('button--loading') } else { $(dom).removeClass('button--loading') } } $.fn.widget.loadModule = async function(callback) { loadVendor() await $.getJSON($.fn.widget.defaults['modFilePath'], function (data) { data['require']['css'].forEach(path => { $('head').append(``) }) data['require']['js'].forEach(path => { $('head').append(``) }) }); callback() } function loadVendor() { const vendorPath = $.fn.widget.defaults['vendorPath'] if (typeof iziToast == 'undefined') { $('head').append(``) } if (typeof Swiper === 'undefined') { $('head').append(``) } if (typeof moment == 'undefined') { $('head').append(``) } if (jQuery().draggable === undefined) { $('head').append(``) } if ($.cookie === undefined) { $('head').append(``) } } $.fn.widget.defaults = { widgetPath: '/dabory/widget', vendorPath: '/dabory/vendor', modFilePath: '/dabory/mod.json', }; }(jQuery));