Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add settings section for clearing browser history #1738

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions localization/languages/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@
"settingsProxyRules": "Proxy rules:",
"settingsProxyBypassRules": "No proxy for:",
"settingsProxyConfigurationURL": "Configuration URL",
"settingsHistoryEraseNow": "Clear browsing history now",
"settingsHistoryHeading": "Privacy and history",
"settingsDeleteHistory": "Are you sure you want to delete all browsing history?",
"settingsDeleteHistoryOnClose": "Erase browsing history when closing the browser",
/* app menu */
"appMenuFile": "File",
"appMenuNewTab": "New Tab",
Expand Down
19 changes: 19 additions & 0 deletions pages/settings/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,25 @@ <h3 data-string="settingsPrivacyHeading"></h3>
<div id="content-type-blocking"></div>
</div>

<div class="settings-container" id="history-settings-container">
<h3 data-string="settingsHistoryHeading"></h3>
<div class="setting-section">
<button
style="border-radius: 4px; padding: 8px; background: black; color: white;"
data-string="settingsHistoryEraseNow"
id="clear-history-now">
</button>
</div>
<div class="setting-section">
<input type="checkbox" id="checkbox-erase-history-close-browser" />
<label
for="checkbox-erase-history-close-browser"
data-string="settingsDeleteHistoryOnClose"
></label>
</div>

</div>

<div class="settings-container" id="appearance-settings-container">
<h3 data-string="settingsAppearanceHeading"></h3>

Expand Down
18 changes: 18 additions & 0 deletions pages/settings/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,24 @@ for (var contentType in contentTypes) {
})(contentType)
}

/* Privacy and history */

var clearHistoryButton = document.getElementById("clear-history-now")
clearHistoryButton.addEventListener("click", () => {
const confirmedDeletion = confirm(l('settingsDeleteHistory'))
if (confirmedDeletion) {
try {
// Nuke history here with places.deleteAllHistory() ??
// postMessage({ message: { action: 'deleteAllHistory' } })
window.alert("Your browsing history has been erased.")
} catch (e) {
window.alert("There was an error clearing your history.")
}
} else {
return
}
})

/* dark mode setting */
var darkModeNever = document.getElementById('dark-mode-never')
var darkModeNight = document.getElementById('dark-mode-night')
Expand Down