mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-05 02:10:45 +01:00
2c4438f379
git-svn-id: http://svn.automattic.com/wordpress/trunk@19997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
1.3 KiB
JavaScript
1 line
1.3 KiB
JavaScript
(function(a,c){var b=wp.customize;b.Previewer=b.Messenger.extend({initialize:function(e,d){c.extend(this,d||{});this.iframe=b.ensure(e.iframe);this.form=b.ensure(e.form);b.Messenger.prototype.initialize.call(this,e.url,{targetWindow:this.iframe[0].contentWindow});this._formOriginalProps={target:this.form.prop("target"),action:this.form.prop("action")};this.bind("url",function(f){if(this.url()==f||0!==f.indexOf(this.origin()+"/")||-1!==f.indexOf("wp-admin")){return}this.url(f);this.refresh()});this.refresh()},refresh:function(){this.submit({target:this.iframe.prop("name"),action:this.url()})},submit:function(d){if(d){this.form.prop(d)}this.form.submit();if(d){this.form.prop(this._formOriginalProps)}}});c(function(){var e,d=c('[name^="'+b.settings.prefix+'"]');e=new b.Previewer({iframe:"#customize-preview iframe",form:"#customize-controls",url:b.settings.preview});c.each(b.settings.values,function(i,h){var g=d.filter('[name="'+b.settings.prefix+i+'"]'),f=b.set(i,h);f.control=new wp.customize.Element(g);f.control.link(f);f.link(f.control)});c(".control-section h3").click(function(){c(this).siblings("ul").slideToggle(200);c(this).toggleClass("open");return false});c("#save").click(function(){e.submit();return false});c("#refresh").click(function(){e.refresh();return false});c('[name^="'+b.settings.prefix+'"]').each(function(){})})})(wp,jQuery); |