Advertisement
NikolayBezay

Bezeq check products before show the coupone campaign(Updated with new products Black List!)

Mar 30th, 2023 (edited)
498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 12.36 KB | None | 0 0
  1. <script>
  2. (function() {
  3.     var productsBlackList = ['139655', '139654', '139653', '139652', '137984', '137985', '137983', '139393', '139392', '139391', '139387', '139386', '139385', '139390', '139389', '139388', '139651', '139658', '139649', '139659', '139384', '139383', '139382', '139650', '139684', '139683', '139682', '139681', '139400', '139395', '139394', '139410', '139398', '139399', '139407', '139402', '139404', '139406', '139401', '139403', '139411', '139408', '139409', '139648', '139647', '139646', '139645', '139200', '139243', '139405', '139396', '139397', '139632', '139631', '139630', '139629', '139628', '139627', '139644', '139643', '139642', '139641', '139640', '139639', '139638', '139637', '139636', '139635', '139634', '139633', '139626', '139625', '139624', '139695', '139622', '139621', '139377', '139436', '139375', '139374', '139351', '139350', '139381', '139440', '139379', '139378', '139373', '139432', '139431', '139370', '139369', '139368', '139367', '139366', '139365', '139364', '139363', '139362', '139361', '139420', '139359', '139358', '139357', '139356', '139355', '139354', '139261', '139260', '139259', '139258', '139257', '139336', '139255', '139254', '139253', '139252', '139251', '139250', '139249', '139248', '139247', '139326', '139245', '139244', '139243', '139242', '139241', '139240', '139239', '139238', '139237', '139316', '139315', '139234', '139233', '139312', '139231', '139230', '139214', '139213', '139212', '139211', '139210', '139209', '139208', '139207', '139206', '139205', '139204', '139283', '139202', '139201', '139200', '139229', '139228', '139227', '139226', '139225', '139224', '139223', '139222', '139221', '139220', '139219', '139298', '139217', '139216', '139215', '137962', '137961', '137959', '137958', '137957', '137955', '137954', '137974', '137972', '137970', '137968', '137967', '137966', '137965', '137964', '137963', '137069', '136952', '136951', '136950', '136949', '136948', '136947', '136946', '136945', '136964', '136963', '136962', '136958', '136957', '136956', '136961', '136960', '136959', '136955', '136954', '136953', '136944', '136943', '136942', '136941', '136940', '136939', '136938', '136937', '136936', '136935', '136934', '136933', '136932', '136931', '136930', '136929', '136928', '136927', '136926', '136925', '137930', '137929', '137940', '136857', '136856', '136788', '136854', '136853', '136852', '136851', '136850', '136782', '136848', '136847', '136846', '136778', '136844', '136776', '136775', '137938', '137937', '136774', '136773', '136772', '136838', '137926', '136770', '136836', '136768', '136767', '136833', '136832', '136831', '136830', '136762', '136761', '136760', '136826', '137922', '137921', '136758', '136757', '136756', '136822', '136754', '136753', '136752', '136751', '136750', '136749', '136815', '136747', '136813', '136812', '136811', '136810', '136809', '136741', '136807', '136806', '136805', '136804', '136736', '136735', '136801', '136800', '136799', '136798', '136681', '136680', '136679', '136678', '136677', '136676', '136675', '136674', '136673', '136672', '136671', '136670', '136669', '136668', '136667', '136666', '136665', '136664', '136663', '136662', '136661', '136660', '136659', '136658', '136003', '136000', '136153', '137920', '136007', '136008', '136010', '136009', '136026', '136025', '136024', '136023', '136019', '136018', '136017', '136016', '136022', '136021', '136020', '136015', '136014', '136012', '136013', '135461', '136981', '135421', '135037', '135419', '135035', '135415', '135416', '135417', '135414', '135413', '135411', '135410', '135412', '135026', '135025', '135024', '135409', '135404', '135403', '135402', '135405', '135401', '135398', '135399', '135400', '135638', '135637', '135636', '135635', '135634', '135007', '135633', '135632', '135631', '135004', '135003', '135002', '135001', '135000', '134999', '134998', '134997', '134995', '134996', '134994', '134993', '134992', '134991', '134990', '134989', '134988', '134987', '134985', '134986', '135530', '132936', '132698', '132697', '132935', '132696', '135629', '135630', '132934', '132692', '134880', '134879', '132691', '135595', '135593', '135592', '134664', '135590', '134661', '135591', '135588', '134542', '134541', '135599', '134539', '134538', '135596', '135839', '135838', '135837', '134559', '134558', '134557', '134556', '134555', '135835', '135834', '134552', '134551', '135832', '135831', '135833', '134547', '135830', '134545', '135829', '135828', '134567', '136263', '136261', '134565', '136258', '136259', '134175', '133817', '136515', '133650', '133649', '133648', '133647', '133646', '133645', '133644', '133643', '133642', '133608', '135460', '133610', '133606', '133607', '133603', '133602', '133604', '133605', '133601', '131893', '131892', '132818', '137227', '132816', '132817', '133279', '132813', '133278', '132811', '132812', '133280', '132815', '132814', '132714', '132713', '132940', '132712', '132711', '132710', '132939', '132709', '132708', '132707', '132706', '132705', '132938', '132704', '132703', '132702', '132937', '132701', '132700', '132699', '132936', '132698', '132697', '132935', '132696', '132695', '132694', '134832', '132934', '132692', '132691', '132690', '132689', '135684', '132018', '132019', '131889', '131888', '131891', '131992', '132418', '132188', '131890', '132021', '135422', '135448', '135833', '137953', '136052', '135092', '138636', '132889', '134519', '134520', '134787', '136158', '136228', '136235', '136683', '136684', '136685', '136686', '136965', '137169', '137566', '134788', '139737', '139798', '140291', '132759', '132760', '133455', '133803', '133872', '133917', '133918', '137651', '134198', '134199', '134201', '134203', '134359', '134634', '135283', '135284', '135285', '135291', '135292', '135293', '135294', '135372', '135373', '135374', '136049', '135375', '135247', '135248', '138035', '135649', '135651', '135652', '135866', '135867', '135868', '135990', '136162', '136163', '136343', '136344', '136798', '136799', '136800', '136801', '136802', '136803', '136804', '136805', '136806', '136807', '136808', '136809', '136810', '136811', '136812', '136813', '136814', '136815', '136816', '136817', '136818', '136819', '136820', '136821', '136822', '136823', '136824', '136825', '136826', '136827', '136828', '136829', '136830', '136831', '136832', '136833', '136834', '136835', '136836', '136837', '136838', '136839', '136840', '136841', '136842', '136843', '136844', '136845', '136846', '136847', '136848', '136849', '136852', '136853', '136854', '136855', '136856', '136857', '136094', '137310', '137311', '137647', '137648', '137649', '137650', '138282', '138283', '138284', '138285', '137655', '137656', '137657', '137658', '137659', '137660', '137661', '137662', '137537', '137538', '137638', '137640', '137641', '137776', '137772', '137877', '137878', '137879', '137880', '137881', '137882', '137883', '138666', '137884', '137871', '137872', '137873', '137874', '137918', '137919', '137934', '137935', '137937', '137938', '137940', '137941', '137942', '138019', '138020', '138021', '137959', '137958', '137954', '137955', '137957', '138177', '138178', '138179', '138170', '138289', '138290', '138291', '138428', '138429', '138430', '138431', '138432', '138433', '138434', '138435', '138437', '138438', '138439', '138602', '138603', '138979', '138888', '138889', '138890', '138858', '138859', '138860', '138861', '138862', '138863', '138864', '138865', '138872', '138873', '138866', '138867', '138868', '138869', '138870', '138871', '139008', '139009', '139010', '139011', '139012', '139013', '139014', '139015', '138963', '138964', '138965', '138966', '138967', '136717', '139197', '139198', '139199', '139589', '139590', '139591', '139599', '139600', '139601', '139602', '139603', '139479', '139480', '139481', '139482', '139483', '139484', '139919', '139920', '139921', '139922', '139923', '139924', '140260', '140311', '140312', '140313', '140314', '140315', '140316', '140317', '140318', '140319', '140320', '140321', '140322', '140323', '140324', '140325', '140326', '140327', '140328', '140329', '140330', '140331', '140332', '140333', '140334', '140335', '140336', '140337', '140338', '140361', '140362', '140363', '140364', '140365', '139587', '139588', '140595', '140596', '140597', '140598', '140599', '140600', '140601', '140602', '137398', '137400', '137401', '140686', '140687', '140688', '140710', '140711', '140712', '140713', '140714', '140715', '140716', '140717', '140718', '133036', '136489', '136490', '137337', '134855', '138423', '138424', '139106', '139105', '137338', '140015', '140016', '140495', '140496'];
  4.  
  5.     function checkAppleTitle(title) {
  6.         if (!title) return;
  7.         if (title.toLowerCase().indexOf('apple') != -1 ||
  8.             title.toLowerCase().indexOf('airpods') != -1 ||
  9.             title.toLowerCase().indexOf('iphone') != -1) {
  10.             return true;
  11.         }
  12.         return false
  13.     }
  14.    
  15.     function checkProductLink(productLink) {
  16.         if (!productLink) return;
  17.    
  18.         if (productLink.indexOf('productMakat=BE136362') != -1) {
  19.             return true;
  20.         }
  21.         if (productLink.indexOf('productMakat=BE136368') != -1) {
  22.             return true;
  23.         }
  24.         if (productLink.indexOf('productMakat=BE136365') != -1) {
  25.             return true;
  26.         }
  27.         return false;
  28.     }
  29.     function checkProductCategory(category) {
  30.         if (!category) return;
  31.         if (category.toLowerCase().indexOf('gamers/console') != -1 ||
  32.             category.toLowerCase().indexOf('mobiles/cellular') != -1 ||
  33.             category.toLowerCase().indexOf('smarthome/scruples') != -1 ||
  34.             category.toLowerCase().indexOf('scruplesandphotography/Scruples') != -1) {
  35.             return true;
  36.         }
  37.         return false
  38.     }
  39.    
  40.     function checkProductList() {
  41.         var productImageLink = document.querySelectorAll('.product-image-wrapper a[href*=mobiles]');
  42.         var productS20Link = document.querySelectorAll('.product-image-wrapper a[href*="/s20/"]');
  43.         var creditTime = 0;
  44.         var elementCreditTime = document.querySelector('.sum-cart-with-payments-ils.col-md-5 > span:nth-child(5)');
  45.         if (elementCreditTime) {
  46.             elementCreditTime = parseInt(elementCreditTime.textContent);
  47.         } else {
  48.             elementCreditTime = 0;
  49.         }
  50.         creditTime += elementCreditTime;
  51.         if ((productImageLink.length > 0 || productS20Link.length > 0) && creditTime < 24) {
  52.            localStorage.setItem('show_coupon_adoric', false);
  53.             return false;
  54.         }
  55.    
  56.         var productsList = document.querySelectorAll('.product-details-container');
  57.    
  58.         for(var i=0; i < productsList.length; i++) {
  59.            var productTitle = productsList[i].querySelector('.product-title');
  60.            var productSubTitle = productsList[i].querySelector('.product-sub-title');
  61.            var productLink = productsList[i].querySelector('a');
  62.            var productCategory = productsList[i].parentNode.getAttribute('data-cat2');
  63.            var productId = productsList[i].parentNode.getAttribute('data-pmk');
  64.    
  65.            if (productCategory && checkProductCategory(productCategory)) {
  66.                localStorage.setItem('show_coupon_adoric', false);
  67.                return false;
  68.            }
  69.            if (productTitle && checkAppleTitle(productTitle.textContent)) {
  70.                localStorage.setItem('show_coupon_adoric', false);
  71.                return false;
  72.            }
  73.            if (productSubTitle && checkAppleTitle(productSubTitle.textContent)) {
  74.                localStorage.setItem('show_coupon_adoric', false);
  75.                return false;
  76.            }
  77.            if (productLink && checkProductLink(productLink.getAttribute('href'))) {
  78.                localStorage.setItem('show_coupon_adoric', false);
  79.                return false;
  80.            }
  81.            if (productsBlackList.indexOf(productId) !== -1) {
  82.                localStorage.setItem('show_coupon_adoric', false);
  83.                return false;
  84.            }
  85.        }
  86.        localStorage.setItem('show_coupon_adoric', true);
  87.    }
  88.    
  89.    var productsTimer = 10;
  90.    
  91.    function waitPageProducts() {
  92.    
  93.        productsTimer--;
  94.        var pageProducts = document.querySelectorAll('.product-details-container');
  95.        
  96.        if (pageProducts.length < 1 && productsTimer > 0) {
  97.                 setTimeout(waitPageProducts, 500);
  98.         } else {
  99.             checkProductList();
  100.         }
  101.     }
  102.     waitPageProducts();
  103. })();
  104. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement