@@ -43,8 +43,9 @@ $.onReady(function () {
4343 const elOexBtn = $ . id ( "oex" ) ;
4444 const elOexMenu = $ . id ( "oexMenu" ) ;
4545 const elOexMenuItems = $ . all ( "#oexMenu .dropdown-item" ) ;
46+ const elNl = $ . id ( "nl" ) ;
4647 const elNlGroup = $ . id ( "nlGroup" ) ;
47- const elNlGroupBtns = $ . all ( "#nlGroup .btn " ) ;
48+ const elNlMenuItems = $ . all ( "#nlMenu [data-nl] " ) ;
4849 const elTz = $ . id ( "tz" ) ;
4950 const elTzGroup = $ . id ( "tzGroup" ) ;
5051 const elTzMenuItems = $ . all ( "#tzMenuItems [data-tz]" ) ;
@@ -76,7 +77,7 @@ $.onReady(function () {
7677
7778 elOexBtn . setAttribute ( "data-oe" , selectItem ( elOexMenuItems , elOexMenu , "oe" , "oex" ) ) ;
7879 selectItem ( elOeGroupBtns , elOeGroup , "oe" , "oe" ) ;
79- selectItem ( elNlGroupBtns , elNlGroup , "nl" , "nl" ) ;
80+ elNl . setAttribute ( "data-nl" , selectItem ( elNlMenuItems , elNlGroup , "nl" , "nl" ) ) ;
8081 elTz . setAttribute ( "data-tz" , selectItem ( elTzMenuItems , elTzGroup , "tz" , "tz" ) ) ;
8182
8283 elOptions . forEach ( ( el ) => {
@@ -212,16 +213,22 @@ $.onReady(function () {
212213 }
213214
214215 if ( dencoderDefs [ dencodeMethod ] . useNl ) {
216+ let elNlMenuItem = elNlMenuItems . find ( ( el ) => el . classList . contains ( "active" ) ) ;
217+ if ( ! elNlMenuItem ) {
218+ elNlMenuItem = elNlMenuItems [ 0 ] ;
219+ }
220+ elNl . textContent = elNlMenuItem . textContent ;
221+ elNl . setAttribute ( "data-nl" , elNlMenuItem . getAttribute ( "data-nl" ) ) ;
222+
215223 elNlGroup . style . display = "" ;
216224
217- $ . on ( elNlGroupBtns , "click" , function ( ) {
218- if ( this . classList . contains ( "active" ) ) {
219- return ;
220- }
221-
222- elNlGroupBtns . forEach ( ( el ) => el . classList . remove ( "active" ) ) ;
225+ $ . on ( elNlMenuItems , "click" , function ( ) {
226+ elNlMenuItems . forEach ( ( el ) => el . classList . remove ( "active" ) ) ;
223227 this . classList . add ( "active" ) ;
224228
229+ elNl . textContent = this . textContent ;
230+ elNl . setAttribute ( "data-nl" , this . getAttribute ( "data-nl" ) ) ;
231+
225232 dencode ( ) ;
226233 } ) ;
227234 }
@@ -775,7 +782,7 @@ $.onReady(function () {
775782 const v = elV . value ;
776783 const oe = elOeGroupBtns . find ( ( el ) => el . classList . contains ( "active" ) ) ?. getAttribute ( "data-oe" ) ;
777784 const oex = elOexMenuItems . find ( ( el ) => el . classList . contains ( "active" ) ) ?. getAttribute ( "data-oe" ) ;
778- const nl = elNlGroupBtns . find ( ( el ) => el . classList . contains ( "active" ) ) ? .getAttribute ( "data-nl" ) ;
785+ const nl = elNl . getAttribute ( "data-nl" ) ;
779786 const tz = elTz . getAttribute ( "data-tz" ) ;
780787 let options = { } ;
781788 elOptions . forEach ( ( el ) => {
@@ -955,7 +962,7 @@ $.onReady(function () {
955962 url += "&oe=" + encodeURIComponent ( oe ) ;
956963 }
957964 if ( dcDef === null || dcDef . useNl ) {
958- const nl = elNlGroupBtns . find ( ( el ) => el . classList . contains ( "active" ) ) ? .getAttribute ( "data-nl" ) ;
965+ const nl = elNl . getAttribute ( "data-nl" ) ;
959966 url += "&nl=" + encodeURIComponent ( nl ) ;
960967 }
961968 if ( dcDef === null || dcDef . useTz ) {
0 commit comments