Created
October 14, 2019 18:56
-
-
Save pbojinov/d572b5494a4f26390aeb5136d7097655 to your computer and use it in GitHub Desktop.
Safeway Just For You - Automatic Coupon Clipper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function() {"use strict"; var coupons = angular.element("#lt-coupon-area").scope().sharedValues.unfilteredItems.slice(); coupons.filter(function(x){return x.clipStatus==="U";}).forEach(function(item){ var c1 = document.cookie.match(new RegExp('swyConsumerlbcookie=([^;]+)'))[1]; var c2 = document.cookie.match(new RegExp('swyConsumerDirectoryPro=([^;]+)'))[1]; var data = {"items":[]}; var clip = {}; clip.clipType="C";clip.itemId=item.offerId;clip.itemType=item.offerPgm;clip.vndrBannerCd=""; var list = {}; list.clipType="L";list.itemId=item.offerId;list.itemType=item.offerPgm; data.items.push(clip);data.items.push(list); var request = new Request('https://nimbus.safeway.com/Clipping1/services/clip/items', { method: 'POST', mode: 'cors', redirect: 'error', headers: new Headers({ 'Content-Type': 'application/json', 'X-SWY_VERSION': '1.0', 'X-SWY_API_KEY': 'emjou', 'X-SWY_BANNER': 'safeway', 'SWY_ISREMEMBERED': 'false', 'X-swyConsumerlbcookie': c1, 'X-swyConsumerDirectoryPro': c2 }), body: JSON.stringify(data) }); fetch(request).then(function(){ document.querySelector("#headerMyListCount").textContent = parseInt(document.querySelector("#headerMyListCount").textContent,10)+1; }); }); alert('clipping ' + coupons.filter(function(x){return x.clipStatus==="U"}).length + ' J4U coupons');}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function() { | |
"use strict"; | |
var coupons = angular.element("#lt-coupon-area").scope().sharedValues.unfilteredItems.slice(); | |
coupons.filter(function(x) { | |
return x.clipStatus === "U"; | |
}).forEach(function(item) { | |
var c1 = document.cookie.match(new RegExp('swyConsumerlbcookie=([^;]+)'))[1]; | |
var c2 = document.cookie.match(new RegExp('swyConsumerDirectoryPro=([^;]+)'))[1]; | |
var data = { | |
"items": [] | |
}; | |
var clip = {}; | |
clip.clipType = "C"; | |
clip.itemId = item.offerId; | |
clip.itemType = item.offerPgm; | |
clip.vndrBannerCd = ""; | |
var list = {}; | |
list.clipType = "L"; | |
list.itemId = item.offerId; | |
list.itemType = item.offerPgm; | |
data.items.push(clip); | |
data.items.push(list); | |
var request = new Request('https://nimbus.safeway.com/Clipping1/services/clip/items', { | |
method: 'POST', | |
mode: 'cors', | |
redirect: 'error', | |
headers: new Headers({ | |
'Content-Type': 'application/json', | |
'X-SWY_VERSION': '1.0', | |
'X-SWY_API_KEY': 'emjou', | |
'X-SWY_BANNER': 'safeway', | |
'SWY_ISREMEMBERED': 'false', | |
'X-swyConsumerlbcookie': c1, | |
'X-swyConsumerDirectoryPro': c2 | |
}), | |
body: JSON.stringify(data) | |
}); | |
fetch(request).then(function() { | |
document.querySelector("#headerMyListCount").textContent = parseInt(document.querySelector("#headerMyListCount").textContent, 10) + 1; | |
}); | |
}); | |
alert('clipping ' + coupons.filter(function(x) { | |
return x.clipStatus === "U" | |
}).length + ' J4U coupons'); | |
}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated: https://github.com/sierralx/frys