Customize: Improve custom background properties UI.
Introduces new control for managing the background position. Adds control for setting the `background-size`.
Props cdog, celloexpressions, grapplerulrich, MikeHansenMe, FolioVision, afercia, helen, melchoyce, karmatosed, westonruter, Kelderic, sebastian.pisula.
Fixes #22058.
Built from https://develop.svn.wordpress.org/trunk@38948
git-svn-id: http://core.svn.wordpress.org/trunk@38891 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-26 02:52:29 -04:00
|
|
|
!function(a,b){var c,d=wp.customize,e={};!function(a){var c;a.replaceState&&(c=function(a){var c,e;return c=document.createElement("a"),c.href=a,e=d.utils.parseQueryString(c.search.substr(1)),e.customize_changeset_uuid=d.settings.changeset.uuid,d.settings.theme.active||(e.customize_theme=d.settings.theme.stylesheet),d.settings.theme.channel&&(e.customize_messenger_channel=d.settings.channel),c.search=b.param(e),a},a.replaceState=function(b){return function(d,f,g){return e=d,b.call(a,d,f,c(g))}}(a.replaceState),a.pushState=function(b){return function(d,f,g){return e=d,b.call(a,d,f,c(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.body.on("click.preview","a",function(a){f.handleLinkClick(a)}),f.body.on("submit.preview","form",function(a){f.handleFormSubmit(a)}),f.window=b(window),d.settings.channel&&(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;return c=b(a.target),_.isUndefined(c.attr("href"))||(e="#"===c.attr("href").substr(0,1))?void 0:d.isLinkPreviewable(c[0])?void(d.settings.channel&&(a.preventDefault(),a.shiftKey||f.send("url",c.prop("href")))):(wp.a11y.speak(d.settings.l10n.linkUnpreviewable),void a.preventDefault())},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)?void(d.settings.channel&&(a.isDefaultPrevented()||(c.search.length>1&&(c.search+="&"),c.search+=e.serialize(),f.send("url",c.href)),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;return f=_.extend({},{allowAdminAjax:!1},b||{}),"javascript:"===a.protocol?!0:"https:"!==a.protocol&&"http:"!==a.protocol?!1:(e=document.createElement("a"),c=!_.isUndefined(_.find(d.settings.url.allowed,function(b){return e.href=b,e.protocol===a.protocol&&e.host===a.host&&0===a.pathname.indexOf(e.pathname.replace(/\/$/,""))})),c?/\/wp-(login|signup)\.php$/.test(a.pathname)?!1:/\/wp-admin\/admin-ajax\.php$/.test(a.pathname)?f.allowAdminAjax:!/\/wp-(admin|includes|content)(\/|$)/.test(a.pathname):!1)},d.prepareLinkPreview=function(a){var c;if(!b(a).closest("#wpadminbar").length&&"#"!==b(a).attr("href").substr(0,1)){if("https"===d.preview.scheme.get()&&"http:"===a.protocol&&-1!==d.settings.url.allowedHosts.indexOf(a.host)&&(a.protocol="https:"),!d.isLinkPreviewable(a))return void 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.toUpperCas
|