Ei kuvausta

um-admin-settings.js 921B

1234567891011121314151617181920212223242526272829303132333435
  1. jQuery( document ).ready( function() {
  2. /**
  3. * Licenses
  4. */
  5. jQuery( document.body ).on( 'click', '.um_license_deactivate', function() {
  6. jQuery(this).siblings('.um-option-field').val('');
  7. jQuery(this).parents('form.um-settings-form').trigger('submit');
  8. });
  9. /**
  10. * Not licenses page
  11. */
  12. if ( jQuery( '#licenses_settings' ).length === 0 ) {
  13. var changed = false;
  14. jQuery( 'input, textarea, select' ).on('change', function() {
  15. changed = true;
  16. });
  17. jQuery( '#um-settings-wrap .um-nav-tab-wrapper a, #um-settings-wrap .subsubsub a' ).on( 'click', function() {
  18. if ( changed ) {
  19. window.onbeforeunload = function() {
  20. return wp.i18n.__( 'Are sure, maybe some settings not saved', 'ultimate-member' );
  21. };
  22. } else {
  23. window.onbeforeunload = '';
  24. }
  25. });
  26. jQuery( '.submit input' ).on( 'click', function() {
  27. window.onbeforeunload = '';
  28. });
  29. }
  30. });