"optionsDownloads": {"message": "Clear download history"},
"optionsSaved": {"message": "Preferences saved!"},
"optionsAutoclear": {"message": "Automatically purge old entries"},
+ "optionsNotify": {"message": "Display a notification whenever data is cleared"},
"confirmPrompt": {"message": "Are you sure you want to delete the history?"},
"notificationTitle": {"message": "History deleted successfully!"},
"notificationTimeNewer": {
* Callback for when history deletion is successful
*/
function didClearHistory(s) {
+ if (s.notify !== CONSTANTS.YES)
+ return;
+
var time = ~~(s.time) || CONSTANTS.DEFAULT_TIME;
time = getUnitsForTime(time);
var timeMsg = (time.time === -1) ? 'notificationTimeAll' :
'notificationTimeOlder';
var timeString = chrome.i18n.getMessage(timeMsg, [time.time, time.units]);
var message = chrome.i18n.getMessage('notificationBody', timeString);
- var notification = webkitNotifications.createNotification(
- chrome.extension.getURL('/images/icon48.png'),
- chrome.i18n.getMessage('notificationTitle'),
- message);
- notification.show();
- setTimeout(function() {
- notification.cancel();
- }, 5000);
+ var options = {
+ type: 'basic',
+ title: chrome.i18n.getMessage('notificationTitle'),
+ message: message,
+ iconUrl: chrome.extension.getURL('/images/icon128.png'),
+ };
+
+ var id = 'clearhistory advance notify';
+ chrome.notifications.clear(id, function(wasCleared) {
+ chrome.notifications.create(id, options, function(){});
+ });
}
/**
function runCleaner() {
var keys = [
- 'cookies', 'downloads', 'time', 'timeStart',
+ 'cookies', 'downloads', 'time', 'timeStart', 'notify',
];
chrome.storage.sync.get(keys, function(s) {
if (s.cookies === CONSTANTS.YES) {
// Load or set localStorage data
var settings = [
- 'timeStart', 'time', 'prompt', 'cookies', 'downloads', 'autoclear',
+ 'timeStart', 'time', 'prompt', 'cookies', 'downloads', 'autoclear', 'notify',
];
chrome.storage.sync.get(settings, function(s) {
var timeStart = s.timeStart || CONSTANTS.YES;
var clearCookies = s.cookies || CONSTANTS.NO;
var clearDownloads = s.downloads || CONSTANTS.NO;
var autoClear = s.autoclear || CONSTANTS.NO;
+ var notify = s.notify || CONSTANTS.YES;
$('input[name=timeStart][value="' + timeStart + '"]')[0].checked = true;
$('input[name=time][value="' + time + '"]')[0].checked = true;
$('input[name=cookies]')[0].checked = (clearCookies === CONSTANTS.YES);
$('input[name=downloads]')[0].checked = (clearDownloads === CONSTANTS.YES);
$('input[name=autoclear]')[0].checked = (autoClear === CONSTANTS.YES);
+ $('input[name=notify]')[0].checked = (notify === CONSTANTS.YES);
});
}
"name": "__MSG_name__",
"default_locale": "en",
"manifest_version": 2,
- "version": "1.5.3",
+ "minimum_chrome_version": "28",
+ "version": "1.5.4",
"description": "__MSG_description__",
"permissions": [
"alarms",
"128": "images/icon128.png"
},
"web_accessible_resources": [
- "images/icon48.png"
+ "images/icon128.png"
]
}
</label>
</div>
+ <div class="checkbox">
+ <label>
+ <input name="notify" type="checkbox"/>
+ <span i18n-content="optionsNotify"></span>
+ </label>
+ </div>
+
<div class="checkbox">
<label>
<input name="autoclear" type="checkbox"/>