NikolayBezay

Carpetshop embed for GTM show out of stock

Apr 5th, 2021
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.98 KB | None | 0 0
  1. <script>
  2.     (function() {
  3.         function checkText() {
  4.             var text = document.querySelector('.variations_form .single_variation .price + B');
  5.             if (text && text.innerText === 'אזל מהמלאי אך ניתן למצוא אצלנו שטיחים דומים') {
  6.                 adoric && adoric.trigger('find_text_not_available');
  7.             }
  8.         }
  9.  
  10.         var radioButtonTimer = 20;
  11.  
  12.         function waitPageRadioButton() {
  13.             radioButtonTimer--;
  14.             var productInfo = document.querySelector('.product-info');
  15.  
  16.             if (!productInfo && radioButtonTimer > 0) {
  17.                   setTimeout(waitPageRadioButton, 500);
  18.             } else {
  19.                 productInfo.addEventListener('click', function(event) {
  20.                     if (event.target.getAttribute('type') == 'radio') {
  21.                         setTimeout(checkText, 750);
  22.                     }
  23.                 });
  24.             }
  25.         }
  26.         setTimeout(waitPageRadioButton, 200);
  27.         setTimeout(checkText, 2000);
  28.     })();
  29. </script>
Advertisement
Add Comment
Please, Sign In to add comment