laipower/wp-content/plugins/menu-icons/vendor/codeinwp/icon-picker/js/icon-picker.min.js

1 line
12 KiB
JavaScript
Raw Normal View History

2020-04-07 13:03:04 +00:00
!function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};b.m=a,b.c=c,b.i=function(a){return a},b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{configurable:!1,enumerable:!0,get:d})},b.n=function(a){var c=a&&a.__esModule?function(){return a.default}:function(){return a};return b.d(c,"a",c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p="",b(b.s=1)}([function(a,b,c){wp.media.model.IconPickerTarget=c(6),wp.media.model.IconPickerFonts=c(5),wp.media.controller.iconPickerMixin=c(4),wp.media.controller.IconPickerFont=c(2),wp.media.controller.IconPickerImg=c(3),wp.media.view.IconPickerBrowser=c(7),wp.media.view.IconPickerSidebar=c(14),wp.media.view.IconPickerFontItem=c(10),wp.media.view.IconPickerFontLibrary=c(11),wp.media.view.IconPickerFontFilter=c(9),wp.media.view.IconPickerFontBrowser=c(8),wp.media.view.IconPickerImgBrowser=c(13),wp.media.view.IconPickerSvgItem=c(15),wp.media.view.MediaFrame.IconPicker=c(12)},function(a,b,c){c(0),function(a){var b,c,d,e,f,g,h,i=wp.media.view.l10n.iconPicker,j={};e=function(){return b||(b=new wp.media.view.MediaFrame.IconPicker,b.target.on("change",f)),b},f=function(a){_.each(a.get("inputs"),function(b,c){b.val(a.get(c))}),a.clear({silent:!0}),h.trigger("ipf:update")},g=function(b){var c,d=a(b.currentTarget),e=d.find("a.ipf-select"),f=d.find("a.ipf-remove"),g=d.find("input.ipf-type").val(),h=d.find("input.ipf-icon").val(),k=d.find("input.url").val();if(""===g||""===h||!_.has(iconPicker.types,g))return f.addClass("hidden"),void e.removeClass("has-icon").addClass("button").text(i.selectIcon).attr("title","");c=j[g]?j[g]:j[g]=wp.template("iconpicker-"+iconPicker.types[g].templateId+"-icon"),f.removeClass("hidden"),e.attr("title",i.selectIcon).addClass("has-icon").removeClass("button").html(c({type:g,icon:h,url:k}))},c=function(b){var c=e(),d={inputs:{}};b.preventDefault(),h=a(b.currentTarget).closest(".ipf"),d.id=h.attr("id"),h.find("input").each(function(){var b=a(this),c=b.attr("class").replace("ipf-",""),e=b.val();d[c]=e,d.inputs[c]=b}),c.target.set(d,{silent:!0}),c.open()},d=function(b){var c=a(b.currentTarget).closest("div.ipf");c.find("input").val(""),c.trigger("ipf:update")},a(document).on("click","a.ipf-select",c).on("click","a.ipf-remove",d).on("ipf:update","div.ipf",g),a("div.ipf").trigger("ipf:update")}(jQuery)},function(a,b){var c=wp.media.controller.State.extend(_.extend({},wp.media.controller.iconPickerMixin,{defaults:{multiple:!1,menu:"default",toolbar:"select",baseType:"font"},initialize:function(){var a=this.get("data");this.set("groups",new Backbone.Collection(a.groups)),this.set("library",new wp.media.model.IconPickerFonts(a.items)),this.set("selection",new wp.media.model.Selection(null,{multiple:this.get("multiple")}))},activate:function(){this.frame.on("open",this.updateSelection,this),this.resetFilter(),this.updateSelection()},deactivate:function(){this.frame.off("open",this.updateSelection,this)},resetFilter:function(){this.get("library").props.set("group","all")},updateSelection:function(){var a,b=this.get("selection"),c=this.get("library"),d=this.frame.target,e=d.get("icon"),f=d.get("type");this.id===f&&(a=c.findWhere({id:e})),b.reset(a||null)},getContentView:function(){return new wp.media.view.IconPickerFontBrowser(_.extend({controller:this.frame,model:this,groups:this.get("groups"),collection:this.get("library"),selection:this.get("selection"),baseType:this.get("baseType"),type:this.get("id")},this.ipGetSidebarOptions()))}}));a.exports=c},function(a,b){var c,d=wp.media.controller.Library,e=wp.media.view.l10n,f=wp.media.model,g=wp.media.view;c=d.extend(_.extend({},wp.media.controller.iconPickerMixin,{defaults:_.defaults({id:"image",baseType:"image",syncSelection:!1},d.prototype.defaults),initialize:function(a){var b=this.get("selection");this.options=a,this.set("library",wp.media.query({type:a.data.mimeTypes})),this.routers={upload:{text:e.uploadFilesTitle,priority:20},browse:{text:e.mediaLibraryTitle,priority:40}},b instanceof f.Selec