diff --git a/themes/grav/app/forms/fields/iconpicker.js b/themes/grav/app/forms/fields/iconpicker.js index 04eb08aa..57b98944 100755 --- a/themes/grav/app/forms/fields/iconpicker.js +++ b/themes/grav/app/forms/fields/iconpicker.js @@ -6,244 +6,279 @@ import $ from 'jquery'; * License: GPLv2 */ -$(function() { +var defaults = { + 'mode': 'dialog', // show overlay 'dialog' panel or slide down 'inline' panel + 'closeOnPick': true, // whether to close panel after picking or 'no' + 'save': 'class', // save icon 'class' or 'code' + 'size': '', + 'classes': { + 'launcher': '', // extra classes for launcher buttons + 'clear': 'remove-times', // extra classes for button that removes preview and clears field + 'highlight': '', // extra classes when highlighting an icon + 'close': '' // extra classes for close button + }, + 'iconSets': { // example data structure. Used to specify which launchers will be created + 'genericon': 'Genericon', // create a launcher to pick genericon icons + 'fa': 'FontAwesome' // create a launcher to pick fontawesome icons + } +}; - 'use strict'; +class QL_Icon_Picker { - var defaults = { - 'mode': 'dialog', // show overlay 'dialog' panel or slide down 'inline' panel - 'closeOnPick': true, // whether to close panel after picking or 'no' - 'save': 'class', // save icon 'class' or 'code' - 'size': '', - 'classes': { - 'launcher': '', // extra classes for launcher buttons - 'clear': 'remove-times', // extra classes for button that removes preview and clears field - 'highlight': '', // extra classes when highlighting an icon - 'close': '' // extra classes for close button - }, - 'iconSets': { // example data structure. Used to specify which launchers will be created - 'genericon': 'Genericon', // create a launcher to pick genericon icons - 'fa': 'FontAwesome' // create a launcher to pick fontawesome icons - } - }; - - function QL_Icon_Picker(element, options) { + constructor(element, options) { + this.iconSet = ''; + this.iconSetName = ''; + this.$field = ''; this.element = element; this.settings = $.extend({}, defaults, options); this._defaults = defaults; this.init(); } - QL_Icon_Picker.prototype = { + init() { + var $brick = $(this.element); + var pickerId = $brick.data('pickerid'); + var $preview = $('
'); - iconSet: '', - iconSetName: '', - $field: '', + this.$field = $brick.find('input'); - init: function() { + // Add preview area + this.makePreview($brick, pickerId, $preview); - var $brick = $(this.element); - var pickerId = $brick.data('pickerid'); - var $preview = $(''); + // Make button to clear field and remove preview + this.makeClear(pickerId, $preview); - this.$field = $brick.find('input'); + // Make buttons that open the panel of icons + this.makeLaunchers($brick, pickerId); - // Add preview area - this.makePreview($brick, pickerId, $preview); + // Prepare display styles, inline and dialog + this.makeDisplay($brick); + } - // Make button to clear field and remove preview - this.makeClear(pickerId, $preview); + makePreview($brick, pickerId, $preview) { + var $icon = $(''); + var iconValue = this.$field.val(); - // Make buttons that open the panel of icons - this.makeLaunchers($brick, pickerId); - - // Prepare display styles, inline and dialog - this.makeDisplay($brick); - }, - - makePreview: function($brick, pickerId, $preview) { - var $icon = $(''); - var iconValue = this.$field.val(); - - $preview.prependTo($brick); - $icon.prependTo($preview); - if (iconValue !== '') { - $preview.addClass('icon-preview-on'); - $icon.addClass(iconValue); - } - }, - - makeClear: function(pickerId, $preview) { - var base = this; - var $clear = $(''); - - // Hide button to remove icon and preview and append it to preview area - $clear.hide().prependTo($preview); - // If there's a icon saved in the field, show remove icon button - if (base.$field.val() !== '') { - $clear.show(); - } - - $preview.on('click', '.remove-icon', function(e) { - e.preventDefault(); - base.$field.val(''); - $preview.removeClass('icon-preview-on').find('i').removeClass(); - $(this).hide(); - }); - }, - - makeDisplay: function($brick) { - var base = this; - var close = base.settings.classes.close; - var $body = $('body'); - - var $close = $(''); - - if (base.settings.mode === 'inline') { - $brick.find('.icon-set').append($close).removeClass('dialog').addClass('inline ' + base.settings.size).parent().addClass('icon-set-wrap'); - } else if (base.settings.mode === 'dialog') { - $('.icon-set').addClass('dialog ' + base.settings.size); - if ($('.icon-picker-overlay').length <= 0) { - $body.append('').append($close); - } - } - $body - .on('click', '.icon-picker-close, .icon-picker-overlay', function(e) { - e.preventDefault(); - base.closePicker($brick, $(base.iconSet), base.settings.mode); - }) - .on('mouseenter mouseleave', '.icon-picker-close', function(e) { - if (e.type === 'mouseenter') { - $(this).addClass(close); - } else { - $(this).removeClass(close); - } - }); - }, - - makeLaunchers: function($brick) { - var base = this; - var dataIconSets = $brick.data('iconsets'); - var iconSet; - - if (typeof dataIconSets === 'undefined') { - dataIconSets = base.settings.iconSets; - } - for (iconSet in dataIconSets) { - if (dataIconSets.hasOwnProperty(iconSet)) { - $brick.append('' + dataIconSets[iconSet] + ''); - } - } - - $brick.find('.launch-icons').on('click', function(e) { - e.preventDefault(); - var $self = $(this); - var theseIcons = $self.data('icons'); - - base.iconSetName = theseIcons; - base.iconSet = '.' + theseIcons + '-set'; - - // Initialize picker - base.iconPick($brick); - - // Show icon picker - base.showPicker($brick, $(base.iconSet), base.settings.mode); - }); - }, - - iconPick: function($brick) { - var base = this; - var highlight = 'icon-highlight ' + base.settings.classes.highlight; - - $(base.iconSet).on('click', 'li', function(e) { - e.preventDefault(); - var $icon = $(this); - var icon = $icon.data(base.settings.save); - - // Mark as selected - $('.icon-selected').removeClass('icon-selected'); - $icon.addClass('icon-selected'); - - // Save icon value to field - base.$field.val(icon); - - // Close icon picker - if (base.settings.closeOnPick) { - base.closePicker($brick, $icon.closest(base.iconSet), base.settings.mode); - } - - // Set preview - base.setPreview($icon.data('class')); - - // Broadcast event passing the selected icon. - $('body').trigger('iconselected.queryloop', icon); - }); - $(base.iconSet).on('mouseenter mouseleave', 'li', function(e) { - if (e.type === 'mouseenter') { - $(this).addClass(highlight); - } else { - $(this).removeClass(highlight); - } - }); - }, - - showPicker: function($brick, $icons, mode) { - if (mode === 'inline') { - $('.icon-set').removeClass('inline-open'); - $brick.find($icons).toggleClass('inline-open'); - } else if (mode === 'dialog') { - $('.icon-picker-close, .icon-picker-overlay').addClass('make-visible'); - $icons.addClass('dialog-open'); - } - - $icons.find('.icon-selected').removeClass('icon-selected'); - var selectedIcon = this.$field.val().replace(' ', '.'); - if (selectedIcon !== '') { - if (this.settings.save === 'class') { - $icons.find('.' + selectedIcon).addClass('icon-selected'); - } else { - $icons.find('[data-code="' + selectedIcon + '"]').addClass('icon-selected'); - } - } - // Broadcast event when the picker is shown passing the picker mode. - $('body').trigger('iconpickershow.queryloop', mode); - }, - - closePicker: function($brick, $icons, mode) { - // Remove event so they don't fire from a different picker - $(this.iconSet).off('click', 'li'); - - if (mode === 'inline') { - $brick.find($icons).removeClass('inline-open'); - } else if (mode === 'dialog') { - $('.icon-picker-close, .icon-picker-overlay').removeClass('make-visible'); - $icons.removeClass('dialog-open'); - } - // Broadcast event when the picker is closed passing the picker mode. - $('body').trigger('iconpickerclose.queryloop', mode); - }, - - setPreview: function(preview) { - var $preview = $(this.element).find('.icon-preview'); - - $preview.addClass('icon-preview-on').find('i').removeClass() - .addClass(this.iconSetName) - .addClass(preview); - $preview.find('a').show(); + $preview.prependTo($brick); + $icon.prependTo($preview); + if (iconValue !== '') { + $preview.addClass('icon-preview-on'); + $icon.addClass(iconValue); } - }; + } - $.fn.qlIconPicker = function(options) { - this.each(function() { - if (!$.data(this, 'plugin_qlIconPicker')) { - $.data(this, 'plugin_qlIconPicker', new QL_Icon_Picker(this, options)); + makeClear(pickerId, $preview) { + var base = this; + var $clear = $(''); + + // Hide button to remove icon and preview and append it to preview area + $clear.hide().prependTo($preview); + // If there's a icon saved in the field, show remove icon button + if (base.$field.val() !== '') { + $clear.show(); + } + + $preview.on('click', '.remove-icon', function(e) { + e.preventDefault(); + base.$field.val(''); + $preview.removeClass('icon-preview-on').find('i').removeClass(); + $(this).hide(); + }); + } + + makeDisplay($brick) { + var base = this; + var close = base.settings.classes.close; + var $body = $('body'); + + var $close = $(''); + + if (base.settings.mode === 'inline') { + $brick.find('.icon-set').append($close).removeClass('dialog').addClass('inline ' + base.settings.size).parent().addClass('icon-set-wrap'); + } else if (base.settings.mode === 'dialog') { + $('.icon-set').addClass('dialog ' + base.settings.size); + if ($('.icon-picker-overlay').length <= 0) { + $body.append('').append($close); + } + } + $body + .on('click', '.icon-picker-close, .icon-picker-overlay', function(e) { + e.preventDefault(); + base.closePicker($brick, $(base.iconSet), base.settings.mode); + }) + .on('mouseenter mouseleave', '.icon-picker-close', function(e) { + if (e.type === 'mouseenter') { + $(this).addClass(close); + } else { + $(this).removeClass(close); + } + }); + } + + makeLaunchers($brick) { + var base = this; + var dataIconSets = $brick.data('iconsets'); + var iconSet; + + if (typeof dataIconSets === 'undefined') { + dataIconSets = base.settings.iconSets; + } + for (iconSet in dataIconSets) { + if (dataIconSets.hasOwnProperty(iconSet)) { + $brick.append('' + dataIconSets[iconSet] + ''); + } + } + + $brick.find('.launch-icons').on('click', function(e) { + e.preventDefault(); + var $self = $(this); + var theseIcons = $self.data('icons'); + + base.iconSetName = theseIcons; + base.iconSet = '.' + theseIcons + '-set'; + + // Initialize picker + base.iconPick($brick); + + // Show icon picker + base.showPicker($brick, $(base.iconSet), base.settings.mode); + }); + } + + iconPick($brick) { + var base = this; + var highlight = 'icon-highlight ' + base.settings.classes.highlight; + + $(base.iconSet).on('click', 'li', function(e) { + e.preventDefault(); + var $icon = $(this); + var icon = $icon.data(base.settings.save); + + // Mark as selected + $('.icon-selected').removeClass('icon-selected'); + $icon.addClass('icon-selected'); + + // Save icon value to field + base.$field.val(icon); + + // Close icon picker + if (base.settings.closeOnPick) { + base.closePicker($brick, $icon.closest(base.iconSet), base.settings.mode); + } + + // Set preview + base.setPreview($icon.data('class')); + + // Broadcast event passing the selected icon. + $('body').trigger('iconselected.queryloop', icon); + }); + $(base.iconSet).on('mouseenter mouseleave', 'li', function(e) { + if (e.type === 'mouseenter') { + $(this).addClass(highlight); + } else { + $(this).removeClass(highlight); } }); - return this; - }; + } - $('.icon-picker').qlIconPicker({ - 'save': 'class' + showPicker($brick, $icons, mode) { + if (mode === 'inline') { + $('.icon-set').removeClass('inline-open'); + $brick.find($icons).toggleClass('inline-open'); + } else if (mode === 'dialog') { + $('.icon-picker-close, .icon-picker-overlay').addClass('make-visible'); + $icons.addClass('dialog-open'); + } + + $icons.find('.icon-selected').removeClass('icon-selected'); + var selectedIcon = this.$field.val().replace(' ', '.'); + if (selectedIcon !== '') { + if (this.settings.save === 'class') { + $icons.find('.' + selectedIcon).addClass('icon-selected'); + } else { + $icons.find('[data-code="' + selectedIcon + '"]').addClass('icon-selected'); + } + } + // Broadcast event when the picker is shown passing the picker mode. + $('body').trigger('iconpickershow.queryloop', mode); + } + + closePicker($brick, $icons, mode) { + // Remove event so they don't fire from a different picker + $(this.iconSet).off('click', 'li'); + + if (mode === 'inline') { + $brick.find($icons).removeClass('inline-open'); + } else if (mode === 'dialog') { + $('.icon-picker-close, .icon-picker-overlay').removeClass('make-visible'); + $icons.removeClass('dialog-open'); + } + // Broadcast event when the picker is closed passing the picker mode. + $('body').trigger('iconpickerclose.queryloop', mode); + } + + setPreview(preview) { + var $preview = $(this.element).find('.icon-preview'); + + $preview.addClass('icon-preview-on').find('i').removeClass() + .addClass(this.iconSetName) + .addClass(preview); + $preview.find('a').show(); + } +}; + +export default class IconpickerField { + + constructor(options) { + this.items = $(); + this.options = Object.assign({}, this.defaults, options); + + $('[data-grav-iconpicker]').each((index, element) => this.addItem(element)); + $('body').on('mutation._grav', this._onAddedNodes.bind(this)); + } + + _onAddedNodes(event, target/* , record, instance */) { + let fields = $(target).find('[data-grav-iconpicker]'); + if (!fields.length) { return; } + + fields.each((index, field) => { + field = $(field); + if (!~this.items.index(field)) { + this.addItem(field); + } + }); + } + + addItem(element) { + element = $(element); + this.items = this.items.add(element); + + $.fn.qlIconPicker = function(options) { + this.each(function() { + if (!$.data(this, 'plugin_qlIconPicker')) { + $.data(this, 'plugin_qlIconPicker', new QL_Icon_Picker(this, options)); + } + }); + return this; + }; + + $('.icon-picker').qlIconPicker({ + 'save': 'class' + }); + } +} + +export let Instance = new IconpickerField(); + +$.fn.qlIconPicker = function(options) { + this.each(function() { + if (!$.data(this, 'plugin_qlIconPicker')) { + $.data(this, 'plugin_qlIconPicker', new QL_Icon_Picker(this, options)); + } }); + return this; +}; +$('.icon-picker').qlIconPicker({ + 'save': 'class' }); diff --git a/themes/grav/js/admin.min.js b/themes/grav/js/admin.min.js index 32ed893e..3f265d35 100644 --- a/themes/grav/js/admin.min.js +++ b/themes/grav/js/admin.min.js @@ -1,29 +1,29 @@ -var Grav=webpackJsonpGrav([0],[function(e,t,n){(function(e){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),a=r(i),o=n(2),s=r(o),l=n(311),c=r(l),u=n(312),f=r(u),d=n(332),p=r(d),h=n(337),m=r(h),v=n(423),g=r(v),_=n(561),y=r(_);n(566),n(577);var b=n(578);n(579),n(580),n(581),n(582);var k=n(584),w=r(k);c.default.start(),e.setInterval(function(){_.Instance.update(),k.Instance.scroller.update()},150),(0,a.default)(e).on("sidebar_state._grav",function(){Object.keys(p.default.Chart.Instances).forEach(function(e){setTimeout(function(){return p.default.Chart.Instances[e].chart.update()},10)})}),t.default={GPM:{GPM:s.default,Instance:o.Instance},KeepAlive:c.default,Dashboard:p.default,Pages:m.default,Forms:g.default,Scrollbar:{Scrollbar:y.default,Instance:_.Instance},Updates:{Updates:f.default,Notifications:u.Notifications,Feed:u.Feed,Instance:u.Instance},Sidebar:{Sidebar:w.default,Instance:k.Instance},MediaFilter:{MediaFilter:b.Filter,Instance:b.Instance}}}).call(t,function(){return this}())},,function(e,t,n){(function(e){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Instance=void 0;var o=function(){function e(e,t){for(var n=0;n"+e.stack+"":"";c.default.error("Fetch Failed: \n '+u.translations.PLUGIN_ADMIN.UPDATE+" "+u.translations.PLUGIN_ADMIN.ALL+" "+l+'\n \n '+a+" "+u.translations.PLUGIN_ADMIN.OF_YOUR+" "+o+" "+u.translations.PLUGIN_ADMIN.HAVE_AN_UPDATE_AVAILABLE+"\n
\n ");var d=(0,s.default)("[data-update-packages]").attr("data-packages-slugs")||"";d=d?d.split(","):[];var p=(0,c.default)(d.concat(Object.keys(r))).join();(0,s.default)("[data-update-packages]").attr("data-packages-slugs",""+p),Object.keys(r).forEach(function(t){var a=(0,s.default)("[data-gpm-"+n[i]+'="'+t+'"]'),l=a.find(".gpm-name"),c=l.find("a"),f=a.parents(".content-wrapper");if("plugins"!==o||l.find(".badge.update").length?"themes"===o&&(l.append('"),f.addClass("has-updates")):(l.append(''+u.translations.PLUGIN_ADMIN.UPDATE_AVAILABLE+"!"),f.addClass("has-updates")),a.length){var d=(0,s.default)(".grav-update."+n[i]);if(d.length){var p="testing"===r[t].type?'test release':"";d.html('\n\n '+u.translations.PLUGIN_ADMIN.UPDATE+" "+(n[i].charAt(0).toUpperCase()+n[i].substr(1).toLowerCase())+'\n \n v'+r[t].available+" "+p+" "+u.translations.PLUGIN_ADMIN.OF_THIS+" "+n[i]+" "+u.translations.PLUGIN_ADMIN.IS_NOW_AVAILABLE+"!\n
\n ").css("display","block"),e=!1}}}),(0,s.default)("[data-update-packages]").removeClass("hidden")}}),(0,s.default)(".content-wrapper").addClass("updates-checked"),void(e||(0,s.default)(".warning-reinstall-not-latest-release").removeClass("hidden"))):this}}]),e}();t.default=_;var y=new _;t.Instance=y,t.Notifications=m.default,t.Feed=g.default,p.Instance.on("fetched",function(e,t){y.setPayload(e.payload||{}),y.grav().resources()}),"1"===u.config.enable_auto_updates_check&&p.Instance.fetch()},function(e,t,n){function r(e,t){return t=t||i,a(e,function(e,n,r){for(var i=r.length;++n ul").show();switch(r.find("div").remove(),r.find(".fa-warning").removeClass("fa-warning").addClass("fa-refresh fa-spin"),e.type||(e.type="note"),e.type){case"note":e.intro_text="Note";break;case"info":e.intro_text="Info";break;case"warning":e.intro_text="Warning"}var a="";if(t>9&&(a=" hidden "),e.link)i.append('\n"+e.message+"
").text();i.append('\n"+p.translations.PLUGIN_ADMIN.FILE_ERROR_UPLOAD+" "+t.name+"
\n"+n.message+""})}},{key:"onDropzoneComplete",value:function(t){if(!t.accepted&&!t.rejected){var n={status:"error",message:p.translations.PLUGIN_ADMIN.FILE_UNSUPPORTED+": "+t.name.match(/\..+/).join("")};return this.handleError({file:t,data:n,mode:"removeFile",msg:"
"+p.translations.PLUGIN_ADMIN.FILE_ERROR_ADD+" "+t.name+"
\n"+n.message+""})}this.options.reloadPage&&e.location.reload()}},{key:"b64_to_utf8",value:function(e){return e=e.replace(/\s/g,""),decodeURIComponent(escape(window.atob(e)))}},{key:"onDropzoneRemovedFile",value:function(e){var t=this;if(e.accepted&&!e.rejected){var n=e.removeUrl||this.urls.delete,r=(n||"").match(/path:(.*)\//),i={filename:e.name};e.sessionParams&&(i.task="filessessionremove",i.session=e.sessionParams),(0,d.default)(n,{method:"post",body:i},function(){if(r){r=t.b64_to_utf8(r[1]);var e=t.container.find('[name][type="hidden"]'),n=JSON.parse(e.val()||"{}");delete n[r],e.val(JSON.stringify(n))}})}}},{key:"onDropzoneError",value:function(e,t,n){var r=n?t.error.message:t;return(0,l.default)(e.previewElement).find("[data-dz-errormessage]").html(r),this.handleError({file:e,data:{status:"error"},msg:"
"+r+""})}},{key:"handleError",value:function(e){var t=e.file,n=e.data,r=e.mode,i=e.msg;if("error"===n.status||"unauthorized"===n.status){switch(r){case"addBack":t instanceof File?this.dropzone.addFile.call(this.dropzone,t):(this.dropzone.files.push(t),this.dropzone.options.addedfile.call(this.dropzone,t),this.dropzone.options.thumbnail.call(this.dropzone,t,t.extras.url));break;case"removeFile":default:~this.dropzone.files.indexOf(t)&&(t.rejected=!0,this.dropzone.removeFile.call(this.dropzone,t,{silent:!0}))}var a=(0,l.default)('[data-remodal-id="generic"]');a.find(".error-content").html(i),l.default.remodal.lookup[a.data("remodal")].open()}}}]),t}();t.default=v;var g=[],_=(0,l.default)(),y=function(e,t){var n=(0,l.default)(t).find(".dropzone.files-upload");n.length&&n.each(function(e,t){t=(0,l.default)(t),~_.index(t)||b(t)})},b=function(e){e=(0,l.default)(e);var t=e.find('input[type="file"]'),n=e.data("grav-file-settings")||{};n.accept&&~n.accept.indexOf("*")&&(n.accept=[""]);var r={url:e.data("file-url-add")||(e.closest("form").attr("action")||p.config.current_url)+".json",paramName:n.paramName||"file",dotNotation:n.name||"file",acceptedFiles:n.accept?n.accept.join(","):t.attr("accept")||e.data("media-types"),maxFilesize:"undefined"!=typeof n.filesize?n.filesize:256,maxFiles:n.limit||null};_=_.add(e),e=e[0],g.push(new v({container:e,options:r}))};t.Instances=function(){return(0,l.default)(".dropzone.files-upload").each(function(e,t){return b(t)}),(0,l.default)("body").on("mutation._grav",y),g}()}).call(t,function(){return this}())},,,function(e,t,n){(function(e){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.Instance=t.Toolbar=void 0;var a=function(){function e(e,t){for(var n=0;n
"+e.stack+"":"";c.default.error("Fetch Failed: \n '+u.translations.PLUGIN_ADMIN.UPDATE+" "+u.translations.PLUGIN_ADMIN.ALL+" "+l+'\n \n '+a+" "+u.translations.PLUGIN_ADMIN.OF_YOUR+" "+o+" "+u.translations.PLUGIN_ADMIN.HAVE_AN_UPDATE_AVAILABLE+"\n
\n ");var d=(0,s.default)("[data-update-packages]").attr("data-packages-slugs")||"";d=d?d.split(","):[];var h=(0,c.default)(d.concat(Object.keys(r))).join();(0,s.default)("[data-update-packages]").attr("data-packages-slugs",""+h),Object.keys(r).forEach(function(t){var a=(0,s.default)("[data-gpm-"+n[i]+'="'+t+'"]'),l=a.find(".gpm-name"),c=l.find("a"),f=a.parents(".content-wrapper");if("plugins"!==o||l.find(".badge.update").length?"themes"===o&&(l.append('"),f.addClass("has-updates")):(l.append(''+u.translations.PLUGIN_ADMIN.UPDATE_AVAILABLE+"!"),f.addClass("has-updates")),a.length){var d=(0,s.default)(".grav-update."+n[i]);if(d.length){var h="testing"===r[t].type?'test release':"";d.html('\n\n '+u.translations.PLUGIN_ADMIN.UPDATE+" "+(n[i].charAt(0).toUpperCase()+n[i].substr(1).toLowerCase())+'\n \n v'+r[t].available+" "+h+" "+u.translations.PLUGIN_ADMIN.OF_THIS+" "+n[i]+" "+u.translations.PLUGIN_ADMIN.IS_NOW_AVAILABLE+"!\n
\n ").css("display","block"),e=!1}}}),(0,s.default)("[data-update-packages]").removeClass("hidden")}}),(0,s.default)(".content-wrapper").addClass("updates-checked"),void(e||(0,s.default)(".warning-reinstall-not-latest-release").removeClass("hidden"))):this}}]),e}();t.default=y;var _=new y;t.Instance=_,t.Notifications=m.default,t.Feed=g.default,h.Instance.on("fetched",function(e,t){_.setPayload(e.payload||{}),_.grav().resources()}),"1"===u.config.enable_auto_updates_check&&h.Instance.fetch()},function(e,t,n){function r(e,t){return t=t||i,a(e,function(e,n,r){for(var i=r.length;++n ul").show();switch(r.find("div").remove(),r.find(".fa-warning").removeClass("fa-warning").addClass("fa-refresh fa-spin"),e.type||(e.type="note"),e.type){case"note":e.intro_text="Note";break;case"info":e.intro_text="Info";break;case"warning":e.intro_text="Warning"}var a="";if(t>9&&(a=" hidden "),e.link)i.append('\n"+e.message+"
").text();i.append('\n"+h.translations.PLUGIN_ADMIN.FILE_ERROR_UPLOAD+" "+t.name+"
\n"+n.message+""})}},{key:"onDropzoneComplete",value:function(t){if(!t.accepted&&!t.rejected){var n={status:"error",message:h.translations.PLUGIN_ADMIN.FILE_UNSUPPORTED+": "+t.name.match(/\..+/).join("")};return this.handleError({file:t,data:n,mode:"removeFile",msg:"
"+h.translations.PLUGIN_ADMIN.FILE_ERROR_ADD+" "+t.name+"
\n"+n.message+""})}this.options.reloadPage&&e.location.reload()}},{key:"b64_to_utf8",value:function(e){return e=e.replace(/\s/g,""),decodeURIComponent(escape(window.atob(e)))}},{key:"onDropzoneRemovedFile",value:function(e){var t=this;if(e.accepted&&!e.rejected){var n=e.removeUrl||this.urls.delete,r=(n||"").match(/path:(.*)\//),i={filename:e.name};e.sessionParams&&(i.task="filessessionremove",i.session=e.sessionParams),(0,d.default)(n,{method:"post",body:i},function(){if(r){r=t.b64_to_utf8(r[1]);var e=t.container.find('[name][type="hidden"]'),n=JSON.parse(e.val()||"{}");delete n[r],e.val(JSON.stringify(n))}})}}},{key:"onDropzoneError",value:function(e,t,n){var r=n?t.error.message:t;return(0,l.default)(e.previewElement).find("[data-dz-errormessage]").html(r),this.handleError({file:e,data:{status:"error"},msg:"
"+r+""})}},{key:"handleError",value:function(e){var t=e.file,n=e.data,r=e.mode,i=e.msg;if("error"===n.status||"unauthorized"===n.status){switch(r){case"addBack":t instanceof File?this.dropzone.addFile.call(this.dropzone,t):(this.dropzone.files.push(t),this.dropzone.options.addedfile.call(this.dropzone,t),this.dropzone.options.thumbnail.call(this.dropzone,t,t.extras.url));break;case"removeFile":default:~this.dropzone.files.indexOf(t)&&(t.rejected=!0,this.dropzone.removeFile.call(this.dropzone,t,{silent:!0}))}var a=(0,l.default)('[data-remodal-id="generic"]');a.find(".error-content").html(i),l.default.remodal.lookup[a.data("remodal")].open()}}}]),t}();t.default=v;var g=[],y=(0,l.default)(),_=function(e,t){var n=(0,l.default)(t).find(".dropzone.files-upload");n.length&&n.each(function(e,t){t=(0,l.default)(t),~y.index(t)||b(t)})},b=function(e){e=(0,l.default)(e);var t=e.find('input[type="file"]'),n=e.data("grav-file-settings")||{};n.accept&&~n.accept.indexOf("*")&&(n.accept=[""]);var r={url:e.data("file-url-add")||(e.closest("form").attr("action")||h.config.current_url)+".json",paramName:n.paramName||"file",dotNotation:n.name||"file",acceptedFiles:n.accept?n.accept.join(","):t.attr("accept")||e.data("media-types"),maxFilesize:"undefined"!=typeof n.filesize?n.filesize:256,maxFiles:n.limit||null};y=y.add(e),e=e[0],g.push(new v({container:e,options:r}))};t.Instances=function(){return(0,l.default)(".dropzone.files-upload").each(function(e,t){return b(t)}),(0,l.default)("body").on("mutation._grav",_),g}()}).call(t,function(){return this}())},,,function(e,t,n){(function(e){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.Instance=t.Toolbar=void 0;var a=function(){function e(e,t){for(var n=0;n
"+this.options.dictFallbackText+"
"),i+='',n=t.createElement(i),"FORM"!==this.element.tagName?(r=t.createElement(''),r.appendChild(n)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=r?r:n)},t.prototype.getExistingFallback=function(){var e,t,n,i,r,s;for(t=function(e){var t,n,i;for(n=0,i=e.length;n0){for(a=["TB","GB","MB","KB","b"],n=o=0,l=a.length;o