PageSourceSearch

https://www.fairfin.be/themes/custom/fairfin/js/top_banner.js?v=10.3.1

js fairfin.be collected 2026-09-24 21:30:32 UTC 3,065 bytes, 97 lines download raw bytes

1(function ($) {
2  $(document).ready(function () {
3    // only after second page view
4    let viewCount = 'viewCount' in sessionStorage ? parseInt(sessionStorage.getItem('viewCount')) : 0;
5    sessionStorage.setItem('viewCount', viewCount+1);
6
7    if (!drupalSettings.path.isFront && viewCount > 0) {
8
9      if ( $(".config_pages--type--top-banner" ).length ) {
10        var show = true;
11      }
12
13      $(".config_pages--type--top-banner .webform-button--submit").addClass('close-validate');
14      $('.config_pages--type--top-banner .js-form-item input').each(function () {
15        $(this).attr("placeholder", $(this).attr("name"));
16        $(this).attr("value", $(this).attr("name"));
17      })
18
19
20      $(".config_pages--type--top-banner .banner-link").each(function () {
21        var created = Cookies.get('banner_' + $(this).data("id"));
22        if (created == $(this).data("created")) {
23          show = false;
24          $('html').css('overflow-y', 'scroll');
25        }
26      });
27
28      let timeout;
29
30      function myFunction() {
31        timeout = setTimeout(alertFunc, 10000);
32      }
33
34      function alertFunc() {
35        $(".config_pages--type--top-banner").addClass("show");
36        $('html').css('overflow-y', 'hidden');
37      }
38
39
40      if (show) {
41        myFunction()
42
43      }
44    }
45
46    $(".close-banner").click(function (e) {
47      e.preventDefault();
48
49      var banner = $(".banner-link");
50      Cookies.set('banner_' + banner.data("id"), banner.data("created"));
51
52      $(".config_pages--type--top-banner").removeClass("show");
53      $('html').css('overflow-y','scroll');
54    })
55    // $(".close-button").click(function (e) {
56    //   e.preventDefault();
57    //   var banner = $(".banner-link");
58    //   Cookies.set('banner_' + banner.data("id"), banner.data("created"));
59    //   $(".config_pages--type--top-banner").removeClass("show");
60    //     window.location.href = $(this).attr('href');
61    //   $('html').css('overflow-y','scroll');
62    // })
63    function validate(emailAdress) {
64      let regexEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
65      if (emailAdress.match(regexEmail)) {
66        return true;
67      } else {
68        return false;
69      }
70    }
71    function insertAfter(newNode, existingNode) {
72      existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling);
73    }
74
75    $(".close-validate").click(function (e) {
76      e.preventDefault();
77      var banner = $(".banner-link");
78      Cookies.set('banner_' + banner.data("id"), banner.data("created"));
79
80      var form = $(this).parent().parent().parent().find('.webform-submission-form');
81      var emailAdress =  $(this).parent().parent().parent().find("#edit-email")
82      let emailWrapper = $(this).parent().parent().parent().find(".form-item-email")
83      var validation = validate(emailAdress.val());
84      if (validation){
85        form.submit()
86      } else {
87        let li = document.createElement('li');
88        li.textContent = 'Services';
89        emailAdress.insertBefore(li, emailWrapper.nextSibling);
90      }
91
92    })
93
94
95  })
96
97}(jQuery, Drupal));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.