Skip to content

Commit

Permalink
fix session-storage key names relates #35
Browse files Browse the repository at this point in the history
  • Loading branch information
MissArray committed Sep 18, 2018
1 parent e3ff535 commit e887a45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions public/js/checkboxlocalstoragebackground.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var checkboxes = document.querySelectorAll('.govuk-checkboxes__input');

checkboxes.forEach(function (i) {
i.addEventListener('click', clickFunc);
if(sessionStorage.hasOwnProperty(i.value)){
if(sessionStorage.hasOwnProperty(i.value + '-background')){
i.checked = true;
}
})
Expand All @@ -11,8 +11,8 @@ function clickFunc() {
if(this.checked){
sessionStorage.setItem(this.value + '-background', this.value);
} else {
if(sessionStorage.hasOwnProperty(this.value)){
sessionStorage.removeItem(this.value);
if(sessionStorage.hasOwnProperty(this.value + '-background')){
sessionStorage.removeItem(this.value + '-background');
}
}
}
6 changes: 3 additions & 3 deletions public/js/checkboxlocalstorageresources.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var checkboxes = document.querySelectorAll('.govuk-checkboxes__input');

checkboxes.forEach(function (i) {
i.addEventListener('click', clickFunc);
if(sessionStorage.hasOwnProperty(i.value)){
if(sessionStorage.hasOwnProperty(i.value + '-resource')){
i.checked = true;
}
})
Expand All @@ -11,8 +11,8 @@ function clickFunc() {
if(this.checked){
sessionStorage.setItem(this.value + '-resource', this.value);
} else {
if(sessionStorage.hasOwnProperty(this.value)){
sessionStorage.removeItem(this.value);
if(sessionStorage.hasOwnProperty(this.value + '-resource')){
sessionStorage.removeItem(this.value + '-resource');
}
}
}

0 comments on commit e887a45

Please sign in to comment.