-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathbookmarklet.txt
1 lines (1 loc) · 1.9 KB
/
bookmarklet.txt
1
javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.7.2",function($,L){function OfferProcessor(c,f){var d=c;var b=0;var a=f;var e="/Clipping1/services/clip/offers";return{processOffers:function(l){var p=l.offers;var n=0;for(var m=0;m<p.length;m++){var o=p[m];if(o.clipStatus==="U"){n++;var g=[];var k={};k.offerId=o.offerId;k.offerPgm=o.offerPgm;g.push(k);var h={};h.clips=g;var j=JSON.stringify(h);$.ajax({type:"POST",url:e,contentType:"application/json",data:j,beforeSend:function(i){i.setRequestHeader("SWY_API_KEY","emjou");i.setRequestHeader("SWY_BANNER","safeway");i.setRequestHeader("SWY_VERSION","1.0");i.setRequestHeader("X-SWY_API_KEY","emjou");i.setRequestHeader("X-SWY_BANNER","safeway");i.setRequestHeader("X-SWY_VERSION","1.0")}})}}b=n;a()},process:function(){var g=this;$.ajax(d).done(function(h){g.processOffers(h)})},getOffersAdded:function(){return b}}}function Counter(c){var d=c;var a="";var b=0;return{incrementCount:function(){b++;if(b==d){a()}},setCallback:function(e){a=e}}}$(document).ready(function(){var c=Counter(3);var b=OfferProcessor("/J4UProgram1/services/program/CC/offer/allocations",c.incrementCount);var e=OfferProcessor("/J4UProgram1/services/program/PD/offer/allocations",c.incrementCount);var d=OfferProcessor("/J4UProgram1/services/program/YCS/offer/allocations",c.incrementCount);var a=function(){var f=b.getOffersAdded();var g=e.getOffersAdded();if(f+g>0){alert("J4U - Added "+f+" 'Coupon Center' coupons and \n "+g+" 'Personalized Deals' Coupons. \n Please reload the page.")}};c.setCallback(a);b.process();e.process();d.process()});});