Skip to content

Commit

Permalink
issue cucumber#637 - addressing a PR comment for tidying up code
Browse files Browse the repository at this point in the history
  • Loading branch information
10xtechie committed Jun 30, 2022
1 parent f8aec78 commit f9cf999
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions themes/cucumber-sb/static/js/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ function getLangFromUrl(){
return lang
}

function setDefaultLang(){
if(!supportedLanguages.includes(localStorage.getItem('language'))){
showOnly(defaulLanguage)
localStorage.setItem('language', defaulLanguage)
}else{
showOnly(localStorage.getItem('language'))
}
}
// Activate

var supportedLanguages = [
Expand All @@ -133,22 +141,12 @@ var defaulLanguage = 'java'
ready(function() {
var selectedLang = getLangFromUrl();
if((selectedLang == '' || selectedLang == null)){
if(localStorage.getItem('language') == ''){
showOnly(defaulLanguage)
localStorage.setItem('language', defaulLanguage)
}else{
showOnly(localStorage.getItem('language'))
}
setDefaultLang()
}else{
if(supportedLanguages.includes(selectedLang)){
showOnly(selectedLang)
}else{
if(localStorage.getItem('language') == ''){
showOnly(defaulLanguage)
localStorage.setItem('language', defaulLanguage)
}else{
showOnly(localStorage.getItem('language'))
}
setDefaultLang()
}
}

Expand Down

0 comments on commit f9cf999

Please sign in to comment.