/* Minified: widgets.TextCompareDialog.js */
App.widgets.TextCompareDialog=function(){var versions=new Array();return{reset:function(){versions=new Array()},compareText:function(link,versions_to_compare){var submit_url=$(link).attr("href");var final_version={version:versions_to_compare.final_version,name:versions_to_compare.final_name,body:versions_to_compare.final_body};var compare_with_version={version:versions_to_compare.compare_with_version,name:versions_to_compare.compare_with_name,body:versions_to_compare.compare_with_body};$.ajax({url:App.extendUrl(submit_url,{async:1}),data:{"final":final_version,compare_with:compare_with_version},type:"POST",success:function(response){App.widgets.FlyoutDialog.show({title:App.lang("Compare Text"),data:App.extendUrl(submit_url),data_type:"url",width:1000,success:function(){$(this).replaceWith(response)}})}});return false},compareVersions:function(link){var link_instance=$(link);var submit_url=link_instance.attr("href");var left_version_num=link_instance.attr("left_version_num");var right_version_num=link_instance.attr("right_version_num");$.ajax({url:App.extendUrl(submit_url,{async:1}),data:{left:left_version_num,right:right_version_num,versions:versions},type:"POST",success:function(response){App.widgets.FlyoutDialog.show({title:App.lang("Compare Versions"),data:App.extendUrl(submit_url),data_type:"url",width:1000,success:function(){$(this).replaceWith(response);var loading=false;$("#page_compare form").submit(function(){if(loading){return false}var form=$(this);var left_version=$("#left_version_select").val();var right_version=$("#right_version_select").val();if(left_version==right_version){alert(App.lang("Please select different versions!"));return false}loading=true;var compared_versions_wrapper=$("#compared_versions");compared_versions_wrapper.block(App.lang("Loading..."));form.find("select").attr("disabled","disabled");$.ajax({url:App.extendUrl(form.attr("action"),{async:1,inline:1}),data:{left:left_version,right:right_version,versions:versions},type:"POST",success:function(response){compared_versions_wrapper.find("table").remove();compared_versions_wrapper.append(response);compared_versions_wrapper.unblock();form.find("select").removeAttr("disabled");compared_versions_wrapper.highlightFade();loading=false},error:function(){compared_versions_wrapper.unblock();loading=false}});return false})}})}});return false},addVersion:function(version){versions.push(version)}}}();
