X-Git-Url: https://git.wh0rd.org/?p=chrome-ext%2Fclearhistory-advance-fork.git;a=blobdiff_plain;f=javascript%2Foptions.js;h=62721cbdd7d44c888c5a25d7bb02584a64c5b992;hp=682347bff6c00e2e6d68980bba947938c3030673;hb=77dffdcdb7a4c632fd98c566eb2b3f487f6efb0e;hpb=e70bcd55897cb58bc2f632a46f6e88827dcdb04a diff --git a/javascript/options.js b/javascript/options.js index 682347b..62721cb 100644 --- a/javascript/options.js +++ b/javascript/options.js @@ -30,12 +30,16 @@ function init() { $('#optionsHeader')[0].innerText = chrome.i18n.getMessage('optionsHeader'); $('#optionsPrompt')[0].innerText = chrome.i18n.getMessage('optionsPrompt'); $('#optionsTimeFor')[0].innerText = chrome.i18n.getMessage('optionsTimeFor'); + $('#optionsCookies')[0].innerText = chrome.i18n.getMessage('optionsCookies'); $('#optionsSaved > b')[0].innerText = chrome.i18n.getMessage('optionsSaved'); // Bind all the callbacks $('#opt-time input.opt-chk[type=radio]').forEach(function(e) { e.onclick = toggle; }); + $('input.opt-chk[type=checkbox]').forEach(function(e) { + e.onclick = setCheck; + }); $('#opt-prompt input.opt-chk[type=checkbox]').forEach(function(e) { e.onclick = setPrompt; }); @@ -45,9 +49,11 @@ function init() { (localStorage['time'] = CONSTANTS.DEFAULT_TIME); var showPrompt = localStorage['prompt'] || (localStorage['prompt'] = CONSTANTS.YES); + var clearCookies = localStorage['cookies'] || CONSTANTS.NO; $('input[name=time][value="' + time + '"]')[0].checked = true; $('input[name=prompt]')[0].checked = (showPrompt === CONSTANTS.YES); + $('input[name=cookies]')[0].checked = (clearCookies === CONSTANTS.YES); } /** @@ -68,6 +74,11 @@ function setPrompt() { optionSaved(); } +function setCheck() { + localStorage[this.name] = this.checked ? CONSTANTS.YES : CONSTANTS.NO; + optionSaved(); +} + // For rapid changes/saves var isSaving = null; /**