don't report usercss as installed on USO if homepage matches
This commit is contained in:
parent
d52664d11c
commit
9486c7f3df
|
@ -255,9 +255,9 @@ function getStyles(options) {
|
||||||
|
|
||||||
function filterStyles({
|
function filterStyles({
|
||||||
enabled = null,
|
enabled = null,
|
||||||
url = null,
|
|
||||||
id = null,
|
id = null,
|
||||||
matchUrl = null,
|
matchUrl = null,
|
||||||
|
md5Url = null,
|
||||||
asHash = null,
|
asHash = null,
|
||||||
strictRegexp = true, // used by the popup to detect bad regexps
|
strictRegexp = true, // used by the popup to detect bad regexps
|
||||||
} = {}) {
|
} = {}) {
|
||||||
|
@ -267,9 +267,9 @@ function filterStyles({
|
||||||
|
|
||||||
if (
|
if (
|
||||||
enabled === null &&
|
enabled === null &&
|
||||||
url === null &&
|
|
||||||
id === null &&
|
id === null &&
|
||||||
matchUrl === null &&
|
matchUrl === null &&
|
||||||
|
md5Url === null &&
|
||||||
asHash !== true
|
asHash !== true
|
||||||
) {
|
) {
|
||||||
return cachedStyles.list;
|
return cachedStyles.list;
|
||||||
|
@ -284,8 +284,7 @@ function filterStyles({
|
||||||
exposeIframes: prefs.get('exposeIframes'),
|
exposeIframes: prefs.get('exposeIframes'),
|
||||||
};
|
};
|
||||||
|
|
||||||
// add \t after url to prevent collisions (not sure it can actually happen though)
|
const cacheKey = [enabled, id, matchUrl, md5Url, asHash, strictRegexp].join('\t');
|
||||||
const cacheKey = ' ' + enabled + url + '\t' + id + matchUrl + '\t' + asHash + strictRegexp;
|
|
||||||
const cached = cachedStyles.filters.get(cacheKey);
|
const cached = cachedStyles.filters.get(cacheKey);
|
||||||
if (cached) {
|
if (cached) {
|
||||||
cached.hits++;
|
cached.hits++;
|
||||||
|
@ -297,9 +296,9 @@ function filterStyles({
|
||||||
|
|
||||||
return filterStylesInternal({
|
return filterStylesInternal({
|
||||||
enabled,
|
enabled,
|
||||||
url,
|
|
||||||
id,
|
id,
|
||||||
matchUrl,
|
matchUrl,
|
||||||
|
md5Url,
|
||||||
asHash,
|
asHash,
|
||||||
strictRegexp,
|
strictRegexp,
|
||||||
blankHash,
|
blankHash,
|
||||||
|
@ -312,9 +311,9 @@ function filterStylesInternal({
|
||||||
// js engines don't like big functions (V8 often deoptimized the original filterStyles)
|
// js engines don't like big functions (V8 often deoptimized the original filterStyles)
|
||||||
// it also makes sense to extract the less frequently executed code
|
// it also makes sense to extract the less frequently executed code
|
||||||
enabled,
|
enabled,
|
||||||
url,
|
|
||||||
id,
|
id,
|
||||||
matchUrl,
|
matchUrl,
|
||||||
|
md5Url,
|
||||||
asHash,
|
asHash,
|
||||||
strictRegexp,
|
strictRegexp,
|
||||||
blankHash,
|
blankHash,
|
||||||
|
@ -343,7 +342,7 @@ function filterStylesInternal({
|
||||||
let style;
|
let style;
|
||||||
for (let i = 0; (style = styles[i]); i++) {
|
for (let i = 0; (style = styles[i]); i++) {
|
||||||
if ((enabled === null || style.enabled === enabled)
|
if ((enabled === null || style.enabled === enabled)
|
||||||
&& (url === null || style.url === url)
|
&& (md5Url === null || style.md5Url === md5Url)
|
||||||
&& (id === null || style.id === id)) {
|
&& (id === null || style.id === id)) {
|
||||||
const sections = needSections &&
|
const sections = needSections &&
|
||||||
getApplicableSections({
|
getApplicableSections({
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
document.title = document.title.replace(/^(\d+)&\w+=/, '#$1: ');
|
document.title = document.title.replace(/^(\d+)&\w+=/, '#$1: ');
|
||||||
chrome.runtime.sendMessage({
|
chrome.runtime.sendMessage({
|
||||||
method: 'getStyles',
|
method: 'getStyles',
|
||||||
url: getMeta('stylish-id-url') || location.href
|
md5Url: getMeta('stylish-md5-url') || location.href
|
||||||
}, checkUpdatability);
|
}, checkUpdatability);
|
||||||
}
|
}
|
||||||
}).observe(document.documentElement, {childList: true});
|
}).observe(document.documentElement, {childList: true});
|
||||||
|
@ -121,7 +121,7 @@
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
chrome.runtime.sendMessage({
|
chrome.runtime.sendMessage({
|
||||||
method: 'getStyles',
|
method: 'getStyles',
|
||||||
url: getMeta('stylish-id-url') || location.href,
|
md5Url: getMeta('stylish-md5-url') || location.href,
|
||||||
}, ([style]) => {
|
}, ([style]) => {
|
||||||
saveStyleCode('styleUpdate', style.name, {id: style.id})
|
saveStyleCode('styleUpdate', style.name, {id: style.id})
|
||||||
.then(resolve, reject);
|
.then(resolve, reject);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user