From 81a5acfda37d9e2ed66dff4076ac645669b1b212 Mon Sep 17 00:00:00 2001 From: tophf Date: Fri, 11 Feb 2022 00:08:20 +0300 Subject: [PATCH] .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 --- background/style-via-webrequest.js | 2 +- content/style-injector.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/background/style-via-webrequest.js b/background/style-via-webrequest.js index 1da554ca..4c02b612 100644 --- a/background/style-via-webrequest.js +++ b/background/style-via-webrequest.js @@ -51,7 +51,7 @@ } if (CHROME) { chrome.webRequest.onBeforeRequest.addListener(openNamedStyle, { - urls: [URLS.ownOrigin + 'virtual/*.css'], + urls: [URLS.ownOrigin + '*.user.css'], types: ['main_frame'], }, ['blocking']); } diff --git a/content/style-injector.js b/content/style-injector.js index 037f8312..8f0f9333 100644 --- a/content/style-injector.js +++ b/content/style-injector.js @@ -150,7 +150,7 @@ window.StyleInjector = window.INJECTED === 1 ? window.StyleInjector : ({ if (exposeStyleName && name) { el.dataset.name = name; 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'; // SVG className is not a string, but an instance of SVGAnimatedString