{"version":3,"sources":["webpack:///./app/javascript/packs/common/user_info.js"],"names":["document","addEventListener","infoLink","getElementById","bell","bellCheck","undefined","style","display","dropdown","classList","contains","remove","add","user","alreadyRead","dataset","read","request","XMLHttpRequest","token","getElementsByName","item","content","open","setRequestHeader","status","console","log","send"],"mappings":"4EAqCAA,SAASC,iBAAiB,oBArC1B,WACE,IAAMC,EAAWF,SAASG,eAAe,QACnCC,EAAOJ,SAASG,eAAe,QAE/BE,EAAYL,SAASG,eAAe,mBAC9BG,GAARF,IAAqBA,EAAKG,MAAMC,QAAU,QAC1CN,GACFA,EAASD,iBAAiB,SAAS,WACjC,IAAMQ,EAAWT,SAASG,eAAe,YAErCM,EAASC,UAAUC,SAAS,aAC9BF,EAASC,UAAUE,OAAO,aAE1BH,EAASC,UAAUG,IAAI,aAGzB,IAAMC,EAAOd,SAASG,eAAe,QAC/BY,EAAcD,EAAKE,QAAQC,KAEjC,GAAIH,GAAuB,SAAfC,EAAwB,CAElCX,EAAKG,MAAMC,QAAU,QACrBH,EAAUE,MAAMC,QAAU,OAG1B,IAAMU,EAAU,IAAIC,eACdC,EAAQpB,SAASqB,kBAAkB,cAAcC,KAAK,GAAGC,QAC/DL,EAAQM,KAAK,QAAS,oCAAoC,GAC1DN,EAAQO,iBAAiB,eAAgBL,GACzCF,EAAQjB,iBAAiB,QAAQ,WACR,MAAnBiB,EAAQQ,QAAgBC,QAAQC,IAAI,YAE1CV,EAAQW,gB","file":"js/common/user_info-30c25e4288e09dbe6b05.chunk.js","sourcesContent":["function initApp() {\n const infoLink = document.getElementById('info');\n const bell = document.getElementById('bell');\n // already_read_admin_info が false の時、通常のベルマークは非表示\n const bellCheck = document.getElementById('bell-check');\n if (bell != undefined) { bell.style.display = \"none\" }\n if (infoLink) {\n infoLink.addEventListener('click', () => {\n const dropdown = document.getElementById('dropdown');\n // クリックで表示・非表示\n if (dropdown.classList.contains('is-active')) {\n dropdown.classList.remove('is-active')\n } else {\n dropdown.classList.add('is-active');\n }\n\n const user = document.getElementById('user');\n const alreadyRead = user.dataset.read;\n // already_read_admin_info が false → 未読のお知らせがある(チェックマーク付きのベルマークが表示)\n if (user && alreadyRead == 'false') {\n // チェックマーク付きのベルマークは非表示。通常のベルマークが表示。\n bell.style.display = \"block\";\n bellCheck.style.display = \"none\";\n\n // current_user.already_read_admin_info を true にする。\n const request = new XMLHttpRequest();\n const token = document.getElementsByName('csrf-token').item(0).content;\n request.open('PATCH', '/already_read_admin_info_to_true', true);\n request.setRequestHeader('X-CSRF-Token', token);\n request.addEventListener('load', () => {\n if (request.status !== 204) console.log('error');\n });\n request.send();\n }\n });\n }\n}\ndocument.addEventListener('DOMContentLoaded', initApp);\n"],"sourceRoot":""}