templates/recurrent_jobs_search/_includes/form_javascript.html.twig line 1

Open in your IDE?
  1. {{ include('/_includes/radiusslider.html.twig') }}
  2. <script>
  3. {{ inlineJsWrapperBegin() }}
  4. jQuery('form[name="recurrent_jobs_search_parameters"]').on('submit', function () {
  5. jQuery(window).on('beforeunload', function () {
  6. startLoader()
  7. });
  8. });
  9. const progressBar = document.getElementById('progress-bar')
  10. const progressBarTarget = document.getElementById('progress-bar-target')
  11. let intervalId
  12. const startLoader = function () {
  13. const max = 95;
  14. progressBar.classList.add('tw-block')
  15. progressBar.classList.remove('tw-hidden')
  16. let progress = 0;
  17. progressBarTarget.style.width = progress + '%';
  18. clearInterval(intervalId)
  19. intervalId = setInterval(() => {
  20. if (progress < max) {
  21. progress += Math.random() * 5;
  22. if (progress > max) progress = max;
  23. progressBarTarget.style.width = progress + '%';
  24. }
  25. }, 60
  26. );
  27. }
  28. jQuery('.popular-jobs-button').on('click', function (event) {
  29. event.preventDefault();
  30. jQuery('.popular-jobs').toggleClass('tw-hidden');
  31. jQuery('.info-bubble').addClass('tw-hidden');
  32. jQuery('.info-bubble').removeClass('md:tw-block');
  33. jQuery('.popular-jobs-arrow').toggleClass('fa-chevron-down');
  34. jQuery('.popular-jobs-arrow').toggleClass('fa-chevron-up');
  35. if (!jQuery('.popular-jobs').hasClass('tw-hidden')) {
  36. } else {
  37. jQuery('#recurrent_jobs_search_parameters_filterSearchterm').focus();
  38. }
  39. })
  40. jQuery('#specificBlockID.form-group').contents().unwrap();
  41. jQuery('.suggested-searchterm-button').on('click', function (event) {
  42. event.preventDefault();
  43. jQuery('#recurrent_jobs_search_parameters_filterSearchterm').val(jQuery(this).attr('data-translation'));
  44. jQuery('.popular-jobs').toggleClass('tw-hidden');
  45. jQuery('.popular-jobs-arrow').toggleClass('fa-chevron-down');
  46. jQuery('.popular-jobs-arrow').toggleClass('fa-chevron-up');
  47. jQuery('#recurrent_jobs_search_parameters_filterSearchterm').focus();
  48. });
  49. {{ inlineJsWrapperEnd() }}
  50. </script>
  51. {{ include('/_includes/selectZipcodeOrCity.html.twig') }}
  52. {{ include('/_includes/searchFormFieldValidation.html.twig') }}
  53. <script defer src="{{ asset('assets/generated/js/autoSuggest.js')|cdnifyUri }}"></script>
  54. <script>
  55. {{ inlineJsWrapperBegin() }}
  56. window.appFunctions.initializeAutoSuggest('recurrent_jobs_search_parameters_filterSearchterm', 'searchterm-autosuggest-results', '{{ path('occupational_fields_and_professions_search.autosuggest.api') }}', '<p class="autosuggest-item m-0 cursor-pointer list-group-item list-group-item-action py-1">', '</p>', '<hr/>', 'autosuggest-item', '0');
  57. {{ inlineJsWrapperEnd() }}
  58. </script>
  59. {% if showMembershipModal is defined and showMembershipModal %}
  60. <script>
  61. {{ inlineJsWrapperBegin() }}
  62. jQuery('#jobseeker-membership-modal').modal('show');
  63. jQuery('#jobseeker-membership-close-button').on('click', function () {
  64. jQuery('#jobseeker-membership-modal').modal('hide');
  65. })
  66. {{ inlineJsWrapperEnd() }}
  67. </script>
  68. {% endif %}
  69. <script>
  70. {{ inlineJsWrapperBegin() }}
  71. window.appFunctions.searchAllJobs = function () {
  72. event.preventDefault();
  73. var querystring = jQuery('form[name="recurrent_jobs_search_parameters"]').serialize();
  74. window.location.href = '{{ path('recurrent_jobs_search.all_jobs') }}?' + querystring;
  75. }
  76. window.appFunctions.searchAllJobsExternalBoost = function () {
  77. event.preventDefault();
  78. var querystring = jQuery('form[name="recurrent_jobs_search_parameters"]').serialize();
  79. window.location.href = '{{ path('recurrent_jobs_search.all_jobs') }}?' + querystring + '&boostExternalJobs=1';
  80. }
  81. {{ inlineJsWrapperEnd() }}
  82. </script>
  83. {% if criteo_service.pageShouldContainCriteoCode(app.request, app.user) %}
  84. <!-- Criteo Product Tag -->
  85. <script>
  86. {{ inlineJsWrapperBegin() }}
  87. if (typeof window.CCM === 'object') {
  88. const hasConsentForEmbedding = CCM.acceptedEmbeddings.some(embedding => {
  89. return embedding.name === 'Criteo';
  90. });
  91. if (hasConsentForEmbedding) {
  92. window.criteo_q = window.criteo_q || [];
  93. var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";
  94. window.criteo_q.push({
  95. event: "setAccount",
  96. account: 88703
  97. },
  98. {
  99. event: "setEmail",
  100. email: {% if app.user is defined and app.user is not null and app.user.email is defined and app.user.email is not null %}"{{ app.user.email|sha256 }}",
  101. hash_method: "sha256"
  102. {% else %}
  103. "" {% endif %}
  104. },
  105. {
  106. event: "setSiteType",
  107. type: deviceType
  108. },
  109. {
  110. event: "viewItem",
  111. item: "1"
  112. });
  113. }
  114. }
  115. {{ inlineJsWrapperEnd() }}
  116. </script>
  117. <!-- END Criteo Product Tag -->
  118. {% endif %}