mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
[fenix] For https://github.com/mozilla-mobile/fenix/issues/6558 - added web extension for extracting document urls
This commit is contained in:
parent
f765736b27
commit
15552a39c3
17
app/src/main/assets/extensions/ads/ads.js
Normal file
17
app/src/main/assets/extensions/ads/ads.js
Normal 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);
|
24
app/src/main/assets/extensions/ads/manifest.json
Normal file
24
app/src/main/assets/extensions/ads/manifest.json
Normal 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"
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user