Skip to content

Commit

Permalink
feat: clear browsing data from the past 1, 3, 10, and 30 minutes
Browse files Browse the repository at this point in the history
Closes #17.
  • Loading branch information
dessant committed Sep 6, 2019
1 parent 1a80190 commit 1d91308
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 2 deletions.
20 changes: 20 additions & 0 deletions src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,26 @@
"description": "Title of the option."
},

"optionValue_clearSince_1minute": {
"message": "Last minute",
"description": "Value of the option."
},

"optionValue_clearSince_3minutes": {
"message": "Last 3 minutes",
"description": "Value of the option."
},

"optionValue_clearSince_10minutes": {
"message": "Last 10 minutes",
"description": "Value of the option."
},

"optionValue_clearSince_30minutes": {
"message": "Last 30 minutes",
"description": "Value of the option."
},

"optionValue_clearSince_1hour": {
"message": "Last hour",
"description": "Value of the option."
Expand Down
4 changes: 4 additions & 0 deletions src/action/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ export default {
showSettings: false,
selectOptions: getOptionLabels({
clearSince: [
'1minute',
'3minutes',
'10minutes',
'30minutes',
'1hour',
'3hours',
'1day',
Expand Down
12 changes: 12 additions & 0 deletions src/background/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ async function clearDataType(dataType, options = null, enDataTypes = null) {
} else {
let timeDelta;
switch (options.clearSince) {
case '1minute':
timeDelta = 1000 * 60;
break;
case '3minutes':
timeDelta = 1000 * 60 * 3;
break;
case '10minutes':
timeDelta = 1000 * 60 * 10;
break;
case '30minutes':
timeDelta = 1000 * 60 * 30;
break;
case '1hour':
timeDelta = 1000 * 60 * 60;
break;
Expand Down
4 changes: 4 additions & 0 deletions src/options/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ export default {
reloadTabs: ['all', 'active', 'allButActive', 'false'],
clearAllDataTypesAction: ['main', 'sub', 'false'],
clearSince: [
'1minute',
'3minutes',
'10minutes',
'30minutes',
'1hour',
'3hours',
'1day',
Expand Down
2 changes: 1 addition & 1 deletion src/storage/versions/local/xO0Hh1Vm2.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async function upgrade() {
dataTypes,
disabledDataTypes,
clearAllDataTypesAction: 'sub', // 'main', 'sub', 'false'
clearSince: 'epoch', // '1hour', '3hours', '1day', '1week', '4weeks', '90days', '365days', 'epoch'
clearSince: 'epoch', // '1minute', '3minutes', '10minutes', '30minutes', '1hour', '3hours', '1day', '1week', '4weeks', '90days', '365days', 'epoch'
notifyOnSuccess: true
};

Expand Down
2 changes: 1 addition & 1 deletion src/storage/versions/sync/xO0Hh1Vm2.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async function upgrade() {
dataTypes,
disabledDataTypes,
clearAllDataTypesAction: 'sub', // 'main', 'sub', 'false'
clearSince: 'epoch', // '1hour', '3hours', '1day', '1week', '4weeks', '90days', '365days', 'epoch'
clearSince: 'epoch', // '1minute', '3minutes', '10minutes', '30minutes', 1hour', '3hours', '1day', '1week', '4weeks', '90days', '365days', 'epoch'
notifyOnSuccess: true
};

Expand Down

0 comments on commit 1d91308

Please sign in to comment.