-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Continued work on Manifest v3 support. Compatibility with GM API is p…
…rovided, script injection mechanism is improved
- Loading branch information
Showing
14 changed files
with
415 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//@license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3 | ||
|
||
import browser from "webextension-polyfill"; | ||
import { check_matching } from "lib-iitc-manager"; | ||
|
||
const is_ingress_tab = (url) => { | ||
return /https:\/\/(intel|missions).ingress.com\/*/.test(url); | ||
}; | ||
|
||
// Fetch all completly loaded tabs | ||
export async function getTabsToInject() { | ||
let allTabs = await browser.tabs.query({ status: "complete" }); | ||
return allTabs.filter(function (tab) { | ||
return tab.status === "complete" && tab.url; | ||
}); | ||
} | ||
|
||
// Filter all completly loaded Ingress Intel tabs | ||
export async function getNiaTabsToInject(plugin) { | ||
const tabs = await getTabsToInject(); | ||
return Object.values(tabs).filter( | ||
(tab) => | ||
(is_ingress_tab(tab.url) && check_matching(plugin, "<all_ingress>")) || | ||
check_matching(plugin, tab.url) | ||
); | ||
} | ||
|
||
export function getPluginMatches(plugin) { | ||
let matches = []; | ||
if (check_matching(plugin, "<all_ingress>")) { | ||
matches.push("https://intel.ingress.com/*"); | ||
matches.push("https://missions.ingress.com/*"); | ||
} | ||
if (plugin.match) { | ||
matches = matches.concat(plugin.match); | ||
} | ||
return matches; | ||
} |
Oops, something went wrong.