WordPress/wp-includes/js/customize-base.min.js

1 line
7.3 KiB
JavaScript
Raw Normal View History

window.wp=window.wp||{},function(t,h){var a={},s=Array.prototype.slice,r=function(){},i=function(t,e,i){var n=e&&e.hasOwnProperty("constructor")?e.constructor:function(){return t.apply(this,arguments)};return h.extend(n,t),r.prototype=t.prototype,n.prototype=new r,e&&h.extend(n.prototype,e),i&&h.extend(n,i),(n.prototype.constructor=n).__super__=t.prototype,n};a.Class=function(t,e,i){var n,s=arguments;return t&&e&&a.Class.applicator===t&&(s=e,h.extend(this,i||{})),(n=this).instance&&(n=function(){return n.instance.apply(n,arguments)},h.extend(n,this)),n.initialize.apply(n,s),n},a.Class.extend=function(t,e){e=i(this,t,e);return e.extend=this.extend,e},a.Class.applicator={},a.Class.prototype.initialize=function(){},a.Class.prototype.extended=function(t){for(var e=this;void 0!==e.constructor;){if(e.constructor===t)return!0;if(void 0===e.constructor.__super__)return!1;e=e.constructor.__super__}return!1},a.Events={trigger:function(t){return this.topics&&this.topics[t]&&this.topics[t].fireWith(this,s.call(arguments,1)),this},bind:function(t){return this.topics=this.topics||{},this.topics[t]=this.topics[t]||h.Callbacks(),this.topics[t].add.apply(this.topics[t],s.call(arguments,1)),this},unbind:function(t){return this.topics&&this.topics[t]&&this.topics[t].remove.apply(this.topics[t],s.call(arguments,1)),this}},a.Value=a.Class.extend({initialize:function(t,e){this._value=t,this.callbacks=h.Callbacks(),this._dirty=!1,h.extend(this,e||{}),this.set=h.proxy(this.set,this)},instance:function(){return arguments.length?this.set.apply(this,arguments):this.get()},get:function(){return this._value},set:function(t){var e=this._value;return t=this._setter.apply(this,arguments),null===(t=this.validate(t))||_.isEqual(e,t)||(this._value=t,this._dirty=!0,this.callbacks.fireWith(this,[t,e])),this},_setter:function(t){return t},setter:function(t){var e=this.get();return this._setter=t,this._value=null,this.set(e),this},resetSetter:function(){return this._setter=this.constructor.prototype._setter,this.set(this.get()),this},validate:function(t){return t},bind:function(){return this.callbacks.add.apply(this.callbacks,arguments),this},unbind:function(){return this.callbacks.remove.apply(this.callbacks,arguments),this},link:function(){var t=this.set;return h.each(arguments,function(){this.bind(t)}),this},unlink:function(){var t=this.set;return h.each(arguments,function(){this.unbind(t)}),this},sync:function(){var t=this;return h.each(arguments,function(){t.link(this),this.link(t)}),this},unsync:function(){var t=this;return h.each(arguments,function(){t.unlink(this),this.unlink(t)}),this}}),a.Values=a.Class.extend({defaultConstructor:a.Value,initialize:function(t){h.extend(this,t||{}),this._value={},this._deferreds={}},instance:function(t){return 1===arguments.length?this.value(t):this.when.apply(this,arguments)},value:function(t){return this._value[t]},has:function(t){return void 0!==this._value[t]},add:function(t,e){return this.has(t)?this.value(t):((this._value[t]=e).parent=this,e.extended(a.Value)&&e.bind(this._change),this.trigger("add",e),this._deferreds[t]&&this._deferreds[t].resolve(),this._value[t])},create:function(t){return this.add(t,new this.defaultConstructor(a.Class.applicator,s.call(arguments,1)))},each:function(i,n){n=void 0===n?this:n,h.each(this._value,function(t,e){i.call(n,e,t)})},remove:function(t){var e;this.has(t)&&(e=this.value(t),this.trigger("remove",e),e.extended(a.Value)&&e.unbind(this._change),delete e.parent),delete this._value[t],delete this._deferreds[t]},when:function(){var e=this,i=s.call(arguments),n=h.Deferred();return h.isFunction(i[i.length-1])&&n.done(i.pop()),h.when.apply(h,h.map(i,function(t){if(!e.has(t))return e._deferreds[t]=e._deferreds[t]||h.Deferred()})).done(function(){var t=h.map(i,function(t){return e(t)});t.length===i.length?n.resolveWith(e,t):e.when.apply(e,i).done(function(){n.resolveWith(e,t)})}),n.promise()},_change:function(){this.parent.trigger("change",this)}}),h.extend(a.Values.prototype,a.Events),a.ensure=function(t){return"string"==typeof t?h(t):t},a.Element=a.Value.extend({initialize:functi