Update libxmp, reorganize project structure, add Makefile

This commit is contained in:
Kouya Heika
2026-04-22 19:04:22 -05:00
parent 2db7fe959b
commit 77d02142d3
17 changed files with 42 additions and 57 deletions

28
src/background.js Normal file
View File

@@ -0,0 +1,28 @@
browser.browserAction.onClicked.addListener(() => {
browser.tabs.create({
url: browser.runtime.getURL("player.html")
});
});
browser.webRequest.onBeforeRequest.addListener(
(details) => {
const url = details.url.toLowerCase();
if (isSupportedMediaUrl(url)) {
const playerUrl = browser.runtime.getURL("player.html") + "?media=" + encodeURIComponent(details.url);
return { redirectUrl: playerUrl };
}
return {};
},
{
urls: ["<all_urls>"],
types: ["main_frame", "sub_frame"]
},
["blocking"]
);
function isSupportedMediaUrl(url) {
return url.match(/\.(669|amf|it|mod|mtm|mptm|s3m|stm|ult|uni|xm|umx)$/i) ||
url.match(/^(669|amf|it|mod|mtm|mptm|s3m|stm|ult|uni|xm|umx)\./i);
}