jQuery(function($){function validEditListFilters(group){$(document.body).css({'cursor':'wait'});var tab=$("input[name='tab']");var page=$("input[name='option_page']");var form=$("<form />").css("display","none").attr("method","get").attr("action","").appendTo("body");if(tab.length>0)$("<input />").attr("name","tab").attr("value",tab.val()).appendTo(form);if(page.length>0)$("<input />").attr("name","page").attr("value",page.val()).appendTo(form);form.append(group.clone());form.trigger('submit')}
$(".lws-editlist-action-trigger").on('click',function(e){$(document.body).css({'cursor':'wait'});e.preventDefault();var action=$(this).closest(".lws-editlist-action");items=[];var ids=$("#"+action.data("id")).find("input.lws_editlist_check_selectitem").each(function(){if($(this).is(':checked')&&$(this).data("id")!=undefined){items.push(lwsBase64.decode($(this).data("id")))}});if(items.length<=0){$(document.body).css({'cursor':'default'});alert(lws_adminpanel.noSelection)}else{var tab=$("input[name='tab']");var page=$("input[name='option_page']");var form=$("<form />").css("display","none").attr("method","post").attr("action",document.URL).appendTo("body");if(tab.length>0)$("<input />").attr("name","tab").attr("value",tab.val()).appendTo(form);if(page.length>0)$("<input />").attr("name","option_page").attr("value",page.val()).appendTo(form);$("<input />").attr("name","action-items").attr("value",lwsBase64.fromObj(items)).appendTo(form);form.append(action.clone());var workaround={src:action.find('select, textarea'),dst:form.find('select, textarea')};for(var i=0;i<workaround.src.length;++i)
$(workaround.dst[i]).val($(workaround.src[i]).val());form.trigger('submit')}});$("form").on('submit',function(event){var group=$(document.activeElement).closest(".lws-editlist-filters");if(group.length>0){event.preventDefault();validEditListFilters(group)}});$('.lws-editlist-filters').on('click','button.lws-editlist-filter-btn,input[type="submit"]',function(event){var group=$(event.currentTarget).closest(".lws-editlist-filters");if(group.length>0){event.preventDefault();validEditListFilters(group)}});$('.lws-editlist-filters').on('change','.lws_editlist_onchange_filter',function(event){var group=$(event.currentTarget).closest(".lws-editlist-filters");if(group.length>0){validEditListFilters(group)}});$('.lws-editlist-filters').on('submit',function(){validEditListFilters($(this))});$(".lws-input-enter-submit").on('keyup',function(e){if(e.which==10||e.which==13)
$(this).closest("form").on('submit');});$(".lws-paging-navspan-ok").on('click',function(){var dest=$(this).data("name");$(this).closest(".lws-tablenav-pages").find("input[name='"+dest+"']").val($(this).data("page"));validEditListFilters($(this).closest(".lws-editlist-filters"))});$(".lws-input-ipp").on('click',function(){var dest=$(this).data("name");$(this).closest(".lws-perpage-input").find("input[name='"+dest+"']").val($(this).data("count"));validEditListFilters($(this).closest(".lws-editlist-filters"))});$(".lws_editlist_table[data-popup]").each(function(){var content=lwsBase64.decode($(this).data('popup'));if(content.length>0){$("<div>").append($("<p>").html(content)).appendTo($('body')).dialog({modal:!0,buttons:{Ok:function(){$(this).dialog("close")}}})}});$('.lws-editlist-filter-column-visibility').on('change','.editlist_cb_visibility',function(){$('.lws-editlist .lws-editlist-cell[data-key="'+$(this).data('name')+'"]').toggleClass('hidden-column',!this.checked);$('.lws-editlist .small-media-subcell[data-key="'+$(this).data('name')+'"]').toggleClass('hidden-column',!this.checked);$('.lws-editlist-filter-column-visibility .editlist_cb_visibility').each(function(){localStorage.setItem($(this).attr('name'),$(this).prop('checked')?'Y':'N')})});$('.lws-editlist-filter-column-visibility .editlist_cb_visibility').each(function(){if(localStorage.getItem($(this).attr('name'))){var checked=(localStorage.getItem($(this).attr('name')).startsWith('Y'));$(this).prop('checked',checked);$('.lws-editlist .lws-editlist-cell[data-key="'+$(this).data('name')+'"]').toggleClass('hidden-column',!checked);$('.lws-editlist .small-media-subcell[data-key="'+$(this).data('name')+'"]').toggleClass('hidden-column',!this.checked)}})})