chore: rename to slash

This commit is contained in:
Steven
2023-07-11 23:51:17 +08:00
parent fcd72e1f98
commit b36572c5be
43 changed files with 97 additions and 97 deletions

View File

@@ -1,4 +1,4 @@
import { getShortifyData } from "./common.js";
import { getSlashData } from "./common.js";
const urlRegex = /https?:\/\/s\/(.+)/;
@@ -6,16 +6,16 @@ chrome.tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => {
if (typeof tab.url === "string") {
const matchResult = urlRegex.exec(tab.url);
if (matchResult) {
const shortifyData = await getShortifyData();
const slashData = await getSlashData();
const name = matchResult[1];
const url = `${shortifyData.domain}/s/${name}`;
return chrome.tabs.update({ url });
const url = `${slashData.domain}/s/${name}`;
return chrome.tabs.update(tab.id, { url });
}
}
});
chrome.omnibox.onInputEntered.addListener(async (text) => {
const shortifyData = await getShortifyData();
const url = `${shortifyData.domain}/s/${text}`;
const slashData = await getSlashData();
const url = `${slashData.domain}/s/${text}`;
return chrome.tabs.update({ url });
});