@@ -6,20 +6,22 @@ export default class PolyglotHooks {
66 static renderChatLog ( chatlog , html , data ) {
77 game . polyglot . renderChatLog = true ;
88 const input = game . settings . get ( "polyglot" , "displayCheckbox" )
9- ? `<input name ="polyglot-checkbox" type="checkbox" ${ game . settings . get ( "polyglot" , "checkbox" ) ? "checked" : "" } >`
9+ ? `<input id ="polyglot-checkbox" type="checkbox" ${ game . settings . get ( "polyglot" , "checkbox" ) ? "checked" : "" } >`
1010 : "" ;
11- html . find ( "#chat-controls" ) . after (
12- `<div id='polyglot' class='polyglot polyglot-lang-select flexrow'>
13- ${ input }
14- <label>${ game . i18n . localize ( "POLYGLOT.LanguageLabel" ) } </label>
15- <select name='polyglot-language'></select>
16- </div>` ,
17- ) ;
18- html . find ( ".polyglot-lang-select select" ) . change ( ( ev ) => {
11+ const polyglotDiv = document . createElement ( "div" ) ;
12+ polyglotDiv . setAttribute ( "id" , "polyglot" ) ;
13+ polyglotDiv . classList . add ( "polyglot" , "polyglot-lang-select" , "flexrow" ) ;
14+ polyglotDiv . innerHTML = `
15+ ${ input }
16+ <label for="polyglot-checkbox">${ game . i18n . localize ( "POLYGLOT.LanguageLabel" ) } </label>
17+ <select name='polyglot-language'></select>
18+ ` ;
19+ html . querySelector ( ".chat-controls" ) . insertAdjacentElement ( "afterend" , polyglotDiv ) ;
20+ html . querySelector ( ".polyglot-lang-select select" ) . addEventListener ( "change" , ( ev ) => {
1921 const lang = ev . target . value ;
2022 game . polyglot . lastSelection = lang ;
2123 } ) ;
22- html . find ( "input[name ='polyglot-checkbox']" ) . change ( ( ev ) => {
24+ html . querySelector ( "input[id ='polyglot-checkbox']" ) . addEventListener ( "change" , ( ev ) => {
2325 game . settings . set ( "polyglot" , "checkbox" , ev . target . checked ) ;
2426 } ) ;
2527 game . polyglot . updateUserLanguages ( html ) ;
0 commit comments