page_cache_validation.phtml 1014 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /** @var \Magento\PageCache\Block\System\Config\Form\Field\Export $block */
  7. ?>
  8. <script>
  9. require(['jquery'], function($){
  10. //<![CDATA[
  11. var fieldset = $('#system_full_page_cache_varnish'),
  12. fields = fieldset.find(':input:not(button)');
  13. if (fieldset.is(':visible') == false) {
  14. fieldset.show();
  15. fields.show();
  16. }
  17. fields.each(function (e) {
  18. $(this).data('previous-value', $(this).val());
  19. });
  20. fieldset.on('change', function (e) {
  21. var invalidFields = fields.filter(function () {
  22. return ($(this).val().length == 0 || ($(this).val() != $(this).data('previous-value')));
  23. });
  24. $('[id^=system_full_page_cache_varnish_export_button_version]').prop(
  25. 'disabled',
  26. (invalidFields.length > 0)
  27. );
  28. });
  29. //]]>
  30. });
  31. </script>