Advertisement
NikolayBezay

Cellcom GTM teg for AbroadMain lobby page

Apr 11th, 2022
709
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.36 KB | None | 0 0
  1. <script>
  2. (function() {
  3.     if (window.Element && !Element.prototype.closest) {
  4.        Element.prototype.closest = function(s) {
  5.            var matches = (this.document || this.ownerDocument).querySelectorAll(s),
  6.                i, el = this;
  7.             do {
  8.                 i = matches.length;
  9.                 while (--i >= 0 && matches.item(i) !== el) {};
  10.             } while ((i < 0) && (el = el.parentElement));
  11.            return el;
  12.        };
  13.    }
  14.  
  15.    window.isNativeFormClicked = false;
  16.    window.isNativeFormFilled = false;
  17.    window.isNativeFormSubmitted = false;
  18.    document.addEventListener('click', function(event) {
  19.        console.log('event.target - ', event.target);
  20.        var nativeFormField = event.target.closest('.lobby-tabs-content .tab-pane');
  21.        if (nativeFormField) {
  22.            window.isNativeFormClicked = true;
  23.        }
  24.        setTimeout(function() {
  25.            var nativeFormField = document.querySelector('.lobby-tabs-content .tab-pane .selected-data-exists');
  26.            if (nativeFormField) {
  27.                window.isNativeFormFilled = true;
  28.            }
  29.        }, 250);
  30.  
  31.        var nativeFormSubmited = event.target.closest('.lobby-tabs-content .tab-pane .search-wrapper-button');
  32.        if (nativeFormSubmited) {
  33.            window.isNativeFormSubmitted = true;
  34.        }
  35.    });
  36. })();
  37. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement