eq2emu.js 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. var eq2 = {
  2. };
  3. /* NAVIGATION HANDLING & EVENTS */
  4. $(document).on('click', '.eq-nav-link', function() {
  5. var m = $(this).data('module'),
  6. e = $(this),
  7. t = $(this).find('.nav-link-text').text();
  8. console.log(t);
  9. $(this).find('a').empty().append('<span class="inline animated fadeInLeft"><i class="fad fa-spinner-third fa-spin fast-spin"></i></span>&nbsp;&nbsp;<span class="nav-link-text">'+t+'</span>');
  10. $.post('autoload.php', {'set-navigation':m}, function(data) {
  11. location.reload();
  12. });
  13. });
  14. /* ITEM EDITOR FUNCTIONS & EVENTS */
  15. //Load Item Editor Pane
  16. $(document).on('click', '.quick-item-search-row', function() {
  17. var id = $(this).data('id'),
  18. l = $('#item-editor-header-label'),
  19. c = $('#item-editor-content');
  20. if(l.hasClass('hidden')) {
  21. l.removeClass('hidden').removeClass('animated').removeClass('fadeInRight');
  22. l.addClass('animated fadeInRight');
  23. l.empty().append('<i class="fad fa-caret-right"></i> Loading ...');
  24. }
  25. c.empty().append('<p class="text-center"><div class="spinner-grow spinner-grow-lg text-primary" role="status"><span class="sr-only">Loading...</span></div></p>');
  26. $.post('autoload.php', {'get-edit-item':id}, function(data) {
  27. setTimeout(function() {
  28. c.empty().append(data);
  29. },700);
  30. });
  31. });
  32. //Quick Search Handler
  33. var quicksearchtimer,
  34. quicksearchdata;
  35. $(document).on('keyup', '#item-quick-search', function() {
  36. var s = $(this).val(),
  37. i = $('#quick-item-search-icon'),
  38. l = $('#quick-item-list');
  39. console.log('Keyup Detected');
  40. if(quicksearchtimer) { clearTimeout(quicksearchtimer) } //Clear timeout between keystrokes
  41. i.empty().append('<i class="fad fa-circle-notch text-success fa-spin fast-spin fs-xl"></i>');
  42. l.empty().append('<div class="panel-content text-center"><div class="spinner-grow spinner-grow-sm" role="status"><span class="sr-only"></span></div>&nbsp;&nbsp;&nbsp;<div class="spinner-grow spinner-grow-sm" role="status"><span class="sr-only"></span></div>&nbsp;&nbsp;&nbsp;<div class="spinner-grow spinner-grow-sm" role="status"><span class="sr-only"></span></div></div>');
  43. quicksearchtimer = setTimeout(function() {
  44. $.post('autoload.php', {'quick-item-search':s}, function(data) {
  45. quicksearchdata = data;
  46. build_quicksearch_list(data);
  47. },'json');
  48. }, 800);
  49. });
  50. function build_quicksearch_list(d) {
  51. var i = $('#quick-item-search-icon'),
  52. l = $('#quick-item-list');
  53. i.empty().append('<span class="animated zoomIn inline"><i class="fad fa-search fa-info fs-xl"></i></span>')
  54. console.log(d);
  55. if(d.rows.length > 0) {
  56. l.empty().append('<p class="text-center"><small><span class="text-success">'+d.found+'</span> item(s) found - results limited to <span class="text-danger">'+d.count+'</span>.</small></p>');
  57. $.each(quicksearchdata.rows, function(k,v) {
  58. l.append(''
  59. +'<div class="row quick-item-search-row" data-id="'+v.id+'">'
  60. +' <div class="col-hidden-xs col-sm-3 col-md-3 col-lg-2 text-center"><img class="quick-search-item-ico vm" src="img/eq2/items/'+v.icon+'.png"/></div>'
  61. +' <div class="col-xs-12 col-sm-9 col-md-7 col-lg-8 text-left">'
  62. +' <a href="#" class="text-primary">'+v.name+'</a> '
  63. +' <small class="text-muted"><br><span class="badge badge-primary"><strong>ID</strong>: '+v.id+'</span> '+v.item_type+'</small>'
  64. +' </div>'
  65. +' <div class="col-hidden-xs col-hidden-sm col-md-1 col-lg-2 text-right text-primary" style="font-size:15pt;"><span class="vm"><i class="fad fa-angle-right vm"></i></span></div>'
  66. +'</div>');
  67. });
  68. } else {
  69. l.empty().append(''
  70. +'<div class="col-xs-12">'
  71. +' <h4 style="padding-top:50px;padding-bottom:50px;" class="text-center">'
  72. +' <span class="animated bounceInDown inline"><i class="fad fa-minus-hexagon text-danger"></i></span>'
  73. +' No items were found matching your search.'
  74. +' </h4>'
  75. +'</div>');
  76. }
  77. }