Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- (function() {
- function upplyAdoricCoupon() {
- var discountCodeContainer = document.getElementById('discount-code');
- var couponCodeContainer = document.getElementById('coupon_code');
- var coupon = window.localStorage.getItem('adoricCoupon');
- window.localStorage.removeItem('adoricCoupon');
- function appearInput() {
- var firstSubmitButton, firstBlockContent, firstBlockDiscount = document.querySelector('.checkout-discount-block');
- var secondSubmitButton, secondBlockContent, secondBlockDiscount = document.querySelector('#block-discount');
- if (firstBlockDiscount) {
- firstBlockContent = firstBlockDiscount.querySelector('.block-content');
- firstSubmitButton = firstBlockDiscount.querySelector('.action-apply');
- firstBlockDiscount.classList.add('_active');
- if (firstBlockContent) {
- firstBlockContent.style.display = 'block';
- }
- setTimeout(function() {
- if (firstSubmitButton) {
- firstSubmitButton.click();
- }
- }, 1000);
- }
- if (secondBlockDiscount) {
- secondBlockContent = secondBlockDiscount.querySelector('.content');
- secondSubmitButton = secondBlockDiscount.querySelector('.action.apply');
- secondBlockDiscount.classList.add('active');
- if (secondBlockContent) {
- secondBlockContent.style.display = 'block';
- }
- setTimeout(function() {
- if (secondSubmitButton) {
- secondSubmitButton.click();
- }
- }, 1000);
- }
- }
- if (coupon) {
- if (discountCodeContainer) {
- discountCodeContainer.value = coupon;
- }
- if (couponCodeContainer) {
- couponCodeContainer.value = coupon;
- }
- appearInput();
- }
- }
- var MAXIMUM_WAITING_TIME = 10 * 1000;/*10 seconds*/
- var waitPageTriggerElement = setInterval(function() {
- var discountCodeContainer = document.getElementById('discount-code');
- var couponCodeContainer = document.getElementById('coupon_code');
- if (discountCodeContainer || couponCodeContainer) {
- clearInterval(waitPageTriggerElement);
- upplyAdoricCoupon();
- }
- }, 500);
- setTimeout(function() {
- clearInterval(waitPageTriggerElement);
- }, MAXIMUM_WAITING_TIME);
- })();
- </script>
Add Comment
Please, Sign In to add comment