var DocSearch = { init: false, init: function() { if (this.initialized) return; this.initialized = true; this.DocSearch_items(); }, DocSearch_items: function() { this.DocSearch_sortable(); this.DocSearch_del_item(); this.DocSearch_add(); this.DocSearch_search(); }, DocSearch_update: function() { this.DocSearch_maxid(); this.DocSearch_del_item(); this.DocSearch_search(); AveAdmin.tooltip(); }, DocSearch_maxid: function(id) { var maxid = 1; $('#docsearch_lists_' + id).children('.docsearch_list').each(function() { maxid = Math.max(maxid, parseInt($(this).attr("data-id")) + 1); }); return maxid; }, DocSearch_del_item: function() { $('.docsearch_list .DelButton').on('click', function(event) { event.preventDefault(); var id = $(this).attr('data-id'); jConfirm( docsearch_del_conf, docsearch_del_head, function(b) { if (b) { $('#docsearch_list_' + id).remove(); } } ); }); }, DocSearch_add: function() { $('.AddButton').on('click', function() { c_id = $(this).parent().parent('.docsearch_lists').attr("data-id"); d_id = $(this).parent().parent('.docsearch_lists').attr("data-docid"); i_id = DocSearch.DocSearch_maxid(d_id + '_' + c_id); $('#docsearch_lists_' + d_id + '_' + c_id + ':last').append( '