PageSourceSearch

https://s1.48hourprint.com/assets/scripts_min/vanilla_js/coupon-banner-widget-handler.min.js

js 48hourprint.com collected 2026-10-03 22:11:42 UTC 5,306 bytes, 2 lines download raw bytes

1/*! up-static 2026-09-25 */
2function Cookie(a){a.setTime(a.getTime()+12096e5),this.expire_date=a.toUTCString(),this.domain=website_config.domain}function CouponStorage(){this.storageDataKey=website_config.coupon_storage_name,this.CookieService=CookieService}function parseJsonString(a){try{return JSON.parse(a)}catch(a){return!1}}function getCookie(a){return CookieService.readCookie(a)}Cookie.prototype.createCookie=function(a,b){document.cookie=a+"="+b+";path=/;expires="+this.expire_date+";domain="+this.domain},Cookie.prototype.readCookie=function(a){for(var b=a+"=",c=document.cookie.split(";"),d=0;d<c.length;d++){for(var e=c[d];" "==e.charAt(0);)e=e.substring(1);if(0==e.indexOf(b))return e.substring(b.length,e.length)}return""},Cookie.prototype.deleteCookie=function(a){document.cookie=a+"=;path=/;expires=Thu, 01 Jan 1970 00:00:01 GMT;domain="+this.domain},Cookie.prototype.deleteCookieByValue=function(a,b){if(this.readCookie(a)==b)return this.deleteCookie(a),!0},Cookie.prototype.setExpireDate=function(a){this.expire_date=a},Cookie.prototype.getExpireDate=function(){return this.expire_date},Cookie.prototype.setDomain=function(a){this.domain=a},Cookie.prototype.getDomain=function(){return this.domain};var date=new Date,CookieService=new Cookie(date);CouponStorage.prototype.getStorageData=function(){var a=this.CookieService.readCookie(this.storageDataKey);return a&&(a=decodeURIComponent(a)),parseJsonString(a)},CouponStorage.prototype.setStorageData=function(a){var b=new Date;b.setTime(b.getTime()+31536e7),this.CookieService.setExpireDate(b.toUTCString()),this.CookieService.createCookie(this.storageDataKey,a)},CouponStorage.prototype.setCouponWithBasicValidation=function(a){var b=this;return new Promise(function(c,d){b.validateCouponWithBasic(a).then(function(a){void 0!==a.cp_storage_data&&null!==a.cp_storage_data&&b.setStorageData(a.cp_storage_data),c(a)})})},CouponStorage.prototype.setCouponIdWithBasicValidation=function(a){var b=this;return new Promise(function(c,d){b.validateCouponByIdWithBasic(a).then(function(a){void 0!==a.cp_storage_data&&null!==a.cp_storage_data&&b.setStorageData(a.cp_storage_data),c(a)})})},CouponStorage.prototype.validateCouponWithBasic=function(a){return new Promise(function(b,c){var d=new XMLHttpRequest,e={},f=getCookie(website_config.auth.act_field);f&&(e={Authorization:"Bearer "+f});var g=website_config.checkout_api+"/validate-coupon-code/"+a+"?website_code="+website_config.website_code;
2if(d.open("GET",g),d.setRequestHeader("Content-type","application/json"),e)for(var h in e)d.setRequestHeader(h,e[h]);d.onload=function(){if(4===this.readyState&&200===this.status){var a=parseJsonString(d.responseText);b(a)}else c(Error(d.statusText))},d.onerror=function(){c(Error("Network Error"))},d.send()})},CouponStorage.prototype.validateCouponByIdWithBasic=function(a){return new Promise(function(b,c){var d=new XMLHttpRequest,e={},f=getCookie(website_config.auth.act_field);f&&(e={Authorization:"Bearer "+f});var g=website_config.checkout_api+"/coupon-by-id-validator/"+a+"?website_code="+website_config.website_code;if(d.open("GET",g),d.setRequestHeader("Content-type","application/json"),e)for(var h in e)d.setRequestHeader(h,e[h]);d.onload=function(){if(4===this.readyState&&200===this.status){var a=parseJsonString(d.responseText);b(a)}else c(Error(d.statusText))},d.onerror=function(){c(Error("Network Error"))},d.send()})},CouponStorage.prototype.getCouponCodeFromStorageData=function(a){return void 0!==a.pc&&void 0!==a.pc[0]?a.pc[0]:void 0!==a.sc&&void 0!==a.sc[0]?a.sc[0]:void 0},CouponStorage.prototype.getProductCouponCodeFromStorageData=function(a){return a&&void 0!==a.pc&&void 0!==a.pc[0]?a.pc[0]:null};var CouponStorageService=new CouponStorage;if(void 0!==CouponStorageService)var CouponBannerWidgetHandler=new(function(){function a(){website_config.coupon_enable_banner&&this.showCouponBanner()}return a.prototype.showCouponBanner=function(){var a=this;a.getCouponCode().then(function(b){if(website_config.coupon_enabled_via_url){var c=a.getParameterByName(website_config.coupon_storage_name);void 0!==c&&null!=c&&(b=c)}if("undefined"!=typeof DriCouponBannerWidget&&null!=b){var d=new DriCouponBannerWidget.CouponBannerWidget;d.setConfig({validate_coupon_url:website_config.checkout_api+"/validate-coupon-code/",website_code:website_config.website_code,coupon_enable_partner:website_config.coupon_enable_partner,act_field:website_config.auth.act_field}),d.getCouponBannerMessage("comp_coupon_banner",b).then(function(a){a&&website_config.coupon_enable_partner&&void 0!==document.getElementById("apply_partner_coupon_link")&&document.getElementById("apply_partner_coupon_link").addEventListener("click",function(){void 0!==d.partnerCouponDetails.coupon_code&&void 0!==d.partnerCouponDetails.cp_storage_data&&(CouponStorageService.setStorageData(d.partnerCouponDetails.cp_storage_data),location.reload())})})}})},a.prototype.getCouponCode=function(){return new Promise(function(a,b){var c=CouponStorageService.getStorageData();a(c?CouponStorageService.getCouponCodeFromStorageData(c):null)})},a.prototype.getParameterByName=function(a,b){b||(b=window.location.href),a=a.replace(/[\[\]]/g,"\\$&");var c=new RegExp("[?&]"+a+"(=([^&#]*)|&|#|$)"),d=c.exec(b);return d?d[2]?decodeURIComponent(d[2].replace(/\+/g," ")):"":null},a}());

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.