Add cache clearing feature and update UI
This commit is contained in:
parent
b92b8eacfe
commit
1ad1b7004d
4 changed files with 116 additions and 4 deletions
22
resources/clearCacheButton.js
Normal file
22
resources/clearCacheButton.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
(function() {
|
||||
function addButton() {
|
||||
const toolbar = document.querySelector("#header-view-toolbar") ||
|
||||
document.querySelector("#mail-toolbox toolbar");
|
||||
if (!toolbar || document.getElementById('sortana-clear-cache-button')) return;
|
||||
const button = document.createXULElement ?
|
||||
document.createXULElement('toolbarbutton') :
|
||||
document.createElement('button');
|
||||
button.id = 'sortana-clear-cache-button';
|
||||
button.setAttribute('label', 'Clear Cache');
|
||||
button.className = 'toolbarbutton-1';
|
||||
button.addEventListener('command', () => {
|
||||
browser.runtime.sendMessage({ type: 'sortana:clearCacheForDisplayed' });
|
||||
});
|
||||
toolbar.appendChild(button);
|
||||
}
|
||||
if (document.readyState === 'complete' || document.readyState === 'interactive') {
|
||||
addButton();
|
||||
} else {
|
||||
document.addEventListener('DOMContentLoaded', addButton, { once: true });
|
||||
}
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue