{"version":3,"sources":["newsfeed.js"],"names":["const","newsfeed","lsKey","feedUrl","maxItems","maxAge","dismissed","done","string","months","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","match","date","Date","setUTCDate","setUTCMonth","setUTCFullYear","setUTCHours","setUTCMinutes","setUTCSeconds","delta","fuzzy","unit","hour","minute","day","week","Math","floor","item","isRecentWeek","dateDelta","element","document","createElement","dataset","identifier","className","href","link","target","innerHTML","title","description","slice","parsedDate","toLocaleString","formatRelativeDate","parentNode","removeChild","keys","Object","length","let","i","localStorage","JSON","stringify","axios","get","responseType","then","response","data","documentElement","Element","Error","items","querySelectorAll","parse","id","column","querySelector","min","titleElement","descriptionElement","pubDateElement","linkElement","textContent","pubDate","simpleParseDate","round","notificationElement","formatNotification","dismissTrigger","addEventListener","event","preventDefault","dismissNotification","appendChild","body","catch","console","error","page","apiChecked","do","readyState","onloaded","window"],"mappings":"AAEAA,IAAMC,SAAW,CACfC,MAAO,WACPC,QAAS,yCACTC,SAAU,EACVC,OAAQ,QACRC,UAAW,CAAA,EACXC,MAAM,EAGRN,gBAAwB,SAAGO,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,QAAsC,IAArBb,EAAOa,EAAM,IAAsB,CACtDtB,IAAMuB,EAAO,IAAIC,KAOjB,OANAD,EAAKE,WAAWH,EAAM,IACtBC,EAAKG,YAAYjB,EAAOa,EAAM,KAC9BC,EAAKI,eAAeL,EAAM,IAC1BC,EAAKK,YAAYN,EAAM,IACvBC,EAAKM,cAAcP,EAAM,IACzBC,EAAKO,cAAcR,EAAM,IAClBC,CACT,CACF,EAEAtB,mBAA2B,SAAG8B,GAG5B/B,IAKIgC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AmBAA,EAAKC,YAAEA,EAAWoC,QAAEA,EAAOxC,KAAEA,EAAIH,WAAEA,EAAUS,WAAEA,EAAUd,UAAEA,IAGvDqD,EAAiBF,EAAoBV,cAAc,WACrDY,GACFA,EAAeC,iBAAiB,SAAS,WACvCC,MAAMC,iBACNjG,SAASkG,oBAAoBF,MAAM9C,OAAOQ,WAlB5C,IAsBFuB,EAAOkB,YAAYP,EAlBrB,CACF,CACF,CAqBAjD,SAASyD,KAAKD,YAAYzD,EAlB5B,CAIJ,IAmBG2D,MAAMC,QAAQC,MAlBnB,EAqBAvG,SAAiB,WAGK,oBAATwG,MAAwBA,KAAKC,aAAezG,SAASM,MAC9DN,SAAS0G,IAjBb,GAqB4B,gBAAxB/D,SAASgE,YAAwD,aAAxBhE,SAASgE,WACpD3G,SAAS4G,WAETC,OAAOd,iBAAiB,oBAAkB,WAAK,OAAG/F,SAAS4G,UAAQ","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 maxAge: 91 * 24 * 60 * 60, // 91 days (~3 months)\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 && (typeof 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 // CC BY-SA 3.0\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 isRecentWeek = item.dateDelta <= (7 * 24 * 60 * 60) // 7 days (1 week)\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