diff --git a/external-video.js b/external-video.js
index 0bd545c..f08857f 100644
--- a/external-video.js
+++ b/external-video.js
@@ -1,11 +1,9 @@
var targetPages = [
- "*://*.youtube.com/watch*",
+ "*://*.youtube.com/watch?*",
"*://*.twitch.tv/*",
"*://*.vimeo.com/*",
"*://*.streamable.com/*",
"*://*.liveleak.com/view*",
- "*://*.vid.me/*",
- "*://*.funnyordie.com/videos/*",
"*://*.dailymotion.com/video/*"
];
@@ -34,28 +32,47 @@ function restoreSettings() {
}
function openInMpv(request) {
+ if (!(request.type == "main_frame")) {
+ return { cancel: false };
+ }
+
var lockedTabIndex = tabsLock.lastIndexOf(request.tabId);
+ if (!(lockedTabIndex == -1)) {
+ return { cancel: false };
+ }
+
function closeTab(data) {
+ if (settings.mainClose) {
+ browser.tabs.remove(data.id);
+ }
if (!data.active) {
browser.tabs.remove(data.id);
}
}
- if (request.type === "main_frame" && lockedTabIndex === -1) {
- var command = `${request.url} --force-window=immediate ${settings.args}`;
-
+ function mpvRun(data) {
+ var command = `${data.url} --force-window=immediate`;
browser.runtime.sendNativeMessage("mpv", command);
- var querying = browser.tabs.get(request.tabId);
- querying.then(closeTab);
-
browser.history.addUrl({
- url: request.url
+ url: data.url
});
- return { cancel: true };
+ var querying = browser.tabs.get(data.tabId);
+ querying.then(closeTab);
+ }
+
+ if (request.url == "https://www.twitch.tv/") {
+ return { cancel: false };
}
+
+ if (request.url.includes("twitch.tv/directory")) {
+ return { cancel: false };
+ }
+
+ mpvRun(request);
+ return { cancel: true };
}
chrome.contextMenus.create({
diff --git a/settings/options.html b/settings/options.html
index 5d4312b..ec4e2ca 100644
--- a/settings/options.html
+++ b/settings/options.html
@@ -13,9 +13,16 @@
Options given to MPV
+
+
+
+