},
"optionsTimeAll": {"message": "Everything"},
"optionsPrompt": {"message": "Prompt before deleting"},
+ "optionsCookies": {"message": "Clear cookies too"},
"optionsSaved": {"message": "Preferences saved!"},
"confirmPrompt": {"message": "Are you sure you want to delete the history?"},
"notificationTitle": {"message": "History deleted successfully!"},
width: 400px;
}
#opt-time,
-#opt-prompt {
+#opt-prompt,
+#opt-cookies {
background-color: white;
clear: left;
margin: 5px auto;
chrome.browserAction.onClicked.addListener(function(tab) {
// Get the value from localStorage
var showPrompt = localStorage['prompt'] || CONSTANTS.YES;
+ var clearCookies = localStorage['cookies'] || CONSTANTS.NO;
// The confirmation message to ask
var message = chrome.i18n.getMessage('confirmPrompt');
// Clear cookies, and then clear the history
if (showPrompt === CONSTANTS.YES) {
- confirm(message) && clearCookies(clearHistory);
- } else {
+ if (!confirm(message))
+ return;
+ }
+ if (clearCookies === CONSTANTS.YES) {
clearCookies(clearHistory);
+ } else {
+ clearHistory();
}
});
$('#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;
});
(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);
}
/**
optionSaved();
}
+function setCheck() {
+ localStorage[this.name] = this.checked ? CONSTANTS.YES : CONSTANTS.NO;
+ optionSaved();
+}
+
// For rapid changes/saves
var isSaving = null;
/**
</div>
</div>
<hr>
+ <div id="opt-cookies">
+ <div class="opt-name">
+ <b> </b>
+ </div>
+ <div class="opt-value">
+ <div class="opt-option">
+ <input name="cookies" class="opt-chk" type="checkbox">
+ <div class="opt-label" id="optionsCookies"></div>
+ </div>
+ </div>
+ </div>
+ <hr>
<div id="optionsSaved">
<b></b>
</div>