presist checklist states in localStorage
This commit is contained in:
@ -24,12 +24,10 @@ $(document).ready(function() {
|
|||||||
setCSRFToken($('meta[name="csrf-token"]').attr('content'));
|
setCSRFToken($('meta[name="csrf-token"]').attr('content'));
|
||||||
|
|
||||||
$('.checklist-element').each(function() {
|
$('.checklist-element').each(function() {
|
||||||
if (!!$(this).attr('id')) {
|
var checklistElementId = $(this).attr('id');
|
||||||
var checklistElementId = $('.checklist-element').attr('id');
|
if(!!localStorage[checklistElementId]) {
|
||||||
if(localStorage[checklistElementId]) {
|
$(this).children('.step-text').addClass('italic');
|
||||||
$(this).children('.step-text').addClass('italic');
|
$(this).children().children('input').trigger('click');
|
||||||
$(this).children('input').trigger('click');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -49,13 +47,13 @@ $(document).ready(function() {
|
|||||||
if ($(this).is(":checked")) {
|
if ($(this).is(":checked")) {
|
||||||
$(this).parent().parent().children('.step-text').addClass('italic');
|
$(this).parent().parent().children('.step-text').addClass('italic');
|
||||||
if (!localStorage || !localStorage[checkboxId]) {
|
if (!localStorage || !localStorage[checkboxId]) {
|
||||||
localStorage[checkboxId] = "true";
|
localStorage[checkboxId] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$(this).is(":checked")) {
|
if (!$(this).is(":checked")) {
|
||||||
$(this).parent().parent().children('.step-text').removeClass('italic');
|
$(this).parent().parent().children('.step-text').removeClass('italic');
|
||||||
if (localStorage[checkboxId]) {
|
if (localStorage[checkboxId]) {
|
||||||
localStorage[checkboxId] = "false";
|
localStorage.removeItem(checkboxId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user