NikolayBezay

dr-gav Adoric indegame event.

Mar 11th, 2021 (edited)
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.99 KB | None | 0 0
  1. <script>
  2. (function() {
  3.     function checkCoupon() {
  4.         var exceptionElement = document.querySelector('div[data-productid="19338"]');
  5.         if (exceptionElement && exceptionElement.textContent.indexOf('כסא גיימינג XP1') != -1) {
  6.            return null;
  7.         }
  8.         var isShowed = window.sessionStorage.getItem('showed_indegame');
  9.         var couponElement = document.querySelector('.discount_0-total .title > span');
  10.         if (!isShowed && couponElement && couponElement.textContent.indexOf('indegame') != -1) {
  11.            adoric.trigger('show_indegame');
  12.             window.sessionStorage.setItem('showed_indegame', true);
  13.         }
  14.     };
  15.     checkCoupon();
  16.     document.querySelector('body').addEventListener('click', function(event){
  17.         if (adoric && (event.target.matches(".apply") || event.target.parentNode.matches(".apply"))) {
  18.            setTimeout(checkCoupon, 1000);
  19.             setTimeout(checkCoupon, 2000);
  20.         }
  21.     });        
  22. })();
  23. </script>
  24.  
Add Comment
Please, Sign In to add comment