{"version":3,"sources":["webpack:///./app/javascript/packs/initializers/initializeTimeFixer.js","webpack:///./app/javascript/packs/subscribeButton.js","webpack:///./app/javascript/utilities/localDateTime.js","webpack:///./app/javascript/utilities/showUserAlertModal.js","webpack:///./app/javascript/packs/initializers/initializeCommentPreview.js","webpack:///./app/javascript/packs/initializers/initializeCommentDate.js","webpack:///./app/javascript/settings/copyOrgSecret.js","webpack:///./app/javascript/settings/mobilePageSel.js","webpack:///./app/javascript/packs/initializers/initializeSettings.js","webpack:///./app/javascript/settings/rssFetchTime.js","webpack:///./app/javascript/utilities/sendHapticMessage.js","webpack:///./app/javascript/packs/initializers/initializeNotifications.js","webpack:///./app/javascript/utilities/checkUserLoggedIn.js","webpack:///./app/javascript/packs/initializers/initializeDateTimeHelpers.js","webpack:///./app/javascript/packs/baseInitializers.js"],"names":["formatDateTime","options","value","Intl","DateTimeFormat","format","convertUtcTime","utcTime","hour","minute","timeZoneName","Date","Number","convertUtcDate","utcDate","month","day","convertCalEvent","utc","weekday","updateLocalDateTime","elements","convertCallback","getUtcDateTime","local","i","length","innerHTML","initializeTimeFixer","document","getElementsByClassName","element","dataset","datetime","updateSubscribeButtonText","button","overrideSubscribed","window_size","label","mobileLabel","window","innerWidth","noun","_button$dataset","subscription_id","subscription_config","comment_id","subscriptionIsActive","pressed","verb","spanElement","querySelector","concat","charAt","toUpperCase","slice","setAttribute","innerText","optimisticallyUpdateButtonUI","modeChange","classList","remove","add","determinePayloadAndEndpoint","payload","endpoint","subscribed_to","article_id","handleSubscribeButtonClick","_x","_handleSubscribeButtonClick","apply","arguments","_asyncToGenerator","_ref","target","_determinePayloadAndE","requestJson","JSON","stringify","getCsrfToken","then","sendFetch","_ref2","response","status","res","json","destroyed","matchingButtons","querySelectorAll","subscription","id","_x2","initializeSubscribeButton","buttons","Array","from","wasInitialized","removeEventListener","addEventListener","timestampToLocalDateTime","timestamp","locale","time","formattedTime","year","replace","e","addLocalizedDateTimeToElementsTitles","timestampAttribute","getAttribute","localDateTime","timestampToLocalDateTimeLong","localizeTimeElements","timeOptions","navigator","language","textContent","second","globalThis","timestampToLocalDateTimeShort","currentYear","getFullYear","modalId","showUserAlertModal","title","text","confirm_text","modalDiv","getElementById","outerHTML","getModal","body","appendChild","buildModalDiv","Forem","showModal","contentSelector","overlay","showModalAfterError","action_ing","action_past","_ref2$timeframe","timeframe","errorResponse","_ref$timeframe","rateLimitText","_ref3","buildRateLimitText","showRateLimitModal","error","wrapper","createElement","getModalHtml","getAndShowPreview","preview","editor","comment","body_markdown","script","processed_html","includes","src","async","activateRunkitTags","err","console","log","handleCommentPreview","event","preventDefault","form","trigger","contains","toggle","editorHeight","offsetHeight","style","minHeight","initializeCommentPreview","previewButton","initializeCommentDate","commentsDates","copyToClipboardListener","settingsOrgSecretInput","Runtime","copyToClipboard","mobilePageSelListener","url","InstantClick","preload","display","initializeSettings","_document$getElementB","timeNode","timeStamp","setupRssFetchTime","setupMobilePageSel","sendHapticMessage","message","webkit","messageHandlers","haptic","postMessage","fetchNotificationsCount","instantClick","removeExpiredKeys","setTimeout","href","initReactions","butts","butt","onclick","thisButt","this","successCb","result","formData","FormData","append","reactableType","category","reactableId","focus","initPagination","paginators","paginator","fetch","paginationPath","method","credentials","html","markup","trim","container","newNotifications","initializeNotifications","notificationsLink","notificationsFilterSelect","csrfToken","locationAsArray","location","pathname","split","parsedLastParam","parseInt","headers","isInteger","initializeDateHelpers","on"],"mappings":"iHAAA,SAASA,EAAeC,EAASC,GAC/B,OAAO,IAAIC,KAAKC,eAAe,QAASH,GAASI,OAAOH,EAC1D,CAEA,SAASI,EAAeC,GAOtB,OAAOP,EALS,CACdQ,KAAM,UACNC,OAAQ,UACRC,aAAc,SAJH,IAAIC,KAAKC,OAAOL,IAO/B,CAEA,SAASM,EAAeC,GAMtB,OAAOd,EAJS,CACde,MAAO,QACPC,IAAK,WAHM,IAAIL,KAAKC,OAAOE,IAM/B,CAEA,SAASG,EAAgBC,GAUvB,OAAOlB,EARS,CACdmB,QAA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AASqG,eACzC,kCAMA6G,EAA0B3I,iBAAiB,UAJjB,SAACsE,GAC3BlI,OAAO0M,SAASjC,KAAOvC,EAAM/F,OAAOzE,KACtC,IA+DA+N,KAZM9L,EAASN,SAASqG,eAAe,sBAErC/F,EAAOiE,iBAAiB,QAAS6H,EAYrC,C,mCE9MA,0EAEO,SAASwB,IAEdvI,YAAqBrF,SAAS6D,iBAAiB,qBAAsB,CACnE3E,MAAO,QACPC,IAAK,YAIPkG,YAAqBrF,SAAS6D,iBAAiB,aAAc,CAC3DgB,KAAM,UACN3F,MAAO,QACPC,IAAK,YAIPkG,YAAqBrF,SAAS6D,iBAAiB,wBAAyB,CACtEgB,KAAM,UACN3F,MAAO,QACPC,IAAK,WAET,C,mCCtBA,0EAWAsK,kCACAF,qCACAa,+BACA4C,oCACAjN,gCACA6N,kCAEA3D,aAAa4D,GAAG,UAAU,WACxBpE,kCACAF,qCACAa,+BACA4C,mCACF,IAEArM,OAAOqF,mBAAqBA,IAC5BrF,OAAOoG,oBAAsBA,G","file":"js/baseInitializers-c970d70d548ec1d03cea.chunk.js","sourcesContent":["function formatDateTime(options, value) {\n return new Intl.DateTimeFormat('en-US', options).format(value);\n}\n\nfunction convertUtcTime(utcTime) {\n const time = new Date(Number(utcTime));\n const options = {\n hour: 'numeric',\n minute: 'numeric',\n timeZoneName: 'short',\n };\n return formatDateTime(options, time);\n}\n\nfunction convertUtcDate(utcDate) {\n const date = new Date(Number(utcDate));\n const options = {\n month: 'short',\n day: 'numeric',\n };\n return formatDateTime(options, date);\n}\n\nfunction convertCalEvent(utc) {\n const date = new Date(Number(utc));\n const options = {\n weekday: 'long',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n };\n\n return formatDateTime(options, date);\n}\n\nfunction updateLocalDateTime(elements, convertCallback, getUtcDateTime) {\n let local;\n for (let i = 0; i < elements.length; i += 1) {\n local = convertCallback(getUtcDateTime(elements[i]));\n // eslint-disable-next-line no-param-reassign\n elements[i].innerHTML = local;\n }\n}\n\nfunction initializeTimeFixer() {\n const utcTime = document.getElementsByClassName('utc-time');\n const utcDate = document.getElementsByClassName('utc-date');\n const utc = document.getElementsByClassName('utc');\n\n if (!utc) {\n return;\n }\n\n updateLocalDateTime(\n utcTime,\n convertUtcTime,\n (element) => element.dataset.datetime,\n );\n updateLocalDateTime(\n utcDate,\n convertUtcDate,\n (element) => element.dataset.datetime,\n );\n updateLocalDateTime(utc, convertCalEvent, (element) => element.innerHTML);\n}\n\nexport {\n initializeTimeFixer,\n updateLocalDateTime,\n convertUtcDate,\n convertUtcTime,\n formatDateTime,\n convertCalEvent,\n};\n","// /* global showModalAfterError*/\n\nexport function updateSubscribeButtonText(\n button,\n overrideSubscribed,\n window_size,\n) {\n let label = '';\n let mobileLabel = '';\n if (typeof window_size == 'undefined') {\n window_size = window.innerWidth;\n }\n\n let noun = 'comments';\n const { subscription_id, subscription_config, comment_id } = button.dataset;\n\n let subscriptionIsActive = subscription_id != '';\n if (typeof overrideSubscribed != 'undefined') {\n subscriptionIsActive = overrideSubscribed == 'subscribe';\n }\n\n const pressed = subscriptionIsActive;\n const verb = subscriptionIsActive ? 'Subscribed' : 'Subscribe';\n\n // comment_id should only be present if there's a subscription, so a button\n // that initially renders as 'Subscribed-to-thread' can be a toggle until refreshed\n if (comment_id && comment_id != '') {\n noun = 'thread';\n }\n\n // Find the element within the button\n const spanElement = button.querySelector('span');\n\n switch (subscription_config) {\n case 'top_level_comments':\n label = `${verb} to top-level comments`;\n mobileLabel = `Top-level ${noun}`;\n break;\n case 'only_author_comments':\n label = `${verb} to author comments`;\n mobileLabel = `Author ${noun}`;\n break;\n default:\n label = `${verb} to ${noun}`;\n mobileLabel = `${noun}`.charAt(0).toUpperCase() + noun.slice(1);\n }\n\n button.setAttribute('aria-label', label);\n spanElement.innerText = window_size <= 760 ? mobileLabel : label;\n button.setAttribute('aria-pressed', pressed);\n}\n\nexport function optimisticallyUpdateButtonUI(button, modeChange) {\n if (typeof modeChange == 'undefined') {\n modeChange = button.dataset.subscription_id ? 'unsubscribe' : 'subscribe';\n }\n\n if (modeChange == 'unsubscribe') {\n button.classList.remove('comment-subscribed');\n updateSubscribeButtonText(button, 'unsubscribe');\n } else {\n button.classList.add('comment-subscribed');\n updateSubscribeButtonText(button, 'subscribe');\n }\n\n return;\n}\n\nexport function determinePayloadAndEndpoint(button) {\n let payload;\n let endpoint;\n\n if (button.dataset.subscription_id != '') {\n payload = {\n subscription_id: button.dataset.subscription_id,\n };\n endpoint = 'comment-unsubscribe';\n } else if (\n button.dataset.subscribed_to &&\n button.dataset.subscribed_to == 'comment'\n ) {\n payload = {\n comment_id: button.dataset.comment_id,\n };\n endpoint = 'comment-subscribe';\n } else {\n payload = {\n article_id: button.dataset.article_id,\n subscription_config: button.dataset.subscription_config,\n };\n endpoint = 'comment-subscribe';\n }\n\n return {\n payload,\n endpoint,\n };\n}\n\nasync function handleSubscribeButtonClick({ target }) {\n optimisticallyUpdateButtonUI(target);\n\n const { payload, endpoint } = determinePayloadAndEndpoint(target);\n const requestJson = JSON.stringify(payload);\n\n getCsrfToken()\n .then(await sendFetch(endpoint, requestJson))\n .then(async (response) => {\n if (response.status === 200) {\n const res = await response.json();\n\n if (res.destroyed) {\n const matchingButtons = document.querySelectorAll(\n `button[data-subscription_id='${target.dataset.subscription_id}']`,\n );\n for (let i = 0; i < matchingButtons.length; i++) {\n const button = matchingButtons[i];\n button.dataset.subscription_id = '';\n if (button != target) {\n optimisticallyUpdateButtonUI(button, 'unsubscribe');\n }\n }\n } else if (res.subscription) {\n target.dataset.subscription_id = res.subscription.id;\n } else {\n throw `Problem (un)subscribing: ${JSON.stringify(res)}`;\n }\n }\n });\n}\n\nexport function initializeSubscribeButton() {\n const buttons = document.querySelectorAll('.subscribe-button');\n\n if (buttons.length === 0) {\n return;\n }\n\n Array.from(buttons, (button) => {\n if (button.wasInitialized) {\n return;\n }\n\n button.removeEventListener('click', handleSubscribeButtonClick); // Remove previous event listener\n button.addEventListener('click', handleSubscribeButtonClick);\n\n button.wasInitialized = true;\n updateSubscribeButtonText(button);\n });\n}\n\n// Some subscribe buttons are added to the DOM dynamically.\n// They will need to call this — see initializeNotifications > initPagination\ninitializeSubscribeButton();\n","/* Local date/time utilities */\n\n/*\n Convert string timestamp to local time, using the given locale.\n\n timestamp should be something like '2019-05-03T16:02:50.908Z'\n locale can be `navigator.language` or a custom locale. defaults to 'default'\n options are `Intl.DateTimeFormat` options\n\n see \n for more information.\n*/\nexport function timestampToLocalDateTime(timestamp, locale, options) {\n if (!timestamp) {\n return '';\n }\n\n try {\n const time = new Date(timestamp);\n const formattedTime = new Intl.DateTimeFormat(\n locale || 'default',\n options,\n ).format(time);\n return options.year === '2-digit'\n ? formattedTime.replace(', ', \" '\")\n : formattedTime;\n } catch (e) {\n return '';\n }\n}\n\nexport function addLocalizedDateTimeToElementsTitles(elements, timestampAttribute) {\n for (let i = 0; i < elements.length; i += 1) {\n const element = elements[i];\n\n // get UTC timestamp set by the server\n const timestamp = element.getAttribute(timestampAttribute || 'datetime');\n\n if (timestamp) {\n // add a full datetime to the element title, visible on hover.\n // `navigator.language` is used to allow the date to be localized\n // according to the browser's locale\n // see \n const localDateTime = timestampToLocalDateTimeLong(timestamp);\n element.setAttribute('title', localDateTime);\n }\n }\n}\n\nexport function localizeTimeElements(elements, timeOptions) {\n for (let i = 0; i < elements.length; i += 1) {\n const element = elements[i];\n\n const timestamp = element.getAttribute('datetime');\n if (timestamp) {\n const localDateTime = timestampToLocalDateTime(\n timestamp,\n navigator.language,\n timeOptions,\n );\n\n element.textContent = localDateTime;\n }\n }\n}\n\nfunction timestampToLocalDateTimeLong(timestamp) {\n // example: \"Wednesday, April 3, 2019, 2:55:14 PM\"\n\n return timestampToLocalDateTime(timestamp, navigator.language, {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n });\n}\n\nfunction timestampToLocalDateTimeShort(timestamp) {\n // example: \"10 Dec 2018\" if it is not the current year\n // example: \"6 Sep\" if it is the current year\n\n if (timestamp) {\n const currentYear = new Date().getFullYear();\n const givenYear = new Date(timestamp).getFullYear();\n\n const timeOptions = {\n day: 'numeric',\n month: 'short',\n };\n\n if (givenYear !== currentYear) {\n timeOptions.year = 'numeric';\n }\n\n return timestampToLocalDateTime(timestamp, navigator.language, timeOptions);\n }\n\n return '';\n}\n\nif (typeof globalThis !== 'undefined') {\n globalThis.timestampToLocalDateTimeLong = timestampToLocalDateTimeLong; // eslint-disable-line no-undef\n globalThis.timestampToLocalDateTimeShort = timestampToLocalDateTimeShort; // eslint-disable-line no-undef\n}\n","/**\n * HTML ID for modal DOM node\n *\n * @private\n * @constant modalId *\n * @type {string}\n */\nconst modalId = 'user-alert-modal';\n\n/**\n * Displays a general purpose user alert modal with a title, body text, and confirmation button.\n *\n * @function showUserAlertModal\n * @param {string} title The title/heading text to be displayed\n * @param {string} text The body text to be displayed\n * @param {string} confirm_text Text of the confirmation button\n *\n * @example\n * showUserAlertModal('Warning', 'You must wait', 'OK', '/faq/why-must-i-wait', 'Why must I wait?');\n */\nexport function showUserAlertModal(title, text, confirm_text) {\n buildModalDiv(text, confirm_text);\n window.Forem.showModal({\n title,\n contentSelector: `#${modalId}`,\n overlay: true,\n });\n}\n\n/**\n * Displays a user rate limit alert modal letting the user know what they did that exceeded a rate limit,\n * and gives them links to explain why they must wait\n *\n * @function showRateLimitModal\n * @param {string} element Description of the element that throw the error\n * @param {string} action_ing The -ing form of the action taken by the user\n * @param {string} action_past The past tense of the action taken by the user\n * @param {string} timeframe Description of the time that we need to wait\n *\n * @example\n * showRateLimitModal('Made a comment', 'comment again')\n */\nfunction showRateLimitModal({\n element,\n action_ing,\n action_past,\n timeframe = 'a moment',\n}) {\n const rateLimitText = buildRateLimitText({\n element,\n action_ing,\n action_past,\n timeframe,\n });\n const rateLimitLink = '/faq';\n showUserAlertModal(\n `Wait ${timeframe}...`,\n rateLimitText,\n 'Got it',\n rateLimitLink,\n 'Why do I have to wait?',\n );\n}\n\n/**\n * Displays the corresponding modal after an error.\n *\n * @function showModalAfterError\n * @param {Object} response The response from the API\n * @param {string} element Description of the element that throw the error\n * @param {string} action_ing The -ing form of the action taken by the user\n * @param {string} action_past The past tense of the action taken by the user\n * @param {string} timeframe Description of the time that we need to wait\n *\n * @example\n * showModalAfterError(response, 'made a comment', 'making another comment', 'a moment');\n */\nexport function showModalAfterError({\n response,\n element,\n action_ing,\n action_past,\n timeframe = 'a moment',\n}) {\n response\n .json()\n .then((errorResponse) => {\n if (response.status === 429) {\n showRateLimitModal({\n element,\n action_ing,\n action_past,\n timeframe,\n });\n } else {\n showUserAlertModal(\n `Error ${action_ing} ${element}`,\n `Your ${element} could not be ${action_past} due to an error: ${errorResponse.error}`,\n 'OK',\n );\n }\n })\n .catch(() => {\n showUserAlertModal(\n `Error ${action_ing} ${element}`,\n `Your ${element} could not be ${action_past} due to a server error`,\n 'OK',\n );\n });\n}\n\n/**\n * Constructs wording for rate limit modals\n *\n * @private\n * @function buildRateLimitText\n *\n * @param {string} element Description of the element that throw the error\n * @param {string} action_ing The -ing form of the action taken by the user\n * @param {string} action_past The past tense of the action taken by the user\n * @param {string} timeframe Description of the time that we need to wait\n *\n * @returns {string} Formatted body text for a rate limit modal\n */\nexport function buildRateLimitText({\n element,\n action_ing,\n action_past,\n timeframe,\n}) {\n return `Since you recently ${action_past} a ${element}, you’ll need to wait ${timeframe} before ${action_ing} another ${element}.`;\n}\n\n/**\n * HTML template for modal\n *\n * @private\n * @function getModalHtml\n *\n * @param {string} text The body text to be displayed\n * @param {string} confirm_text Text of the confirmation button\n *\n * @returns {string} HTML for the modal\n */\nexport const getModalHtml = (text, confirm_text) => `\n \n `;\n\n/**\n * Checks for the alert modal, and if it's not present builds and inserts it in the DOM\n *\n * @private\n * @function buildModalDiv\n *\n * @param {string} text The body text to be displayed\n * @param {string} confirm_text Text of the confirmation button\n *\n * @returns {Element} DOM node of the inserted alert modal\n */\nfunction buildModalDiv(text, confirm_text) {\n let modalDiv = document.getElementById(modalId);\n if (!modalDiv) {\n modalDiv = getModal(text, confirm_text);\n document.body.appendChild(modalDiv);\n } else {\n modalDiv.outerHTML = getModal(text, confirm_text).outerHTML;\n }\n return modalDiv;\n}\n\n/**\n * Takes template HTML for a modal and creates a DOM node based on supplied arguments\n *\n * @private\n * @function getModal\n *\n * @param {string} text The body text to be displayed\n * @param {string} confirm_text Text of the confirmation button\n *\n * @returns {Element} DOM node of alert modal with formatted text\n */\nexport function getModal(text, confirm_text) {\n const wrapper = document.createElement('div');\n wrapper.innerHTML = getModalHtml(text, confirm_text);\n return wrapper;\n}\n","/* global activateRunkitTags */\n\nfunction getAndShowPreview(preview, editor) {\n function attachTwitterTimelineScript() {\n const script = document.createElement('script');\n script.src = 'https://platform.twitter.com/widgets.js';\n script.async = true;\n document.body.appendChild(script);\n return () => {\n document.body.removeChild(script);\n };\n }\n\n function successCb(body) {\n preview.innerHTML = body.processed_html; // eslint-disable-line no-param-reassign\n if (body.processed_html.includes('twitter-timeline')) {\n attachTwitterTimelineScript();\n }\n activateRunkitTags();\n }\n\n const payload = JSON.stringify({\n comment: {\n body_markdown: editor.value,\n },\n });\n getCsrfToken()\n .then(sendFetch('comment-preview', payload))\n .then((response) => {\n return response.json();\n })\n .then(successCb)\n .catch((err) => {\n console.log('error!'); // eslint-disable-line\n console.log(err); // eslint-disable-line no-console\n });\n}\n\nfunction handleCommentPreview(event) {\n event.preventDefault();\n const { form } = event.target;\n const editor = form.getElementsByClassName('comment-textarea')[0];\n const preview = form.getElementsByClassName('comment-form__preview')[0];\n const trigger = form.getElementsByClassName('preview-toggle')[0];\n\n if (editor.value !== '') {\n if (form.classList.contains('preview-open')) {\n form.classList.toggle('preview-open');\n trigger.innerHTML = 'Preview';\n } else {\n getAndShowPreview(preview, editor);\n const editorHeight = editor.offsetHeight + 43; // not ideal but prevents jumping screen\n preview.style.minHeight = `${editorHeight}px`;\n trigger.innerHTML = 'Continue editing';\n form.classList.toggle('preview-open');\n }\n }\n}\n\nexport function initializeCommentPreview() {\n const previewButton = document.getElementsByClassName('preview-toggle')[0];\n\n if (!previewButton) {\n return;\n }\n\n previewButton.addEventListener('click', handleCommentPreview);\n}\n","import { addLocalizedDateTimeToElementsTitles } from \"../../utilities/localDateTime\";\n\nexport function initializeCommentDate() {\n const commentsDates = document.querySelectorAll('.comment-date time');\n\n if (commentsDates) {\n addLocalizedDateTimeToElementsTitles(commentsDates, 'datetime');\n }\n}\n","export function copyToClipboardListener() {\n const settingsOrgSecretInput = document.getElementById('settings-org-secret');\n if (settingsOrgSecretInput === null) return;\n\n const { value } = settingsOrgSecretInput;\n return window.Forem.Runtime.copyToClipboard(value).then(() => {\n // Show the confirmation message\n document.getElementById('copy-text-announcer').classList.remove('hidden');\n });\n}\n\nexport function setupCopyOrgSecret() {\n document\n .getElementById('settings-org-secret-copy-btn')\n ?.addEventListener('click', copyToClipboardListener);\n}\n","export function mobilePageSelListener(event) {\n const url = event.target.value;\n InstantClick.preload(url);\n InstantClick.display(url);\n}\n\nexport function setupMobilePageSel() {\n document\n .getElementById('mobile-page-selector')\n ?.addEventListener('change', mobilePageSelListener);\n}\n","import { setupCopyOrgSecret } from '../../settings/copyOrgSecret';\nimport { setupRssFetchTime } from '../../settings/rssFetchTime';\nimport { setupMobilePageSel } from '../../settings/mobilePageSel';\n\nexport function initializeSettings() {\n setupCopyOrgSecret();\n setupRssFetchTime();\n setupMobilePageSel();\n}\n","import { timestampToLocalDateTime } from '@utilities/localDateTime';\n\nexport function setupRssFetchTime() {\n // shows RSS fetch time in local time\n const timeNode = document.getElementById('rss-fetch-time');\n if (timeNode) {\n const timeStamp = timeNode.getAttribute('datetime');\n const timeOptions = {\n month: 'long',\n day: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric',\n };\n\n timeNode.textContent = timestampToLocalDateTime(\n timeStamp,\n navigator.language,\n timeOptions,\n );\n }\n}\n","export function sendHapticMessage(message) {\n try {\n if (\n window &&\n window.webkit &&\n window.webkit.messageHandlers &&\n window.webkit.messageHandlers.haptic\n ) {\n window.webkit.messageHandlers.haptic.postMessage(message);\n }\n } catch (err) {\n console.log(err.message); // eslint-disable-line no-console\n }\n}\n","import { sendHapticMessage } from '../../utilities/sendHapticMessage';\nimport { checkUserLoggedIn } from '../../utilities/checkUserLoggedIn';\nimport { showModalAfterError } from '../../utilities/showUserAlertModal';\nimport { initializeSubscribeButton } from '../../packs/subscribeButton';\n// eslint-disable-next-line no-redeclare\n/* global InstantClick, instantClick */\n\nfunction markNotificationsAsRead() {\n setTimeout(() => {\n if (document.getElementById('notifications-container')) {\n getCsrfToken().then((csrfToken) => {\n const locationAsArray = window.location.pathname.split('/');\n // Use regex to ensure only numbers in the original string are converted to integers\n const parsedLastParam = parseInt(\n locationAsArray[locationAsArray.length - 1].replace(/[^0-9]/g, ''),\n 10,\n );\n\n const options = {\n method: 'POST',\n headers: { 'X-CSRF-Token': csrfToken },\n };\n\n if (Number.isInteger(parsedLastParam)) {\n fetch(`/notifications/reads?org_id=${parsedLastParam}`, options);\n } else {\n fetch('/notifications/reads', options);\n }\n });\n }\n }, 450);\n}\n\nfunction fetchNotificationsCount() {\n if (\n document.getElementById('notifications-container') == null &&\n checkUserLoggedIn()\n ) {\n // Prefetch notifications page\n if (instantClick) {\n InstantClick.removeExpiredKeys('force');\n setTimeout(() => {\n InstantClick.preload(\n document.getElementById('notifications-link').href,\n 'force',\n );\n }, 30);\n }\n }\n}\n\nfunction initReactions() {\n setTimeout(() => {\n if (document.getElementById('notifications-container')) {\n let butts = document.getElementsByClassName('reaction-button');\n\n for (let i = 0; i < butts.length; i++) {\n const butt = butts[i];\n butt.setAttribute('aria-pressed', butt.classList.contains('reacted'));\n\n butt.onclick = function (event) {\n event.preventDefault();\n sendHapticMessage('medium');\n const thisButt = this;\n thisButt.classList.add('reacted');\n\n function successCb(response) {\n if (response.result === 'create') {\n thisButt.classList.add('reacted');\n thisButt.setAttribute('aria-pressed', true);\n } else {\n thisButt.classList.remove('reacted');\n thisButt.setAttribute('aria-pressed', false);\n }\n }\n\n const formData = new FormData();\n formData.append('reactable_type', thisButt.dataset.reactableType);\n formData.append('category', thisButt.dataset.category);\n formData.append('reactable_id', thisButt.dataset.reactableId);\n\n getCsrfToken()\n .then(sendFetch('reaction-creation', formData))\n .then((response) => {\n if (response.status === 200) {\n response.json().then(successCb);\n } else {\n showModalAfterError({\n response,\n element: 'reaction',\n action_ing: 'updating',\n action_past: 'updated',\n });\n }\n });\n };\n }\n\n butts = document.getElementsByClassName('toggle-reply-form');\n\n for (let i = 0; i < butts.length; i++) {\n const butt = butts[i];\n\n butt.onclick = function (event) {\n event.preventDefault();\n const thisButt = this;\n document\n .getElementById(`comment-form-for-${thisButt.dataset.reactableId}`)\n .classList.remove('hidden');\n thisButt.classList.add('hidden');\n thisButt.classList.remove('inline-flex');\n setTimeout(() => {\n document\n .getElementById(\n `comment-textarea-for-${thisButt.dataset.reactableId}`,\n )\n .focus();\n }, 30);\n };\n }\n }\n }, 180);\n}\n\nfunction listenForNotificationsBellClick() {\n const notificationsLink = document.getElementById('notifications-link');\n if (notificationsLink) {\n setTimeout(() => {\n notificationsLink.onclick = function () {\n document.getElementById('notifications-number').classList.add('hidden');\n };\n }, 180);\n }\n}\n\nfunction initFilter() {\n const notificationsFilterSelect = document.getElementById(\n 'notifications-filter__select',\n );\n const changeNotifications = (event) => {\n window.location.href = event.target.value;\n };\n if (notificationsFilterSelect) {\n notificationsFilterSelect.addEventListener('change', changeNotifications);\n }\n}\n\nfunction initPagination() {\n // paginators appear after each block of HTML notifications sent by the server\n const paginators = document.getElementsByClassName('notifications-paginator');\n if (paginators && paginators.length > 0) {\n const paginator = paginators[paginators.length - 1];\n\n if (paginator) {\n window\n .fetch(paginator.dataset.paginationPath, {\n method: 'GET',\n credentials: 'same-origin',\n })\n .then((response) => {\n if (response.status === 200) {\n response.text().then((html) => {\n const markup = html.trim();\n\n if (markup) {\n const container = document.getElementById('articles-list');\n\n const newNotifications = document.createElement('div');\n newNotifications.innerHTML = markup;\n\n paginator.remove();\n container.append(newNotifications);\n\n initReactions();\n } else {\n // no more notifications to load, we hide the load more wrapper\n const button = document.getElementById('load-more-button');\n if (button) {\n button.style.display = 'none';\n }\n paginator.remove();\n }\n\n initializeSubscribeButton();\n });\n }\n });\n }\n }\n}\n\nfunction initLoadMoreButton() {\n const button = document.getElementById('load-more-button');\n if (button) {\n button.addEventListener('click', initPagination);\n }\n}\n\nexport function initializeNotifications() {\n fetchNotificationsCount();\n markNotificationsAsRead();\n initReactions();\n listenForNotificationsBellClick();\n initFilter();\n initPagination();\n initLoadMoreButton();\n}\n","export function checkUserLoggedIn() {\n const { body } = document;\n if (!body) {\n return false;\n }\n\n return body.getAttribute('data-user-status') === 'logged-in';\n}\n","import { localizeTimeElements } from '../../utilities/localDateTime';\n\nexport function initializeDateHelpers() {\n // Date without year: Jul 12\n localizeTimeElements(document.querySelectorAll('time.date-no-year'), {\n month: 'short',\n day: 'numeric',\n });\n\n // Full date: Jul 12, 2020\n localizeTimeElements(document.querySelectorAll('time.date'), {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n });\n\n // Date with short year: Jul 12 '20\n localizeTimeElements(document.querySelectorAll('time.date-short-year'), {\n year: '2-digit',\n month: 'short',\n day: 'numeric',\n });\n}\n","import { initializeCommentDate } from './initializers/initializeCommentDate';\nimport { initializeCommentPreview } from './initializers/initializeCommentPreview';\nimport { initializeTimeFixer } from './initializers/initializeTimeFixer';\nimport { initializeNotifications } from './initializers/initializeNotifications';\nimport { initializeDateHelpers } from './initializers/initializeDateTimeHelpers';\nimport { initializeSettings } from './initializers/initializeSettings';\nimport {\n showUserAlertModal,\n showModalAfterError,\n} from '@utilities/showUserAlertModal';\n\ninitializeCommentDate();\ninitializeCommentPreview();\ninitializeSettings();\ninitializeNotifications();\ninitializeTimeFixer();\ninitializeDateHelpers();\n\nInstantClick.on('change', () => {\n initializeCommentDate();\n initializeCommentPreview();\n initializeSettings();\n initializeNotifications();\n});\n\nwindow.showUserAlertModal = showUserAlertModal;\nwindow.showModalAfterError = showModalAfterError;\n"],"sourceRoot":""}