2012-05-25 20:58:23 +02:00
|
|
|
(function(b,d){var c=wp.customize,a;a=function(g,e,f){var h;return function(){var i=arguments;f=f||this;clearTimeout(h);h=setTimeout(function(){h=null;g.apply(f,i)},e)}};c.Preview=c.Messenger.extend({initialize:function(g,f){var e=this;c.Messenger.prototype.initialize.call(this,g,null,f);this.body=d(document.body);this.body.on("click.preview","a",function(h){h.preventDefault();e.send("scroll",0);e.send("url",d(this).prop("href"))});this.body.on("submit.preview","form",function(h){h.preventDefault()});this.window=d(window);this.window.on("scroll.preview",a(function(){e.send("scroll",e.window.scrollTop())},200));this.bind("scroll",function(h){e.window.scrollTop(h)})}});d(function(){c.settings=window._wpCustomizeSettings;if(!c.settings){return}var f,e;f=new c.Preview(window.location.href);d.each(c.settings.values,function(h,g){c.create(h,g)});f.bind("setting",function(g){var h=c(g.shift());if(h){h.set.apply(h,g)}});e=d.map(["color","image","position_x","repeat","attachment"],function(g){return"background_"+g});c.when.apply(c,e).done(function(g,k,h,j,l){var i=d("#custom-background-css"),m;if(!i.length){return}m=function(){var n="";if(g()){n+="background-color: #"+g()+";"}if(k()){n+='background-image: url("'+k()+'");';n+="background-position: top "+h()+";";n+="background-repeat: "+j()+";";n+="background-position: top "+l()+";"}i.html("body.custom-background { "+n+" }")};d.each(arguments,function(){this.bind(m)})})})})(wp,jQuery);
|