Apply to file: protocol #25
This commit is contained in:
parent
c4c92c6c27
commit
d09255a6b8
|
@ -47,7 +47,7 @@ function getStyles(options, callback) {
|
||||||
if (id != null && style.id != id) {
|
if (id != null && style.id != id) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (matchUrl != null && getApplicableSections(style, matchUrl) == 0) {
|
if (matchUrl != null && getApplicableSections(style, matchUrl).length == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -132,8 +132,8 @@ function getApplicableSections(style, url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function sectionAppliesToUrl(section, url) {
|
function sectionAppliesToUrl(section, url) {
|
||||||
// only http and https allowed
|
// only http, https, and file allowed
|
||||||
if (url.indexOf("http") != 0) {
|
if (url.indexOf("http") != 0 && url.indexOf("file") != 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!section.urls && !section.domains && !section.urlPrefixes && !section.regexps) {
|
if (!section.urls && !section.domains && !section.urlPrefixes && !section.regexps) {
|
||||||
|
@ -286,6 +286,9 @@ function saveFromJSONStyleReloaded(updateType, style, callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDomains(url) {
|
function getDomains(url) {
|
||||||
|
if (url.indexOf("file:") == 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
var d = /.*?:\/*([^\/]+)/.exec(url)[1];
|
var d = /.*?:\/*([^\/]+)/.exec(url)[1];
|
||||||
var domains = [d];
|
var domains = [d];
|
||||||
while (d.indexOf(".") != -1) {
|
while (d.indexOf(".") != -1) {
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
},
|
},
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
{
|
{
|
||||||
"matches": ["http://*/*", "https://*/*"],
|
"matches": ["http://*/*", "https://*/*", "file:///*"],
|
||||||
"run_at": "document_start",
|
"run_at": "document_start",
|
||||||
"all_frames": true,
|
"all_frames": true,
|
||||||
"js": ["apply.js"]
|
"js": ["apply.js"]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user