From 2800ad60b0e90b1833a98d714affe7db87c8f235 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 6 Apr 2017 17:33:34 +0000 Subject: [PATCH] Customize: Fix HTTPS navigation of site in preview on IE11. Accounts for HTTPS links (port 443) where [40318] only accounted for HTTP links (port 80). Addresses issue in IE11 where the default port number is unexpectedly included on `link.host` for links dynamically created by scripts. Props mattwiebe. Amends [40318], [38890]. See #38409. Fixes #40198. Merges [40381] to the 4.7 branch. Built from https://develop.svn.wordpress.org/branches/4.7@40386 git-svn-id: http://core.svn.wordpress.org/branches/4.7@40293 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/js/customize-base.js | 2 +- wp-includes/js/customize-base.min.js | 2 +- wp-includes/js/customize-preview.js | 4 ++-- wp-includes/js/customize-preview.min.js | 2 +- wp-includes/version.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/wp-includes/js/customize-base.js b/wp-includes/js/customize-base.js index a1528de4ff..3fdb92423f 100644 --- a/wp-includes/js/customize-base.js +++ b/wp-includes/js/customize-base.js @@ -655,7 +655,7 @@ window.wp = window.wp || {}; var urlParser = document.createElement( 'a' ); urlParser.href = to; // Port stripping needed by IE since it adds to host but not to event.origin. - return urlParser.protocol + '//' + urlParser.host.replace( /:80$/, '' ); + return urlParser.protocol + '//' + urlParser.host.replace( /:(80|443)$/, '' ); }); // first add with no value diff --git a/wp-includes/js/customize-base.min.js b/wp-includes/js/customize-base.min.js index 0a2ce9ff04..93b69ccdf9 100644 --- a/wp-includes/js/customize-base.min.js +++ b/wp-includes/js/customize-base.min.js @@ -1 +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){return this.has(a)?this.value(a):(this._value[a]=b,b.parent=this,b.extended(e.Value)&&b.bind(this._change),this.trigger("add",b),this._deferreds[a]&&this._deferreds[a].resolve(),this._value[a])},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.has(a)&&(b=this.value(a),this.trigger("remove",b),b.extended(e.Value)&&b.unbind(this._change),delete b.parent),delete this._value[a],delete this._deferreds[a]},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")&&(this.events+="change",i=e.Element.synchronizer.val,this.element.is("input")?(d=this.element.prop("type"),e.Element.synchronizer[d]&&(i=e.Element.synchronizer[d]),"text"===d||"password"===d?this.events+=" keyup":"range"===d&&(this.events+=" input propertychange")):this.element.is("textarea")&&(this.events+=" keyup")),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$/,"")}),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({initialize:function(a,b){var c;this.code=a,c=_.extend({message:null,type:"error",fromServer:!1,data:null,setting:null},b),delete c.code,_.extend(this,c)}}),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); \ No newline at end of file +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){return this.has(a)?this.value(a):(this._value[a]=b,b.parent=this,b.extended(e.Value)&&b.bind(this._change),this.trigger("add",b),this._deferreds[a]&&this._deferreds[a].resolve(),this._value[a])},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.has(a)&&(b=this.value(a),this.trigger("remove",b),b.extended(e.Value)&&b.unbind(this._change),delete b.parent),delete this._value[a],delete this._deferreds[a]},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")&&(this.events+="change",i=e.Element.synchronizer.val,this.element.is("input")?(d=this.element.prop("type"),e.Element.synchronizer[d]&&(i=e.Element.synchronizer[d]),"text"===d||"password"===d?this.events+=" keyup":"range"===d&&(this.events+=" input propertychange")):this.element.is("textarea")&&(this.events+=" keyup")),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({initialize:function(a,b){var c;this.code=a,c=_.extend({message:null,type:"error",fromServer:!1,data:null,setting:null},b),delete c.code,_.extend(this,c)}}),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); \ No newline at end of file diff --git a/wp-includes/js/customize-preview.js b/wp-includes/js/customize-preview.js index 7b8804d3ed..adb9f03847 100644 --- a/wp-includes/js/customize-preview.js +++ b/wp-includes/js/customize-preview.js @@ -286,11 +286,11 @@ return false; } - elementHost = element.host.replace( /:80$/, '' ); + elementHost = element.host.replace( /:(80|443)$/, '' ); parsedAllowedUrl = document.createElement( 'a' ); matchesAllowedUrl = ! _.isUndefined( _.find( api.settings.url.allowed, function( allowedUrl ) { parsedAllowedUrl.href = allowedUrl; - return parsedAllowedUrl.protocol === element.protocol && parsedAllowedUrl.host.replace( /:80$/, '' ) === elementHost && 0 === element.pathname.indexOf( parsedAllowedUrl.pathname.replace( /\/$/, '' ) ); + return parsedAllowedUrl.protocol === element.protocol && parsedAllowedUrl.host.replace( /:(80|443)$/, '' ) === elementHost && 0 === element.pathname.indexOf( parsedAllowedUrl.pathname.replace( /\/$/, '' ) ); } ) ); if ( ! matchesAllowedUrl ) { return false; diff --git a/wp-includes/js/customize-preview.min.js b/wp-includes/js/customize-preview.min.js index 5fa53c07e5..2f3f36a792 100644 --- a/wp-includes/js/customize-preview.min.js +++ b/wp-includes/js/customize-preview.min.js @@ -1 +1 @@ -!function(a,b){var c,d=wp.customize,e={};!function(a){var c;a.replaceState&&(c=function(a){var c,e,f;return c=document.createElement("a"),c.href=a,e=d.utils.parseQueryString(location.search.substr(1)),f=d.utils.parseQueryString(c.search.substr(1)),f.customize_changeset_uuid=e.customize_changeset_uuid,e.customize_theme&&(f.customize_theme=e.customize_theme),e.customize_messenger_channel&&(f.customize_messenger_channel=e.customize_messenger_channel),c.search=b.param(f),c.href},a.replaceState=function(b){return function(d,f,g){return e=d,b.call(a,d,f,"string"==typeof g&&g.length>0?c(g):g)}}(a.replaceState),a.pushState=function(b){return function(d,f,g){return e=d,b.call(a,d,f,"string"==typeof g&&g.length>0?c(g):g)}}(a.pushState),window.addEventListener("popstate",function(a){e=a.state}))}(history),c=function(a,b,c){var d;return function(){var e=arguments;c=c||this,clearTimeout(d),d=setTimeout(function(){d=null,a.apply(c,e)},b)}},d.Preview=d.Messenger.extend({initialize:function(a,e){var f=this,g=document.createElement("a");d.Messenger.prototype.initialize.call(f,a,e),g.href=f.origin(),f.add("scheme",g.protocol.replace(/:$/,"")),f.body=b(document.body),f.window=b(window),d.settings.channel&&(f.body.on("click.preview","a",function(a){f.handleLinkClick(a)}),f.body.on("submit.preview","form",function(a){f.handleFormSubmit(a)}),f.window.on("scroll.preview",c(function(){f.send("scroll",f.window.scrollTop())},200)),f.bind("scroll",function(a){f.window.scrollTop(a)}))},handleLinkClick:function(a){var c,e,f=this;if(c=b(a.target).closest("a"),!_.isUndefined(c.attr("href"))&&(e="#"===c.attr("href").substr(0,1),!e&&/^https?:$/.test(c.prop("protocol")))){if(!d.isLinkPreviewable(c[0]))return wp.a11y.speak(d.settings.l10n.linkUnpreviewable),void a.preventDefault();a.preventDefault(),a.shiftKey||f.send("url",c.prop("href"))}},handleFormSubmit:function(a){var c,e,f=this;return c=document.createElement("a"),e=b(a.target),c.href=e.prop("action"),"GET"===e.prop("method").toUpperCase()&&d.isLinkPreviewable(c)?(a.isDefaultPrevented()||(c.search.length>1&&(c.search+="&"),c.search+=e.serialize(),f.send("url",c.href)),void a.preventDefault()):(wp.a11y.speak(d.settings.l10n.formUnpreviewable),void a.preventDefault())}}),d.addLinkPreviewing=function(){var a="a[href], area";b(document.body).find(a).each(function(){d.prepareLinkPreview(this)}),"undefined"!=typeof MutationObserver?(d.mutationObserver=new MutationObserver(function(c){_.each(c,function(c){b(c.target).find(a).each(function(){d.prepareLinkPreview(this)})})}),d.mutationObserver.observe(document.documentElement,{childList:!0,subtree:!0})):b(document.documentElement).on("click focus mouseover",a,function(){d.prepareLinkPreview(this)})},d.isLinkPreviewable=function(a,b){var c,e,f,g;return f=_.extend({},{allowAdminAjax:!1},b||{}),"javascript:"===a.protocol||("https:"===a.protocol||"http:"===a.protocol)&&(g=a.host.replace(/:80$/,""),e=document.createElement("a"),c=!_.isUndefined(_.find(d.settings.url.allowed,function(b){return e.href=b,e.protocol===a.protocol&&e.host.replace(/:80$/,"")===g&&0===a.pathname.indexOf(e.pathname.replace(/\/$/,""))})),!!c&&(!/\/wp-(login|signup)\.php$/.test(a.pathname)&&(/\/wp-admin\/admin-ajax\.php$/.test(a.pathname)?f.allowAdminAjax:!/\/wp-(admin|includes|content)(\/|$)/.test(a.pathname))))},d.prepareLinkPreview=function(a){var c;if(!b(a).closest("#wpadminbar").length&&"#"!==b(a).attr("href").substr(0,1)&&/^https?:$/.test(a.protocol)){if(d.settings.channel&&"https"===d.preview.scheme.get()&&"http:"===a.protocol&&-1!==d.settings.url.allowedHosts.indexOf(a.host)&&(a.protocol="https:"),!d.isLinkPreviewable(a))return void(d.settings.channel&&b(a).addClass("customize-unpreviewable"));b(a).removeClass("customize-unpreviewable"),c=d.utils.parseQueryString(a.search.substring(1)),c.customize_changeset_uuid=d.settings.changeset.uuid,d.settings.theme.active||(c.customize_theme=d.settings.theme.stylesheet),d.settings.channel&&(c.customize_messenger_channel=d.settings.channel),a.search=b.param(c),d.settings.channel&&(a.target="_self")}},d.addRequestPreviewing=function(){var a=function(a,c,e){var f,g,h,i={};f=document.createElement("a"),f.href=a.url,d.isLinkPreviewable(f,{allowAdminAjax:!0})&&(g=d.utils.parseQueryString(f.search.substring(1)),d.each(function(a){a._dirty&&(i[a.id]=a.get())}),_.isEmpty(i)||(h=a.type.toUpperCase(),"POST"!==h&&(e.setRequestHeader("X-HTTP-Method-Override",h),g._method=h,a.type="POST"),a.data?a.data+="&":a.data="",a.data+=b.param({customized:JSON.stringify(i)})),g.customize_changeset_uuid=d.settings.changeset.uuid,d.settings.theme.active||(g.customize_theme=d.settings.theme.stylesheet),f.search=b.param(g),a.url=f.href)};b.ajaxPrefilter(a)},d.addFormPreviewing=function(){b(document.body).find("form").each(function(){d.prepareFormPreview(this)}),"undefined"!=typeof MutationObserver&&(d.mutationObserver=new MutationObserver(function(a){_.each(a,function(a){b(a.target).find("form").each(function(){d.prepareFormPreview(this)})})}),d.mutationObserver.observe(document.documentElement,{childList:!0,subtree:!0}))},d.prepareFormPreview=function(a){var c,e={};return a.action||(a.action=location.href),c=document.createElement("a"),c.href=a.action,d.settings.channel&&"https"===d.preview.scheme.get()&&"http:"===c.protocol&&-1!==d.settings.url.allowedHosts.indexOf(c.host)&&(c.protocol="https:",a.action=c.href),"GET"===a.method.toUpperCase()&&d.isLinkPreviewable(c)?(b(a).removeClass("customize-unpreviewable"),e.customize_changeset_uuid=d.settings.changeset.uuid,d.settings.theme.active||(e.customize_theme=d.settings.theme.stylesheet),d.settings.channel&&(e.customize_messenger_channel=d.settings.channel),_.each(e,function(c,d){var e=b(a).find('input[name="'+d+'"]');e.length?e.val(c):b(a).prepend(b("",{type:"hidden",name:d,value:c}))}),void(d.settings.channel&&(a.target="_self"))):void(d.settings.channel&&b(a).addClass("customize-unpreviewable"))},d.keepAliveCurrentUrl=function(){var a=location.pathname,c=location.search.substr(1),e=null,f=["customize_theme","customize_changeset_uuid","customize_messenger_channel"];return function(){var g,h;return c===location.search.substr(1)&&a===location.pathname?void d.preview.send("keep-alive"):(g=document.createElement("a"),null===e&&(g.search=c,e=d.utils.parseQueryString(c),_.each(f,function(a){delete e[a]})),g.href=location.href,h=d.utils.parseQueryString(g.search.substr(1)),_.each(f,function(a){delete h[a]}),a===location.pathname&&_.isEqual(e,h)?d.preview.send("keep-alive"):(g.search=b.param(h),g.hash="",d.settings.url.self=g.href,d.preview.send("ready",{currentUrl:d.settings.url.self,activePanels:d.settings.activePanels,activeSections:d.settings.activeSections,activeControls:d.settings.activeControls,settingValidities:d.settings.settingValidities})),e=h,c=location.search.substr(1),void(a=location.pathname))}}(),d.settingPreviewHandlers={custom_logo:function(a){b("body").toggleClass("wp-custom-logo",!!a)},custom_css:function(a){b("#wp-custom-css").text(a)},background:function(){var a="",c={};_.each(["color","image","preset","position_x","position_y","size","repeat","attachment"],function(a){c[a]=d("background_"+a)}),b(document.body).toggleClass("custom-background",!(!c.color()&&!c.image())),c.color()&&(a+="background-color: "+c.color()+";"),c.image()&&(a+='background-image: url("'+c.image()+'");',a+="background-size: "+c.size()+";",a+="background-position: "+c.position_x()+" "+c.position_y()+";",a+="background-repeat: "+c.repeat()+";",a+="background-attachment: "+c.attachment()+";"),b("#custom-background-css").text("body.custom-background { "+a+" }")}},b(function(){var a,c;d.settings=window._wpCustomizeSettings,d.settings&&(d.preview=new d.Preview({url:window.location.href,channel:d.settings.channel}),d.addLinkPreviewing(),d.addRequestPreviewing(),d.addFormPreviewing(),c=function(a,b,c){var e=d(a);e?e.set(b):(c=c||!1,e=d.create(a,b,{id:a}),c&&(e._dirty=!0))},d.preview.bind("settings",function(a){b.each(a,c)}),d.preview.trigger("settings",d.settings.values),b.each(d.settings._dirty,function(a,b){var c=d(b);c&&(c._dirty=!0)}),d.preview.bind("setting",function(a){var b=!0;c.apply(null,a.concat(b))}),d.preview.bind("sync",function(a){a.settings&&a["settings-modified-while-loading"]&&_.each(_.keys(a.settings),function(b){d.has(b)&&!a["settings-modified-while-loading"][b]&&delete a.settings[b]}),b.each(a,function(a,b){d.preview.trigger(a,b)}),d.preview.send("synced")}),d.preview.bind("active",function(){d.preview.send("nonce",d.settings.nonce),d.preview.send("documentTitle",document.title),d.preview.send("scroll",b(window).scrollTop())}),d.preview.bind("saved",function(a){a.next_changeset_uuid&&(d.settings.changeset.uuid=a.next_changeset_uuid,b(document.body).find("a[href], area").each(function(){d.prepareLinkPreview(this)}),b(document.body).find("form").each(function(){d.prepareFormPreview(this)}),history.replaceState&&history.replaceState(e,"",location.href)),d.trigger("saved",a)}),d.preview.bind("changeset-saved",function(a){_.each(a.saved_changeset_values,function(a,b){var c=d(b);c&&_.isEqual(c.get(),a)&&(c._dirty=!1)})}),d.preview.bind("nonce-refresh",function(a){b.extend(d.settings.nonce,a)}),d.preview.send("ready",{currentUrl:d.settings.url.self,activePanels:d.settings.activePanels,activeSections:d.settings.activeSections,activeControls:d.settings.activeControls,settingValidities:d.settings.settingValidities}),setInterval(d.keepAliveCurrentUrl,d.settings.timeouts.keepAliveSend),d.preview.bind("loading-initiated",function(){b("body").addClass("wp-customizer-unloading")}),d.preview.bind("loading-failed",function(){b("body").removeClass("wp-customizer-unloading")}),a=b.map(["color","image","preset","position_x","position_y","size","repeat","attachment"],function(a){return"background_"+a}),d.when.apply(d,a).done(function(){b.each(arguments,function(){this.bind(d.settingPreviewHandlers.background)})}),d("custom_logo",function(a){d.settingPreviewHandlers.custom_logo.call(a,a.get()),a.bind(d.settingPreviewHandlers.custom_logo)}),d("custom_css["+d.settings.theme.stylesheet+"]",function(a){a.bind(d.settingPreviewHandlers.custom_css)}),d.trigger("preview-ready"))})}(wp,jQuery); \ No newline at end of file +!function(a,b){var c,d=wp.customize,e={};!function(a){var c;a.replaceState&&(c=function(a){var c,e,f;return c=document.createElement("a"),c.href=a,e=d.utils.parseQueryString(location.search.substr(1)),f=d.utils.parseQueryString(c.search.substr(1)),f.customize_changeset_uuid=e.customize_changeset_uuid,e.customize_theme&&(f.customize_theme=e.customize_theme),e.customize_messenger_channel&&(f.customize_messenger_channel=e.customize_messenger_channel),c.search=b.param(f),c.href},a.replaceState=function(b){return function(d,f,g){return e=d,b.call(a,d,f,"string"==typeof g&&g.length>0?c(g):g)}}(a.replaceState),a.pushState=function(b){return function(d,f,g){return e=d,b.call(a,d,f,"string"==typeof g&&g.length>0?c(g):g)}}(a.pushState),window.addEventListener("popstate",function(a){e=a.state}))}(history),c=function(a,b,c){var d;return function(){var e=arguments;c=c||this,clearTimeout(d),d=setTimeout(function(){d=null,a.apply(c,e)},b)}},d.Preview=d.Messenger.extend({initialize:function(a,e){var f=this,g=document.createElement("a");d.Messenger.prototype.initialize.call(f,a,e),g.href=f.origin(),f.add("scheme",g.protocol.replace(/:$/,"")),f.body=b(document.body),f.window=b(window),d.settings.channel&&(f.body.on("click.preview","a",function(a){f.handleLinkClick(a)}),f.body.on("submit.preview","form",function(a){f.handleFormSubmit(a)}),f.window.on("scroll.preview",c(function(){f.send("scroll",f.window.scrollTop())},200)),f.bind("scroll",function(a){f.window.scrollTop(a)}))},handleLinkClick:function(a){var c,e,f=this;if(c=b(a.target).closest("a"),!_.isUndefined(c.attr("href"))&&(e="#"===c.attr("href").substr(0,1),!e&&/^https?:$/.test(c.prop("protocol")))){if(!d.isLinkPreviewable(c[0]))return wp.a11y.speak(d.settings.l10n.linkUnpreviewable),void a.preventDefault();a.preventDefault(),a.shiftKey||f.send("url",c.prop("href"))}},handleFormSubmit:function(a){var c,e,f=this;return c=document.createElement("a"),e=b(a.target),c.href=e.prop("action"),"GET"===e.prop("method").toUpperCase()&&d.isLinkPreviewable(c)?(a.isDefaultPrevented()||(c.search.length>1&&(c.search+="&"),c.search+=e.serialize(),f.send("url",c.href)),void a.preventDefault()):(wp.a11y.speak(d.settings.l10n.formUnpreviewable),void a.preventDefault())}}),d.addLinkPreviewing=function(){var a="a[href], area";b(document.body).find(a).each(function(){d.prepareLinkPreview(this)}),"undefined"!=typeof MutationObserver?(d.mutationObserver=new MutationObserver(function(c){_.each(c,function(c){b(c.target).find(a).each(function(){d.prepareLinkPreview(this)})})}),d.mutationObserver.observe(document.documentElement,{childList:!0,subtree:!0})):b(document.documentElement).on("click focus mouseover",a,function(){d.prepareLinkPreview(this)})},d.isLinkPreviewable=function(a,b){var c,e,f,g;return f=_.extend({},{allowAdminAjax:!1},b||{}),"javascript:"===a.protocol||("https:"===a.protocol||"http:"===a.protocol)&&(g=a.host.replace(/:(80|443)$/,""),e=document.createElement("a"),c=!_.isUndefined(_.find(d.settings.url.allowed,function(b){return e.href=b,e.protocol===a.protocol&&e.host.replace(/:(80|443)$/,"")===g&&0===a.pathname.indexOf(e.pathname.replace(/\/$/,""))})),!!c&&(!/\/wp-(login|signup)\.php$/.test(a.pathname)&&(/\/wp-admin\/admin-ajax\.php$/.test(a.pathname)?f.allowAdminAjax:!/\/wp-(admin|includes|content)(\/|$)/.test(a.pathname))))},d.prepareLinkPreview=function(a){var c;if(!b(a).closest("#wpadminbar").length&&"#"!==b(a).attr("href").substr(0,1)&&/^https?:$/.test(a.protocol)){if(d.settings.channel&&"https"===d.preview.scheme.get()&&"http:"===a.protocol&&-1!==d.settings.url.allowedHosts.indexOf(a.host)&&(a.protocol="https:"),!d.isLinkPreviewable(a))return void(d.settings.channel&&b(a).addClass("customize-unpreviewable"));b(a).removeClass("customize-unpreviewable"),c=d.utils.parseQueryString(a.search.substring(1)),c.customize_changeset_uuid=d.settings.changeset.uuid,d.settings.theme.active||(c.customize_theme=d.settings.theme.stylesheet),d.settings.channel&&(c.customize_messenger_channel=d.settings.channel),a.search=b.param(c),d.settings.channel&&(a.target="_self")}},d.addRequestPreviewing=function(){var a=function(a,c,e){var f,g,h,i={};f=document.createElement("a"),f.href=a.url,d.isLinkPreviewable(f,{allowAdminAjax:!0})&&(g=d.utils.parseQueryString(f.search.substring(1)),d.each(function(a){a._dirty&&(i[a.id]=a.get())}),_.isEmpty(i)||(h=a.type.toUpperCase(),"POST"!==h&&(e.setRequestHeader("X-HTTP-Method-Override",h),g._method=h,a.type="POST"),a.data?a.data+="&":a.data="",a.data+=b.param({customized:JSON.stringify(i)})),g.customize_changeset_uuid=d.settings.changeset.uuid,d.settings.theme.active||(g.customize_theme=d.settings.theme.stylesheet),f.search=b.param(g),a.url=f.href)};b.ajaxPrefilter(a)},d.addFormPreviewing=function(){b(document.body).find("form").each(function(){d.prepareFormPreview(this)}),"undefined"!=typeof MutationObserver&&(d.mutationObserver=new MutationObserver(function(a){_.each(a,function(a){b(a.target).find("form").each(function(){d.prepareFormPreview(this)})})}),d.mutationObserver.observe(document.documentElement,{childList:!0,subtree:!0}))},d.prepareFormPreview=function(a){var c,e={};return a.action||(a.action=location.href),c=document.createElement("a"),c.href=a.action,d.settings.channel&&"https"===d.preview.scheme.get()&&"http:"===c.protocol&&-1!==d.settings.url.allowedHosts.indexOf(c.host)&&(c.protocol="https:",a.action=c.href),"GET"===a.method.toUpperCase()&&d.isLinkPreviewable(c)?(b(a).removeClass("customize-unpreviewable"),e.customize_changeset_uuid=d.settings.changeset.uuid,d.settings.theme.active||(e.customize_theme=d.settings.theme.stylesheet),d.settings.channel&&(e.customize_messenger_channel=d.settings.channel),_.each(e,function(c,d){var e=b(a).find('input[name="'+d+'"]');e.length?e.val(c):b(a).prepend(b("",{type:"hidden",name:d,value:c}))}),void(d.settings.channel&&(a.target="_self"))):void(d.settings.channel&&b(a).addClass("customize-unpreviewable"))},d.keepAliveCurrentUrl=function(){var a=location.pathname,c=location.search.substr(1),e=null,f=["customize_theme","customize_changeset_uuid","customize_messenger_channel"];return function(){var g,h;return c===location.search.substr(1)&&a===location.pathname?void d.preview.send("keep-alive"):(g=document.createElement("a"),null===e&&(g.search=c,e=d.utils.parseQueryString(c),_.each(f,function(a){delete e[a]})),g.href=location.href,h=d.utils.parseQueryString(g.search.substr(1)),_.each(f,function(a){delete h[a]}),a===location.pathname&&_.isEqual(e,h)?d.preview.send("keep-alive"):(g.search=b.param(h),g.hash="",d.settings.url.self=g.href,d.preview.send("ready",{currentUrl:d.settings.url.self,activePanels:d.settings.activePanels,activeSections:d.settings.activeSections,activeControls:d.settings.activeControls,settingValidities:d.settings.settingValidities})),e=h,c=location.search.substr(1),void(a=location.pathname))}}(),d.settingPreviewHandlers={custom_logo:function(a){b("body").toggleClass("wp-custom-logo",!!a)},custom_css:function(a){b("#wp-custom-css").text(a)},background:function(){var a="",c={};_.each(["color","image","preset","position_x","position_y","size","repeat","attachment"],function(a){c[a]=d("background_"+a)}),b(document.body).toggleClass("custom-background",!(!c.color()&&!c.image())),c.color()&&(a+="background-color: "+c.color()+";"),c.image()&&(a+='background-image: url("'+c.image()+'");',a+="background-size: "+c.size()+";",a+="background-position: "+c.position_x()+" "+c.position_y()+";",a+="background-repeat: "+c.repeat()+";",a+="background-attachment: "+c.attachment()+";"),b("#custom-background-css").text("body.custom-background { "+a+" }")}},b(function(){var a,c;d.settings=window._wpCustomizeSettings,d.settings&&(d.preview=new d.Preview({url:window.location.href,channel:d.settings.channel}),d.addLinkPreviewing(),d.addRequestPreviewing(),d.addFormPreviewing(),c=function(a,b,c){var e=d(a);e?e.set(b):(c=c||!1,e=d.create(a,b,{id:a}),c&&(e._dirty=!0))},d.preview.bind("settings",function(a){b.each(a,c)}),d.preview.trigger("settings",d.settings.values),b.each(d.settings._dirty,function(a,b){var c=d(b);c&&(c._dirty=!0)}),d.preview.bind("setting",function(a){var b=!0;c.apply(null,a.concat(b))}),d.preview.bind("sync",function(a){a.settings&&a["settings-modified-while-loading"]&&_.each(_.keys(a.settings),function(b){d.has(b)&&!a["settings-modified-while-loading"][b]&&delete a.settings[b]}),b.each(a,function(a,b){d.preview.trigger(a,b)}),d.preview.send("synced")}),d.preview.bind("active",function(){d.preview.send("nonce",d.settings.nonce),d.preview.send("documentTitle",document.title),d.preview.send("scroll",b(window).scrollTop())}),d.preview.bind("saved",function(a){a.next_changeset_uuid&&(d.settings.changeset.uuid=a.next_changeset_uuid,b(document.body).find("a[href], area").each(function(){d.prepareLinkPreview(this)}),b(document.body).find("form").each(function(){d.prepareFormPreview(this)}),history.replaceState&&history.replaceState(e,"",location.href)),d.trigger("saved",a)}),d.preview.bind("changeset-saved",function(a){_.each(a.saved_changeset_values,function(a,b){var c=d(b);c&&_.isEqual(c.get(),a)&&(c._dirty=!1)})}),d.preview.bind("nonce-refresh",function(a){b.extend(d.settings.nonce,a)}),d.preview.send("ready",{currentUrl:d.settings.url.self,activePanels:d.settings.activePanels,activeSections:d.settings.activeSections,activeControls:d.settings.activeControls,settingValidities:d.settings.settingValidities}),setInterval(d.keepAliveCurrentUrl,d.settings.timeouts.keepAliveSend),d.preview.bind("loading-initiated",function(){b("body").addClass("wp-customizer-unloading")}),d.preview.bind("loading-failed",function(){b("body").removeClass("wp-customizer-unloading")}),a=b.map(["color","image","preset","position_x","position_y","size","repeat","attachment"],function(a){return"background_"+a}),d.when.apply(d,a).done(function(){b.each(arguments,function(){this.bind(d.settingPreviewHandlers.background)})}),d("custom_logo",function(a){d.settingPreviewHandlers.custom_logo.call(a,a.get()),a.bind(d.settingPreviewHandlers.custom_logo)}),d("custom_css["+d.settings.theme.stylesheet+"]",function(a){a.bind(d.settingPreviewHandlers.custom_css)}),d.trigger("preview-ready"))})}(wp,jQuery); \ No newline at end of file diff --git a/wp-includes/version.php b/wp-includes/version.php index da02120e26..77c1eaa757 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7.4-alpha-40385'; +$wp_version = '4.7.4-alpha-40386'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.