mirror of
https://github.com/aykhans/slash-e.git
synced 2025-07-23 05:14:26 +00:00
feat: add chrome extension
This commit is contained in:
23
extension/popup.js
Normal file
23
extension/popup.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import { getShortifyData } from "./common.js";
|
||||
|
||||
const saveButton = document.body.querySelector("#save-button");
|
||||
const domainInput = document.body.querySelector("#domain-input");
|
||||
|
||||
saveButton.addEventListener("click", () => {
|
||||
chrome.storage.local.set({
|
||||
shortify: {
|
||||
domain: domainInput.value,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
const shortifyData = await getShortifyData();
|
||||
if (shortifyData) {
|
||||
domainInput.value = shortifyData.domain;
|
||||
}
|
||||
} catch (error) {
|
||||
// do nothing.
|
||||
}
|
||||
})();
|
Reference in New Issue
Block a user