var eq2 = { }; /* NAVIGATION HANDLING & EVENTS */ $(document).on('click', '.eq-nav-link', function() { var m = $(this).data('module'), e = $(this), t = $(this).find('.nav-link-text').text(); console.log(t); $(this).find('a').empty().append('  '+t+''); $.post('autoload.php', {'set-navigation':m}, function(data) { location.reload(); }); }); /* ITEM EDITOR FUNCTIONS & EVENTS */ //Load Item Editor Pane $(document).on('click', '.quick-item-search-row', function() { var id = $(this).data('id'), l = $('#item-editor-header-label'), c = $('#item-editor-content'); if(l.hasClass('hidden')) { l.removeClass('hidden').removeClass('animated').removeClass('fadeInRight'); l.addClass('animated fadeInRight'); l.empty().append(' Loading ...'); } c.empty().append('

Loading...

'); $.post('autoload.php', {'get-edit-item':id}, function(data) { setTimeout(function() { c.empty().append(data); },700); }); }); //Quick Search Handler var quicksearchtimer, quicksearchdata; $(document).on('keyup', '#item-quick-search', function() { var s = $(this).val(), i = $('#quick-item-search-icon'), l = $('#quick-item-list'); console.log('Keyup Detected'); if(quicksearchtimer) { clearTimeout(quicksearchtimer) } //Clear timeout between keystrokes i.empty().append(''); l.empty().append('
   
   
'); quicksearchtimer = setTimeout(function() { $.post('autoload.php', {'quick-item-search':s}, function(data) { quicksearchdata = data; build_quicksearch_list(data); },'json'); }, 800); }); function build_quicksearch_list(d) { var i = $('#quick-item-search-icon'), l = $('#quick-item-list'); i.empty().append('') console.log(d); if(d.rows.length > 0) { l.empty().append('

'+d.found+' item(s) found - results limited to '+d.count+'.

'); $.each(quicksearchdata.rows, function(k,v) { l.append('' +'
' +'
' +'
' +' '+v.name+' ' +'
ID: '+v.id+' '+v.item_type+'
' +'
' +'
' +'
'); }); } else { l.empty().append('' +'
' +'

' +' ' +' No items were found matching your search.' +'

' +'
'); } }