www.goodreturns.in Open in urlscan Pro
2606:4700:4400::ac40:94ba  Public Scan

URL: https://www.goodreturns.in/common/build/js/site-notification-desk.min.js?v=2.0.43
Submission: On October 14 via manual from GB — Scanned from GB

Form analysis 0 forms found in the DOM

Text Content

var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,b,c){a instanceof String&&(a=String(a));for(var d=a.length,e=0;e<d;e++){var g=a[e];if(b.call(c,g,e,a))return{i:e,v:g}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};
$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(a,b,c,d){if(b){c=$jscomp.global;a=a.split(".");for(d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:b})}};
$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).v}},"es6","es3");$jscomp.SYMBOL_PREFIX="jscomp_symbol_";$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.Symbol=function(){var a=0;return function(b){return $jscomp.SYMBOL_PREFIX+(b||"")+a++}}();
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.iterator;a||(a=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&$jscomp.defineProperty(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(a){var b=0;return $jscomp.iteratorPrototype(function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}})};
$jscomp.iteratorPrototype=function(a){$jscomp.initSymbolIterator();a={next:a};a[$jscomp.global.Symbol.iterator]=function(){return this};return a};$jscomp.makeIterator=function(a){$jscomp.initSymbolIterator();var b=a[Symbol.iterator];return b?b.call(a):$jscomp.arrayIterator(a)};$jscomp.FORCE_POLYFILL_PROMISE=!1;
$jscomp.polyfill("Promise",function(a){function b(){this.batch_=null}function c(a){return a instanceof e?a:new e(function(b,c){b(a)})}if(a&&!$jscomp.FORCE_POLYFILL_PROMISE)return a;b.prototype.asyncExecute=function(a){null==this.batch_&&(this.batch_=[],this.asyncExecuteBatch_());this.batch_.push(a);return this};b.prototype.asyncExecuteBatch_=function(){var a=this;this.asyncExecuteFunction(function(){a.executeBatch_()})};var d=$jscomp.global.setTimeout;b.prototype.asyncExecuteFunction=function(a){d(a,
0)};b.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=this.batch_;this.batch_=[];for(var b=0;b<a.length;++b){var c=a[b];delete a[b];try{c()}catch(m){this.asyncThrow_(m)}}}this.batch_=null};b.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a;})};var e=function(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var b=this.createResolveAndReject_();try{a(b.resolve,b.reject)}catch(p){b.reject(p)}};e.prototype.createResolveAndReject_=
function(){function a(a){return function(d){c||(c=!0,a.call(b,d))}}var b=this,c=!1;return{resolve:a(this.resolveTo_),reject:a(this.reject_)}};e.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof e)this.settleSameAsPromise_(a);else{a:switch(typeof a){case "object":var b=null!=a;break a;case "function":b=!0;break a;default:b=!1}b?this.resolveToNonPromiseObj_(a):this.fulfill_(a)}};e.prototype.resolveToNonPromiseObj_=function(a){var b=
void 0;try{b=a.then}catch(p){this.reject_(p);return}"function"==typeof b?this.settleSameAsThenable_(b,a):this.fulfill_(a)};e.prototype.reject_=function(a){this.settle_(2,a)};e.prototype.fulfill_=function(a){this.settle_(1,a)};e.prototype.settle_=function(a,b){if(0!=this.state_)throw Error("Cannot settle("+a+", "+b|"): Promise already settled in state"+this.state_);this.state_=a;this.result_=b;this.executeOnSettledCallbacks_()};e.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a=
this.onSettledCallbacks_,b=0;b<a.length;++b)a[b].call(),a[b]=null;this.onSettledCallbacks_=null}};var g=new b;e.prototype.settleSameAsPromise_=function(a){var b=this.createResolveAndReject_();a.callWhenSettled_(b.resolve,b.reject)};e.prototype.settleSameAsThenable_=function(a,b){var c=this.createResolveAndReject_();try{a.call(b,c.resolve,c.reject)}catch(m){c.reject(m)}};e.prototype.then=function(a,b){function c(a,b){return"function"==typeof a?function(b){try{d(a(b))}catch(r){f(r)}}:b}var d,f,g=new e(function(a,
b){d=a;f=b});this.callWhenSettled_(c(a,d),c(b,f));return g};e.prototype.catch=function(a){return this.then(void 0,a)};e.prototype.callWhenSettled_=function(a,b){function c(){switch(d.state_){case 1:a(d.result_);break;case 2:b(d.result_);break;default:throw Error("Unexpected state: "+d.state_);}}var d=this;null==this.onSettledCallbacks_?g.asyncExecute(c):this.onSettledCallbacks_.push(function(){g.asyncExecute(c)})};e.resolve=c;e.reject=function(a){return new e(function(b,c){c(a)})};e.race=function(a){return new e(function(b,
d){for(var e=$jscomp.makeIterator(a),f=e.next();!f.done;f=e.next())c(f.value).callWhenSettled_(b,d)})};e.all=function(a){var b=$jscomp.makeIterator(a),d=b.next();return d.done?c([]):new e(function(a,e){function f(b){return function(c){g[b]=c;m--;0==m&&a(g)}}var g=[],m=0;do g.push(void 0),m++,c(d.value).callWhenSettled_(f(g.length-1),e),d=b.next();while(!d.done)})};return e},"es6","es3");
$jscomp.checkStringArgs=function(a,b,c){if(null==a)throw new TypeError("The 'this' value for String.prototype."+c+" must not be null or undefined");if(b instanceof RegExp)throw new TypeError("First argument to String.prototype."+c+" must not be a regular expression");return a+""};
$jscomp.polyfill("String.prototype.repeat",function(a){return a?a:function(a){var b=$jscomp.checkStringArgs(this,null,"repeat");if(0>a||1342177279<a)throw new RangeError("Invalid count value");a|=0;for(var d="";a;)if(a&1&&(d+=b),a>>>=1)b+=b;return d}},"es6","es3");
var gsid,BROWSER_SUPPORTS=1,dbname="engoodreturns-store",dbversion="3",ARTICLE_STORE="notification-article-db",UIDSTORE="unique-id-store",service_worker,db_type,db_city_id,db_city_name,db_sub_text,db_unsub_text,db_sub_btn,db_unsub_btn,db,idb_server_id,idb_subscription_id,last_sub_id,idb,db1,db2,redirectUrl,furl={},notificationApi={},licount,utmval="utm_source=pn-desktop&utm_medium=pn-article&utm_campaign=pn-cms&ref=pn-cms";globalUtmForNoti&&(utmval=globalUtmForNoti);
var notfslider,openNotify,k,l,myRecord,notification_source=1,chkcookiepolicy=getUserCookie("cookiePolicy"),noti_page_type="home",noti_module_name="home";document.querySelector("head")&&document.querySelector("head").hasAttribute("data-content_type")&&(noti_page_type=document.querySelector("head").getAttribute("data-content_type"),void 0!=noti_page_type||""!=noti_page_type||null!=noti_page_type)&&(noti_page_type=noti_page_type.toLowerCase());
if(document.querySelector("head")&&document.querySelector("head").hasAttribute("data-module_name")){if(noti_module_name=document.querySelector("head").getAttribute("data-module_name"),void 0!=noti_module_name||""!=noti_module_name||null!=noti_module_name)noti_module_name=noti_module_name.toLowerCase()}else document.querySelector("head")&&document.querySelector("head").hasAttribute("data-category_name")&&(noti_module_name=document.querySelector("head").getAttribute("data-category_name"),void 0!=noti_module_name||
""!=noti_module_name||null!=noti_module_name)&&(noti_module_name=noti_module_name.toLowerCase());console.log("Page : "+noti_page_type+" & Category : "+noti_module_name);0==chkcookiepolicy&&clearTimeout(openNotify);Object.defineProperties(window,{indexedDB:{value:window.indexedDB,writable:!0}});
if(/(chrome\/)(\d+\.\d+)/i.test(navigator.userAgent)&&0>navigator.userAgent.search("UCBrowser")&&/(chrome\/)(\d+\.\d+)/i.test(navigator.userAgent)&&0>navigator.userAgent.search("Edge")&&/(chrome\/)(\d+\.\d+)/i.test(navigator.userAgent)&&0>navigator.userAgent.search("UBrowser")){var bversion=new Number(RegExp.$2);42<=parseInt(bversion)&&(BROWSER_SUPPORTS=1)}var browserName;
function browserDetection(){var a=navigator.userAgent;browserName=navigator.appName;var b=""+parseFloat(navigator.appVersion);parseInt(navigator.appVersion,10);var c,d;var e=navigator.userAgent;e.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i);var g="desktop";/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(e)&&(g="mobile");-1!=(c=a.indexOf("OPR/"))?(browserName="Opera",b=a.substring(c+4)):-1!=(c=a.indexOf("Opera"))?(browserName="Opera",b=a.substring(c+6),
-1!=(c=a.indexOf("Version"))&&(b=a.substring(c+8))):-1!=(c=a.indexOf("MSIE"))?(browserName="Microsoft Internet Explorer",b=a.substring(c+5)):-1!=(c=a.indexOf("Chrome"))?(browserName="Chrome",b=a.substring(c+7)):-1!=(c=a.indexOf("Safari"))?(browserName="Safari",b=a.substring(c+7),-1!=(c=a.indexOf("Version"))&&(b=a.substring(c+8))):-1!=(c=a.indexOf("Firefox"))?(browserName="Firefox",b=a.substring(c+8)):(e=a.lastIndexOf(" ")+1)<(c=a.lastIndexOf("/"))&&(browserName=a.substring(e,c),b=a.substring(c+1),
browserName.toLowerCase()==browserName.toUpperCase()&&(browserName=navigator.appName));-1!=(d=b.indexOf(";"))&&(b=b.substring(0,d));-1!=(d=b.indexOf(" "))&&(b=b.substring(0,d));a=parseInt(""+b,10);isNaN(a)&&(b=""+parseFloat(navigator.appVersion),parseInt(navigator.appVersion,10));console.log("Browser name  = <em>"+browserName+"</em><br>Full version  = <em>"+b+"</em><br>Device = <em>"+g);"Chrome"==browserName&&42<=b?BROWSER_SUPPORTS=1:"Firefox"==browserName&&44<=b&&"desktop"==g&&(BROWSER_SUPPORTS=
1)}browserDetection();
notificationApi={html_entity_decode:function(a){var b=document.createElement("textarea");b.innerHTML=a.replace(/</g,"&lt;").replace(/>/g,"&gt;");return b.value},shareContent:function(a,b,c,d){return"<div class='article-slider-sharelinks'><a href='javascript:void(0);' class='article-share'><i class='fa fa-share-alt'></i></a><div class='article-slider-num'><span>"+a+"/"+b+"</span></div><div class='article-slider-footer'><a href='#' class='article-slider-facebook' data-url='"+c+"' data-title='"+d+"'><i class='fa fa-facebook'></i></a><a href='#' class='article-slider-twitter' data-url='"+
c+"' data-title='"+d+"'><i class='fa fa-twitter'></i></a><a href='javascript:void(0);' class='article-social-close'>X</a></div></div>"},removeDuplicatesFromObjArray:function(a,b){var c=[];a.reduce(function(a,e){a[b]!==e[b]&&c.push(e);return e},[]);return c},getAllData:function(){var a=window.indexedDB.open(dbname,dbversion);a.onsuccess=function(b){db1=a.result;if(db1.objectStoreNames.contains(ARTICLE_STORE)){b=db1.transaction([ARTICLE_STORE],"readwrite");b.oncomplete=function(a){console.log("Complete")};
b.onerror=function(a){console.log("Error")};var c=b.objectStore(ARTICLE_STORE).getAll();c.onsuccess=function(a){var b=c.result;a=document.getElementById("notification-content");b=notificationApi.removeDuplicatesFromObjArray(b,"url");console.log(b);console.log(b.length);licount=b.length;0==licount?($(".notification-num").hide(),document.getElementById("clear-inbox")&&(document.getElementById("clear-inbox").style.display="none")):(10<licount&&(licount=10),$(".notification-num").text(licount).show(),
document.getElementById("clear-inbox")&&(document.getElementById("clear-inbox").style.display="block"));var d=10>=b.length?parseInt(b.length)-1:9;b=b.reverse();for(var h="",f=0;f<=d;f++)if(""!=b[f].url){var p=b[f].id+"?"+b[f].url;-1<b[f].url.indexOf("?")?b[f].url=b[f].url+"&"+utmval:b[f].url=b[f].url+"?"+utmval;var m=parseInt(f)+1,n=parseInt(licount);m=notificationApi.shareContent(m,n,b[f].url,b[f].title);n=b[f].pdate;n=""==n||"undefined"==n||null==n?"":notificationApi.getDateFormat(n);var q=b[f].fdesc;
if(""==q||"undefined"==q||null==q)q="";"-1"<b[f].image.indexOf("/100x90x100")?b[f].image=b[f].image.replace("/100x90x100",""):"-1"<b[f].image.indexOf("/100x90x75")?b[f].image=b[f].image.replace("/100x90x75",""):b[f].image=b[f].image;h+="<li><div class='article-slider-container'><a href='"+b[f].url+"' id='notanchor' data-url='"+p+"' data-index='"+f+"' data-type='article'><div class='article-slider-thumb'><img src='"+b[f].image+"' alt='' /></div><div class='article-slider-details'><h2 class='article-slider-title'>"+
b[f].title+"</h2><div class='article-slider-datetime'>"+n+"</div><div class='article-slider-desc'>"+q+"</div></div></a></div>"+m+"</li>"}b=notificationApi.html_entity_decode(h);a.innerHTML=b;a=$(".article-slider ul li").length;0<a&&(1>=a?$(".article-slider ul li").addClass("oneslide"):3>=a?$(".article-slider ul li").addClass("slide23"):setTimeout(function(){notfslider=$(".article-slider ul").bxSlider({pager:!1,slideMargin:25,slideWidth:320,moveSlides:1,minSlides:3,hideControlOnEnd:!0,infiniteLoop:!1})},
3E3),document.getElementById("notf-cont").style.display="block")}}};a.onupgradeneeded=function(a){a=a.target.result;console.log(a);a.objectStoreNames.contains(ARTICLE_STORE)||a.createObjectStore(ARTICLE_STORE);a.objectStoreNames.contains(UIDSTORE)||a.createObjectStore(UIDSTORE)}},deleteData:function(a){db1.transaction([ARTICLE_STORE],"readwrite").objectStore(ARTICLE_STORE).delete(a).onsuccess=function(b){console.log(a+" has been removed from your database.")}},clearData:function(){var a=window.indexedDB.open(dbname,
dbversion);a.onsuccess=function(b){db2=a.result;db2.transaction([ARTICLE_STORE],"readwrite").objectStore(ARTICLE_STORE).clear().onsuccess=function(a){console.log("Object Store has been cleared.")}}},manageNotificationListView:function(a,b,c){$("#licontent"+b).fadeOut(300,function(){$(this).remove()})},trackAppClicked:function(a){""!=a&&fetch("https://notification.oneindia.com/scripts/cms/subscriptionPage.php?module=notificationAppClicked&url="+a+"&last_sub_id="+last_sub_id,{method:"post"}).catch(function(a){console.error("Inside 1st error:",
a)})},displayNumberNotification:function(){licount--;$(".notification-num").text(licount);0==licount&&(document.getElementById("notf-cont").style.display="none",$(".notification-num").hide(),$(".notification-text").show(),setTimeout(function(){$(".notification-wrapper").hide()},1E3))},getDateFormat:function(a){var b=new Date(a);a=b.getFullYear();var c=b.getMonth(),d=b.getDate(),e=b.getHours();b=b.getMinutes();10>b&&(b="0"+b);c="January February March April May June July August September October November December".split(" ")[c];
return c+" "+d+", "+a+", "+e+":"+b+"[IST]"},truncateWords:function(a,b){return a.split(" ").splice(0,b).join(" ")},openManageScreen:function(a){var b=$(".article-slider ul li").length;0==a?setTimeout(function(){$(".notification-wrapper").hide()},1E3):(0==b?($(".article-slider-wrapper,.article-overlay").addClass("show-popup"),$(".article-slider-container").show(),$(".article-slider-container").css("overflow-y","hidden"),$(".article-slider").hide()):($(".article-slider").find("li").css("width","320px"),
$(".article-slider-wrapper,.article-overlay").addClass("show-popup")),$(".notification-settings-clearbox").hide())},manageOnOff:function(a,b){0==a?($("."+b).removeClass("onstate"),$("."+b).addClass("offstate"),notificationApi.manageEnableDisable(0),notificationApi.clearData(),$(".notification-bell").hide(),$(".notification-bell-inactive").show(),$(".notification-num").hide(),$(".articlelist").remove()):($("."+b).addClass("onstate"),$("."+b).removeClass("offstate"),$(".notification-bell").show(),$(".notification-bell-inactive").hide(),
notificationApi.manageEnableDisable(1))},manageEnableDisable:function(a){localStorage.getItem("web_id");var b=localStorage.getItem("engoodreturns_subscription_id");if(""!=b&&void 0!=b)fetch("https://notification.oneindia.com/scripts/cms/subscriptionPage.php?module=manageEnableDisable&last_sub_id="+b+"&active_status="+a,{method:"post"}).then(function(b){b.text().then(function(b){console.log(b);localStorage.setItem("engoodreturns_enabled",a);notificationApi.openManageScreen(0)})})["catch"](function(a){console.log("Fetch Error :-S",
a)})},detectPrivateWindow:function(){var a=window.RequestFileSystem||window.webkitRequestFileSystem;a?a(window.TEMPORARY,100,function(a){console.log("Normal Mode")},function(a){console.log("incognito Mode");alert("You are in incognito mode.\nSome of the functionalities may not work.")}):console.log("No such Functions....")},manageFooterEnableClick:function(a){$(".notification-bell").show();$(".notification-bell-inactive").hide();localStorage.getItem("web_id");var b=localStorage.getItem("engoodreturns_subscription_id");
$(".manage-notification").show();setTimeout(function(){$(".manage-notification").hide()},5E3);$(".manage-notification-close").on("touchstart click",function(a){$(".manage-notification").hide("slow")});if(""!=b&&void 0!=b)fetch("https://notification.oneindia.com/scripts/cms/subscriptionPage.php?module=manageEnableDisable&last_sub_id="+b+"&active_status="+a,{method:"post"}).then(function(b){b.text().then(function(b){console.log(b);localStorage.setItem("fbtamil_enabled",a);$("#notification-link").hide()})})["catch"](function(a){console.log("Fetch Error :-S",
a)})},manageNotifyProduct:function(a,b){document.getElementById("gr-modlule-notify-loader")&&($("#gr-modlule-notify-loader").css("display","block"),$("#gr-modlule-notify-subscribe").css("display","none"),$("#gr-modlule-notify-unsubscribe").css("display","none"));localStorage.getItem("web_id");var c=localStorage.getItem("engoodreturns_subscription_id"),d=[],e=[],g=localStorage.getItem("gr_product_type"),h=localStorage.getItem("gr_product_city");if(""==g||"undefined"==g||null==g)g="";if(""==h||"undefined"==
h||null==h)if(""==b||"undefined"==b||null==b)b="NC";if(""==g)d.push(a),localStorage.setItem("gr_product_type",JSON.stringify(d));else{if(""==b||"undefined"==b||null==b)b="NC";d=JSON.parse(g);d.push(a);localStorage.setItem("gr_product_type",JSON.stringify(d));e=JSON.parse(h)}e.push(b);localStorage.setItem("gr_product_city",JSON.stringify(e));g=[];for(var f in d)g.push({type:d[f],city:e[f]});if(""!=c&&void 0!=c)fetch("/scripts/cms/controller.php?module=subscription&type=manageNotifyProduct&last_sub_id="+
c+"&gr_db_info="+JSON.stringify(g),{method:"post"}).then(function(c){c.text().then(function(c){console.log(c);c=localStorage.getItem("gr_product_type");var f=localStorage.getItem("gr_product_city");if(""==c||"undefined"==c||null==c)c="";if(""==f||"undefined"==f||null==f)if(""==b||"undefined"==b||null==b)b="NC";if(""==c)d.push(a),localStorage.setItem("gr_product_type",JSON.stringify(d)),e.push(b),localStorage.setItem("gr_product_city",JSON.stringify(e));else{if(""==b||"undefined"==b||null==b)b="NC";
d=JSON.parse(c);"-1"==d.indexOf(a)&&(d.push(a),localStorage.setItem("gr_product_type",JSON.stringify(d)),e=JSON.parse(f),e.push(b),localStorage.setItem("gr_product_city",JSON.stringify(e)))}document.getElementById("gr-modlule-notify-unsubscribe")&&($("#gr-modlule-notify-loader").css("display","none"),$("#gr-modlule-notify-subscribe").css("display","none"),$("#gr-modlule-notify-unsubscribe").css("display","block"))})})["catch"](function(a){console.log("Fetch Error :-S",a)})},manageNotificationBlock:function(){console.log(browserName);
if("Firefox"==browserName){$(".manage-notification-block-top-firefox").show();$("html,body").css("overflow","hidden");setUserCookie("manage_engoodreturns_notification_block",1,1440,"/","","");var a=setTimeout(function(){$(".manage-notification-block-top-firefox").hide();$("html,body").css("overflow","auto")},2E4);$(".click-close").on("click",function(b){$(".manage-notification-close-block-firefox").hide("slow");$("html,body").css("overflow","auto");clearTimeout(a)})}else $(".manage-notification-block-top").show(),
$("html,body").css("overflow","hidden"),setUserCookie("manage_engoodreturns_notification_block",1,1440,"/","",""),a=setTimeout(function(){$(".manage-notification-block-top").hide();$("html,body").css("overflow","auto")},1E4),$(".click-close-firefox").on("click",function(b){$(".manage-notification-block-top").hide("slow");$("html,body").css("overflow","auto");clearTimeout(a)});$(document).on("click",".click-close",function(b){$(".manage-notification-block-top").hide();$("html,body").css("overflow",
"auto");clearTimeout(a)});$(document).on("click",".click-close-firefox",function(b){$(".manage-notification-block-top-firefox").hide();$("html,body").css("overflow","auto");clearTimeout(a)})},manageArticleBottom:function(a){0==a?("default"==Notification.permission&&document.getElementById("notification-articleblock")&&(document.getElementById("notification-articleblock").style.display="block",document.getElementById("already-subscribed").style.display="none",document.getElementById("allow-notifications").style.display=
"block"),document.querySelector(".oi-dailyalerts")&&(document.querySelector(".oi-dailyalerts").style.display="block"),document.getElementById("giz-emailsubscribe")&&(document.getElementById("giz-emailsubscribe").style.display="none"),"default"==Notification.permission?(document.getElementById("giz-unsubscribe")&&(document.getElementById("giz-unsubscribe").style.display="none"),document.getElementById("giz-subscribe")&&(document.getElementById("giz-subscribe").style.display="block")):(document.getElementById("giz-unsubscribe")&&
(document.getElementById("giz-unsubscribe").style.display="block"),document.getElementById("giz-subscribe")&&(document.getElementById("giz-subscribe").style.display="none"))):(document.getElementById("notification-articleblock")&&(document.getElementById("notification-articleblock").style.display="none",document.getElementById("already-subscribed").style.display="none",document.getElementById("allow-notifications").style.display="none"),document.querySelector(".oi-dailyalerts")&&(document.querySelector(".oi-dailyalerts").style.display=
"none"),document.getElementById("giz-unsubscribe")&&(document.getElementById("giz-unsubscribe").style.display="none"),document.getElementById("giz-emailsubscribe")&&(document.getElementById("giz-emailsubscribe").style.display="block"),document.getElementById("giz-subscribe")&&(document.getElementById("giz-subscribe").style.display="none"))},updateIndexDb:function(a){var b=window.indexedDB.open(dbname,dbversion);b.onsuccess=function(c){db1=b.result;var d=db1.transaction([dbname],"readwrite");d.objectStore(dbname).get("subscriptionid").onsuccess=
function(b){d.objectStore(dbname).put(a,"subscriptionid")}}},createFcmToken:function(a,b){navigator.serviceWorker.ready.then(function(a){service_worker=a;a.pushManager.subscribe({userVisibleOnly:!0}).then(function(a){a="subscriptionId"in a?a.subscriptionId:a.endpoint.replace("https://fcm.googleapis.com/fcm/send/","");console.log(a+" : New Token Generated");notificationApi.sendTokenToServer(a,b)}).catch(function(a){console.log("An error occurred while retrieving token. ",a)})})},sendTokenToServer:function(a,
b){if(""!=b&&void 0!=b)fetch("https://notification.oneindia.com/scripts/cms/subscriptionPage.php?module=sendTokenToServer&last_sub_id="+b+"&currentToken="+a,{method:"post"}).then(function(c){c.text().then(function(c){console.log(c);localStorage.setItem("engoodreturns_enabled",1);localStorage.setItem("engoodreturns_subscription_id",b);notificationApi.updateIndexDb(a)})})["catch"](function(a){console.log("Fetch Error :-S",a)})},getUserStatus:function(a){if(""!=a&&void 0!=a)fetch("https://notification.oneindia.com/scripts/cms/subscriptionPage.php?module=getNotificationStatus&last_sub_id="+
a,{method:"post"}).then(function(b){b.text().then(function(b){console.log(b);var c=JSON.parse(b);(3==c.active_status||"2024-01-11 23:59:59">c.added_date&&"0000-00-00 00:00:00"==c.pushed_date)&&navigator.serviceWorker.getRegistration().then(function(c){c.unregister().then(function(){localStorage.removeItem("engoodreturns_subscription_id");return navigator.serviceWorker.register("/oiframework-sw-web.js?v="+version).then(function(){console.log("Service Worker Registered");notificationApi.createFcmToken(b,
a)})}).then(function(a){c!==a})})})})["catch"](function(a){console.log("Fetch Error :-S",a)})},manageSettingsStorage:function(a,b){localStorage.getItem("web_id");var c=localStorage.getItem("engoodreturns_subscription_id");if(""!=c&&void 0!=c)fetch("https://notification.oneindia.com/scripts/cms/subscriptionPage.php?module=manageEnableDisable&last_sub_id="+c+"&active_status="+a,{method:"post"}).then(function(c){c.text().then(function(c){localStorage.setItem("engoodreturns_enabled",a);0==a?setUserCookie("engoodreturns_disabled_val",
b,b,"/","",""):(deleteUserCookie("engoodreturns_disabled_val","/",""),console.log("cookie Deleted......"))})})["catch"](function(a){console.log("Fetch Error :-S",a)})},manageLocalDbInfo:function(a){var b=window.indexedDB.open(dbname,dbversion);b.onsuccess=function(c){db1=b.result;db1.objectStoreNames.contains(dbname)&&db1.transaction([dbname],"readwrite").objectStore(dbname).put(a,"block_time")}}};
0==BROWSER_SUPPORTS&&(document.getElementById("notification-link")&&(document.getElementById("notification-link").style.display="none"),document.getElementById("giz-emailsubscribe")&&$("#giz-emailsubscribe").show());
if(1==BROWSER_SUPPORTS&&0!=chkcookiepolicy)try{require(["jquery","bxslider"],function(a){console.log(Notification.permission);if(document.getElementById("db_module_notification")){if("true"==a("#db_module_notification").attr("data-notify")){var b=a("#db_module_notification").attr("data-db-info");b&&(b=JSON.parse(b),db_type=b.type,db_city_id=b.city_id,db_city_name=b.city_name,db_sub_text=b.subscribe_text,db_unsub_text=b.unsubscribe_text,db_sub_btn=b.subscribe_button_text,db_unsub_btn=b.unsubscribe_button_text,
""==db_city_name||"undefined"==db_city_name||null==db_city_name)&&(db_city_name="NC")}if("default"==Notification.permission||"denied"==Notification.permission)localStorage.setItem("gr_product_type",""),localStorage.setItem("gr_product_city",""),a("#gr-modlule-notify-subscribe").css("display","block"),a("#gr-modlule-notify-unsubscribe").css("display","none");else if("granted"==Notification.permission){var c=localStorage.getItem("gr_product_type");if(""==c||"undefined"==c||null==c)c="";if(void 0!=db_city_name&&
""!=db_city_name){var d=localStorage.getItem("gr_product_city");if(""==d||"undefined"==d||null==d)d=""}if(""!=c){b=[];c=JSON.parse(c);var e=JSON.parse(d);for(d=0;d<c.length;d++){var g={};g[c[d]]=e[d];b.push(g);g=b[d][db_type];console.log(g+"...."+db_city_name);if(g==db_city_name){a("#gr-modlule-notify-unsubscribe").css("display","block");a("#gr-modlule-notify-subscribe").css("display","none");break}else a("#gr-modlule-notify-unsubscribe").css("display","none"),a("#gr-modlule-notify-subscribe").css("display",
"block")}}else a("#gr-modlule-notify-subscribe").css("display","block"),a("#gr-modlule-notify-unsubscribe").css("display","none")}a("#gr-modlule-notify-subscribe").on("click",function(){"denied"==Notification.permission?notificationApi.manageNotificationBlock():"default"==Notification.permission?1==BROWSER_SUPPORTS&&(localStorage.setItem("gr_product_type",""),localStorage.setItem("gr_product_city",""),a(".oicms-nf-popup-text").html(db_sub_text),a(".notify-overlay").fadeIn(),a(".oicms-nf-popup").fadeIn(),
a("body").css("overflow","hidden"),a(".oicms-nf-cancel").click(function(){a(".notify-overlay").fadeOut();a(".oicms-nf-popup").fadeOut();a("body").css("overflow","inherit")}),a(".oicms-nf-ok").click(function(){a(".notify-overlay").fadeOut();a(".oicms-nf-popup").fadeOut();a("body").css("overflow","inherit");subscribeDevice("notify-product",db_type,db_city_name)})):1==BROWSER_SUPPORTS&&(a(".oicms-nf-popup-text").html(db_sub_text),a(".notify-overlay").fadeIn(),a(".oicms-nf-popup").fadeIn(),a("body").css("overflow",
"hidden"),a(".oicms-nf-cancel").click(function(){a(".notify-overlay").fadeOut();a(".oicms-nf-popup").fadeOut();a("body").css("overflow","inherit")}),a(".oicms-nf-ok").click(function(){a(".notify-overlay").fadeOut();a(".oicms-nf-popup").fadeOut();a("body").css("overflow","inherit");notificationApi.manageNotifyProduct(db_type,db_city_name)}))})}c=localStorage.getItem("engoodreturns_subscription_id");if(""==c||"undefined"==c||null==c)c="";"granted"==Notification.permission&&""!=c&&(notificationApi.getUserStatus(c),
notificationApi.getAllData());b=getUserCookie("isShown");if("undefined"==typeof b||null==b)notificationApi.detectPrivateWindow(),setUserCookie("isShown",1,1440,"/","","");c=localStorage.getItem("engoodreturns_subscription_id");b=localStorage.getItem("engoodreturns_enabled");if(""==b||"undefined"==b||null==b)b="";if("default"==Notification.permission){var h=getUserCookie("desktop_bsnotification_seen");"undefined"==typeof h||null==h?(openNotify=setTimeout(function(){a("div#oiNotification").addClass("shownotf")},
5E3),document.getElementById("notification_bell").style.display="none",setUserCookie("desktop_bsnotification_seen",1,48,"/","","")):(document.getElementById("notification_bell").style.display="block",a(".notification-bell").addClass("ismovement"));document.getElementById("giz-subscribe")&&a("#giz-subscribe").show();notificationApi.manageArticleBottom(0)}else if("denied"==Notification.permission)h=getUserCookie("desktop_bsnotification_seen"),"undefined"==typeof h||null==h?(openNotify=setTimeout(function(){a("div#oiNotification").addClass("shownotf")},
5E3),document.getElementById("notification_bell").style.display="none",setUserCookie("desktop_bsnotification_seen",1,48,"/","","")):(a(".notification-bell").hide(),a(".notification-bell-inactive").show()),document.getElementById("notification-link")&&a("#notification-link").show(),document.getElementById("giz-unsubscribe")&&a("#giz-unsubscribe").show(),notificationApi.manageArticleBottom(0);else{""==c||"undefined"==c||null==c?(subscribeDevice(),a(".notification-bell").hide(),notificationApi.manageArticleBottom(0)):
1==b?(a(".popup-notification-on-off").addClass("onstate"),a(".popup-notification-on-off").removeClass("offstate"),a(".notification-bell").show(),document.getElementById("notification-link")&&a("#notification-link").hide(),document.getElementById("giz-emailsubscribe")&&a("#giz-emailsubscribe").show(),notificationApi.manageArticleBottom(1)):(a(".popup-notification-on-off").removeClass("onstate"),a(".popup-notification-on-off").addClass("offstate"),a(".notification-bell-inactive").show(),document.getElementById("notification-link")&&
a("#notification-link").show(),document.getElementById("giz-unsubscribe")&&a("#giz-unsubscribe").show(),notificationApi.manageArticleBottom(0));a(".notification-bell").removeClass("ismovement");d=getUserCookie("engoodreturns_disabled_val");c=localStorage.getItem("engoodreturns_enabled_time");if(""==c||"undefined"==c||null==c)c="";console.log(d+" : Cookie Value For Radio Button");"undefined"==typeof d||null==d?(d=c.split("_")[0],e=c.split("_")[1],g=(new Date).getHours(),""!=e&&void 0!=e&&(h=g>=d&&
g<e?1:0),0==c||""==c?a("input[name=block-radio][value=0]").attr("checked","checked"):(d=c.split("_"),c=d[0],d=d[1],0==h?a("input[name=block-radio][value=0]").attr("checked","checked"):(a("input[name=block-radio][value=1]").attr("checked","checked"),a("#block-from").removeAttr("disabled"),a("#block-to").removeAttr("disabled")),a("#block-from option[value="+c+"]").attr("selected","selected"),a("#block-to option[value="+d+"]").attr("selected","selected")),1==b?(a(".notification-bell").show(),a(".notification-bell-inactive").hide()):
(a(".notification-bell").hide(),a(".notification-bell-inactive").show())):(a("input[name=block-radio][value="+d+"]").attr("checked","checked"),a(".notification-bell").hide(),a(".notification-bell-inactive").show())}a(".instant-updates-close-new").on("click",function(b){b.preventDefault();"denied"==Notification.permission?(a(".notification-bell").hide(),a(".notification-bell-inactive").show()):(document.getElementById("notification_bell").style.display="block",a(".notification-bell").addClass("ismovement"));
a("div#oiNotification").removeClass("shownotf")});a("#enable-btn").on("click",function(b){b.preventDefault();"denied"==Notification.permission?(a(".notification-bell").hide(),a(".notification-bell-inactive").show(),a("div#oiNotification").removeClass("shownotf"),b=getUserCookie("manage_engoodreturns_notification_block"),"undefined"!=typeof b&&null!=b||notificationApi.manageNotificationBlock()):(a("div#oiNotification").removeClass("shownotf"),1==BROWSER_SUPPORTS&&(notification_source=4,subscribeDevice(),
a(".notification-bell").removeClass("ismovement"),a(".notf-overlay").show()))});a(".notification-bell").on("click",function(){"denied"==Notification.permission?(a(".notification-bell").hide(),a(".notification-bell-inactive").show(),notificationApi.manageNotificationBlock()):"default"==Notification.permission?(1==BROWSER_SUPPORTS&&(subscribeDevice(),a(".notf-overlay").show()),a(".notification-bell").removeClass("ismovement")):(a("body,html").css("overflow","hidden"),notificationApi.openManageScreen(1))});
a("#notification_bell_left").on("click",function(){"denied"==Notification.permission?(a(".notification-bell").hide(),a(".notification-bell-inactive").show(),notificationApi.manageNotificationBlock()):"default"==Notification.permission?(1==BROWSER_SUPPORTS&&(notification_source=2,subscribeDevice(),a(".notf-overlay").show()),a(".notification-bell").removeClass("ismovement")):notificationApi.openManageScreen(1)});a(".notification_bell_unsub").on("click",function(){"denied"==Notification.permission?notificationApi.manageNotificationBlock():
notificationApi.openManageScreen(1)});a(".notification-bell-inactive").on("click",function(){"denied"==Notification.permission?notificationApi.manageNotificationBlock():notificationApi.openManageScreen(1)});if(document.getElementById("notification-articleblock"))a(".allow-notifications").on("click",function(){"denied"==Notification.permission?(a(".notification-bell").hide(),a(".notification-bell-inactive").show(),notificationApi.manageNotificationBlock()):"default"==Notification.permission?1==BROWSER_SUPPORTS&&
(notification_source=3,subscribeDevice(),a(".notf-overlay").show()):(notificationApi.manageOnOff(1,"popup-notification-on-off"),notificationApi.manageArticleBottom(1))});if(document.getElementById("notify-subscribe"))a("#notify-subscribe").on("click touchstart",function(){"denied"==Notification.permission?notificationApi.manageNotificationBlock():"default"==Notification.permission?1==BROWSER_SUPPORTS&&(subscribeDevice(),a(".notf-overlay").show()):0==localStorage.getItem("engoodreturns_enabled")&&
(a("#notification-link").show(),a(".popup-notification-on-off").addClass("onstate"),a(".popup-notification-on-off").removeClass("offstate"),notificationApi.manageFooterEnableClick(1))});a(document).on("click","#closebtn",function(b){b.preventDefault();notificationApi.displayNumberNotification();b=a(this).attr("data-url");var c=a(this).attr("data-index");notificationApi.manageNotificationListView(b,c,"close");notificationApi.deleteData(b)});a(document).on("click","#notanchor",function(b){b=a(this).attr("href");
a(this).attr("data-index");var c=a(this).attr("data-url");window.location.href=b+"?utm_source=pn-&utm_medium=pn-article&utm_campaign=pn-cms";b=b.split("?")[0];notificationApi.trackAppClicked(b);notificationApi.deleteData(c)});a(document).on("click",".popup-notification-on-off",function(b){a(this).hasClass("onstate")?(document.getElementById("notification-link")&&a("#notification-link").show(),notificationApi.manageOnOff(0,"popup-notification-on-off"),document.getElementById("giz-unsubscribe")&&a("#giz-unsubscribe").show(),
document.getElementById("giz-emailsubscribe")&&a("#giz-emailsubscribe").hide(),notificationApi.manageArticleBottom(0),licount=0):(document.getElementById("notification-link")&&a("#notification-link").hide(),notificationApi.manageOnOff(1,"popup-notification-on-off"),document.getElementById("giz-unsubscribe")&&a("#giz-unsubscribe").hide(),document.getElementById("giz-emailsubscribe")&&a("#giz-emailsubscribe").show(),notificationApi.manageArticleBottom(1))});a(document).on("click",".notification-clear",
function(b){notificationApi.clearData();a(".notification-text").show();a(".notification-num").hide();a(".articlelist").remove();document.getElementById("notf-cont").style.display="none";licount=0});a(".popup-notification-text").on("click",function(b){b.preventDefault();a(".notification-wrapper").hide()});a(document).on("click",".article-share",function(b){a(this).parent(".article-slider-sharelinks").find(".article-slider-footer").addClass("active")});a(document).on("click",".article-social-close",
function(b){a(".article-slider-footer").removeClass("active")});a(".notification-on-off .on-off-link").click(function(){a(this).parent(".notification-on-off").hasClass("onstate")?(a(this).parent(".notification-on-off").removeClass("onstate"),a(this).parent(".notification-on-off").addClass("offstate"),a(".notification-settings-popup").show()):(a(this).parent(".notification-on-off").addClass("onstate"),a(this).parent(".notification-on-off").removeClass("offstate"),a(".notification-settings-popup").hide())});
a(".notification-settings-heading span").click(function(){a(".notification-settings-popup").hide()});a(".article-popup-close").click(function(){a(".article-slider-wrapper,.article-overlay").removeClass("show-popup");a(".notification-settings-popup").hide();a(".article-slider-wrapper").removeClass("hide-popup");a(".notification-settings-clearbox").hide();a("body,html").css("overflow","")});a(".article-popup-settings").click(function(){a(this).parent().addClass("hide-popup");a(".notification-settings-popup").addClass("show-popup");
a(".notification-settings-popup").show()});a(".notification-settings.notfset").click(function(){a(".notification-settings-popup").removeClass("show-popup");a(".article-slider-wrapper").removeClass("hide-popup");a(".notification-settings-popup").hide()});a(".no").click(function(){a(".notification-settings-clearbox").hide();a(".notification-settings-popup").show()});a(".yes").click(function(){notificationApi.clearData();a(".notification-settings-popup").removeClass("show-popup");a(".article-slider-wrapper").removeClass("hide-popup");
a(".notification-settings-popup").hide();a(".notification-settings-clearbox").hide();a(".article-slider-wrapper,.article-overlay").addClass("show-popup");a(".article-slider-container").show();a(".article-slider").hide();a(".notification-num").hide()});a(".notification-settings-heading a").click(function(){a(".notification-settings-clearbox").show();a(".notification-settings-popup").hide()});a(".notification-settings.clearnotf").click(function(){a(".notification-settings-clearbox").hide();a(".notification-settings-popup").show()});
a(".notification-settings-btn").on("click",function(){if(1==a("input[name='block-radio']:checked").val()){var b=document.getElementById("block-from").value;var c=document.getElementById("block-to").value;var d=b+"_"+c;b==c?(a("#error_msg").html('<p style="color:red;font-size:15px;">Start Time and End Time should not be same.</p>').show(),setTimeout(function(){a("#error_msg").hide()},3E3)):(localStorage.setItem("engoodreturns_enabled_time",d),notificationApi.manageSettingsStorage(1,d),notificationApi.manageLocalDbInfo(d),
a("#error_msg").html('<p style="color:green;font-size:15px;">Settings data stored successfully.</p>').show(),setTimeout(function(){a("#error_msg").hide()},3E3),a(".notification-bell").show(),a(".notification-bell-inactive").hide())}else 0==a("input[name='block-radio']:checked").val()?(d=a("input[name='block-radio']:checked").val(),localStorage.setItem("engoodreturns_enabled_time",0),notificationApi.manageSettingsStorage(1,d),notificationApi.manageLocalDbInfo(0),a(".notification-bell").show(),a(".notification-bell-inactive").hide()):
(a("input[name='block-radio']:checked").val(),d=a("input[name='block-radio']:checked").val(),localStorage.setItem("engoodreturns_enabled_time",0),notificationApi.manageSettingsStorage(0,d),notificationApi.manageLocalDbInfo(0),a(".notification-bell").hide(),a(".notification-bell-inactive").show()),a("#error_msg").html('<p style="color:green;font-size:15px;">Settings data stored successfully.</p>').show(),setTimeout(function(){a("#error_msg").hide()},3E3)});a(".squaredradio input[name='block-radio']").on("click",
function(){1==a(this).val()&&a(this).is(":checked")?(a("#block-from").removeAttr("disabled"),a("#block-to").removeAttr("disabled")):(a("#block-from").attr("disabled",!0),a("#block-to").attr("disabled",!0))});a(document).on("click",".article-slider-footer a",function(b){var c=a(this).attr("class");console.log(c);var d=a(this).attr("data-url"),e=a(this).attr("data-title");switch(c){case "article-slider-whatsapp":whatsapp_social_url=encodeURIComponent(d);window.location.href="whatsapp://send?text="+
encodeURIComponent(e)+" "+whatsapp_social_url;break;case "article-slider-twitter":c=encodeURIComponent(d);e=encodeURIComponent(e);window.open("https://twitter.com/share?url="+c+"&via=GoodReturnsIN&text="+e,"Share on Twitter","menubar=no,toolbar=no,resizable=no,scrollbars=no,height=400,width=600");break;case "article-slider-facebook":e="https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(d),window.open(e,"Share on Facebook","menubar=no,toolbar=no,resizable=no,scrollbars=no,height=400,width=600")}b.preventDefault()})})}catch(a){console.log("Notification Block: "+
a)}function promisifyRequest(a){return new Promise(function(b,c){function d(){b(a.result);g()}function e(){c(a.error);g()}function g(){a.removeEventListener("complete",d);a.removeEventListener("success",d);a.removeEventListener("error",e);a.removeEventListener("abort",e)}a.addEventListener("complete",d);a.addEventListener("success",d);a.addEventListener("error",e);a.addEventListener("abort",e)})}
function IndexDBWrapper(a,b,c){var d=indexedDB.open(a,b);this.ready=promisifyRequest(d);d.onupgradeneeded=function(a){c(d.result,a.oldVersion)}}function databaseExists(a,b){var c=indexedDB.open(a),d=!0;c.onsuccess=function(){c.result.close();d||indexedDB.deleteDatabase(a);b(d)};c.onupgradeneeded=function(){d=!1}}
function createDatabase(a,b){window.indexedDB=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB;window.IDBTransaction=window.IDBTransaction||window.webkitIDBTransaction||window.msIDBTransaction;window.IDBKeyRange=window.IDBKeyRange||window.webkitIDBKeyRange||window.msIDBKeyRange;window.indexedDB||window.alert("Your browser doesn't support a stable version of IndexedDB.");var c,d=window.indexedDB.open(dbname,dbversion),e=function(a){console.log("Creating objectStore");
a.objectStoreNames.contains(dbname)||a.createObjectStore(dbname);a.objectStoreNames.contains(ARTICLE_STORE)||a.createObjectStore(ARTICLE_STORE);a.objectStoreNames.contains(UIDSTORE)||a.createObjectStore(UIDSTORE)};console.log(d);d.onerror=function(a){console.log("error: ")};d.onsuccess=function(g){c=d.result;console.log("success: "+c);c.setVersion&&c.version!=dbversion&&(c.setVersion(dbversion).onsuccess=function(){e(c)});g=c.transaction([dbname],"readwrite");g.objectStore(dbname).put(a,"subscriptionid");
g.objectStore(dbname).put(b,"server_id")};d.onupgradeneeded=function(a){console.log(a.target.result);e(a.target.result)}}
function onPushSubscription(a,b,c,d){$(".notf-overlay").hide();var e=getUserCookie("manage_engoodreturns_notification");console.log("pushSubscription = ");var g=localStorage.getItem("engoodreturns_subscription_id"),h=localStorage.getItem("engoodreturns_enabled");if(""==g||"undefined"==g||null==g)g="";if(""==h||"undefined"==h||null==h)h="";var f=localStorage.getItem("web_id");if(""==f||"undefined"==f||null==f)f="";gsid="subscriptionId"in a?a.subscriptionId:a.endpoint.replace("https://fcm.googleapis.com/fcm/send/",
"");console.log(gsid);0!=b?(document.getElementById("gr-modlule-notify-loader")&&($("#gr-modlule-notify-loader").css("display","block"),$("#gr-modlule-notify-subscribe").css("display","none"),$("#gr-modlule-notify-unsubscribe").css("display","none")),a=[],a.push({type:c,city:d}),a=JSON.stringify(a),a="/scripts/cms/controller.php?module=subscription&regId="+gsid+"&sys_gen_id="+g+"&gr_db_info="+a+"&notifyproduct="+b+"&notification_source="+notification_source+"&pagetype="+noti_page_type+"&category_name="+
noti_module_name):a="/scripts/cms/controller.php?module=subscription&regId="+gsid+"&sys_gen_id="+g+"&notification_source="+notification_source+"&pagetype="+noti_page_type+"&category_name="+noti_module_name;fetch(a,{method:"post"}).then(function(a){a.text().then(function(a){console.log(a);var h=JSON.parse(a);""==g&&(localStorage.setItem("engoodreturns_subscription_id",h.id),localStorage.setItem("engoodreturns_enabled",1));""==f&&localStorage.setItem("web_id",h.wi);if("updated"==h.msg||"exists"==h.msg){document.querySelector(".notification-bell")&&
(document.querySelector(".notification-bell").style.display="block");document.querySelector(".notification-bell-inactive")&&(document.querySelector(".notification-bell-inactive").style.display="none");localStorage.setItem("engoodreturns_enabled",1);document.getElementById("notification-link")&&$("#notification-link").hide();document.getElementById("giz-subscribe")&&$("#giz-subscribe").hide();document.getElementById("giz-emailsubscribe")&&$("#giz-emailsubscribe").show();if(0!=b){if(document.getElementById("gr-modlule-notify-unsubscribe")){a=
[];cityArr=[];c;d;if(""==d||"undefined"==d||null==d)d="NC";a.push(c);localStorage.setItem("gr_product_type",JSON.stringify(a));cityArr.push(d);localStorage.setItem("gr_product_city",JSON.stringify(cityArr));$("#gr-modlule-notify-loader").css("display","none");$("#gr-modlule-notify-subscribe").css("display","none");$("#gr-modlule-notify-unsubscribe").css("display","block")}}else localStorage.setItem("gr_product_type",""),localStorage.setItem("gr_product_city","");notificationApi.manageArticleBottom(1)}else if("success"==
h.msg){document.querySelector(".notification-bell")&&(document.querySelector(".notification-bell").style.display="block");document.querySelector(".notification-bell-inactive")&&(document.querySelector(".notification-bell-inactive").style.display="none");if("undefined"==typeof e||null==e)$(".manage-notification").show(),setUserCookie("manage_engoodreturns_notification",1,1440,"/","",""),setTimeout(function(){$(".manage-notification").hide()},5E3),$(".manage-notification-close").on("click",function(a){$(".manage-notification").hide("slow")});
onRegisterNotify(service_worker);localStorage.setItem("engoodreturns_enabled",1);document.getElementById("notification-link")&&$("#notification-link").hide();document.getElementById("giz-subscribe")&&$("#giz-subscribe").hide();document.getElementById("giz-emailsubscribe")&&$("#giz-emailsubscribe").show();notificationApi.manageArticleBottom(1);if(0!=b&&document.getElementById("gr-modlule-notify-unsubscribe")){a=[];cityArr=[];c;d;if(""==d||"undefined"==d||null==d)d="NC";a.push(c);localStorage.setItem("gr_product_type",
JSON.stringify(a));cityArr.push(d);localStorage.setItem("gr_product_city",JSON.stringify(cityArr));$("#gr-modlule-notify-loader").css("display","none");$("#gr-modlule-notify-subscribe").css("display","none");$("#gr-modlule-notify-unsubscribe").css("display","block")}}window.indexedDB.deleteDatabase(dbname).onsuccess=function(a){console.log("Database deleted successfully.");createDatabase(gsid,h.id)}})})["catch"](function(a){console.log("Fetch Error :-S",a)})}
function urlBase64ToUint8Array(a){var b="=".repeat((4-a.length%4)%4);a=(a+b).replace(/\-/g,"+").replace(/_/g,"/");a=window.atob(a);b=new Uint8Array(a.length);for(var c=0;c<a.length;++c)b[c]=a.charCodeAt(c);return b}
function subscribeDevice(a,b,c){a=void 0===a?0:a;var d={};messaging.requestPermission().then(function(){console.log("Notification permission granted.");return messaging.getToken()}).then(function(e){console.log("FCM token:",e);d.subscriptionId=e;onPushSubscription(d,a,b,c);$(".notf-overlay").hide()}).finally(function(){$(".notf-overlay").hide();var a=Notification.permission;console.log("Notification permission status:",a);"denied"==a&&fetch("https://notification.oneindia.com/scripts/cms/subscriptionPage.php?module=notificationBlocked&device_type=computer",
{method:"post",cache:"no-store"}).then(function(a){a.text().then(function(a){console.log(a)})})})}
function unsubscribeDevice(){navigator.serviceWorker.ready.then(function(a){a.pushManager.getSubscription().then(function(a){a&&a.unsubscribe().then(function(a){var b=localStorage.getItem("engoodreturns_subscription_id");if(""==b||"undefined"==b||null==b)b="";""!=b&&fetch("https://notification.oneindia.com/scripts/cms/subscriptionPage.php?module=unsubscribe&sys_gen_id="+b,{method:"post"}).then(function(a){a.text().then(function(c){console.log(c);c=JSON.parse(c);""==b&&localStorage.setItem("engoodreturns_subscription_id",
c.id);console.log("Unsubscribed from push: ",a)})})}).catch(function(a){console.log("Unsubscription error: ",a)})}).catch(function(a){console.error("Error thrown while unsubscribing from push messaging.",a)})})}function onRegisterNotify(a){try{a.showNotification("www.goodreturns.in",{body:"Thank you for subscribing to Goodreturns News alerts.",icon:"/images/goodreturns-144.png",vibrate:[300,100,400],tag:"engoodreturns-welcome",data:{url:"https://www.goodreturns.in"}})}catch(b){}}
function permissionStatusChange(a){switch(console.log("permissionStatusChange = ",a),a.status){case "denied":console.log("denied");break;case "granted":console.log("granted");break;case "prompt":console.log("prompt")}}
function setUpPushPermission(){navigator.permissions.query({name:"push",userVisibleOnly:!0}).then(function(a){permissionStatusChange(a);a.onchange=function(){permissionStatusChange(this)};navigator.serviceWorker.ready.then(function(a){a.pushManager.getSubscription().then(function(a){return a})["catch"](function(a){console.log("An error occured while calling getSubscription()",a)})})})["catch"](function(a){console.error(a);console.log("Ooops Unable to check the permission , Unfortunately the permission for push notifications couldn't be checked. Are you on Chrome 43+?")})}
function setUpNotificationPermission(){return"denied"===Notification.permission?console.log("Ooops Notifications are Blocked","Unfortunately notifications are permanently blocked. Please unblock / allow them to switch on push notifications."):"default"===Notification.permission?1:void navigator.serviceWorker.ready.then(function(a){a.pushManager.getSubscription().then(function(a){return a})})}
function initialiseState(){return"PushManager"in window?"permissions"in navigator?void setUpPushPermission():void setUpNotificationPermission():1}window.addEventListener("load",function(){1==BROWSER_SUPPORTS&&("granted"==Notification.permission?console.log("Granted Mode"):"default"==Notification.permission?console.log("Default Mode"):"denied"==Notification.permission&&console.log("Denied Mode"))});