1
0
Fork 0

For #6558 - added web extension for extracting document urls

master
Mihai Branescu 2020-04-08 15:49:21 +03:00 committed by Jeff Boek
parent f1559ed2da
commit c4f7972f2b
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,17 @@
function collect_urls(urls) {
let anchors = document.getElementsByTagName("a");
for (let anchor of anchors) {
if (!anchor.href) {
continue;
}
urls.push(anchor.href);
}
}
let urls = [];
collect_urls(urls)
let message = {
'url': document.location.href,
'urls': urls
}
browser.runtime.sendNativeMessage("MozacBrowserAds", message);

View File

@ -0,0 +1,24 @@
{
"manifest_version": 2,
"name": "Mozilla Android Components - Ads",
"version": "1.0",
"content_scripts": [
{
"matches": ["https://*/*"],
"include_globs": [
"https://www.google.*/search*",
"https://www.baidu.com/s*",
"https://www.baidu.com/baidu*",
"https://*search.yahoo.com/search*",
"https://www.bing.com/search*",
"https://duckduckgo.com/*"
],
"js": ["ads.js"],
"run_at": "document_end"
}
],
"permissions": [
"geckoViewAddons",
"nativeMessaging"
]
}