Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: background.js

Issue 29488575: Issue 5384 - Introduced dedicated mobile options page (Closed)
Patch Set: Created July 13, 2017, 2:54 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « README.md ('k') | ext/background.js » ('j') | messageResponder.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: background.js
===================================================================
--- a/background.js
+++ b/background.js
@@ -73,7 +73,8 @@
addSubscription: false,
filterError: false,
downloadStatus: "synchronize_ok",
- showNotificationUI: false
+ showNotificationUI: false,
+ showPageOptions: false
};
updateFromURL(params);
@@ -438,17 +439,32 @@
];
let knownFilters = filters.map(modules.filterClasses.Filter.fromText);
+ let subscriptionServer = "https://easylist-downloads.adblockplus.org";
let subscriptions = [
- "https://easylist-downloads.adblockplus.org/easylistgermany+easylist.txt",
- "https://easylist-downloads.adblockplus.org/exceptionrules.txt",
- "https://easylist-downloads.adblockplus.org/fanboy-social.txt",
- "~user~786254"
+ {
+ title: "EasyList Germany+EasyList",
+ url: `${subscriptionServer}/easylistgermany+easylist.txt`
+ },
+ {
+ title: "Allow non-intrusive advertising",
+ url: `${subscriptionServer}/exceptionrules.txt`
+ },
+ {
+ title: "Fanboy's Social Blocking List",
+ url: `${subscriptionServer}/fanboy-social.txt`
+ },
+ {
+ title: null,
+ url: "~user~786254"
+ }
];
let knownSubscriptions = Object.create(null);
- for (let subscriptionUrl of subscriptions)
+ for (let {title, url} of subscriptions)
{
- knownSubscriptions[subscriptionUrl] =
- modules.subscriptionClasses.Subscription.fromURL(subscriptionUrl);
+ let subscription =
+ modules.subscriptionClasses.Subscription.fromURL(url);
+ subscription.title = title;
+ knownSubscriptions[url] = subscription;
}
let customSubscription = knownSubscriptions["~user~786254"];
@@ -470,6 +486,32 @@
}, 1000);
}
+ if (params.showPageOptions)
+ {
+ // We don't know how long it will take for the page to fully load
+ // so we'll post the message after one second
+ setTimeout(() =>
+ {
+ let host = "example.com";
+ let isWhitelisted = customSubscription.filters
+ .some((filter) => filter.text == `@@||${host}^$document`);
+ window.postMessage({
+ type: "message",
+ payload: {
+ type: "app.open",
+ what: "options",
+ action: "showPageOptions",
+ args: [
+ {
+ host,
+ whitelisted: isWhitelisted
+ }
+ ]
+ }
+ }, "*");
+ }, 1000);
+ }
+
ext.devtools.onCreated.addListener((panel) =>
{
// blocked request
« no previous file with comments | « README.md ('k') | ext/background.js » ('j') | messageResponder.js » ('J')

Powered by Google App Engine
This is Rietveld