{"version":3,"file":"clickHandlers-C1GBfVCp.js","sources":["../../../client/app/assets/javascripts/clickHandlers.js"],"sourcesContent":["import $ from 'jquery';\n\n$('.cb.expand-collapse-button').click(function () {\n const id = $(this).attr(\"id\")\n const topSection = $(`#college-board-toggle-top-section-${id}`);\n const bottomSection = $(`#college-board-toggle-bottom-section-${id}`);\n if(topSection.hasClass('closed')) {\n topSection.removeClass('closed')\n topSection.addClass('open')\n bottomSection.removeClass('hidden')\n } else {\n topSection.removeClass('open')\n topSection.addClass('closed')\n bottomSection.addClass('hidden')\n }\n});\n\n$('.q-and-a-question-button').on('click keydown', function (e) {\n if (e.type === 'keydown' && e.key !== 'Enter') { return; }\n\n const questionButtonId = $(this).attr(\"id\");\n const answerSectionId = questionButtonId.replace('-question-', '-q-and-a-answer-section-');\n const answerSection = $('#' + answerSectionId);\n\n if (answerSection.hasClass('show')) {\n answerSection.removeClass('show').addClass('hide');\n } else {\n answerSection.removeClass('hide').addClass('show');\n }\n});\n\n$('.q-and-a.expand-collapse-button').click(function () {\n const expandButtonId = $(this).attr(\"id\");\n const answerSectionId = expandButtonId.replace('expand-collapse', 'q-and-a-answer-section');\n const answerSection = $('#' + answerSectionId);\n\n const innerTextElement = $(this).children('p').eq(0);\n const innerImgElement = $(this).children('img').eq(0);\n const expandSrc = 'https://assets.quill.org/images/shared/expand.svg';\n const collapseSrc = 'https://assets.quill.org/images/shared/collapse.svg';\n\n // A flag to detect if we're expanding\n let isExpanding = false;\n\n if (answerSection.hasClass('show') && innerTextElement.length !== 0) {\n innerTextElement.text('Expand');\n answerSection.removeClass('show').addClass('hide').attr('aria-hidden', 'true');\n } else if (answerSection.hasClass('show') && innerImgElement.length !== 0) {\n innerImgElement.attr('src', expandSrc);\n answerSection.removeClass('show').addClass('hide').attr('aria-hidden', 'true');\n } else if (answerSection.hasClass('hide') && innerTextElement.length !== 0) {\n innerTextElement.text('Collapse');\n answerSection.removeClass('hide').addClass('show').attr('aria-hidden', 'false');\n isExpanding = true;\n } else if (answerSection.hasClass('hide') && innerImgElement.length !== 0) {\n innerImgElement.attr('src', collapseSrc);\n answerSection.removeClass('hide').addClass('show').attr('aria-hidden', 'false');\n isExpanding = true;\n }\n\n // If we just expanded the answer section, move focus to its first link\n if (isExpanding) {\n // A slight delay may be necessary for the content to become visible\n setTimeout(function () {\n const firstLink = answerSection.find('a').first();\n if (firstLink.length) {\n firstLink.focus();\n }\n }, 100);\n }\n});\n\n"],"names":["$","id","topSection","bottomSection","e","answerSectionId","answerSection","innerTextElement","innerImgElement","expandSrc","collapseSrc","isExpanding","firstLink"],"mappings":"gFAEAA,EAAE,4BAA4B,EAAE,MAAM,UAAY,CAChD,MAAMC,EAAKD,EAAE,IAAI,EAAE,KAAK,IAAI,EACtBE,EAAaF,EAAE,qCAAqCC,CAAE,EAAE,EACxDE,EAAgBH,EAAE,wCAAwCC,CAAE,EAAE,EACjEC,EAAW,SAAS,QAAQ,GAC7BA,EAAW,YAAY,QAAQ,EAC/BA,EAAW,SAAS,MAAM,EAC1BC,EAAc,YAAY,QAAQ,IAElCD,EAAW,YAAY,MAAM,EAC7BA,EAAW,SAAS,QAAQ,EAC5BC,EAAc,SAAS,QAAQ,EAEnC,CAAC,EAEDH,EAAE,0BAA0B,EAAE,GAAG,gBAAiB,SAAUI,EAAG,CAC7D,GAAIA,EAAE,OAAS,WAAaA,EAAE,MAAQ,QAAW,OAGjD,MAAMC,EADmBL,EAAE,IAAI,EAAE,KAAK,IAAI,EACD,QAAQ,aAAc,0BAA0B,EACnFM,EAAgBN,EAAE,IAAMK,CAAe,EAEzCC,EAAc,SAAS,MAAM,EAC/BA,EAAc,YAAY,MAAM,EAAE,SAAS,MAAM,EAEjDA,EAAc,YAAY,MAAM,EAAE,SAAS,MAAM,CAErD,CAAC,EAEDN,EAAE,iCAAiC,EAAE,MAAM,UAAY,CAErD,MAAMK,EADiBL,EAAE,IAAI,EAAE,KAAK,IAAI,EACD,QAAQ,kBAAmB,wBAAwB,EACpFM,EAAgBN,E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