‘; // Check if i am on frontpage if (window.location.href.indexOf ( “. Htm”) === -1) {if ($ ( “.desktopNotification__banner”). Length === 0) $ ( “# . header “) append (html content); ..} $ ( “.desktopNotification__banner”) Parent () css ({ “clear”: “both”}); . $ ( “.desktopNotification__banner”) Css ({ “display”, “block”}); . $ ( “.desktopNotification__banner__Btn__Close”) One ( “click”, function () {document.cookie = “desktopNotification = false”; $ ( “.desktopNotification__banner”) css ({ “display”, “none”});.} ); var myC = document.cookie; . If (myC.indexOf ( “desktopNotification =”) & gt; -1) {$ ( “.desktopNotification__banner”) css ({ “display”, “none”}); } If (window.Notification & amp; & amp; window.Notification.permission === “granted”) {$ ( “.desktopNotification__banner”) css ({ “display”, “none”.}); }} Function highlightNotificationButton () {. $ ( “.desktopNotification__btn__check”) One ( “click”, function () {Notification.requestPermission (function () {checkPermission ();});}); checkPermission (); } Function checkDependencies () {if (typeof console === ‘undefined’) {console = {log: function () {}}; } // This totaly breaks the workflow of developing interactive Articles // TODO: Solutions havebeen Discussed with Henry, please find a different approach // console = {log: function () {}}; // Disable console // used for tracking if (typeof gtmDataLayer === ‘undefined’) {gtmDataLayer = []; }} Function requestNewArticlesWithIntervall () {setInterval (function () {requestLatestArticles ();}, cfg.requestIntervall); } Function Hasper mission () {if (Notification.permission === “granted”) {return true; } Else {return false; }} Function askPermission () {if (cfg.addPermissionButton === true) {$ ( “body”) append ( ‘. “); $ (Document) .on ( “click”, “#askNotificationPermission”, function () {Notification.requestPermission (); $ ( “#askNotificationPermission”) hide ();.}); } If (cfg.askPermissionOnLoad === true) {Notification.requestPermission (); }} Function sendNotification (articlelist) {var lastNotificationId = “”; for (var i = 0; i 0) {sendNotification (diffNewArticles); diffNewArticles = []; .}}} Function addButtonHandler () {$ ( “#requestPermission”) one ( “click”, function () {Notification.requestPermission ();}); . $ ( “#checkPermission”) One ( “click”, function () {if (Notification.permission) {// Firefox $ ( “#result”) val (Notification.permission).} Else {// Chrome $ . ( “#result”) val (new Notification ( “check”) permission.);}}); . $ ( “#show”) One ( “click”, function () {sendNotification ();}); } Function checkPermission () {if {$ ( “.desktopNotification__btn__check”) html ( “Your browser does not support notifications”) (window.Notification!). $ ( “.desktopNotification__btn__check”) AddClass ( “desktopNotification__btn__check-denied”) return. } If (Notification.permission === “granted”) {$ ( “.desktopNotification__btn__check”) html ( “Notifications are already turned on.”); $ ( “.desktopNotification__btn__check”) AddClass ( “desktopNotification__btn__check – granted”). .} If (Notification.permission === “denied”) {$ ( “.desktopNotification__btn__check”) html ( “Notifications are disabled”); $ ( “.desktopNotification__btn__check”) AddClass ( “desktopNotification__btn__check – denied.”); }} Var methods = {init: function () {init (); }, AddNotificationBanner: function () {addNotificationBanner (); }, SendNotification: function (articlelist) {sendNotification (articlelist); }, RequestLatestArticles: function () {requestLatestArticles (); }} Return methods; }) (JQuery); $ (Function () {$ (document) .ready (function () {desktopPushNotification = desktopPushNotificationNew; if (window.featureToggler & amp; & amp; window.featureToggler.desktopPushNotification === true) {desktopPushNotification.addNotificationBanner ();} desktopPushNotification. init ();});});
<- audio id:.! sorry! no ->
dpa / tba
No comments:
Post a Comment