askrobots / bookmarks-firefox
Public
A Firefox extension that saves the page you're on as a bookmark in your AskRobots account, in one click.
settings.js · 554 bytes · 15 lines
| 1 | // settings.js |
| 2 | document.getElementById("saveToken").addEventListener("click", () => { |
| 3 | const token = document.getElementById("apiToken").value; |
| 4 | browser.storage.local.set({ apiToken: token }).catch(err => { |
| 5 | console.error('Error saving token:', err); |
| 6 | }); |
| 7 | }); |
| 8 | |
| 9 | document.addEventListener("DOMContentLoaded", () => { |
| 10 | browser.storage.local.get("apiToken").then(result => { |
| 11 | document.getElementById("apiToken").value = result.apiToken || ""; |
| 12 | }).catch(err => { |
| 13 | console.error('Error retrieving token:', err); |
| 14 | }); |
| 15 | }); |