mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-26 11:08:06 +01:00
a96b9c80b5
see #27112. Built from https://develop.svn.wordpress.org/trunk@27588 git-svn-id: http://core.svn.wordpress.org/trunk@27431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
1.4 KiB
JavaScript
1 line
1.4 KiB
JavaScript
var WidgetCustomizerPreview=function(a){"use strict";var b,c={rendered_sidebars:{},rendered_widgets:{},registered_sidebars:[],registered_widgets:{},widget_selectors:[],preview:null,i18n:{},init:function(){this.buildWidgetSelectors(),this.highlightControls(),c.preview.bind("active",function(){c.preview.send("rendered-sidebars",c.rendered_sidebars),c.preview.send("rendered-widgets",c.rendered_widgets)})},buildWidgetSelectors:function(){a.each(c.registered_sidebars,function(b,d){var e,f,g,h=[d.before_widget.replace("%1$s","").replace("%2$s",""),d.before_title,d.after_title,d.after_widget].join("");e=a(h),f=e.prop("tagName"),g=e.prop("className").replace(/^\s+|\s+$/g,""),g&&(f+="."+g.split(/\s+/).join(".")),c.widget_selectors.push(f)})},getWidgetElement:function(b){return a("#"+b)},highlightControls:function(){var b=this.widget_selectors.join(",");a(b).attr("title",c.i18n.widget_tooltip),a(document).on("mouseenter",b,function(){var b=parent.WidgetCustomizer.getWidgetFormControlForWidget(a(this).prop("id"));b&&b.highlightSectionAndControl()}),a(document).on("click",b,function(b){if(b.shiftKey){b.preventDefault();var c=parent.WidgetCustomizer.getWidgetFormControlForWidget(a(this).prop("id"));c&&c.focus()}})}};return a.extend(c,WidgetCustomizerPreview_exports),b=wp.customize.Preview,wp.customize.Preview=b.extend({initialize:function(a,d){c.preview=this,b.prototype.initialize.call(this,a,d)}}),a(function(){c.init()}),c}(jQuery); |