admin.js 790 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * Main Javascript file
  3. *
  4. * @author Open Mind
  5. * @date 04/12/2018
  6. * @time 16:00
  7. */
  8. var fetchHeaders = {
  9. 'Accept': 'text/html',
  10. 'Content-Type': 'text/html',
  11. 'X-Requested-With': 'XMLHttpRequest',
  12. 'Cache-Control': 'no-cache',
  13. 'Pragma': 'no-cache',
  14. 'Expires': '0'
  15. };
  16. function SetupConfirmationDialog() {
  17. $('.requestconfirm').on('click', function (ev) {
  18. let confirmText = $(this).data('confirmtext');
  19. if (!confirm(confirmText))
  20. ev.preventDefault();
  21. });
  22. }
  23. function SetupSubmitFormDisabler() {
  24. $('body').on('submit', 'form', function () {
  25. $('body').focus();
  26. $('form input,form select').prop('readonly', true);
  27. // Manual submit for more control
  28. this.submit();
  29. return false;
  30. });
  31. }
  32. $(function () {
  33. SetupConfirmationDialog();
  34. SetupSubmitFormDisabler();
  35. });