browsedb.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. $(document).ready(function()
  2. {
  3. $panelHeadingHeight = $('.panel-heading').outerHeight(true);
  4. $panelMarginBottom = $('.panel').css('margin-bottom').replace('px', '');
  5. $editorNavHeight = $('#editorNav').outerHeight(true);
  6. $editorMenuHeight = $('#editorMenu').outerHeight();
  7. $spaceHeight = $('.space.space-sm').outerHeight(true);
  8. $maxHeight = $(window).height() - $panelHeadingHeight - $panelMarginBottom - $editorNavHeight - $editorMenuHeight - $spaceHeight;
  9. $('.panel-body').css('max-height', $maxHeight + 'px');
  10. $('.confirmer').click(function()
  11. {
  12. const $this = $(this);
  13. const url = $this.attr('href');
  14. const role = $this.data('role');
  15. const hasQuote = $this.data('hasquote');
  16. let message = defaultConfirmDelete;
  17. if(role == 'quote') message = confirmDeleteInQuote;
  18. if(hasQuote == '1') message = confirmDeleteHasQuote;
  19. bootbox.confirm(message, function(result)
  20. {
  21. if(!result) return;
  22. $.getJSON(url, function(data)
  23. {
  24. if(data.result == 'fail') bootbox.alert(data.message);
  25. return location.reload();
  26. })
  27. });
  28. return false;
  29. });
  30. });