mirror of
https://github.com/aykhans/slash-e.git
synced 2025-04-20 22:07:15 +00:00
chore: remove extension folder
This commit is contained in:
parent
0c4ed55a76
commit
47e0fcd43c
@ -1,21 +0,0 @@
|
||||
import { getSlashData } from "./common.js";
|
||||
|
||||
const urlRegex = /https?:\/\/s\/(.+)/;
|
||||
|
||||
chrome.tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => {
|
||||
if (typeof tab.url === "string") {
|
||||
const matchResult = urlRegex.exec(tab.url);
|
||||
if (matchResult) {
|
||||
const slashData = await getSlashData();
|
||||
const name = matchResult[1];
|
||||
const url = `${slashData.domain}/s/${name}`;
|
||||
return chrome.tabs.update(tab.id, { url });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
chrome.omnibox.onInputEntered.addListener(async (text) => {
|
||||
const slashData = await getSlashData();
|
||||
const url = `${slashData.domain}/s/${text}`;
|
||||
return chrome.tabs.update({ url });
|
||||
});
|
@ -1,11 +0,0 @@
|
||||
export const getSlashData = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
chrome.storage.local.get(["slash"], (data) => {
|
||||
if (data?.slash) {
|
||||
resolve(data.slash);
|
||||
} else {
|
||||
reject("slash data not found");
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
@ -1,18 +0,0 @@
|
||||
{
|
||||
"name": "Slash",
|
||||
"description": "",
|
||||
"version": "0.1.0",
|
||||
"manifest_version": 3,
|
||||
"omnibox": {
|
||||
"keyword": "s/"
|
||||
},
|
||||
"action": {
|
||||
"default_popup": "popup.html"
|
||||
},
|
||||
"background": {
|
||||
"service_worker": "background.js",
|
||||
"type": "module"
|
||||
},
|
||||
"permissions": ["tabs", "activeTab", "storage"],
|
||||
"host_permissions": ["*://s/*"]
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<h2>Slash extension</h2>
|
||||
<div>
|
||||
<span>Domain</span>
|
||||
<input id="domain-input" type="text" />
|
||||
</div>
|
||||
<div>
|
||||
<button id="save-button">Save</button>
|
||||
</div>
|
||||
<script type="module" src="popup.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -1,23 +0,0 @@
|
||||
import { getSlashData } from "./common.js";
|
||||
|
||||
const saveButton = document.body.querySelector("#save-button");
|
||||
const domainInput = document.body.querySelector("#domain-input");
|
||||
|
||||
saveButton.addEventListener("click", () => {
|
||||
chrome.storage.local.set({
|
||||
slash: {
|
||||
domain: domainInput.value,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
const slashData = await getSlashData();
|
||||
if (slashData) {
|
||||
domainInput.value = slashData.domain;
|
||||
}
|
||||
} catch (error) {
|
||||
// do nothing.
|
||||
}
|
||||
})();
|
Loading…
x
Reference in New Issue
Block a user