forked from cory321/netflixparty-chrome
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.js
More file actions
27 lines (26 loc) · 811 Bytes
/
background.js
File metadata and controls
27 lines (26 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* prettier-ignore */
"use strict";;
// only load for URLs that match app.plex.tv
chrome.runtime.onInstalled.addListener(function (details) {
function onWebNav(details) {
var refIndex = details.url.indexOf("#");
var ref = refIndex >= 0 ? details.url.slice(refIndex + 1) : "";
if (ref.indexOf("key") > -1) {
// contains key? show page action
chrome.pageAction.show(details.tabId);
} else {
chrome.pageAction.hide(details.tabId);
}
}
// Base filter
var filter = {
url: [
{
hostEquals: "app.plex.tv",
},
],
};
chrome.webNavigation.onCommitted.addListener(onWebNav, filter);
chrome.webNavigation.onHistoryStateUpdated.addListener(onWebNav, filter);
chrome.webNavigation.onReferenceFragmentUpdated.addListener(onWebNav, filter);
});