code cosmetics: RX_SUPPORTED_URLS -> URLS.supported
This commit is contained in:
parent
021f50015b
commit
3b3ed6543e
|
@ -11,7 +11,6 @@ env:
|
|||
globals:
|
||||
# messaging.js
|
||||
KEEP_CHANNEL_OPEN: false
|
||||
RX_SUPPORTED_URLS: false
|
||||
FIREFOX: false
|
||||
OPERA: false
|
||||
URLS: false
|
||||
|
|
3
edit.js
3
edit.js
|
@ -1666,7 +1666,6 @@ function showLintHelp() {
|
|||
function showRegExpTester(event, section = getSectionForChild(this)) {
|
||||
const GET_FAVICON_URL = 'https://www.google.com/s2/favicons?domain=';
|
||||
const OWN_ICON = chrome.runtime.getManifest().icons['16'];
|
||||
const RX_SUPPORTED_URLS = new RegExp(`^(file|https?|ftps?):|^${URLS.ownOrigin}`);
|
||||
const cachedRegexps = showRegExpTester.cachedRegexps =
|
||||
showRegExpTester.cachedRegexps || new Map();
|
||||
const regexps = [...section.querySelector('.applies-to-list').children]
|
||||
|
@ -1696,7 +1695,7 @@ function showRegExpTester(event, section = getSectionForChild(this)) {
|
|||
});
|
||||
chrome.tabs.query({}, tabs => {
|
||||
const supported = tabs.map(tab => tab.url)
|
||||
.filter(url => RX_SUPPORTED_URLS.test(url));
|
||||
.filter(url => URLS.supported.test(url));
|
||||
const unique = [...new Set(supported).values()];
|
||||
for (const rxData of regexps) {
|
||||
const {rx, urls} = rxData;
|
||||
|
|
14
messaging.js
14
messaging.js
|
@ -3,25 +3,31 @@
|
|||
|
||||
// keep message channel open for sendResponse in chrome.runtime.onMessage listener
|
||||
const KEEP_CHANNEL_OPEN = true;
|
||||
|
||||
const FIREFOX = /Firefox/.test(navigator.userAgent);
|
||||
const OPERA = /OPR/.test(navigator.userAgent);
|
||||
|
||||
const URLS = {
|
||||
ownOrigin: chrome.runtime.getURL(''),
|
||||
|
||||
optionsUI: [
|
||||
chrome.runtime.getURL('options/index.html'),
|
||||
'chrome://extensions/?options=' + chrome.runtime.id,
|
||||
],
|
||||
|
||||
configureCommands:
|
||||
OPERA ? 'opera://settings/configureCommands'
|
||||
: 'chrome://extensions/configureCommands',
|
||||
|
||||
// CWS cannot be scripted in chromium, see ChromeExtensionsClient::IsScriptableURL
|
||||
// https://cs.chromium.org/chromium/src/chrome/common/extensions/chrome_extensions_client.cc
|
||||
chromeWebStore: FIREFOX ? 'N/A' : 'https://chrome.google.com/webstore/',
|
||||
|
||||
supported: new RegExp(
|
||||
'^(file|ftps?|http)://|' +
|
||||
`^https://${FIREFOX ? '' : '(?!chrome\\.google\\.com/webstore)'}|` +
|
||||
'^' + chrome.runtime.getURL('')),
|
||||
};
|
||||
const RX_SUPPORTED_URLS = new RegExp(
|
||||
'^(file|ftps?|http)://|' +
|
||||
`^https://${FIREFOX ? '' : '(?!chrome\\.google\\.com/webstore)'}|` +
|
||||
'^' + URLS.ownOrigin);
|
||||
|
||||
let BG = chrome.extension.getBackgroundPage();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user