Skip to content

Commit

Permalink
Merge pull request #262 from kojiishi/switch-lang-to-url-search-params
Browse files Browse the repository at this point in the history
Update URL when swithing the language in UI
  • Loading branch information
kojiishi authored Feb 14, 2024
2 parents d4107b5 + d109d3c commit 4a8330e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ function switchLang (lang) {
for (var i=0;i<els.length;i++) els[i].classList.add('hidden')
}
})

const url = new URL(document.location);
const params = url.searchParams;
if (lang == 'all')
params.delete('lang');
else
params.set('lang', lang);
history.replaceState(null, null, url.toString());
}


Expand Down

0 comments on commit 4a8330e

Please sign in to comment.