diff --git a/wp-includes/customize/class-wp-customize-selective-refresh.php b/wp-includes/customize/class-wp-customize-selective-refresh.php index 73af9c9e23..2342aef9ba 100644 --- a/wp-includes/customize/class-wp-customize-selective-refresh.php +++ b/wp-includes/customize/class-wp-customize-selective-refresh.php @@ -188,7 +188,6 @@ final class WP_Customize_Selective_Refresh { 'clickEditWidget' => __( 'Click to edit this widget.' ), 'clickEditTitle' => __( 'Click to edit the site title.' ), 'clickEditMisc' => __( 'Click to edit this element.' ), - 'editShortcutVisibilityToggle' => __( 'Toggle edit shortcuts' ), /* translators: %s: document.write() */ 'badDocumentWrite' => sprintf( __( '%s is forbidden' ), 'document.write()' ), ), diff --git a/wp-includes/js/customize-selective-refresh.js b/wp-includes/js/customize-selective-refresh.js index 2b8cbef73d..70e2b96cc0 100644 --- a/wp-includes/js/customize-selective-refresh.js +++ b/wp-includes/js/customize-selective-refresh.js @@ -1006,18 +1006,6 @@ wp.customize.selectiveRefresh = ( function( $, api ) { } ); api.preview.bind( 'active', function() { - var body = $( document.body ), buttonText, $editShortcutVisibilityButton; - - // Add invisible button to toggle editShortcutVisibility. - if ( $( '.edit-shortcut-visibility-button' ).length < 1 ) { - buttonText = self.data.l10n.editShortcutVisibilityToggle || 'Toggle edit shortcuts'; - $editShortcutVisibilityButton = $( '' ); - $editShortcutVisibilityButton.text( buttonText ); - $editShortcutVisibilityButton.on( 'click', function() { - api.selectiveRefresh.editShortcutVisibility.set( 'visible' === api.selectiveRefresh.editShortcutVisibility.get() ? 'hidden' : 'visible' ); - } ); - body.prepend( $editShortcutVisibilityButton ); - } // Make all partials ready. self.partial.each( function( partial ) { diff --git a/wp-includes/js/customize-selective-refresh.min.js b/wp-includes/js/customize-selective-refresh.min.js index cf1c4818e1..f708e3a208 100644 --- a/wp-includes/js/customize-selective-refresh.min.js +++ b/wp-includes/js/customize-selective-refresh.min.js @@ -1 +1 @@ -wp.customize.selectiveRefresh=function(a,b){"use strict";var c,d,e;return c={ready:a.Deferred(),editShortcutVisibility:new b.Value,data:{partials:{},renderQueryVar:"",l10n:{shiftClickToEdit:""}},currentRequest:null},_.extend(c,b.Events),d=c.Partial=b.Class.extend({id:null,initialize:function(b,c){var d=this;c=c||{},d.id=b,d.params=_.extend({selector:null,settings:[],primarySetting:null,containerInclusive:!1,fallbackRefresh:!0},c.params||{}),d.deferred={},d.deferred.ready=a.Deferred(),d.deferred.ready.done(function(){d.ready()})},ready:function(){var b=this;_.each(b.placements(),function(d){a(d.container).attr("title",c.data.l10n.shiftClickToEdit),b.createEditShortcutForPlacement(d)}),a(document).on("click",b.params.selector,function(c){c.shiftKey&&(c.preventDefault(),_.each(b.placements(),function(d){a(d.container).is(c.currentTarget)&&b.showControl()}))})},createEditShortcutForPlacement:function(b){var c,d,e=this;b.container&&(d=a(b.container),d.length&&(c=e.createEditShortcut(),e.positionEditShortcut(b,c),c.on("click",function(a){a.preventDefault(),a.stopPropagation(),e.showControl()})))},positionEditShortcut:function(b,c){var d,e=a(b.container);e.prepend(c),e.is(":visible")&&"none"!==e.css("display")||c.addClass("customize-partial-edit-shortcut-hidden"),d=c.find("button"),c.toggleClass("customize-partial-edit-shortcut-left-margin",d.offset().left<2)},getEditShortcutClassName:function(){var a,b=this;return a=b.id.replace(/]/g,"").replace(/\[/g,"-"),"customize-partial-edit-shortcut-"+a},getEditShortcutTitle:function(){var a=this,b=c.data.l10n;switch(a.getType()){case"widget":return b.clickEditWidget;case"blogname":return b.clickEditTitle;case"blogdescription":return b.clickEditTitle;case"nav_menu":return b.clickEditMenu;default:return b.clickEditMisc}},getType:function(){var a,b=this;return a=b.params.primarySetting||_.first(b.settings())||"unknown",b.params.type?b.params.type:a.match(/^nav_menu_instance\[/)?"nav_menu":a.match(/^widget_.+\[\d+]$/)?"widget":a},createEditShortcut:function(){var b,c,d,e,f=this;return b=f.getEditShortcutTitle(),c=a("",{"class":"customize-partial-edit-shortcut "+f.getEditShortcutClassName()}),d=a("'),e.text(d),e.on("click",function(){b.selectiveRefresh.editShortcutVisibility.set("visible"===b.selectiveRefresh.editShortcutVisibility.get()?"hidden":"visible")}),f.prepend(e)),c.partial.each(function(a){a.deferred.ready.resolve()}),c.partial.bind("add",function(a){a.deferred.ready.resolve()})})}),c}(jQuery,wp.customize); \ No newline at end of file +wp.customize.selectiveRefresh=function(a,b){"use strict";var c,d,e;return c={ready:a.Deferred(),editShortcutVisibility:new b.Value,data:{partials:{},renderQueryVar:"",l10n:{shiftClickToEdit:""}},currentRequest:null},_.extend(c,b.Events),d=c.Partial=b.Class.extend({id:null,initialize:function(b,c){var d=this;c=c||{},d.id=b,d.params=_.extend({selector:null,settings:[],primarySetting:null,containerInclusive:!1,fallbackRefresh:!0},c.params||{}),d.deferred={},d.deferred.ready=a.Deferred(),d.deferred.ready.done(function(){d.ready()})},ready:function(){var b=this;_.each(b.placements(),function(d){a(d.container).attr("title",c.data.l10n.shiftClickToEdit),b.createEditShortcutForPlacement(d)}),a(document).on("click",b.params.selector,function(c){c.shiftKey&&(c.preventDefault(),_.each(b.placements(),function(d){a(d.container).is(c.currentTarget)&&b.showControl()}))})},createEditShortcutForPlacement:function(b){var c,d,e=this;b.container&&(d=a(b.container),d.length&&(c=e.createEditShortcut(),e.positionEditShortcut(b,c),c.on("click",function(a){a.preventDefault(),a.stopPropagation(),e.showControl()})))},positionEditShortcut:function(b,c){var d,e=a(b.container);e.prepend(c),e.is(":visible")&&"none"!==e.css("display")||c.addClass("customize-partial-edit-shortcut-hidden"),d=c.find("button"),c.toggleClass("customize-partial-edit-shortcut-left-margin",d.offset().left<2)},getEditShortcutClassName:function(){var a,b=this;return a=b.id.replace(/]/g,"").replace(/\[/g,"-"),"customize-partial-edit-shortcut-"+a},getEditShortcutTitle:function(){var a=this,b=c.data.l10n;switch(a.getType()){case"widget":return b.clickEditWidget;case"blogname":return b.clickEditTitle;case"blogdescription":return b.clickEditTitle;case"nav_menu":return b.clickEditMenu;default:return b.clickEditMisc}},getType:function(){var a,b=this;return a=b.params.primarySetting||_.first(b.settings())||"unknown",b.params.type?b.params.type:a.match(/^nav_menu_instance\[/)?"nav_menu":a.match(/^widget_.+\[\d+]$/)?"widget":a},createEditShortcut:function(){var b,c,d,e,f=this;return b=f.getEditShortcutTitle(),c=a("",{"class":"customize-partial-edit-shortcut "+f.getEditShortcutClassName()}),d=a("