{"version":3,"file":"articlepage.6d32a87e.js","mappings":"AAEIA,OAAOC,YAAcD,OAAOC,aAAe,CAAC,EAC5CD,OAAOC,YAAYC,YAAcF,OAAOC,YAAYC,aAAe,CAAC,EACpEF,OAAOC,YAAYC,YAAYC,KAAO,WAIlC,IAAIC,EAAYC,SAASC,cAAc,OACvCF,EAAUG,WAAa,0GAMvBF,SAASG,KAAKC,aAAaL,EAAWC,SAASG,KAAKE,WAAWC,aAoD/D,IAAIC,EAAkBP,SAASQ,eAAe,gBAG9C,GAAuB,MAAnBD,EACJ,CAGI,IAEIE,EAFcT,SAASU,cAAc,0BAA0BC,UAE3CC,OAAOC,MAAM,OAAOC,OACxCC,EAAOC,KAAKC,KAAKR,EAFX,KAIVF,EAAgBI,UAAYI,CAChC,CACJ,EAEApB,OAAOC,YAAYC,YAAYqB,WAAY","sources":["webpack://advanced-web/./UI/js/core/modules/articlepage.js"],"sourcesContent":["(function () {\r\n\r\n window.oneadvanced = window.oneadvanced || {};\r\n window.oneadvanced.articlepage = window.oneadvanced.articlepage || {};\r\n window.oneadvanced.articlepage.init = function () {\r\n //console.log(\"initializing articlepage js.......\");\r\n\r\n //Below code inserts the skip-link \r\n var skipLinks = document.createElement(\"div\");\r\n skipLinks.innerHTML += 'Skip to Main Content';\r\n /* \r\n * if we do document.body.firstChild then the html gets added before the noscript tag, which we don't want. \r\n * We wanted skip-link to be the first thing after the noscript tag,\r\n * that's why 'nextSibling' is used.\r\n */\r\n document.body.insertBefore(skipLinks, document.body.firstChild.nextSibling);\r\n\r\n /* Out of the two screen readers(nvda and windows narrator) I tested out for the skip link, narrator\r\n didn't read out the article-details part of the article upon clicking on skip link. Shifting focus\r\n seemed to be an issue but even with the code for focusing on the div with article-details as ID,\r\n narrator didn't shift the focus correctly. While, the nvda screen reader worked and shifted it's focus\r\n correctly upon click on the skip link button.\r\n Below codes has the jquery and it's converted to js version which shifts the focus, have kept them in\r\n case we need to do somthing of this sort in future.\r\n */\r\n\r\n /*//JQuery implementation\r\n $(document).ready(function () {\r\n // bind a click event to the 'skip' link\r\n $(\".skip-link\").click(function (event) {\r\n // strip the leading hash and declare\r\n // the content we're skipping to\r\n console.log(this.href.split('#'));\r\n var skipTo = \"#\" + this.href.split('#')[1];\r\n // Setting 'tabindex' to -1 takes an element out of normal \r\n // tab flow but allows it to be focused via javascript\r\n $(skipTo).attr('tabindex', -1).on('blur focusout', function () {\r\n // when focus leaves this element, \r\n // remove the tabindex attribute\r\n $(this).removeAttr('tabindex');\r\n }).focus(); // focus on the content container\r\n });\r\n });\r\n */\r\n\r\n /* JS implementation converted from above code\r\n console.log(document.getElementsByClassName(\"skip-link\"));\r\n console.log(document.querySelector(\".skip-link\"));\r\n var skipTo = document.getElementById(\"article-details\");\r\n console.log(skipTo);\r\n document.querySelector(\".skip-link\").addEventListener('keydown', function (e) {\r\n console.log(e.keyCode);\r\n if (e.keyCode === 13) {\r\n skipTo.setAttribute('tabindex', -1);\r\n skipTo.focus();\r\n skipTo.addEventListener('focusout', function () {\r\n this.removeAttribute('tabindex');\r\n console.log(this);\r\n });//.focus();\r\n }\r\n });\r\n */\r\n /*This can be used to check the document status in javascript,\r\n just like in the jquery solution as it checks using ready().\r\n if (document.readyState === 'interactive') {\r\n };*/\r\n\r\n var timeUpdatePlace = document.getElementById(\"reading-time\");\r\n //console.log(timeUpdatePlace);\r\n //condition to run below js if the editor chooses to show/hide time based on bool RefreshedHideReadTime\r\n if (timeUpdatePlace != null)\r\n {\r\n //var articleText = document.querySelector(\"div.refreshed-media-container + section.editorialblock\").innerText;\r\n //Ideally I would want to use the above line but to stay generic for older design we have to use below line.\r\n var articleText = document.querySelector(\"section.editorialblock\").innerText;\r\n var wpm = 225;\r\n var words = articleText.trim().split(/\\s+/).length;\r\n var time = Math.ceil(words / wpm);\r\n //console.log(time);\r\n timeUpdatePlace.innerText = time;\r\n }\r\n };\r\n\r\n window.oneadvanced.articlepage.hasLoaded = true;\r\n})();"],"names":["window","oneadvanced","articlepage","init","skipLinks","document","createElement","innerHTML","body","insertBefore","firstChild","nextSibling","timeUpdatePlace","getElementById","words","querySelector","innerText","trim","split","length","time","Math","ceil","hasLoaded"],"sourceRoot":""}