-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Needs to be embedded into iframe or otherwise the download attribute on the a element is ignored from Firefox due to CORS restrictions Part of #86
- Loading branch information
Showing
4 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<link rel="stylesheet" href="semantic/semantic.min.css"> | ||
</head> | ||
<body> | ||
<script src="backup.js"></script> | ||
<div> | ||
<button id="backupToFile" class="ui button">Back up to file</button> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
document.addEventListener('DOMContentLoaded', () => { | ||
document.getElementById('backupToFile').addEventListener('click', async () => { | ||
const storage = await browser.storage.local.get('preferences'); | ||
const a = document.createElement('a'); | ||
a.href = 'data:text/plain;charset=utf-8,' + encodeURIComponent(JSON.stringify(storage.preferences, null, 2)); | ||
a.setAttribute('download', 'preferences.txt'); | ||
a.setAttribute('type', 'text/plain'); | ||
a.dispatchEvent(new MouseEvent('click')); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -347,5 +347,4 @@ window.requestNotificationsPermissions = async () => { | |
$('#notifications') | ||
.checkbox('uncheck'); | ||
} | ||
}; | ||
|
||
}; |