Merge ef95fc327c
into c1b47e4b23
This commit is contained in:
commit
cca6c364a6
16
edit/edit.js
16
edit/edit.js
|
@ -223,9 +223,23 @@ function initStyleData() {
|
||||||
// TODO: remove .replace(/^\?/, '') when minimum_chrome_version >= 52 (https://crbug.com/601425)
|
// TODO: remove .replace(/^\?/, '') when minimum_chrome_version >= 52 (https://crbug.com/601425)
|
||||||
const params = new URLSearchParams(location.search.replace(/^\?/, ''));
|
const params = new URLSearchParams(location.search.replace(/^\?/, ''));
|
||||||
const id = params.get('id');
|
const id = params.get('id');
|
||||||
|
|
||||||
|
let name = '';
|
||||||
|
if (params.get('domain')) {
|
||||||
|
name = params.get('domain');
|
||||||
|
} else if (params.get('url-prefix')) {
|
||||||
|
let url;
|
||||||
|
try {
|
||||||
|
url = new URL(params.get('url-prefix'));
|
||||||
|
} catch (err) {}
|
||||||
|
if (url && url.hostname) {
|
||||||
|
name = url.hostname;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const createEmptyStyle = () => ({
|
const createEmptyStyle = () => ({
|
||||||
id: null,
|
id: null,
|
||||||
name: '',
|
name: name,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
sections: [
|
sections: [
|
||||||
Object.assign({code: ''},
|
Object.assign({code: ''},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user