var withoutSlug = true var allowNavigation = true; var _ain = { id: "2554", url: "https://www.newsbytesapp.com/news/science/mark-zuckerberg-built-sleep-box-for-his-wife/story", postid: "https://www.newsbytesapp.com/news/science/mark-zuckerberg-built-sleep-box-for-his-wife/story", maincontent: "article", title: "Mark Zuckerberg built this device to help his wife sleep", pubdate: "2019-04-29T12:05:00+0530", authors: "Shubham Sharma", sections: "Science News", tags: "Facebook, Mark Zuckerberg, Priscilla Chan", access_level: "free", reader_type: "anonymous", article_type: "article" }; window.setTimeout(() => { document.getElementsByClassName('navigation-events')[0].classList.toggle('expanded'); }, 5000); //Translator Service: var translatorService = {more:'अन्य'}; window.addEventListener("jsuseraction", function(event) { var sl = new scriptloader(window, document); window.dataLayer = window.dataLayer || []; window.dataLayer.push({ "gtm.start": new Date().getTime(), event: "gtm.js" }); window.readyFunctionExecuted = true; sl.seq([ {s: "https://www.googletagmanager.com/gtm.js?id=GTM-TJDRWKM&l=dataLayer", d: false}, "https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js", {s: "https://sb.scorecardresearch.com/beacon.js", d: false}, "https://cf-cdn.newsbytesapp.com/assets/dynamic/build/assets/components-BIlCi0N_.js" ], function(){window.readyFunction()}); }); function onJqueryLoad() { jQuery.event.special.touchstart = { setup: function(_, ns, handle) { this.addEventListener("touchstart", handle, { passive: !ns.includes("noPreventDefault") }); } }; jQuery.event.special.touchmove = { setup: function(_, ns, handle) { this.addEventListener("touchmove", handle, { passive: !ns.includes("noPreventDefault") }); } }; jQuery.event.special.wheel = { setup: function(_, ns, handle) { this.addEventListener("wheel", handle, { passive: true }); } }; jQuery.event.special.mousewheel = { setup: function(_, ns, handle) { this.addEventListener("mousewheel", handle, { passive: true }); } }; } var appVersion = "191."; var webComponentTemplateRoute = typeof partner != 'undefined' && partner ? "/nb/templates/web-components-partner/191." : "/nb/templates/web-components/191."; var nblocale = "en" var colorMap = JSON.parse(JSON.stringify({"bengaluru":"blue-violet","delhi":"blue-violet","mumbai":"blue-violet","Bengaluru":"blue-violet","Delhi":"blue-violet","Mumbai":"blue-violet","\u092c\u0947\u0902\u0917\u0932\u0941\u0930\u0941":"blue-violet","\u0926\u093f\u0932\u094d\u0932\u0940":"blue-violet","\u092e\u0941\u092e\u094d\u092c\u0908":"blue-violet","india":"persimmon","India":"persimmon","\u0926\u0947\u0936":"persimmon","default":"default","business":"cerulean-blue","Business":"cerulean-blue","\u092c\u093f\u095b\u0928\u0947\u0938":"cerulean-blue","world":"indigo","World":"indigo","\u0926\u0941\u0928\u093f\u092f\u093e":"indigo","politics":"pure-gold","Politics":"pure-gold","\u0930\u093e\u091c\u0928\u0940\u0924\u093f":"pure-gold","sports":"kermit-green","Sports":"kermit-green","\u0916\u0947\u0932\u0915\u0942\u0926":"kermit-green","science":"iris-blue","technology":"iris-blue","Science":"iris-blue","Technology":"iris-blue","\u091f\u0947\u0915\u094d\u0928\u094b\u0932\u0949\u091c\u0940":"iris-blue","reviews":"iris-blue","Reviews":"iris-blue","\u0930\u093f\u0935\u094d\u092f\u0941":"iris-blue","phone":"iris-blue","Phone":"iris-blue","\u092e\u094b\u092c\u093e\u0907\u0932":"iris-blue","tv":"iris-blue","TV":"iris-blue","Tv":"iris-blue","tV":"iris-blue","\u091f\u0947\u0932\u0940\u0935\u093f\u091c\u0928":"iris-blue","app":"iris-blue","App":"iris-blue","\u0910\u092a":"iris-blue","laptop":"iris-blue","Laptop":"iris-blue","\u0932\u0948\u092a\u091f\u0949\u092a":"iris-blue","fitness-bands":"iris-blue","Fitness-bands":"iris-blue","fitness bands":"iris-blue","Fitness Bands":"iris-blue","Fitness-Bands":"iris-blue","\u092b\u093f\u091f\u0928\u0947\u0938 \u092c\u0948\u0902\u0921\u094d\u0938":"iris-blue","speakers":"iris-blue","Speakers":"iris-blue","\u0938\u094d\u092a\u0940\u0915\u0930\u094d\u0938":"iris-blue","entertainment":"razzmatazz","Entertainment":"razzmatazz","\u092e\u0928\u094b\u0930\u0902\u091c\u0928":"razzmatazz","movie":"razzmatazz","Movie":"razzmatazz","\u092b\u093f\u0932\u094d\u092e":"razzmatazz","career":"windows-blue","Career":"windows-blue","\u0915\u0930\u093f\u092f\u0930":"windows-blue","lifestyle":"mountain-meadow","Lifestyle":"mountain-meadow","\u0932\u093e\u0907\u092b\u0938\u094d\u091f\u093e\u0907\u0932":"mountain-meadow","inspirational":"citrus","Inspirational":"citrus","auto":"rusty-orange","Auto":"rusty-orange","\u0911\u091f\u094b":"rusty-orange","car":"rusty-orange","Car":"rusty-orange","\u0915\u093e\u0930":"rusty-orange","bike":"rusty-orange","Bike":"rusty-orange","\u092e\u094b\u091f\u0930\u0938\u093e\u0907\u0915\u093f\u0932":"rusty-orange","weird":"electric-purple","Weird":"electric-purple","\u0905\u091c\u092c-\u0917\u091c\u092c":"electric-purple","exclusive":"spark-red","Exclusive":"spark-red","\u090f\u0915\u094d\u0938\u0915\u094d\u0932\u0942\u0938\u093f\u0935":"spark-red","doyouknow":"acadia","quote":"acadia","information":"acadia","similarincountries":"acadia","historical":"acadia","personal":"acadia","data":"acadia","definition":"acadia","breaking":"acadia","synopsis":"acadia","poll":"acadia","quiz":"acadia","doyouknowtint":"lily-white-gray-nurse","quotetint":"lily-white-gray-nurse","informationtint":"lily-white-gray-nurse","similarincountriestint":"lily-white-gray-nurse","historicaltint":"lily-white-gray-nurse","personaltint":"lily-white-gray-nurse","datatint":"lily-white-gray-nurse","definitiontint":"lily-white-gray-nurse","breakingtint":"lily-white-gray-nurse","synopsistint":"lily-white-gray-nurse","polltint":"lily-white-gray-nurse","quiztint":"lily-white-gray-nurse","phonetint":"froly","tvtint":"froly","apptint":"froly","laptoptint":"froly","speakerstint":"froly","fitness-bandstint":"froly","Phonetint":"froly","TVtint":"froly","Tvtint":"froly","tVtint":"froly","Apptint":"froly","Laptoptint":"froly","sciencetint":"froly","Sciencetint":"froly","businesstint":"froly","Businesstint":"froly","reviewstint":"froly","Reviewstint":"froly","Speakerstint":"froly","Fitness-bandstint":"froly","Fitness-Bandstint":"froly","Fitness Bandstint":"froly","movietint":"fiord","Movietint":"fiord","entertainmenttint":"fiord","Entertainmenttint":"fiord","cartint":"brandy-rose","biketint":"brandy-rose","Cartint":"brandy-rose","Biketint":"brandy-rose","autotint":"brandy-rose","Autotint":"brandy-rose","sportstint":"san-juan","Sportstint":"san-juan","brand":"brand","Brand":"brand","brandtint":"brand","Brandtint":"brand"})); window.scriptloader = function (w, d) { this.init(w, d); }; scriptloader.prototype = { init: function (w, d) { this.w = w; this.d = d; }, push: function(i) { console.log('Loading via scriptloader: ' + i.s); let f = this.d.getElementsByTagName('script')[0], j = this.d.createElement('script'); if(i.d) { j.defer = true; } else { j.async = true; } j.src = i.s; if(typeof i.o != 'undefined') { console.log('defining scriptloader onload and defer: ', i.d) if(i.d) { j.onload = i.o; } else { i.o(); } } // f.parentNode.insertBefore(j, f); this.d.body.appendChild(j) }, seq: function (list, last) { console.log('Sequenced in scriptloader: ' + list.length); if(list.length == 1) { var src = (typeof list[0] == 'string') ? list[0] : list[0].s; var defer = (typeof list[0] == 'string') ? true : list[0].d; this.push({s: src, d: defer, o: last}); return; }else if(list.length > 1) { var l = list.splice(-1), _this = this; var src = (typeof l[0] == 'string') ? l[0] : l[0].s; var defer = (typeof l[0] == 'string') ? true : l[0].d; this.seq(list, function(){_this.push({s: src, d: defer, o: last});}); } } } window.setjs = function(fn) { var sl = new scriptloader(window, document); sl.seq([ "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js", "https://cf-cdn.newsbytesapp.com/assets/js/packageMaster.6.js", "https://cdnjs.cloudflare.com/ajax/libs/jquery-scrollTo/2.1.2/jquery.scrollTo.min.js", "https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.js" ], fn); // ], window.readyFunction); } var svgInclusion = function () { var items = document.getElementsByClassName('svg-inclusion'); for (var i = 0; i < items.length; i++) { var selectSvg = items[i].getAttribute('data-svg'); var ih = document.getElementById('_svg_' + selectSvg).innerHTML; switch (selectSvg) { case 'avatar': items[i].insertAdjacentHTML('afterend', ih); break; default: items[i].innerHTML = ih; break; } } } var isIos = function () { var iDevices = [ 'iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod' ]; if (!!navigator.platform) { while (iDevices.length) { if (navigator.platform === iDevices.pop()) { return true && !window.MSStream; } } } return false; } function detectUserInteraction() { document.getElementsByTagName('html')[0].classList.add('js-user-action'); /*setjs(); window.dispatchEvent(jsuseraction);*/ setjs(function(){onJqueryLoad();window.dispatchEvent(jsuseraction);window.dispatchEvent(load_event);}); 'keydown mouseover touchmove touchstart wheel touchend touchcancel'.split(" ").forEach(function(e){ window.removeEventListener(e,detectUserInteraction,false); }); } function touchHandler(event) { var touches = event.changedTouches, first = touches[0], type = ""; switch(event.type) { case "touchstart": type = "mousedown"; break; case "touchmove": type = "mousemove"; break; case "touchend": type = "mouseup"; break; default: return; } //initMouseEvent(type, canBubble, cancelable, view, clickCount, // screenX, screenY, clientX, clientY, ctrlKey, // altKey, shiftKey, metaKey, button, relatedTarget); var simulatedEvent = document.createEvent("MouseEvent"); simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY, false, false, false, false, 0/*left*/, null); first.target.dispatchEvent(simulatedEvent); // event.preventDefault(); } (function() { window.addEventListener("load", function(event) { svgInclusion(); }); if(isIos()) { document.addEventListener("touchstart", touchHandler, true); document.addEventListener("touchmove", touchHandler, true); document.addEventListener("touchend", touchHandler, true); document.addEventListener("touchcancel", touchHandler, true); } 'keydown mouseover touchmove touchstart wheel touchend touchcancel'.split(" ").forEach(function(e){ window.addEventListener(e, detectUserInteraction, false); }); })(); document.addEventListener('DOMContentLoaded', function () { window.dataLayer = window.dataLayer || []; document.getElementsByClassName('navigation-events')[0]?.addEventListener('click', (e) => { e.preventDefault(); e.stopPropagation(); let url = e.currentTarget.getAttribute('href'); let tag = e.currentTarget.getAttribute('tag'); let title = e.currentTarget.getAttribute('title'); let curUrl = window.location.origin + window.location.pathname; let isNext = e.currentTarget.classList.contains('prev-article-button'); if (url.indexOf('http') !== 0) { url = window.location.protocol+'//'+window.location.host+url; } if (typeof url !== 'undefined') { let sessionNavigationInfo = sessionStorage?.getItem('sessionNavigationInfo'); if(sessionNavigationInfo){ sessionNavigationInfo = JSON.parse(sessionNavigationInfo); sessionNavigationInfo.visitedArticleList = sessionNavigationInfo.visitedArticleList || [curUrl]; }else{ sessionNavigationInfo = { latestCategoryArticleChecked: [], visitedArticleList: [], sessionExpTimestamp: Date.now() + 15 * 60 * 1000 } } if(sessionNavigationInfo.latestCategoryArticleChecked.indexOf(tag.toLowerCase()) == -1 && window.readyFunctionExecuted){ sessionNavigationInfo.latestCategoryArticleChecked.push(tag.toLowerCase()); } if(sessionNavigationInfo.visitedArticleList.indexOf(curUrl) == -1){ sessionNavigationInfo.visitedArticleList.push(curUrl); } sessionStorage.setItem('sessionNavigationInfo', JSON.stringify(sessionNavigationInfo)); window.dataLayer.push({ 'event': isNext ? 'article_nav_click_previous' : 'article_nav_click_next', 'article_name':title, 'article_category':tag, 'author_name':undefined, 'article_id': url, 'User_ID':undefined }); window.location.href = url; } }) });