.user.css in virtual style urls
benefits: * styles are listed directly under `Stylus` in devtools source file tree * easy to differentiate from site's css
This commit is contained in:
parent
10de02f04d
commit
81a5acfda3
|
@ -51,7 +51,7 @@
|
||||||
}
|
}
|
||||||
if (CHROME) {
|
if (CHROME) {
|
||||||
chrome.webRequest.onBeforeRequest.addListener(openNamedStyle, {
|
chrome.webRequest.onBeforeRequest.addListener(openNamedStyle, {
|
||||||
urls: [URLS.ownOrigin + 'virtual/*.css'],
|
urls: [URLS.ownOrigin + '*.user.css'],
|
||||||
types: ['main_frame'],
|
types: ['main_frame'],
|
||||||
}, ['blocking']);
|
}, ['blocking']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({
|
||||||
if (exposeStyleName && name) {
|
if (exposeStyleName && name) {
|
||||||
el.dataset.name = name;
|
el.dataset.name = name;
|
||||||
name = encodeURIComponent(name.replace(/[#%/@:']/g, toSafeChar));
|
name = encodeURIComponent(name.replace(/[#%/@:']/g, toSafeChar));
|
||||||
code += `\n/*# sourceURL=${chrome.runtime.getURL('')}virtual/${name}.css#${id} */`;
|
code += `\n/*# sourceURL=${chrome.runtime.getURL(name)}.user.css#${id} */`;
|
||||||
}
|
}
|
||||||
el.type = 'text/css';
|
el.type = 'text/css';
|
||||||
// SVG className is not a string, but an instance of SVGAnimatedString
|
// SVG className is not a string, but an instance of SVGAnimatedString
|
||||||
|
|
Loading…
Reference in New Issue
Block a user