summaryrefslogtreecommitdiff
blob: 6212605744d32264ff888bf53238459857c06903 (plain)
1
2
3
4
5
/* 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("<div id='TB_load'><img src='"+tb_pathToImage+"' /></div>"),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('<div id="wpas-ajax-'+a+'" class="wrap"></div>').append(t);i.append('<a href="#TB_inline?thickbox&height=420&width=555&inlineId=wpas-ajax-'+a+'" id="wpas-click-'+a+'" class="new-thickbox" style="display: none;"></a>'),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<s){var r=c+15;e("#TB_ajaxContent").css("height",r);var p=parseInt(e("#TB_window").css("margin-top"),10)+(s-r)/2+"px";e("#TB_window").css("margin-top",p)}e(".save-options").unbind("click").click(function(){var t=e("input[name='option']:checked"),o=e("input[name='global']:checked"),a=e(this).data("connection"),i=encodeURIComponent(t.val()),s=encodeURIComponent(t.attr("id")),c=encodeURIComponent(t.attr("data-type")),r=e(this).attr("rel"),p="off",l="";o.length&&(p="on",l=o.val()),e.post(ajaxurl,"action=publicize_"+n+"_options_save&connection="+a+"&selected_id="+s+"&token="+i+"&type="+c+"&_wpnonce="+r+"&global="+p+"&global_nonce="+l,function(){var e;tb_remove(),e=document.location.search.match(/frame-nonce=([^&]+)/),/inside-newdash=1/.test(document.location.search)&&e?document.location="options-general.php?page=sharing&inside-newdash=1&frame-nonce"+e[1]:top.location="options-general.php?page=sharing"})})}},"html")},e("body").append('<div id="wpas-message" style="display: none"></div>'),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('<p><span class="pub-connection-error">'+t.connectionTestMessage+"</span></p>").removeClass("test-passed"),t.userCanRefresh&&(e(o).append("<br/>"),e("<a/>",{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()})});