diff --git a/wp-includes/css/customize-controls.css b/wp-includes/css/customize-controls.css index 2d685331d4..d30cd52228 100644 --- a/wp-includes/css/customize-controls.css +++ b/wp-includes/css/customize-controls.css @@ -1 +1 @@ -body{overflow:hidden}#customize-controls a{text-decoration:none}.customize-section{border-top:1px solid #fff;border-bottom:1px solid #dfdfdf;margin:0}.customize-section:last-child{box-shadow:0 1px 0 0 #fff}.customize-section-title{margin:0;padding:15px 20px;position:relative;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.customize-section-content{display:none;padding:10px 20px 15px;overflow:hidden}.control-section{border:0}.control-section .customize-section-title{padding:8px 20px;border-top:1px solid #fff;border-bottom:1px solid #dfdfdf;font-size:13px}.control-section .customize-section-title:hover{background-color:#efefef;background-image:-webkit-linear-gradient(top,#f5f5f5,#eee);background-image:-moz-linear-gradient(top,#f5f5f5,#eee);background-image:-ms-linear-gradient(top,#f5f5f5,#eee);background-image:-o-linear-gradient(top,#f5f5f5,#eee);background-image:linear-gradient(top,#f5f5f5,#eee);box-shadow:inset -11px 0 8px -8px rgba(0,0,0,0.1)}.control-section .customize-section-content{border-top:1px solid #fff;border-bottom:1px solid #dfdfdf}.customize-section.open .customize-section-content{display:block}.customize-section-title:after{content:'';width:0;height:0;border-color:#ccc transparent transparent transparent;border-style:solid;border-width:6px;position:absolute;top:25px;right:20px;z-index:1}.customize-section.open .customize-section-title:after{margin-top:-7px;border-color:transparent transparent #ccc transparent}.control-section .customize-section-title:after{top:13px}#customize-info{margin-top:45px}#customize-info .preview-notice{font-size:13px;line-height:24px;color:#999}#customize-info .theme-name{font-size:20px;font-weight:200;line-height:24px;display:block;text-shadow:0 1px 0 #fff}#customize-info .theme-screenshot{width:258px;border:1px solid #ccc}#customize-info .theme-description{margin-top:1em;color:#777;line-height:20px}#customize-controls .submit{text-align:center}#customize-theme-controls{padding-bottom:60px}#customize-theme-controls>ul,#customize-theme-controls .customize-section-content{margin:0}.customize-control{float:left;clear:both;margin-bottom:4px}.customize-control-title{clear:left;float:left;min-width:110px;margin-right:10px;line-height:28px}.customize-control-content{float:right;width:140px}.customize-control-text input,.customize-control-select select,.customize-control-checkbox input,.customize-control-color .color-picker,.customize-control-upload div{float:left;clear:right;line-height:28px}.customize-control-text input{float:right;width:138px;line-height:18px;margin:1px}.customize-control-select select{width:138px;height:28px;line-height:28px}.customize-control-checkbox input{margin-top:8px}.customize-control-radio{padding:5px 0 10px}.customize-control-radio .customize-control-title{margin-bottom:0;line-height:22px}.customize-control-radio label{float:left;clear:both;line-height:20px}.customize-control-radio input{margin-right:5px}#customize-preview iframe{width:100%;height:100%}.customize-section select{max-width:150px}.customize-section .dropdown{float:left;display:block;position:relative;cursor:pointer;-webkit-border-radius:3px;border-radius:3px}.customize-section .dropdown-content{overflow:hidden;float:left;min-width:30px;height:16px;line-height:16px;margin-right:16px;padding:4px 5px;background-color:#eee;border:1px solid #ccc;-webkit-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;-webkit-user-select:none;-moz-user-select:none;user-select:none}.customize-control .dropdown-arrow{position:absolute;top:0;bottom:0;right:0;width:15px;border-color:#ccc;border-style:solid;border-width:1px 1px 1px 0;-webkit-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0}.customize-control .dropdown-arrow:after{content:'';width:0;height:0;border-color:#ccc transparent;border-style:solid;border-width:4px 4px 0 4px;position:absolute;top:50%;margin-top:-1px;right:4px;z-index:1}.customize-control.open .dropdown-arrow:after{border-width:0 4px 4px 4px;margin-top:-2px}.customize-section .dropdown:hover .dropdown-content,.customize-control .dropdown:hover .dropdown-arrow{border-color:#aaa}.customize-section .dropdown:hover .dropdown-arrow:after{border-color:#aaa transparent}.customize-control .dropdown-status{display:none;max-width:112px;color:#999}.customize-control-color .color-picker-hex,.customize-control-color .farbtastic-placeholder{display:none}.customize-control-color.open .color-picker-hex,.customize-control-color.open .farbtastic-placeholder{display:block}.customize-control-color .dropdown{margin-right:5px;margin-bottom:5px}.customize-control-color .dropdown .dropdown-content{background-color:#fff;border:1px solid rgba(0,0,0,0.15)}.customize-control-color .dropdown:hover .dropdown-content{border-color:rgba(0,0,0,0.25)}.customize-section .color-picker-hex{float:left;width:70px;font-family:monospace;background-color:#fff;color:#777;border:1px solid #ccc;-webkit-border-radius:3px;border-radius:3px}.customize-section .color-picker-hex span{float:left;display:block;margin:1px -2px 0 0;line-height:16px;padding:3px 0 3px 8px;text-align:right;-webkit-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px}.customize-section .color-picker-hex input[type="text"]{width:50px;height:22px;line-height:16px;color:#777;background:transparent;border:0;-webkit-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0}.customize-control-color .farbtastic-placeholder{width:235px;margin:5px 0 10px 25px;float:left}.customize-control-color .farbtastic{margin:0 auto}.customize-control-image .library,.customize-control-image .actions{display:none;float:left}.customize-control-image.open .library,.customize-control-image.open .actions{display:block}.customize-section .customize-control-image .dropdown-content{height:auto;min-height:24px;min-width:40px;padding:0}.customize-section .customize-control-image .dropdown-status{padding:4px 5px}.customize-section .customize-control-image .preview-thumbnail img{display:block;max-width:122px;max-height:98px;margin:0 auto}.customize-section .customize-control-image .actions{float:right}.customize-section .customize-control-image .actions a{display:block}.customize-section .customize-control-image .library ul{border-bottom:1px solid #dfdfdf;float:left;width:100%;margin:10px 0 0}.customize-section .customize-control-image .library li{color:#999;float:left;padding:3px 5px;margin:0;border-style:solid;border-color:transparent;border-width:1px 1px 0 1px}.customize-section .customize-control-image .library li.library-selected{margin-bottom:-1px;padding-bottom:4px;color:#777;background:#f5f5f5;border-color:#dfdfdf;-webkit-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0}.customize-section .customize-control-image .library-content{display:none;width:100%;float:left;padding:10px 0}.customize-section .customize-control-image .library-content.library-selected{display:block}.customize-section .customize-control-image .library .thumbnail{display:block;width:100%}.customize-section .customize-control-image .library .thumbnail:hover img{border-color:#21759b}.customize-section .customize-control-image .library .thumbnail img{display:block;max-width:220px;max-height:80px;margin:5px auto;padding:4px;background:#fff;border:1px solid #dfdfdf}.customize-section .customize-control-upload .upload-dropzone,.customize-section .customize-control-image .upload-dropzone{padding:15px 10px;border:3px dashed #dfdfdf;margin:5px auto;text-align:center;color:#777;position:relative} \ No newline at end of file +body{overflow:hidden}#customize-controls a{text-decoration:none}.customize-section{border-top:1px solid #fff;border-bottom:1px solid #dfdfdf;margin:0}.customize-section:last-child{box-shadow:0 1px 0 0 #fff}.customize-section-title{margin:0;padding:15px 20px;position:relative;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.customize-section-content{display:none;padding:10px 20px 15px;overflow:hidden}.control-section{border:0}.control-section .customize-section-title{padding:8px 20px;border-top:1px solid #fff;border-bottom:1px solid #dfdfdf;font-size:13px}.control-section .customize-section-title:hover{background-color:#efefef;background-image:-webkit-linear-gradient(top,#f5f5f5,#eee);background-image:-moz-linear-gradient(top,#f5f5f5,#eee);background-image:-ms-linear-gradient(top,#f5f5f5,#eee);background-image:-o-linear-gradient(top,#f5f5f5,#eee);background-image:linear-gradient(top,#f5f5f5,#eee);box-shadow:inset -11px 0 8px -8px rgba(0,0,0,0.1)}.control-section .customize-section-content{border-top:1px solid #fff;border-bottom:1px solid #dfdfdf}.customize-section.open .customize-section-content{display:block}.customize-section-title:after{content:'';width:0;height:0;border-color:#ccc transparent transparent transparent;border-style:solid;border-width:6px;position:absolute;top:25px;right:20px;z-index:1}.customize-section.open .customize-section-title:after{margin-top:-7px;border-color:transparent transparent #ccc transparent}.control-section .customize-section-title:after{top:13px}#customize-info{margin-top:45px}#customize-info .preview-notice{font-size:13px;line-height:24px;color:#999}#customize-info .theme-name{font-size:20px;font-weight:200;line-height:24px;display:block;text-shadow:0 1px 0 #fff}#customize-info .theme-screenshot{width:258px;border:1px solid #ccc}#customize-info .theme-description{margin-top:1em;color:#777;line-height:20px}#customize-controls .submit{text-align:center}#customize-theme-controls{padding-bottom:60px}#customize-theme-controls>ul,#customize-theme-controls .customize-section-content{margin:0}#customize-footer-actions img{display:none;position:absolute;top:18px;margin-left:4px}.saving #customize-footer-actions img{display:inline}.customize-control{float:left;clear:both;margin-bottom:4px}.customize-control-title{clear:left;float:left;min-width:110px;margin-right:10px;line-height:28px}.customize-control-content{float:right;width:140px}.customize-control-text input,.customize-control-select select,.customize-control-checkbox input,.customize-control-color .color-picker,.customize-control-upload div{float:left;clear:right;line-height:28px}.customize-control-text input{float:right;width:138px;line-height:18px;margin:1px}.customize-control-select select{width:138px;height:28px;line-height:28px}.customize-control-checkbox input{margin-top:8px}.customize-control-radio{padding:5px 0 10px}.customize-control-radio .customize-control-title{margin-bottom:0;line-height:22px}.customize-control-radio label{float:left;clear:both;line-height:20px}.customize-control-radio input{margin-right:5px}#customize-preview iframe{width:100%;height:100%}.customize-section select{max-width:150px}.customize-section .dropdown{float:left;display:block;position:relative;cursor:pointer;-webkit-border-radius:3px;border-radius:3px}.customize-section .dropdown-content{overflow:hidden;float:left;min-width:30px;height:16px;line-height:16px;margin-right:16px;padding:4px 5px;background-color:#eee;border:1px solid #ccc;-webkit-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px;-webkit-user-select:none;-moz-user-select:none;user-select:none}.customize-control .dropdown-arrow{position:absolute;top:0;bottom:0;right:0;width:15px;border-color:#ccc;border-style:solid;border-width:1px 1px 1px 0;-webkit-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0}.customize-control .dropdown-arrow:after{content:'';width:0;height:0;border-color:#ccc transparent;border-style:solid;border-width:4px 4px 0 4px;position:absolute;top:50%;margin-top:-1px;right:4px;z-index:1}.customize-control.open .dropdown-arrow:after{border-width:0 4px 4px 4px;margin-top:-2px}.customize-section .dropdown:hover .dropdown-content,.customize-control .dropdown:hover .dropdown-arrow{border-color:#aaa}.customize-section .dropdown:hover .dropdown-arrow:after{border-color:#aaa transparent}.customize-control .dropdown-status{display:none;max-width:112px;color:#999}.customize-control-color .color-picker-hex,.customize-control-color .farbtastic-placeholder{display:none}.customize-control-color.open .color-picker-hex,.customize-control-color.open .farbtastic-placeholder{display:block}.customize-control-color .dropdown{margin-right:5px;margin-bottom:5px}.customize-control-color .dropdown .dropdown-content{background-color:#fff;border:1px solid rgba(0,0,0,0.15)}.customize-control-color .dropdown:hover .dropdown-content{border-color:rgba(0,0,0,0.25)}.customize-section .color-picker-hex{float:left;width:70px;font-family:monospace;background-color:#fff;color:#777;border:1px solid #ccc;-webkit-border-radius:3px;border-radius:3px}.customize-section .color-picker-hex span{float:left;display:block;margin:1px -2px 0 0;line-height:16px;padding:3px 0 3px 8px;text-align:right;-webkit-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px}.customize-section .color-picker-hex input[type="text"]{width:50px;height:22px;line-height:16px;color:#777;background:transparent;border:0;-webkit-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0}.customize-control-color .farbtastic-placeholder{width:235px;margin:5px 0 10px 25px;float:left}.customize-control-color .farbtastic{margin:0 auto}.customize-control-image .library,.customize-control-image .actions{display:none;float:left}.customize-control-image.open .library,.customize-control-image.open .actions{display:block}.customize-section .customize-control-image .dropdown-content{height:auto;min-height:24px;min-width:40px;padding:0}.customize-section .customize-control-image .dropdown-status{padding:4px 5px}.customize-section .customize-control-image .preview-thumbnail img{display:block;max-width:122px;max-height:98px;margin:0 auto}.customize-section .customize-control-image .actions{float:right}.customize-section .customize-control-image .actions a{display:block}.customize-section .customize-control-image .library ul{border-bottom:1px solid #dfdfdf;float:left;width:100%;margin:10px 0 0}.customize-section .customize-control-image .library li{color:#999;float:left;padding:3px 5px;margin:0;border-style:solid;border-color:transparent;border-width:1px 1px 0 1px}.customize-section .customize-control-image .library li.library-selected{margin-bottom:-1px;padding-bottom:4px;color:#777;background:#f5f5f5;border-color:#dfdfdf;-webkit-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0}.customize-section .customize-control-image .library-content{display:none;width:100%;float:left;padding:10px 0}.customize-section .customize-control-image .library-content.library-selected{display:block}.customize-section .customize-control-image .library .thumbnail{display:block;width:100%}.customize-section .customize-control-image .library .thumbnail:hover img{border-color:#21759b}.customize-section .customize-control-image .library .thumbnail img{display:block;max-width:220px;max-height:80px;margin:5px auto;padding:4px;background:#fff;border:1px solid #dfdfdf}.customize-section .customize-control-upload .upload-dropzone,.customize-section .customize-control-image .upload-dropzone{padding:15px 10px;border:3px dashed #dfdfdf;margin:5px auto;text-align:center;color:#777;position:relative} \ No newline at end of file diff --git a/wp-includes/js/customize-base.js b/wp-includes/js/customize-base.js index 6b52dc767d..9b8d66b462 100644 --- a/wp-includes/js/customize-base.js +++ b/wp-includes/js/customize-base.js @@ -1 +1 @@ -if(typeof wp==="undefined"){var wp={}}(function(a,d){var b,g,c,f,e=Array.prototype.slice;g=function(h,i){var j=f(this,h,i);j.extend=this.extend;return j};c=function(){};f=function(i,h,j){var k;if(h&&h.hasOwnProperty("constructor")){k=h.constructor}else{k=function(){var l=i.apply(this,arguments);return l}}d.extend(k,i);c.prototype=i.prototype;k.prototype=new c();if(h){d.extend(k.prototype,h)}if(j){d.extend(k,j)}k.prototype.constructor=k;k.__super__=i.prototype;return k};b={};b.Class=function(l,k,i){var j,h=arguments;if(l&&k&&b.Class.applicator===l){h=k;d.extend(this,i||{})}j=this;if(this.instance){j=function(){return j.instance.apply(j,arguments)};d.extend(j,this)}j.initialize.apply(j,h);return j};b.Class.applicator={};b.Class.prototype.initialize=function(){};b.Class.prototype.extended=function(h){var i=this;while(typeof i.constructor!=="undefined"){if(i.constructor===h){return true}if(typeof i.constructor.__super__==="undefined"){return false}i=i.constructor.__super__}return false};b.Class.extend=g;b.Value=b.Class.extend({initialize:function(i,h){this._value=i;this.callbacks=d.Callbacks();d.extend(this,h||{});this.set=d.proxy(this.set,this)},instance:function(){return arguments.length?this.set.apply(this,arguments):this.get()},get:function(){return this._value},set:function(i){var h=this._value;i=this._setter.apply(this,arguments);i=this.validate(i);if(null===i||this._value===i){return this}this._value=i;this.callbacks.fireWith(this,[i,h]);return this},_setter:function(h){return h},setter:function(h){this._setter=h;this.set(this.get());return this},resetSetter:function(){this._setter=this.constructor.prototype._setter;this.set(this.get());return this},validate:function(h){return h},bind:function(h){this.callbacks.add.apply(this.callbacks,arguments);return this},unbind:function(h){this.callbacks.remove.apply(this.callbacks,arguments);return this},link:function(){var h=this.set;d.each(arguments,function(){this.bind(h)});return this},unlink:function(){var h=this.set;d.each(arguments,function(){this.unbind(h)});return this},sync:function(){var h=this;d.each(arguments,function(){h.link(this);this.link(h)});return this},unsync:function(){var h=this;d.each(arguments,function(){h.unlink(this);this.unlink(h)});return this}});b.Values=b.Class.extend({defaultConstructor:b.Value,initialize:function(h){d.extend(this,h||{});this._value={};this._deferreds={}},instance:function(h){if(arguments.length===1){return this.value(h)}return this.when.apply(this,arguments)},value:function(h){return this._value[h]},has:function(h){return typeof this._value[h]!=="undefined"},add:function(i,h){if(this.has(i)){return this.value(i)}this._value[i]=h;this._value[i].parent=this;if(this._deferreds[i]){this._deferreds[i].resolve()}return this._value[i]},set:function(h){if(this.has(h)){return this.pass("set",arguments)}return this.add(h,new this.defaultConstructor(b.Class.applicator,e.call(arguments,1)))},remove:function(h){delete this._value[h];delete this._deferreds[h]},pass:function(i,h){var k,j;h=e.call(h);k=h.shift();if(!this.has(k)){return}j=this.value(k);return j[i].apply(j,h)},when:function(){var h=this,i=e.call(arguments),j=i.pop();d.when.apply(d,d.map(i,function(k){if(h.has(k)){return}return h._deferreds[k]||(h._deferreds[k]=d.Deferred())})).done(function(){var k=d.map(i,function(l){return h(l)});if(k.length!==i.length){i.push(j);h.when.apply(h,i);return}j.apply(h,k)})}});d.each(["get","bind","unbind","link","unlink","sync","unsync","setter","resetSetter"],function(h,j){b.Values.prototype[j]=function(){return this.pass(j,arguments)}});b.ensure=function(h){return typeof h=="string"?d(h):h};b.Element=b.Value.extend({initialize:function(j,i){var h=this,m=b.Element.synchronizer.html,l,n,k;this.element=b.ensure(j);this.events="";if(this.element.is("input, select, textarea")){this.events+="change";m=b.Element.synchronizer.val;if(this.element.is("input")){l=this.element.prop("type");if(b.Element.synchronizer[l]){m=b.Element.synchronizer[l]}if("text"===l||"password"===l){this.events+=" keyup"}}}b.Value.prototype.initialize.call(this,null,d.extend(i||{},m));this._value=this.get();n=this.update;k=this.refresh;this.update=function(o){if(o!==k.call(h)){n.apply(this,arguments)}};this.refresh=function(){h.set(k.call(h))};this.bind(this.update);this.element.bind(this.events,this.refresh)},find:function(h){return d(h,this.element)},refresh:function(){},update:function(){}});b.Element.synchronizer={};d.each(["html","val"],function(h,j){b.Element.synchronizer[j]={update:function(i){this.element[j](i)},refresh:function(){return this.element[j]()}}});b.Element.synchronizer.checkbox={update:function(h){this.element.prop("checked",h)},refresh:function(){return this.element.prop("checked")}};b.Element.synchronizer.radio={update:function(h){this.element.filter(function(){return this.value===h}).prop("checked",true)},refresh:function(){return this.element.filter(":checked").val()}};b.Messenger=b.Class.extend({add:function(j,i,h){return this[j]=new b.Value(i,h)},initialize:function(i,j,h){d.extend(this,h||{});i=this.add("url",i);this.add("targetWindow",j||window.parent);this.add("origin",i()).link(i).setter(function(k){return k.replace(/([^:]+:\/\/[^\/]+).*/,"$1")});this.topics={};this.receive=d.proxy(this.receive,this);d(window).on("message",this.receive)},destroy:function(){d(window).off("message",this.receive)},receive:function(i){var h;i=i.originalEvent;if(this.origin()&&i.origin!==this.origin()){return}h=JSON.parse(i.data);if(h&&h.id&&h.data&&this.topics[h.id]){this.topics[h.id].fireWith(this,[h.data])}},send:function(j,i){var h;i=i||{};if(!this.url()){return}h=JSON.stringify({id:j,data:i});this.targetWindow().postMessage(h,this.origin())},bind:function(j,i){var h=this.topics[j]||(this.topics[j]=d.Callbacks());h.add(i)},unbind:function(i,h){if(this.topics[i]){this.topics[i].remove(h)}}});b=d.extend(new b.Values(),b);a.customize=b})(wp,jQuery); \ No newline at end of file +if(typeof wp==="undefined"){var wp={}}(function(a,d){var b,g,c,f,e=Array.prototype.slice;g=function(h,i){var j=f(this,h,i);j.extend=this.extend;return j};c=function(){};f=function(i,h,j){var k;if(h&&h.hasOwnProperty("constructor")){k=h.constructor}else{k=function(){var l=i.apply(this,arguments);return l}}d.extend(k,i);c.prototype=i.prototype;k.prototype=new c();if(h){d.extend(k.prototype,h)}if(j){d.extend(k,j)}k.prototype.constructor=k;k.__super__=i.prototype;return k};b={};b.Class=function(l,k,i){var j,h=arguments;if(l&&k&&b.Class.applicator===l){h=k;d.extend(this,i||{})}j=this;if(this.instance){j=function(){return j.instance.apply(j,arguments)};d.extend(j,this)}j.initialize.apply(j,h);return j};b.Class.applicator={};b.Class.prototype.initialize=function(){};b.Class.prototype.extended=function(h){var i=this;while(typeof i.constructor!=="undefined"){if(i.constructor===h){return true}if(typeof i.constructor.__super__==="undefined"){return false}i=i.constructor.__super__}return false};b.Class.extend=g;b.Value=b.Class.extend({initialize:function(i,h){this._value=i;this.callbacks=d.Callbacks();d.extend(this,h||{});this.set=d.proxy(this.set,this)},instance:function(){return arguments.length?this.set.apply(this,arguments):this.get()},get:function(){return this._value},set:function(i){var h=this._value;i=this._setter.apply(this,arguments);i=this.validate(i);if(null===i||this._value===i){return this}this._value=i;this.callbacks.fireWith(this,[i,h]);return this},_setter:function(h){return h},setter:function(h){this._setter=h;this.set(this.get());return this},resetSetter:function(){this._setter=this.constructor.prototype._setter;this.set(this.get());return this},validate:function(h){return h},bind:function(h){this.callbacks.add.apply(this.callbacks,arguments);return this},unbind:function(h){this.callbacks.remove.apply(this.callbacks,arguments);return this},link:function(){var h=this.set;d.each(arguments,function(){this.bind(h)});return this},unlink:function(){var h=this.set;d.each(arguments,function(){this.unbind(h)});return this},sync:function(){var h=this;d.each(arguments,function(){h.link(this);this.link(h)});return this},unsync:function(){var h=this;d.each(arguments,function(){h.unlink(this);this.unlink(h)});return this}});b.Values=b.Class.extend({defaultConstructor:b.Value,initialize:function(h){d.extend(this,h||{});this._value={};this._deferreds={}},instance:function(h){if(arguments.length===1){return this.value(h)}return this.when.apply(this,arguments)},value:function(h){return this._value[h]},has:function(h){return typeof this._value[h]!=="undefined"},add:function(i,h){if(this.has(i)){return this.value(i)}this._value[i]=h;this._value[i].parent=this;if(this._deferreds[i]){this._deferreds[i].resolve()}return this._value[i]},get:function(){var h={};if(arguments.length){return this.pass("get",arguments)}d.each(this._value,function(i,j){h[i]=j.get()});return h},set:function(h){if(this.has(h)){return this.pass("set",arguments)}return this.add(h,new this.defaultConstructor(b.Class.applicator,e.call(arguments,1)))},remove:function(h){delete this._value[h];delete this._deferreds[h]},pass:function(i,h){var k,j;h=e.call(h);k=h.shift();if(!this.has(k)){return}j=this.value(k);return j[i].apply(j,h)},when:function(){var h=this,i=e.call(arguments),j=i.pop();d.when.apply(d,d.map(i,function(k){if(h.has(k)){return}return h._deferreds[k]||(h._deferreds[k]=d.Deferred())})).done(function(){var k=d.map(i,function(l){return h(l)});if(k.length!==i.length){i.push(j);h.when.apply(h,i);return}j.apply(h,k)})}});d.each(["bind","unbind","link","unlink","sync","unsync","setter","resetSetter"],function(h,j){b.Values.prototype[j]=function(){return this.pass(j,arguments)}});b.ensure=function(h){return typeof h=="string"?d(h):h};b.Element=b.Value.extend({initialize:function(j,i){var h=this,m=b.Element.synchronizer.html,l,n,k;this.element=b.ensure(j);this.events="";if(this.element.is("input, select, textarea")){this.events+="change";m=b.Element.synchronizer.val;if(this.element.is("input")){l=this.element.prop("type");if(b.Element.synchronizer[l]){m=b.Element.synchronizer[l]}if("text"===l||"password"===l){this.events+=" keyup"}}}b.Value.prototype.initialize.call(this,null,d.extend(i||{},m));this._value=this.get();n=this.update;k=this.refresh;this.update=function(o){if(o!==k.call(h)){n.apply(this,arguments)}};this.refresh=function(){h.set(k.call(h))};this.bind(this.update);this.element.bind(this.events,this.refresh)},find:function(h){return d(h,this.element)},refresh:function(){},update:function(){}});b.Element.synchronizer={};d.each(["html","val"],function(h,j){b.Element.synchronizer[j]={update:function(i){this.element[j](i)},refresh:function(){return this.element[j]()}}});b.Element.synchronizer.checkbox={update:function(h){this.element.prop("checked",h)},refresh:function(){return this.element.prop("checked")}};b.Element.synchronizer.radio={update:function(h){this.element.filter(function(){return this.value===h}).prop("checked",true)},refresh:function(){return this.element.filter(":checked").val()}};b.Messenger=b.Class.extend({add:function(j,i,h){return this[j]=new b.Value(i,h)},initialize:function(i,j,h){d.extend(this,h||{});i=this.add("url",i);this.add("targetWindow",j||window.parent);this.add("origin",i()).link(i).setter(function(k){return k.replace(/([^:]+:\/\/[^\/]+).*/,"$1")});this.topics={};this.receive=d.proxy(this.receive,this);d(window).on("message",this.receive)},destroy:function(){d(window).off("message",this.receive)},receive:function(i){var h;i=i.originalEvent;if(this.origin()&&i.origin!==this.origin()){return}h=JSON.parse(i.data);if(h&&h.id&&h.data&&this.topics[h.id]){this.topics[h.id].fireWith(this,[h.data])}},send:function(j,i){var h;i=i||{};if(!this.url()){return}h=JSON.stringify({id:j,data:i});this.targetWindow().postMessage(h,this.origin())},bind:function(j,i){var h=this.topics[j]||(this.topics[j]=d.Callbacks());h.add(i)},unbind:function(i,h){if(this.topics[i]){this.topics[i].remove(h)}}});b=d.extend(new b.Values(),b);a.customize=b})(wp,jQuery); \ No newline at end of file diff --git a/wp-includes/js/customize-controls.js b/wp-includes/js/customize-controls.js index 31bb7d3cb0..9ac21304ca 100644 --- a/wp-includes/js/customize-controls.js +++ b/wp-includes/js/customize-controls.js @@ -1 +1 @@ -(function(a,c){var b=wp.customize;b.Setting=b.Value.extend({initialize:function(g,f,d){var e;b.Value.prototype.initialize.call(this,f,d);this.id=g;this.transport=this.transport||"refresh";e=c("",{type:"hidden",value:this.get(),name:b.settings.prefix+g});e.appendTo(this.previewer.form);this.element=new b.Element(e);this.sync(this.element);this.bind(this.preview)},preview:function(){switch(this.transport){case"refresh":return this.previewer.refresh();case"postMessage":return this.previewer.send("setting",[this.id,this()])}}});b.Control=b.Class.extend({initialize:function(i,e){var g=this,d,h,f;this.params={};c.extend(this,e||{});this.id=i;this.selector="#customize-control-"+i.replace("]","").replace("[","-");this.container=c(this.selector);f=c.map(this.params.settings,function(j){return j});b.apply(b,f.concat(function(){var j;g.settings={};for(j in g.params.settings){g.settings[j]=b(g.params.settings[j])}g.setting=g.settings["default"]||null;g.ready()}));g.elements=[];d=this.container.find("[data-customize-setting-link]");h={};d.each(function(){var k=c(this),j;if(k.is(":radio")){j=k.prop("name");if(h[j]){return}h[j]=true;k=d.filter('[name="'+j+'"]')}b(k.data("customizeSettingLink"),function(m){var l=new b.Element(k);g.elements.push(l);l.sync(m);l.set(m())})})},ready:function(){},dropdownInit:function(){var e=this,d=this.container.find(".dropdown-status"),f=this.params,g=function(h){if(typeof h==="string"&&f.statuses&&f.statuses[h]){d.html(f.statuses[h]).show()}else{d.hide()}};this.container.on("click",".dropdown",function(h){h.preventDefault();e.container.toggleClass("open")});this.setting.bind(g);g(this.setting())}});b.ColorControl=b.Control.extend({ready:function(){var e=this,d,f,g;d=this.container.find(".dropdown-content");g=function(h){h=h?"#"+h:"";d.css("background",h);e.farbtastic.setColor(h)};this.farbtastic=c.farbtastic(this.container.find(".farbtastic-placeholder"),function(h){e.setting.set(h.replace("#",""))});this.setting.bind(g);g(this.setting());this.dropdownInit()}});b.UploadControl=b.Control.extend({ready:function(){var d=this;this.params.removed=this.params.removed||"";this.success=c.proxy(this.success,this);this.uploader=new wp.Uploader({browser:this.container.find(".upload"),dropzone:this.container.find(".upload-dropzone"),success:this.success});this.remover=this.container.find(".remove");this.remover.click(function(e){d.setting.set(d.params.removed);e.preventDefault()});this.removerVisibility=c.proxy(this.removerVisibility,this);this.setting.bind(this.removerVisibility);this.removerVisibility(this.setting.get());if(this.params.context){d.uploader.param("post_data[context]",this.params.context)}},success:function(d){this.setting.set(d.url)},removerVisibility:function(d){this.remover.toggle(d!=this.params.removed)}});b.ImageControl=b.UploadControl.extend({ready:function(){var e=this,d;b.UploadControl.prototype.ready.call(this);this.thumbnail=this.container.find(".preview-thumbnail img");this.thumbnailSrc=c.proxy(this.thumbnailSrc,this);this.setting.bind(this.thumbnailSrc);this.library=this.container.find(".library");this.tabs={};d=this.library.find(".library-content");this.library.children("ul").children("li").each(function(){var g=c(this),h=g.data("customizeTab"),f=d.filter('[data-customize-tab="'+h+'"]');e.tabs[h]={both:g.add(f),link:g,panel:f}});this.selected=this.tabs[d.first().data("customizeTab")];this.selected.both.addClass("library-selected");this.library.children("ul").on("click","li",function(g){var h=c(this).data("customizeTab"),f=e.tabs[h];g.preventDefault();if(f.link.hasClass("library-selected")){return}e.selected.both.removeClass("library-selected");e.selected=f;e.selected.both.addClass("library-selected")});this.library.on("click","a",function(f){var g=c(this).data("customizeImageValue");if(g){e.setting.set(g);f.preventDefault()}});if(this.tabs.uploaded){this.tabs.uploaded.target=this.library.find(".uploaded-target");if(!this.tabs.uploaded.panel.find(".thumbnail").length){this.tabs.uploaded.both.addClass("hidden")}}this.dropdownInit()},success:function(d){b.UploadControl.prototype.success.call(this,d);if(this.tabs.uploaded&&this.tabs.uploaded.target.length){this.tabs.uploaded.both.removeClass("hidden");c('').data("customizeImageValue",d.url).append('').appendTo(this.tabs.uploaded.target)}},thumbnailSrc:function(d){if(/^(https?:)?\/\//.test(d)){this.thumbnail.prop("src",d).show()}else{this.thumbnail.hide()}}});b.defaultConstructor=b.Setting;b.control=new b.Values({defaultConstructor:b.Control});b.Previewer=b.Messenger.extend({refreshBuffer:250,initialize:function(f,e){var d=this;c.extend(this,e||{});this.loaded=c.proxy(this.loaded,this);this.loaderUuid=0;this.refresh=(function(g){var h=g.refresh,j=function(){i=null;h.call(g)},i;return function(){if(typeof i!=="number"){if(g.loading){g.loading.remove();delete g.loading;g.loader()}else{return j()}}clearTimeout(i);i=setTimeout(j,g.refreshBuffer)}})(this);this.iframe=b.ensure(f.iframe);this.form=b.ensure(f.form);this.name=this.iframe.prop("name");this.container=this.iframe.parent();b.Messenger.prototype.initialize.call(this,f.url,this.iframe[0].contentWindow);this._formOriginalProps={target:this.form.prop("target"),action:this.form.prop("action")};this.bind("url",function(g){if(this.url()==g||0!==g.indexOf(this.origin()+"/")||-1!==g.indexOf("wp-admin")){return}this.url(g);this.refresh()});this.refresh();this.form.on("keydown",function(g){if(13===g.which){g.preventDefault()}});this.parent=new b.Messenger(b.settings.parent);this.parent.bind("back",function(g){d.form.find(".back").text(g).click(function(h){h.preventDefault();d.parent.send("close")})});this.parent.send("ready")},loader:function(){if(this.loading){return this.loading}this.loading=c("