/* Do not modify this file directly. It is compiled from other files. */
/* jshint onevar: false, smarttabs: true */
/* global tb_show, tb_pathToImage, ajaxurl, tb_init, tb_remove */
/* global myblogsResponse, publicizeConnTestStart:true, publicizeConnTestComplete:true, publicizeConnRefreshClick:true */
var showOptionsPage;jQuery(function(e){showOptionsPage=function(n,t,o,a){tb_show(null,null,null),e("body").append("

"),e("#TB_load").show();var i="";o&&(i+="&connection="+encodeURIComponent(o)),void 0!==a&&a&&(i+="&blog_id="+Number(a)),e.post(ajaxurl,"action=publicize_"+n+"_options_page&_wpnonce="+t+i,function(t){e("#TB_load").remove();try{var o=jQuery.parseJSON(t);if(o&&"object"==typeof o&&o.hasOwnProperty("fb_redirect"))return void(location.href=o.fb_redirect+"&redirect_uri="+encodeURIComponent(location.href))}catch(e){}if(t){var a=e("input[name=wpas_ajax_blog_id]").val(),i=e('').append(t);i.append(''),e("#wpas-message").html(i),tb_init("a.new-thickbox"),e("#wpas-click-"+a).click();var s=parseInt(e("#TB_ajaxContent").css("height"),10),c=e("#thickbox-content").height();if(c'),e(".wpas-posts").change(function(){var n=e(this).parents("td:first").find(":input"),t=this,o=n.filter("[name=wpas_ajax_blog_id]").val();e("#waiting_"+o).show(),e.post(ajaxurl,n.serialize()+"&action=wpas_post",function(e){myblogsResponse.call(t,o,e)},"html")}),e(".options").unbind("click").bind("click",function(n){n.preventDefault(),n.stopPropagation();var t=e(this).attr("class").replace("options ",""),o=null;void 0!==e(this).attr("id")&&(o=parseInt(e(this).attr("id").replace("options-",""),10));var a=e(this).attr("href").replace("#nonce=",""),i=e(this).data("connection");showOptionsPage.call(this,t,a,i,o)}),publicizeConnTestStart=function(){e(".pub-connection-test").addClass("test-in-progress"),e.post(ajaxurl,{action:"test_publicize_conns"},publicizeConnTestComplete)},publicizeConnRefreshClick=function(e){e.preventDefault();var n=e.currentTarget.href,t=e.currentTarget.title,o=window.open(n,t,""),a=window.setInterval(function(){!1!==o.closed&&(window.clearInterval(a),publicizeConnTestStart())},500)},publicizeConnTestComplete=function(n){e(".pub-connection-test").removeClass("test-in-progress"),e.each(n.data,function(n,t){var o="#pub-connection-test-"+t.connectionID;t.connectionTestPassed?e(o).addClass("test-passed").html("").removeClass("test-failed"):(e(o).addClass("test-failed").html(''+t.connectionTestMessage+"
").removeClass("test-passed"),t.userCanRefresh&&(e(o).append("
"),e("",{class:"pub-refresh-button button",title:t.refreshText,href:t.refreshURL,text:t.refreshText,target:"_refresh_"+t.serviceName}).appendTo(o).click(publicizeConnRefreshClick)))})},e(document).ready(function(){e(".pub-connection-test").length&&publicizeConnTestStart()})});