1212 display : flex;
1313 flex-direction : column;
1414 align-items : center;
15- justify-content : center ;
15+ justify-content : flex-start ;
1616 background : # f5f5f5 ;
1717 }
1818
1919 main {
2020 width : 80% ;
2121 max-width : 600px ;
2222 text-align : center;
23+ margin-top : 2rem ;
2324 }
2425
2526 h1 {
5253 font-family : monospace;
5354 font-size : 1.25rem ;
5455 }
56+
57+ .passphrase-section {
58+ margin-top : 2rem ;
59+ text-align : center;
60+ }
61+
62+ .passphrase-options label {
63+ margin-right : 1rem ;
64+ font-size : 1.1rem ;
65+ }
66+
67+ # passphrase {
68+ font-size : 1.5rem ;
69+ font-weight : bold;
70+ margin-top : 1rem ;
71+ word-wrap : break-word;
72+ }
5573 </ style >
5674</ head >
5775< body >
@@ -63,10 +81,22 @@ <h1>🎲 Word Roller</h1>
6381 < button onclick ="rollWords() "> Roll!</ button >
6482 </ div >
6583 < div class ="word-list " id ="result "> Loading wordlist...</ div >
84+
85+ < div class ="passphrase-section ">
86+ < h2 > Passphrase</ h2 >
87+ < div class ="passphrase-options ">
88+ < label > < input type ="radio " name ="delimiter " value =" " checked > space</ label >
89+ < label > < input type ="radio " name ="delimiter " value =". "> period</ label >
90+ < label > < input type ="radio " name ="delimiter " value ="- "> hyphen</ label >
91+ < label > < input type ="radio " name ="delimiter " value =", "> comma</ label >
92+ </ div >
93+ < div id ="passphrase "> </ div >
94+ </ div >
6695</ main >
6796
6897 < script >
6998 let csvData = [ ] ;
99+ let lastWords = [ ] ;
70100
71101 // Load the CSV when the page loads
72102 fetch ( './wordlist.csv' )
@@ -104,6 +134,12 @@ <h1>🎲 Word Roller</h1>
104134 return shuffled ;
105135 }
106136
137+ function updatePassphrase ( ) {
138+ const delimiter = document . querySelector ( 'input[name="delimiter"]:checked' ) . value ;
139+ const romajiWords = lastWords . map ( row => row . split ( ',' ) [ 3 ] ) ;
140+ document . getElementById ( 'passphrase' ) . textContent = romajiWords . join ( delimiter ) ;
141+ }
142+
107143 function rollWords ( ) {
108144 const resultEl = document . getElementById ( 'result' ) ;
109145 const num = parseInt ( document . getElementById ( 'numWords' ) . value ) ;
@@ -119,16 +155,23 @@ <h1>🎲 Word Roller</h1>
119155 }
120156
121157 // Shuffle and select random entries
122- const shuffled = secureShuffle ( csvData ) . slice ( 0 , num ) ;
158+ lastWords = secureShuffle ( csvData ) . slice ( 0 , num ) ;
123159
124- // Extract columns 2 and 4
125- const output = shuffled . map ( row => {
160+ // Extract columns 2, 3, and 4 for display
161+ const output = lastWords . map ( row => {
126162 const cols = row . split ( ',' ) ;
127163 return `${ cols [ 1 ] } - ${ cols [ 2 ] } - ${ cols [ 3 ] } ` ;
128164 } ) . join ( '\n' ) ;
129165
130166 resultEl . textContent = output ;
167+
168+ updatePassphrase ( ) ;
131169 }
170+
171+ // Update passphrase when delimiter changes
172+ document . querySelectorAll ( 'input[name="delimiter"]' ) . forEach ( radio => {
173+ radio . addEventListener ( 'change' , updatePassphrase ) ;
174+ } ) ;
132175 </ script >
133176</ body >
134177</ html >
0 commit comments