diff --git a/public/js/main.js b/public/js/main.js index 6c79342262..d956fa9b58 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -23,6 +23,16 @@ $(document).ready(function() { setCSRFToken($('meta[name="csrf-token"]').attr('content')); + $('.checklist-element').each(function() { + if (!!$(this).attr('id')) { + var checklistElementId = $('.checklist-element').attr('id'); + if(localStorage[checklistElementId]) { + $(this).children('.step-text').addClass('italic'); + $(this).children('input').trigger('click'); + } + } + }); + $('.start-challenge').on('click', function() { $(this).parent().remove(); $('.challenge-content') @@ -35,11 +45,18 @@ $(document).ready(function() { }); $('.challenge-list-checkbox').on('change', function() { + var checkboxId = $(this).parent().parent().attr('id'); if ($(this).is(":checked")) { $(this).parent().parent().children('.step-text').addClass('italic'); + if (!localStorage || !localStorage[checkboxId]) { + localStorage[checkboxId] = "true"; + } } if (!$(this).is(":checked")) { $(this).parent().parent().children('.step-text').removeClass('italic'); + if (localStorage[checkboxId]) { + localStorage[checkboxId] = "false"; + } } }); diff --git a/views/coursewares/showVideo.jade b/views/coursewares/showVideo.jade index 98c35261c7..aba672bada 100644 --- a/views/coursewares/showVideo.jade +++ b/views/coursewares/showVideo.jade @@ -6,9 +6,9 @@ block content .well h4 ol - for step in details + for step, index in details .row - li + li.checklist-element(id="#{dashedName + index}") .col-xs-2 input(type='checkbox' class='challenge-list-checkbox') .col-xs-10.step-text!= step