{"version":3,"sources":["newsfeed.js"],"names":["const","newsfeed","lsKey","feedUrl","maxItems","dismissed","done","simpleParseDate","string","months","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","match","undefined","date","Date","setUTCDate","setUTCMonth","setUTCFullYear","setUTCHours","setUTCMinutes","setUTCSeconds","formatRelativeDate","delta","fuzzy","unit","hour","minute","day","week","Math","floor","formatNotification","item","parsedDate","pubDate","dateDelta","round","isRecentWeek","element","document","createElement","dataset","identifier","className","href","link","target","innerHTML","title","description","slice","toLocaleString","dismissNotification","parentNode","removeChild","keys","Object","length","let","i","localStorage","JSON","stringify","do","axios","get","responseType","then","response","data","documentElement","Element","Error","items","querySelectorAll","parse","id","column","querySelector","min","titleElement","descriptionElement","pubDateElement","linkElement","textContent","notificationElement","dismissTrigger","addEventListener","event","preventDefault","appendChild","body","catch","console","error","onloaded","page","apiChecked","readyState","window"],"mappings":"AAEAA,IAAMC,SAAW,CACfC,MAAO,WACPC,QAAS,yCACTC,SAAU,EACVC,UAAW,GACXC,MAAM,EAGRC,gBAAwB,SAAGC,GAKzBR,IAAMS,EAAS,CAAEC,IAAK,EAAGC,IAAK,EAAGC,IAAK,EAAGC,IAAK,EAAGC,IAAK,EAAGC,IAAK,EAAGC,IAAK,EAAGC,IAAK,EAAGC,IAAK,EAAGC,IAAK,EAAGC,IAAK,GAAIC,IAAK,IACzGC,EAAQd,EAAOc,MAAM,6EAC3B,GAAIA,QAA+BC,IAArBd,EAAOa,EAAM,IAAoB,CAC7CtB,IAAMwB,EAAO,IAAIC,KAOjB,OANAD,EAAKE,WAAWJ,EAAM,IACtBE,EAAKG,YAAYlB,EAAOa,EAAM,KAC9BE,EAAKI,eAAeN,EAAM,IAC1BE,EAAKK,YAAYP,EAAM,IACvBE,EAAKM,cAAcR,EAAM,IACzBE,EAAKO,cAAcT,EAAM,IAClBE,IAIXQ,mBAA2B,SAAGC,GAE5BjC,IAKIkC,EACAC,EALEC,EAAOC,KACPC,E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AS,WACvCC,MAAMC,iBACNnG,SAAS8D,oBAAoBoC,MAAM1C,OAAOO,eAI9CwB,EAAOa,YAAYL,IAIvB9C,SAASoD,KAAKD,YAAYpD,OAK7BsD,MAAMC,QAAQC,QAGnBC,SAAiB,WAGK,oBAATC,MAAwBA,KAAKC,aAAe3G,SAASK,MAC9DL,SAASyE,OAIe,gBAAxBxB,SAAS2D,YAAwD,aAAxB3D,SAAS2D,WACpD5G,SAASyG,WAETI,OAAOZ,iBAAiB,oBAAkB,WAAK,OAAGjG,SAASyG","file":"newsfeed.js","sourcesContent":["/* global page, axios */\n\nconst newsfeed = {\n lsKey: 'newsfeed',\n feedUrl: 'https://blog.fiery.me/rss-newsfeed.xml',\n maxItems: 3,\n dismissed: {},\n done: false\n}\n\nnewsfeed.simpleParseDate = string => {\n // For now limited to support the following examples (used in blog.fiery.me):\n // Mon, 27 Jul 2020 18:30:00 GMT\n // Sat, 16 May 2020 14:55:00 GMT\n // Probably better to use a library if it needs to support other formats.\n const months = { Jan: 0, Feb: 1, Mar: 2, Apr: 3, May: 4, Jun: 5, Jul: 6, Aug: 7, Sep: 8, Oct: 9, Nov: 10, Dec: 11 }\n const match = string.match(/[a-zA-Z]*,\\s(\\d{2})\\s([a-zA-Z]{3})\\s(\\d{4})\\s(\\d{2}):(\\d{2}):(\\d{2})\\sGMT/)\n if (match && (months[match[2]] !== undefined)) {\n const date = new Date()\n date.setUTCDate(match[1])\n date.setUTCMonth(months[match[2]])\n date.setUTCFullYear(match[3])\n date.setUTCHours(match[4])\n date.setUTCMinutes(match[5])\n date.setUTCSeconds(match[6])\n return date\n }\n}\n\nnewsfeed.formatRelativeDate = delta => {\n // https://stackoverflow.com/a/7641812\n const minute = 60\n const hour = minute * 60\n const day = hour * 24\n const week = day * 7\n\n let fuzzy\n let unit\n if (delta < minute) {\n fuzzy = delta\n unit = 'second'\n } else if (delta < hour) {\n fuzzy = Math.floor(delta / minute)\n unit = 'minute'\n } else if (delta < day) {\n fuzzy = Math.floor(delta / hour)\n unit = 'hour'\n } else if (delta < week) {\n fuzzy = Math.floor(delta / day)\n unit = 'day'\n } else {\n fuzzy = Math.floor(delta / week)\n unit = 'week'\n }\n\n return `${fuzzy} ${unit}${fuzzy !== 1 ? 's' : ''} ago`\n}\n\nnewsfeed.formatNotification = item => {\n const parsedDate = newsfeed.simpleParseDate(item.pubDate)\n const dateDelta = Math.round((+new Date() - parsedDate) / 1000)\n const isRecentWeek = dateDelta <= 604800\n\n const element = document.createElement('a')\n element.dataset.identifier = item.identifier\n element.className = 'notification is-info'\n element.href = item.link\n element.target = '_blank'\n element.innerHTML = `\n \n