index of
/
home
/
thefkyzp
/
www
/
wp-content
/
plugins
/
ocean-extra
/
includes
/
metabox
/
butterbean
/
js
/
File: /home/thefkyzp/www/wp-content/plugins/ocean-extra/includes/metabox/butterbean/js/butterbean.min.js
window.butterbean=window.butterbean||{},function(){if(!_.isUndefined(butterbean_data)){var e=butterbean={views:{managers:{},sections:{},controls:{}},templates:{managers:{},sections:{},controls:{}}};e.views.register_manager=function(e,t){"default"!==e&&(this.managers[e]=this.managers.default.extend(t))},e.views.get_manager=function(e){return this.manager_exists(e)?this.managers[e]:this.managers.default},e.views.unregister_manager=function(e){"default"!==e&&this.manager_exists(e)&&delete this.managers[e]},e.views.manager_exists=function(e){return this.managers.hasOwnProperty(e)},e.views.register_section=function(e,t){"default"!==e&&(this.sections[e]=this.sections.default.extend(t))},e.views.get_section=function(e){return this.section_exists(e)?this.sections[e]:this.sections.default},e.views.unregister_section=function(e){"default"!==e&&this.section_exists(e)&&delete this.sections[e]},e.views.section_exists=function(e){return this.sections.hasOwnProperty(e)},e.views.register_control=function(e,t){"default"!==e&&(this.controls[e]=this.controls.default.extend(t))},e.views.get_control=function(e){return this.control_exists(e)?this.controls[e]:this.controls.default},e.views.unregister_control=function(e){"default"!==e&&this.control_exists(e)&&delete this.controls[e]},e.views.control_exists=function(e){return this.controls.hasOwnProperty(e)},e.templates.register_manager=function(e){this.managers[e]=wp.template("butterbean-manager-"+e)},e.templates.get_manager=function(e){return this.manager_exists(e)?this.managers[e]:!1},e.templates.unregister_manager=function(e){this.manager_exists(e)&&delete this.managers[e]},e.templates.manager_exists=function(e){return this.managers.hasOwnProperty(e)},e.templates.register_section=function(e){this.sections[e]=wp.template("butterbean-section-"+e)},e.templates.get_section=function(e){return this.section_exists(e)?this.sections[e]:!1},e.templates.unregister_section=function(e){this.section_exists(e)&&delete this.sections[e]},e.templates.section_exists=function(e){return this.sections.hasOwnProperty(e)},e.templates.register_control=function(e){this.controls[e]=wp.template("butterbean-control-"+e)},e.templates.get_control=function(e){return this.control_exists(e)?this.controls[e]:!1},e.templates.unregister_control=function(e){this.control_exists(e)&&delete this.controls[e]},e.templates.control_exists=function(e){return this.controls.hasOwnProperty(e)},e.render=function(){_.each(butterbean_data.managers,function(t){var i=new n(t),s=e.views.get_manager(t.type),a=new s({model:i}),o=document.getElementById("butterbean-ui-"+i.get("name"));o.className+=" butterbean-ui",o.querySelector(".inside").appendChild(a.render().el),a.subview_render(),a.ready()})};var t=wp.template("butterbean-nav"),n=Backbone.Model.extend({defaults:{name:"",type:"",sections:{},controls:{}}}),i=Backbone.Model.extend({defaults:{name:"",type:"",label:"",description:"",icon:"",manager:"",active:"",selected:!1}}),s=Backbone.Model.extend({defaults:{name:"",type:"",label:"",description:"",icon:"",value:"",choices:{},attr:"",active:"",manager:"",section:"",setting:""}}),a=Backbone.Collection.extend({model:i});e.views.managers["default"]=Backbone.View.extend({tagName:"div",attributes:function(){return{id:"butterbean-manager-"+this.model.get("name"),"class":"butterbean-manager butterbean-manager-"+this.model.get("type")}},initialize:function(){var t=this.model.get("type");e.templates.manager_exists(t)||e.templates.register_manager(t),this.template=e.templates.get_manager(t)},render:function(){return this.el.innerHTML=this.template(this.model.toJSON()),this},subview_render:function(){var t=new a;return _.each(this.model.get("sections"),function(e){t.add(new i(e))}),t.forEach(function(t,n){var i=new o({model:t});document.querySelector("#butterbean-ui-"+t.get("manager")+" .butterbean-nav").appendChild(i.render().el);var s=e.views.get_section(t.attributes.type),a=new s({model:t});document.querySelector("#butterbean-ui-"+t.get("manager")+" .butterbean-content").appendChild(a.render().el),a.ready(),t.set("selected",0===n)},this),_.each(this.model.get("controls"),function(t){var n=new s(t),i=e.views.get_control(t.type),a=new i({model:n});document.getElementById("butterbean-"+n.get("manager")+"-section-"+n.get("section")).appendChild(a.render().el),a.ready()}),this},ready:function(){}}),e.views.sections["default"]=Backbone.View.extend({tagName:"div",attributes:function(){return{id:"butterbean-"+this.model.get("manager")+"-section-"+this.model.get("name"),"class":"butterbean-section butterbean-section-"+this.model.get("type"),"aria-hidden":!this.model.get("selected")}},initialize:function(){this.model.on("change",this.onchange,this);var t=this.model.get("type");e.templates.section_exists(t)||e.templates.register_section(t),this.template=e.templates.get_section(t)},render:function(){return this.model.get("active")&&(this.el.innerHTML=this.template(this.model.toJSON())),this},onchange:function(){this.el.setAttribute("aria-hidden",!this.model.get("selected"))},ready:function(){}});var o=Backbone.View.extend({template:t,tagName:"li",attributes:function(){return{"aria-selected":this.model.get("selected")}},initialize:function(){this.model.on("change",this.render,this),this.model.on("change",this.onchange,this)},render:function(){return this.model.get("active")&&(this.el.innerHTML=this.template(this.model.toJSON())),this},events:{"click a":"onselect"},onchange:function(){this.el.setAttribute("aria-selected",this.model.get("selected"))},onselect:function(e){e.preventDefault(),_.each(this.model.collection.models,function(e){e.set("selected",!1)},this),this.model.set("selected",!0)}});e.views.controls["default"]=Backbone.View.extend({tagName:"div",attributes:function(){return{id:"butterbean-control-"+this.model.get("name"),"class":"butterbean-control butterbean-control-"+this.model.get("type")}},initialize:function(){var t=this.model.get("type");e.templates.control_exists(t)||e.templates.register_control(t),this.template=e.templates.get_control(t),_.bindAll(this,"render"),this.model.bind("change",this.render)},render:function(){return this.model.get("active")&&(this.el.innerHTML=this.template(this.model.toJSON())),this},ready:function(){}}),e.views.register_control("color",{ready:function(){var e=this.model.attributes.options;jQuery(this.$el).find(".butterbean-color-picker").wpColorPicker(e)}}),e.views.register_control("palette",{events:{"change input":"onselect"},onselect:function(){var e=document.querySelector("#"+this.el.id+" input:checked").getAttribute("value"),t=this.model.get("choices");_.each(t,function(t,n){t.selected=n===e}),this.model.set("choices",t).trigger("change",this.model)}}),e.views.register_control("image",{events:{"click .butterbean-add-media":"showmodal","click .butterbean-change-media":"showmodal","click .butterbean-remove-media":"removemedia"},showmodal:function(){return _.isUndefined(this.media_modal)?(this.media_modal=wp.media({frame:"select",multiple:!1,editing:!0,title:this.model.get("l10n").choose,library:{type:"image"},button:{text:this.model.get("l10n").set}}),this.media_modal.on("select",function(){var e=this.media_modal.state().get("selection").first().toJSON(),t=this.model.attributes.size;this.model.set({src:e.sizes[t]?e.sizes[t].url:e.url,alt:e.alt,value:e.id})},this),this.media_modal.open(),void 0):(this.media_modal.open(),void 0)},removemedia:function(){this.model.set({src:"",alt:"",value:""})}})}}();