Skip to content

Commit

Permalink
fix usercss redirection
Browse files Browse the repository at this point in the history
  • Loading branch information
tophf committed Oct 30, 2024
1 parent 9328adc commit b3bfe0e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/background/usercss-install-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ function toggle(key, val) {
updateDNR([{
id: DNR_ID_INSTALLER,
condition: {
regexFilter: val
? /^.*\.user\.(?:css|less|styl)(?:\?.*)?$/.source
: /^.*\.user\.css$/.source,
regexFilter: (val
? /^.*\.user\.(?:css|less|styl)(?:\?.*)?$/
: /^.*\.user\.css$/).source,
requestDomains: val
? undefined
: [...new Set(urls.map(u => u.split('/')[2]))],
Expand Down
5 changes: 0 additions & 5 deletions src/edit/load-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ import * as MozDocMapper from '/js/sections-util';
import {clipString, sessionStore, tryURL} from '/js/util';
import editor from './editor';

if (process.env.MV3 && /#\d+$/.test(location.hash)) {
history.replaceState(history.state, '',
`${location.href.split('#')[0]}?id=${location.hash.slice(1)}`);
}

const params = new URLSearchParams(location.search);
let id = +params.get('id');

Expand Down
5 changes: 5 additions & 0 deletions src/js/get-client-data.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import {isCssDarkScheme, makePropertyPopProxy} from './util';

if (/#\d+$/.test(location.hash)) { // redirected from devtools -> "open in a new tab"
history.replaceState(history.state, '',
`${location.href.split('#')[0]}?id=${location.hash.slice(1)}`);
}

self[process.env.CLIENT_DATA] = makePropertyPopProxy();
document.write(`<script src="?clientData&${new URLSearchParams({
dark: +isCssDarkScheme(),
Expand Down

0 comments on commit b3bfe0e

Please sign in to comment.