]> git.wh0rd.org - chrome-ext/clearhistory-advance-fork.git/blobdiff - javascript/clearhistory.js
make cookie deletion optional
[chrome-ext/clearhistory-advance-fork.git] / javascript / clearhistory.js
index d73827a7e57aed5349752130ab9baa38eea0044b..3766f6bf83e3a3d1adc440a3838e9f3b1f6b652e 100644 (file)
@@ -89,14 +89,19 @@ function clearHistory() {
 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();
   }
 });