Bez popisu

admin-builder-lite.js 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* global wpforms_builder_lite, wpforms_builder */
  2. 'use strict';
  3. var WPFormsBuilderLite = window.WPFormsBuilderLite || ( function( document, window, $ ) {
  4. /**
  5. * Public functions and properties.
  6. *
  7. * @since 1.0.0
  8. *
  9. * @type {object}
  10. */
  11. var app = {
  12. /**
  13. * Start the engine.
  14. *
  15. * @since 1.0.0
  16. */
  17. init: function() {
  18. // Document ready
  19. $( app.ready() );
  20. app.bindUIActions();
  21. },
  22. /**
  23. * Document ready.
  24. *
  25. * @since 1.0.0
  26. */
  27. ready: function() {},
  28. /**
  29. * Element bindings.
  30. *
  31. * @since 1.0.0
  32. */
  33. bindUIActions: function() {
  34. // Warn users if they disable email notifications.
  35. $( document ).on( 'change', '#wpforms-panel-field-settings-notification_enable', function() {
  36. app.formBuilderNotificationAlert( $( this ).is( ':checked' ) );
  37. } );
  38. },
  39. /**
  40. * Warn users if they disable email notifications.
  41. *
  42. * @since 1.5.0
  43. *
  44. * @param {string} value Whether notifications enabled or not. 0 is disabled, 1 is enabled.
  45. */
  46. formBuilderNotificationAlert: function( value ) {
  47. if ( value !== false ) {
  48. return;
  49. }
  50. $.alert( {
  51. title: wpforms_builder.heads_up,
  52. content: wpforms_builder_lite.disable_notifications,
  53. icon: 'fa fa-exclamation-circle',
  54. type: 'orange',
  55. buttons: {
  56. confirm: {
  57. text: wpforms_builder.ok,
  58. btnClass: 'btn-confirm',
  59. keys: [ 'enter' ],
  60. },
  61. },
  62. } );
  63. },
  64. };
  65. // Provide access to public functions/properties.
  66. return app;
  67. }( document, window, jQuery ) );
  68. WPFormsBuilderLite.init();