* Licensed under MIT (https://github.com/authentic-theme/authentic-theme/blob/master/LICENSE)
 */
var mysql_tbl_cnt1_sel_str=".container-fluid .table.table-striped.table-hover",mysql_tbl_cnt2_sel_str=".container-fluid .ui_form > .long-table-wrapper";function __sql_____undel(){var e="body",t="change.sql keydown.sql click.sql dblclick.sql";$(e).off(t),$(e+" *").undelegate(t).unbind(t).off(t),f__ex__mysql_runner_active=0}function db_check_selected(){if("undefined"!=typeof f__ex__mysql_runner_active&&f__ex__mysql_runner_active){var e=$(mysql_tbl_cnt1_sel_str+' input[type="checkbox"]:checked, .container-fluid .ui_grid_table.table-hardcoded input[type="checkbox"]:checked, .container-fluid form div.icons-container.highlighted, .container-fluid form div.small-icons-container.highlighted,  .container-fluid form div.xsmall-icons-container.highlighted').length;0===e?$(".container-fluid button#edit,  .container-fluid button#delete,  .container-fluid button#deleteClone,  .container-fluid input#delete").prop("disabled",!0):$(" .container-fluid button#edit,  .container-fluid button#delete,  .container-fluid button#deleteClone,  .container-fluid input#delete").prop("disabled",!1);var t=$(".container-fluid button#edit span"),a=$('.container-fluid button[name="delete"] span'),n=$(".container-fluid button#deleteClone span");v___location_path==v___location_prefix+"/mysql/edit_dbase.cgi"||v___location_path==v___location_prefix+"/postgresql/edit_dbase.cgi"?e>1?n.text(theme_language("database_objects_selected_delete2")):n.text(theme_language("database_object_selected_delete2")):v___location_path==v___location_prefix+"/mysql/edit_table.cgi"||v___location_path==v___location_prefix+"/postgresql/edit_table.cgi"?e>1?n.text(theme_language("database_delete_selected_fields")):n.text(theme_language("database_delete_selected_field")):v___location_path==v___location_prefix+"/mysql/"||v___location_path==v___location_prefix+"/postgresql/"||v___location_path==v___location_prefix+"/mysql/index.cgi"||v___location_path==v___location_prefix+"/postgresql/index.cgi"?e>1?n.text(theme_language("database_dbs_selected_drop")):n.text(theme_language("database_db_selected_drop")):"list_users.cgi"!=v___location_file&&"list_dbs.cgi"!=v___location_file&&"list_tprivs.cgi"!=v___location_file&&"list_cprivs.cgi"!=v___location_file&&"list_grants.cgi"!=v___location_file&&"list_hosts.cgi"!=v___location_file&&(e>1?(t.text(theme_language("database_edit_selected_rows")),a.text(theme_language("database_delete_selected_rows"))):(t.text(theme_language("database_edit_selected_row")),a.text(theme_language("database_delete_selected_row"))))}}function proc_sql_table(e){"undefined"!=typeof f__ex__mysql_runner_active&&f__ex__mysql_runner_active&&(v___location_path!=v___location_prefix+"/mysql/view_table.cgi"&&v___location_path!=v___location_prefix+"/postgresql/view_table.cgi"||(e.parent("tr").addClass("selectable"),e.addClass("selectable")),!e.find("table").length&&e.attr("title",$.trim(e.text())))}function f__ex__mysql_runner_update(){var e="disabled",t=".container-fluid .btn-group.end_submits";if($(t+" .btn["+e+"], "+t+" .btn."+e).removeAttr(e).removeClass(e),"view_table.cgi"!=v___location_file){var a=parseInt($(mysql_tbl_cnt2_sel_str+" .long-table-scroll").width()),n=parseInt($(mysql_tbl_cnt2_sel_str+" .long-table-scroll > table").width())>a;table_data_init($(mysql_tbl_cnt1_sel_str),!1,n)}}function f__ex__mysql_runner(){f__ex__mysql_runner_active=1,v___location_path==v___location_prefix+"/mysql/view_table.cgi"||(v___location_path,v___location_prefix);var e=$("body"),t='input[type="checkbox"]';e.undelegate(t,"change.sql"),$(mysql_tbl_cnt1_sel_str+", .container-fluid .ui_grid_table.table-hardcoded").on("change.sql",t,function(e){db_check_selected()});var a=".select_all, .select_invert";e.undelegate(a,"click.sql"),e.on("click.sql",a,function(e){db_check_selected()});var n='button[name="cancel"]';if(e.undelegate(n,"click.sql"),e.on("click.sql",n,function(e){set_onbeforeunload_status(0,0)}),$isResizeable=!1,v___location_file&&"index.cgi"!=v___location_file&&"list_users.cgi"!=v___location_file&&"list_dbs.cgi"!=v___location_file&&"list_tprivs.cgi"!=v___location_file&&"list_cprivs.cgi"!=v___location_file||(db_check_selected(),table_data_init($(mysql_tbl_cnt1_sel_str)),page.render.content.filter.init(),"list_dbs.cgi"!=v___location_file&&"list_tprivs.cgi"!=v___location_file&&"list_cprivs.cgi"!=v___location_file||$(".container-fluid .fa-user-times").addClass("fa-times-circle").removeClass("fa-user-times")),v___location_path!=v___location_prefix+"/mysql/drop_dbases.cgi"&&v___location_path!=v___location_prefix+"/postgresql/drop_dbases.cgi"&&v___location_path!=v___location_prefix+"/mysql/drop_tables.cgi"&&v___location_path!=v___location_prefix+"/postgresql/drop_tables.cgi"||setTimeout(function(){$(".btn.btn-default").removeClass("heighter-28 btn-default").addClass("heighter-34 btn-danger")},10),v___location_path!=v___location_prefix+"/mysql/"&&v___location_path!=v___location_prefix+"/postgresql/"&&v___location_path!=v___location_prefix+"/mysql/index.cgi"&&v___location_path!=v___location_prefix+"/postgresql/index.cgi"||(setTimeout(function(){$('.container-fluid .panel-body .table-hardcoded tr td[align="right"]:last-child').find("a").addClass("btn btn-tiny btn-danger").prepend('  '),$(".ui_select.heighter-34").length&&$('.container-fluid a[href="newdb_form.cgi"]').addClass("btn btn-success").text($('.container-fluid a[href="newdb_form.cgi"]').text().replace(".","")).prepend('  ')},10),e.undelegate("#newClone, #deleteClone","click.sql"),e.on("click.sql","#newClone, #deleteClone",function(e){e.preventDefault(),$("#"+$(this).attr("id").replace("Clone","")).trigger("click")})),config_portable_module_xsql_fit_content_screen_height||e.addClass("long-table-scroll-maxHeight"),v___location_path==v___location_prefix+"/mysql/edit_dbase.cgi"||v___location_path==v___location_prefix+"/mysql/edit_table.cgi"||v___location_path==v___location_prefix+"/mysql/view_table.cgi"||v___location_path==v___location_prefix+"/postgresql/edit_dbase.cgi"||v___location_path==v___location_prefix+"/postgresql/edit_table.cgi"||v___location_path==v___location_prefix+"/postgresql/view_table.cgi"){if($('.container-fluid .panel-body .table-hardcoded tr td[align="right"]:last-child').find("a").addClass("btn btn-tiny btn-danger").prepend('  '),v___location_path==v___location_prefix+"/mysql/view_table.cgi"||v___location_path==v___location_prefix+"/postgresql/view_table.cgi"){$('.container-fluid button[type="button"][name="refresh"]').addClass("margined-top-0 btn-info").removeClass("btn-warning");var l=$('.container-fluid input[name="search"][type="hidden"]').parent("form");l.find('button[type="button"].btn-info').removeClass("btn-info").addClass("btn-default heighter-28").find(".fa").remove();var i=$('.container-fluid input[name="jump"]').parent("form");i.find("button.btn-success").removeClass("btn-success").addClass("btn-default heighter-28").find(".fa").remove();var s=i.detach();l.before(s.addClass("pull-right")),$('.container-fluid button[type="button"][name="delete"]').remove(),$(".container-fluid #edit").length&&$('.container-fluid [type="button"][name="new"]').addClass("hidden"),$(".container-fluid #edit").replaceWith('                                                        
        ");var o=".container-fluid #newClone, .container-fluid #deleteClone";e.undelegate(o,"click.sql"),e.on("click.sql",o,function(e){var t=$(quirks.active_element()).parents("form");$("").attr({type:"hidden",name:$(quirks.active_element()).attr("name").replace("Clone",""),value:$.trim(quirks.active_element().innerText)}).appendTo(t),$("#"+$(this).attr("id").replace("Clone","")).trigger("click")})}$(mysql_tbl_cnt1_sel_str).css({width:"99.7%"}).wrap('');o='.container-fluid td > label[for^="row_"], .container-fluid td[data-td-e].selectable';e.undelegate(o,"click.sql"),e.on("click.sql",o,function(e){$(this).find("input, textarea").length||(e.preventDefault(),e.stopPropagation(),$(this).selectText())}),e.undelegate(o,"dblclick.sql"),e.on("dblclick.sql",o,function(e){e.preventDefault(),e.stopPropagation()}),e.undelegate(".long-table-wrapper div.thead","click.sql"),e.on("click.sql",".long-table-wrapper div.thead",function(e){$("#savenew").length||($(this).find("i").hasClass("fa-plus-square")?($(this).find("i").removeClass("fa-plus-square").addClass("fa-minus-square"),$(this).find("i").parent().next(".long-table-scroll").find(".table-hardcoded").removeClass("hidden")):($(this).find("i").addClass("fa-plus-square").removeClass("fa-minus-square"),$(this).find("i").parent().next(".long-table-scroll").find(".table-hardcoded").addClass("hidden")),$(window).trigger("resize"))}),$.each($(mysql_tbl_cnt1_sel_str).find("thead th, tbody td:last-child"),function(e,t){$(this).is("th")&&$(this).html(''+$(this).html()+""),$(this).is(":last-child")&&!$(this).parents(".table-hardcoded").length&&$(this).css("border-right","1px solid #"+(v___theme_night_mode_enabled?"2f3238":"eee"))}).promise().done(function(){$.each($(mysql_tbl_cnt1_sel_str).find("tbody tr td"),function(e,t){proc_sql_table($(this))}).promise().done(function(){var t='  ',a='  ',n='  ',l='';if(v___location_path==v___location_prefix+"/mysql/view_table.cgi"||v___location_path==v___location_prefix+"/postgresql/view_table.cgi")var i=parseInt($(mysql_tbl_cnt2_sel_str+" .long-table-scroll").width()),s=parseInt($(mysql_tbl_cnt2_sel_str+" .long-table-scroll > table").width())>i;if(s||e.addClass("__non_res__"),(v___location_path==v___location_prefix+"/mysql/view_table.cgi"||v___location_path==v___location_prefix+"/postgresql/view_table.cgi")&&$("#save, #savenew").length&&$('.container-fluid [name="cancel"]').length){$("#save").length&&$('.container-fluid [name="cancel"]').length&&($('.container-fluid [name="cancel"]').remove(),$("#save").replaceWith('                                                                                      
              ")),$("#savenew").length&&$('.container-fluid [name="cancel"]').length&&($('.container-fluid [name="cancel"]').remove(),$("#savenew").replaceWith('                                                                                      
              "));var o=$(".container-fluid td[data-td-e] .table-hardcoded"),_=parseInt($(mysql_tbl_cnt2_sel_str+" .long-table-scroll").width()),r=$(mysql_tbl_cnt1_sel_str).find("thead th").filter(function(e){return $(this).position().left+$(this).width()<_}).length+1,c=($(mysql_tbl_cnt1_sel_str).find("thead th").length,0);navigator.userAgent.toLowerCase().indexOf("firefox")>-1?c=20:c=15;var d=1!=session.server.data("navigation-collapsed")&&$.support.spa?parseInt(settings_leftmenu_width)+15:15,f=0==session.server.data("slider-fixed")?15:315,p=100-pxTOvw(d)-pxTOvw(f);o.find('input[type="text"], textarea').addClass("input-sm"),o.wrap('').addClass("container-resizeable-table").css({width:"99%","margin-top":"-1px"}).parent().parent().parent("td").removeClass("selectable").addClass("col-no-styling container-resizeable-col").attr({colspan:r,style:"padding: 0 !important;"}).find(".long-table-wrapper").attr({style:"margin: 0 !important"}).find(".table-hardcoded tr.thead").attr({style:"border: 0 !important"}).addClass("hidden").next("tr").find("td:first-child").css({width:"20%","text-align":"left","padding-left":"10%"}).parent("tr").find("td:last-child").css({width:"80%","text-align":"left","padding-left":"10%"}),$.each(o.parent(".long-table-scroll").parent(".long-table-wrapper"),function(){var e=(e=$(this).find(".table-hardcoded").find("tbody tr:nth-child(2) td:last-child")).find('input[type="text"]').val()?e.find('input[type="text"]').val():e.text();$(this).prepend('                                                                '+($("#savenew").length?"":e)+'                      '+($("#savenew").length?theme_language("database_adding_new_row_data"):"")+"                    
                ")}),$(".col-no-styling").parent("tr").addClass("row-no-styling").parent("tbody").parent(".table-hover").addClass("no-hover"),$.each($(mysql_tbl_cnt1_sel_str+" > thead > tr, "+mysql_tbl_cnt1_sel_str+" > tbody > tr:not(.row-no-styling)"),function(){$(this).find("input, textarea").length||$(this).addClass("opacity-0_5")});var b=$(".container-fluid .container-resizeable-head").length>1?"s":"",u=$("#savenew").length?theme_language("database_adding_new_row"):theme_language("database_editing_row"+b);if($(".container-fluid .panel-body > center").remove(),$(".container-fluid .panel-body").prepend(''+u+""),hSB=$(mysql_tbl_cnt2_sel_str+" .long-table-scroll").hasScrollBar(),hSB)if($("#savenew").length)$(".container-fluid .long-table-scroll").scrollTop($(".long-table-scroll")[0].scrollHeight);else{var h=$(".container-resizeable-head:last");h&&h.length&&h.scrollIntoView({duration:200,direction:"vertical",complete:function(){}})}var g=".container-fluid .container-resizeable-table input, .container-fluid .container-resizeable-table textarea";e.undelegate(g,"keydown.sql"),e.on("keydown.sql",g,function(){$(".container-fluid button.btn-success").removeClass("btn-success").addClass("btn-warning").attr("data-form-onbeforeunload","1").attr("data-form-onbeforeunload-tabledata","1"),set_onbeforeunload_status(1,0)}),$(window).resize(function(){var t=0,a=0,n=0,l=0,i=0;setTimeout(function(){navigator.userAgent.toLowerCase().indexOf("firefox")>-1?(i=25,l=18):(i=19,l=5),n=$(mysql_tbl_cnt2_sel_str+" .long-table-scroll").hasScrollBar(),t=parseInt($(mysql_tbl_cnt2_sel_str+" .long-table-scroll").width()),a=$(mysql_tbl_cnt1_sel_str).find("thead th").filter(function(e){return $(this).position().left+$(this).width()'),setTimeout(function(){$.ajax({type:"POST",url:v___location_path+"?xhr&"+s+"=1",data:n.parents("form").serialize(),dataType:"text",success:function(e){if(session.status(e))if($(".container-fluid button").find(".cspinner_container").replaceWith("save"==i||"savenew"==i?t:a),$(e).find(".ui_form").length){if($(".container-fluid button.btn-warning").removeClass("btn-warning").addClass("btn-success").attr("data-form-onbeforeunload",0),set_onbeforeunload_status(0,0),"save"==i||"save-close"==i){$(".container-resizeable-head").length;"save-close"==i&&$('.container-fluid [name="cancel"]').trigger("click")}if("savenew"==i||"savenew-close"==i){"savenew-close"==i&&$('.container-fluid [name="cancel"]').trigger("click");var n="";$.each($(".container-fluid tr.row-no-styling"),function(){var e=$(this);n+='',$.each(e.find("table tbody tr:not(.thead) td:last-child"),function(){var e=$(this).find('input[type="text"], textarea').val();n+="| "+(e?Convert.htmlEscape(e):"")+" | "}),n+="
"}).promise().done(function(){$(".container-fluid .long-table-wrapper > .long-table-scroll > .table.table-striped.table-hover tbody tr.row-no-styling").before(n),$.each($(mysql_tbl_cnt1_sel_str).find("thead th, tbody td:last-child"),function(e,t){$(this).is("th")&&$(this).html(""+$(this).text()+""),$(this).is(":last-child")&&!$(this).parents(".table-hardcoded").length&&$(this).css("border-right","1px solid #"+(v___theme_night_mode_enabled?"2f3238":"eee"))})})}}else plugins.messenger.post(''+$(e).find("[data-fatal-error-text]").html(),10,"error")},error:function(e){}})},100)})}else"view_table.cgi"!=v___location_file&&table_data_init($(mysql_tbl_cnt1_sel_str),!1,s),$(mysql_tbl_cnt1_sel_str).prev(".dataTables_filter").attr("style","margin-top: -25px !important; margin-right: 1px;"),$(".container-fluid .dataTable.no-footer").find("thead th:first-child").addClass("pointer-events-none opacity-0"),$.each($(".container-fluid .dataTables_filter"),function(){var e=$(this).parents(".long-table-wrapper"),t=e.find(mysql_tbl_cnt1_sel_str),a=-1/0;t.find("tr").each(function(e,t){a=Math.max(a,parseFloat(e))}),a<10?t.parents(".dataTables_wrapper").find(".dataTables_filter").remove():$(this).detach().insertBefore(e).css({float:"right","margin-top":"-30px"})}).promise().done(function(){page.render.content.filter.init()}),v___location_path!=v___location_prefix+"/mysql/edit_dbase.cgi"&&v___location_path!=v___location_prefix+"/postgresql/edit_dbase.cgi"||($('.container-fluid .table-hardcoded[width="100%"]').nextAll(".select_all, .select_invert").attr("style","margin-top: 4px !important"),$(".container-fluid #delete").addClass("hidden").after('"),$(".container-fluid #fields").addClass("heighter-34"),$(".container-fluid .ui_form_end_submit").parent().find(".ui_form_end_submit:not(:first), .ui_form_end_submit:not(:first) + input").wrapAll(''),$(".container-fluid .btn-group.end_submits .btn").addClass("heighter-34 heighter-34-force")),v___location_path!=v___location_prefix+"/mysql/edit_table.cgi"&&v___location_path!=v___location_prefix+"/postgresql/edit_table.cgi"||$(".container-fluid #delete").addClass("hidden").after('"),$('.container-fluid button#delete, .container-fluid button#deleteClone[data-clone-allowed="1"]').confirmation({},function(e){if(e.preventDefault(),e.stopPropagation(),"edit_table.cgi"==v___location_file||"view_table.cgi"==v___location_file){var t=$(this);setTimeout(function(){t.addClass("btn-danger"),t.find(".fa.fa-trash, .fa.fa-trash-o").replaceWith(l)},0),$.ajax({type:"POST",url:t.parents("form").attr("action")+"?xhr&"+t.attr("id")+"=1",data:t.parents("form").serialize(),dataType:"text",success:function(e){if(session.status(e)){if($(e).find(".ui_form").length){var a=$(mysql_tbl_cnt1_sel_str+" tbody tr"),l=$(mysql_tbl_cnt1_sel_str+' tr td:first-child input[type="checkbox"]:checked').parents("tr"),i=(l.length,mysql_tbl_cnt1_sel_str);"view_table.cgi"==v___location_file?$.each(a,function(){$(i).DataTable().row($(this)).remove()}).promise().done(function(){$(i).DataTable().rows.add($(e).find(i).find("tbody").find("tr")).draw(),$.each($(mysql_tbl_cnt1_sel_str).find("tbody tr td"),function(e,t){proc_sql_table($(this))}),page_table_rows_control()}):$.each(l,function(){$(i).DataTable().row($(this)).remove().draw()});v___location_file;t.prop("disabled",!0),db_check_selected()}else plugins.messenger.post(''+$(e).find("[data-fatal-error-text]").html(),10,"error");$("button").find(".cspinner_container").replaceWith(n),t.removeClass("btn-danger")}},error:function(e){}})}})}),db_check_selected()})}}!$.support.spa&&f__ex__mysql_runner();