wp/wp-includes/js/customize-base.min.js
changeset 16 a86126ab1dd4
parent 7 cf61fcea0001
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
     1 window.wp=window.wp||{},function(a,b){var c,d,e={},f=Array.prototype.slice;c=function(){},d=function(a,d,e){var f;return f=d&&d.hasOwnProperty("constructor")?d.constructor:function(){var b=a.apply(this,arguments);return b},b.extend(f,a),c.prototype=a.prototype,f.prototype=new c,d&&b.extend(f.prototype,d),e&&b.extend(f,e),f.prototype.constructor=f,f.__super__=a.prototype,f},e.Class=function(a,c,d){var f,g=arguments;return a&&c&&e.Class.applicator===a&&(g=c,b.extend(this,d||{})),f=this,this.instance&&(f=function(){return f.instance.apply(f,arguments)},b.extend(f,this)),f.initialize.apply(f,g),f},e.Class.extend=function(a,b){var c=d(this,a,b);return c.extend=this.extend,c},e.Class.applicator={},e.Class.prototype.initialize=function(){},e.Class.prototype.extended=function(a){for(var b=this;"undefined"!=typeof b.constructor;){if(b.constructor===a)return!0;if("undefined"==typeof b.constructor.__super__)return!1;b=b.constructor.__super__}return!1},e.Events={trigger:function(a){return this.topics&&this.topics[a]&&this.topics[a].fireWith(this,f.call(arguments,1)),this},bind:function(a){return this.topics=this.topics||{},this.topics[a]=this.topics[a]||b.Callbacks(),this.topics[a].add.apply(this.topics[a],f.call(arguments,1)),this},unbind:function(a){return this.topics&&this.topics[a]&&this.topics[a].remove.apply(this.topics[a],f.call(arguments,1)),this}},e.Value=e.Class.extend({initialize:function(a,c){this._value=a,this.callbacks=b.Callbacks(),this._dirty=!1,b.extend(this,c||{}),this.set=b.proxy(this.set,this)},instance:function(){return arguments.length?this.set.apply(this,arguments):this.get()},get:function(){return this._value},set:function(a){var b=this._value;return a=this._setter.apply(this,arguments),a=this.validate(a),null===a||_.isEqual(b,a)?this:(this._value=a,this._dirty=!0,this.callbacks.fireWith(this,[a,b]),this)},_setter:function(a){return a},setter:function(a){var b=this.get();return this._setter=a,this._value=null,this.set(b),this},resetSetter:function(){return this._setter=this.constructor.prototype._setter,this.set(this.get()),this},validate:function(a){return a},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 a=this.set;return b.each(arguments,function(){this.bind(a)}),this},unlink:function(){var a=this.set;return b.each(arguments,function(){this.unbind(a)}),this},sync:function(){var a=this;return b.each(arguments,function(){a.link(this),this.link(a)}),this},unsync:function(){var a=this;return b.each(arguments,function(){a.unlink(this),this.unlink(a)}),this}}),e.Values=e.Class.extend({defaultConstructor:e.Value,initialize:function(a){b.extend(this,a||{}),this._value={},this._deferreds={}},instance:function(a){return 1===arguments.length?this.value(a):this.when.apply(this,arguments)},value:function(a){return this._value[a]},has:function(a){return"undefined"!=typeof this._value[a]},add:function(a,b){var c,d,f=this;if("string"==typeof a)c=a,d=b;else{if("string"!=typeof a.id)throw new Error("Unknown key");c=a.id,d=a}return f.has(c)?f.value(c):(f._value[c]=d,d.parent=f,d.extended(e.Value)&&d.bind(f._change),f.trigger("add",d),f._deferreds[c]&&f._deferreds[c].resolve(),f._value[c])},create:function(a){return this.add(a,new this.defaultConstructor(e.Class.applicator,f.call(arguments,1)))},each:function(a,c){c="undefined"==typeof c?this:c,b.each(this._value,function(b,d){a.call(c,d,b)})},remove:function(a){var b=this.value(a);b&&(this.trigger("remove",b),b.extended(e.Value)&&b.unbind(this._change),delete b.parent),delete this._value[a],delete this._deferreds[a],b&&this.trigger("removed",b)},when:function(){var a=this,c=f.call(arguments),d=b.Deferred();return b.isFunction(c[c.length-1])&&d.done(c.pop()),b.when.apply(b,b.map(c,function(c){if(!a.has(c))return a._deferreds[c]=a._deferreds[c]||b.Deferred()})).done(function(){var e=b.map(c,function(b){return a(b)});return e.length!==c.length?void a.when.apply(a,c).done(function(){d.resolveWith(a,e)}):void d.resolveWith(a,e)}),d.promise()},_change:function(){this.parent.trigger("change",this)}}),b.extend(e.Values.prototype,e.Events),e.ensure=function(a){return"string"==typeof a?b(a):a},e.Element=e.Value.extend({initialize:function(a,c){var d,f,g,h=this,i=e.Element.synchronizer.html;this.element=e.ensure(a),this.events="",this.element.is("input, select, textarea")&&(d=this.element.prop("type"),this.events+=" change input",i=e.Element.synchronizer.val,this.element.is("input")&&e.Element.synchronizer[d]&&(i=e.Element.synchronizer[d])),e.Value.prototype.initialize.call(this,null,b.extend(c||{},i)),this._value=this.get(),f=this.update,g=this.refresh,this.update=function(a){a!==g.call(h)&&f.apply(this,arguments)},this.refresh=function(){h.set(g.call(h))},this.bind(this.update),this.element.bind(this.events,this.refresh)},find:function(a){return b(a,this.element)},refresh:function(){},update:function(){}}),e.Element.synchronizer={},b.each(["html","val"],function(a,b){e.Element.synchronizer[b]={update:function(a){this.element[b](a)},refresh:function(){return this.element[b]()}}}),e.Element.synchronizer.checkbox={update:function(a){this.element.prop("checked",a)},refresh:function(){return this.element.prop("checked")}},e.Element.synchronizer.radio={update:function(a){this.element.filter(function(){return this.value===a}).prop("checked",!0)},refresh:function(){return this.element.filter(":checked").val()}},b.support.postMessage=!!window.postMessage,e.Messenger=e.Class.extend({add:function(a,b,c){return this[a]=new e.Value(b,c)},initialize:function(a,c){var d=window.parent===window?null:window.parent;b.extend(this,c||{}),this.add("channel",a.channel),this.add("url",a.url||""),this.add("origin",this.url()).link(this.url).setter(function(a){var b=document.createElement("a");return b.href=a,b.protocol+"//"+b.host.replace(/:(80|443)$/,"")}),this.add("targetWindow",null),this.targetWindow.set=function(a){var b=this._value;return a=this._setter.apply(this,arguments),a=this.validate(a),null===a||b===a?this:(this._value=a,this._dirty=!0,this.callbacks.fireWith(this,[a,b]),this)},this.targetWindow(a.targetWindow||d),this.receive=b.proxy(this.receive,this),this.receive.guid=b.guid++,b(window).on("message",this.receive)},destroy:function(){b(window).off("message",this.receive)},receive:function(a){var b;a=a.originalEvent,this.targetWindow&&this.targetWindow()&&(this.origin()&&a.origin!==this.origin()||"string"==typeof a.data&&"{"===a.data[0]&&(b=JSON.parse(a.data),b&&b.id&&"undefined"!=typeof b.data&&((b.channel||this.channel())&&this.channel()!==b.channel||this.trigger(b.id,b.data))))},send:function(a,b){var c;b="undefined"==typeof b?null:b,this.url()&&this.targetWindow()&&(c={id:a,data:b},this.channel()&&(c.channel=this.channel()),this.targetWindow().postMessage(JSON.stringify(c),this.origin()))}}),b.extend(e.Messenger.prototype,e.Events),e.Notification=e.Class.extend({template:null,templateId:"customize-notification",containerClasses:"",initialize:function(a,b){var c;this.code=a,c=_.extend({message:null,type:"error",fromServer:!1,data:null,setting:null,template:null,dismissible:!1,containerClasses:""},b),delete c.code,_.extend(this,c)},render:function(){var a,c,d=this;return d.template||(d.template=wp.template(d.templateId)),c=_.extend({},d,{alt:d.parent&&d.parent.alt}),a=b(d.template(c)),d.dismissible&&a.find(".notice-dismiss").on("click keydown",function(b){"keydown"===b.type&&13!==b.which||(d.parent?d.parent.remove(d.code):a.remove())}),a}}),e=b.extend(new e.Values,e),e.get=function(){var a={};return this.each(function(b,c){a[c]=b.get()}),a},e.utils={},e.utils.parseQueryString=function(a){var b={};return _.each(a.split("&"),function(a){var c,d,e;c=a.split("=",2),c[0]&&(d=decodeURIComponent(c[0].replace(/\+/g," ")),d=d.replace(/ /g,"_"),e=_.isUndefined(c[1])?null:decodeURIComponent(c[1].replace(/\+/g," ")),b[d]=e)}),b},a.customize=e}(wp,jQuery);
     1 /*! This file is auto-generated */
       
     2 window.wp=window.wp||{},function(t,o){var s,i,h={},r=Array.prototype.slice;s=function(){},i=function(t,e,n){var i;return i=e&&e.hasOwnProperty("constructor")?e.constructor:function(){return t.apply(this,arguments)},o.extend(i,t),s.prototype=t.prototype,i.prototype=new s,e&&o.extend(i.prototype,e),n&&o.extend(i,n),(i.prototype.constructor=i).__super__=t.prototype,i},h.Class=function(t,e,n){var i,s=arguments;return t&&e&&h.Class.applicator===t&&(s=e,o.extend(this,n||{})),(i=this).instance&&(i=function(){return i.instance.apply(i,arguments)},o.extend(i,this)),i.initialize.apply(i,s),i},h.Class.extend=function(t,e){var n=i(this,t,e);return n.extend=this.extend,n},h.Class.applicator={},h.Class.prototype.initialize=function(){},h.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},h.Events={trigger:function(t){return this.topics&&this.topics[t]&&this.topics[t].fireWith(this,r.call(arguments,1)),this},bind:function(t){return this.topics=this.topics||{},this.topics[t]=this.topics[t]||o.Callbacks(),this.topics[t].add.apply(this.topics[t],r.call(arguments,1)),this},unbind:function(t){return this.topics&&this.topics[t]&&this.topics[t].remove.apply(this.topics[t],r.call(arguments,1)),this}},h.Value=h.Class.extend({initialize:function(t,e){this._value=t,this.callbacks=o.Callbacks(),this._dirty=!1,o.extend(this,e||{}),this.set=o.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 o.each(arguments,function(){this.bind(t)}),this},unlink:function(){var t=this.set;return o.each(arguments,function(){this.unbind(t)}),this},sync:function(){var t=this;return o.each(arguments,function(){t.link(this),this.link(t)}),this},unsync:function(){var t=this;return o.each(arguments,function(){t.unlink(this),this.unlink(t)}),this}}),h.Values=h.Class.extend({defaultConstructor:h.Value,initialize:function(t){o.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){var n,i,s=this;if("string"==typeof t)n=t,i=e;else{if("string"!=typeof t.id)throw new Error("Unknown key");n=t.id,i=t}return s.has(n)?s.value(n):((s._value[n]=i).parent=s,i.extended(h.Value)&&i.bind(s._change),s.trigger("add",i),s._deferreds[n]&&s._deferreds[n].resolve(),s._value[n])},create:function(t){return this.add(t,new this.defaultConstructor(h.Class.applicator,r.call(arguments,1)))},each:function(n,i){i=void 0===i?this:i,o.each(this._value,function(t,e){n.call(i,e,t)})},remove:function(t){var e=this.value(t);e&&(this.trigger("remove",e),e.extended(h.Value)&&e.unbind(this._change),delete e.parent),delete this._value[t],delete this._deferreds[t],e&&this.trigger("removed",e)},when:function(){var e=this,n=r.call(arguments),i=o.Deferred();return o.isFunction(n[n.length-1])&&i.done(n.pop()),o.when.apply(o,o.map(n,function(t){if(!e.has(t))return e._deferreds[t]=e._deferreds[t]||o.Deferred()})).done(function(){var t=o.map(n,function(t){return e(t)});t.length===n.length?i.resolveWith(e,t):e.when.apply(e,n).done(function(){i.resolveWith(e,t)})}),i.promise()},_change:function(){this.parent.trigger("change",this)}}),o.extend(h.Values.prototype,h.Events),h.ensure=function(t){return"string"==typeof t?o(t):t},h.Element=h.Value.extend({initialize:function(t,e){var n,i,s,r=this,a=h.Element.synchronizer.html;this.element=h.ensure(t),this.events="",this.element.is("input, select, textarea")&&(n=this.element.prop("type"),this.events+=" change input",a=h.Element.synchronizer.val,this.element.is("input")&&h.Element.synchronizer[n]&&(a=h.Element.synchronizer[n])),h.Value.prototype.initialize.call(this,null,o.extend(e||{},a)),this._value=this.get(),i=this.update,s=this.refresh,this.update=function(t){t!==s.call(r)&&i.apply(this,arguments)},this.refresh=function(){r.set(s.call(r))},this.bind(this.update),this.element.bind(this.events,this.refresh)},find:function(t){return o(t,this.element)},refresh:function(){},update:function(){}}),h.Element.synchronizer={},o.each(["html","val"],function(t,e){h.Element.synchronizer[e]={update:function(t){this.element[e](t)},refresh:function(){return this.element[e]()}}}),h.Element.synchronizer.checkbox={update:function(t){this.element.prop("checked",t)},refresh:function(){return this.element.prop("checked")}},h.Element.synchronizer.radio={update:function(t){this.element.filter(function(){return this.value===t}).prop("checked",!0)},refresh:function(){return this.element.filter(":checked").val()}},o.support.postMessage=!!window.postMessage,h.Messenger=h.Class.extend({add:function(t,e,n){return this[t]=new h.Value(e,n)},initialize:function(t,e){var n=window.parent===window?null:window.parent;o.extend(this,e||{}),this.add("channel",t.channel),this.add("url",t.url||""),this.add("origin",this.url()).link(this.url).setter(function(t){var e=document.createElement("a");return e.href=t,e.protocol+"//"+e.host.replace(/:(80|443)$/,"")}),this.add("targetWindow",null),this.targetWindow.set=function(t){var e=this._value;return t=this._setter.apply(this,arguments),null===(t=this.validate(t))||e===t||(this._value=t,this._dirty=!0,this.callbacks.fireWith(this,[t,e])),this},this.targetWindow(t.targetWindow||n),this.receive=o.proxy(this.receive,this),this.receive.guid=o.guid++,o(window).on("message",this.receive)},destroy:function(){o(window).off("message",this.receive)},receive:function(t){var e;t=t.originalEvent,this.targetWindow&&this.targetWindow()&&(this.origin()&&t.origin!==this.origin()||"string"==typeof t.data&&"{"===t.data[0]&&(e=JSON.parse(t.data))&&e.id&&void 0!==e.data&&((e.channel||this.channel())&&this.channel()!==e.channel||this.trigger(e.id,e.data)))},send:function(t,e){var n;e=void 0===e?null:e,this.url()&&this.targetWindow()&&(n={id:t,data:e},this.channel()&&(n.channel=this.channel()),this.targetWindow().postMessage(JSON.stringify(n),this.origin()))}}),o.extend(h.Messenger.prototype,h.Events),h.Notification=h.Class.extend({template:null,templateId:"customize-notification",containerClasses:"",initialize:function(t,e){var n;this.code=t,delete(n=_.extend({message:null,type:"error",fromServer:!1,data:null,setting:null,template:null,dismissible:!1,containerClasses:""},e)).code,_.extend(this,n)},render:function(){var e,t,n=this;return n.template||(n.template=wp.template(n.templateId)),t=_.extend({},n,{alt:n.parent&&n.parent.alt}),e=o(n.template(t)),n.dismissible&&e.find(".notice-dismiss").on("click keydown",function(t){"keydown"===t.type&&13!==t.which||(n.parent?n.parent.remove(n.code):e.remove())}),e}}),(h=o.extend(new h.Values,h)).get=function(){var n={};return this.each(function(t,e){n[e]=t.get()}),n},h.utils={},h.utils.parseQueryString=function(t){var s={};return _.each(t.split("&"),function(t){var e,n,i;(e=t.split("=",2))[0]&&(n=(n=decodeURIComponent(e[0].replace(/\+/g," "))).replace(/ /g,"_"),i=_.isUndefined(e[1])?null:decodeURIComponent(e[1].replace(/\+/g," ")),s[n]=i)}),s},t.customize=h}(wp,jQuery);