@@ -11,15 +11,12 @@ async function updateMediaType(attachmentsCount, attachmentListElem) {
1111 let mediaTypeDesc ;
1212 if ( attachmentsCount === 0 ) {
1313 mediaTypeDesc = 'Text 📝' ;
14- }
15- else if ( attachmentsCount === 1 ) {
16- const singleAttachmentType = attachmentListElem . querySelector ( 'select' ) . value ;
17- if ( singleAttachmentType === 'Image' )
18- mediaTypeDesc = 'Image 🖼️' ;
19- else
20- mediaTypeDesc = 'Video 🎬' ;
21- }
22- else {
14+ } else if ( attachmentsCount === 1 ) {
15+ const singleAttachmentType =
16+ attachmentListElem . querySelector ( 'select' ) . value ;
17+ if ( singleAttachmentType === 'Image' ) mediaTypeDesc = 'Image 🖼️' ;
18+ else mediaTypeDesc = 'Video 🎬' ;
19+ } else {
2320 mediaTypeDesc = 'Carousel 🎠' ;
2421 }
2522
@@ -45,12 +42,18 @@ document.addEventListener('DOMContentLoaded', async () => {
4542 const parentDiv = e . target . parentNode . parentNode ;
4643 parentDiv . remove ( ) ;
4744
48- await updateMediaType ( attachmentsList . children . length , attachmentsList ) ;
45+ await updateMediaType (
46+ attachmentsList . children . length ,
47+ attachmentsList
48+ ) ;
4949 } ) ;
5050
5151 const mediaTypeSelectElem = div . querySelector ( 'select' ) ;
5252 mediaTypeSelectElem . addEventListener ( 'change' , async ( e ) => {
53- await updateMediaType ( attachmentsList . children . length , attachmentsList ) ;
53+ await updateMediaType (
54+ attachmentsList . children . length ,
55+ attachmentsList
56+ ) ;
5457 } ) ;
5558
5659 await updateMediaType ( attachmentsList . children . length , attachmentsList ) ;
@@ -62,12 +65,13 @@ document.addEventListener('DOMContentLoaded', async () => {
6265 attachPollButton . addEventListener ( 'click' , async ( e ) => {
6366 e . preventDefault ( ) ;
6467
65- const pollAttachmentOptions = document . getElementById ( 'poll-attachment-options' ) ;
68+ const pollAttachmentOptions = document . getElementById (
69+ 'poll-attachment-options'
70+ ) ;
6671 if ( pollAttachmentOptions . style . display === 'none' ) {
6772 pollAttachmentOptions . style . display = 'block' ;
6873 } else {
6974 pollAttachmentOptions . style . display = 'none' ;
7075 }
71-
7276 } ) ;
7377} ) ;
0 commit comments