Fix: minor
This commit is contained in:
parent
6964e0f9fa
commit
5a21c72040
|
@ -332,7 +332,7 @@ const APPLY = (() => {
|
||||||
return rootReady().then(() =>
|
return rootReady().then(() =>
|
||||||
docRootObserver.evade(() =>
|
docRootObserver.evade(() =>
|
||||||
styleInjector.addMany(
|
styleInjector.addMany(
|
||||||
Object.values.map(s => ({id: s.id, code: s.code.join('')}))
|
Object.values(sections).map(s => ({id: s.id, code: s.code.join('')}))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -375,8 +375,7 @@ const APPLY = (() => {
|
||||||
}
|
}
|
||||||
// In Chrome content script is orphaned on an extension update/reload
|
// In Chrome content script is orphaned on an extension update/reload
|
||||||
// so we need to detach event listeners
|
// so we need to detach event listeners
|
||||||
docRewriteObserver.stop();
|
styleInjector.clear();
|
||||||
docRootObserver.stop();
|
|
||||||
window.removeEventListener(chrome.runtime.id, orphanCheck, true);
|
window.removeEventListener(chrome.runtime.id, orphanCheck, true);
|
||||||
try {
|
try {
|
||||||
msg.off(applyOnMessage);
|
msg.off(applyOnMessage);
|
||||||
|
|
|
@ -69,10 +69,10 @@ function createStyleInjector({compare, setStyleContent, onUpdate}) {
|
||||||
style.el = createStyle(style.id);
|
style.el = createStyle(style.id);
|
||||||
const pending = setStyleContent(style.el, style.code);
|
const pending = setStyleContent(style.el, style.code);
|
||||||
table.set(style.id, style);
|
table.set(style.id, style);
|
||||||
const nextIndex = list.findIndex(i => compare(style, i) > 0);
|
const nextIndex = list.findIndex(i => compare(i, style) > 0);
|
||||||
if (nextIndex < 0) {
|
if (nextIndex < 0) {
|
||||||
document.documentElement.appendChild(style.el);
|
document.documentElement.appendChild(style.el);
|
||||||
list.push(nextIndex);
|
list.push(style);
|
||||||
} else {
|
} else {
|
||||||
document.documentElement.insertBefore(style.el, list[nextIndex].el);
|
document.documentElement.insertBefore(style.el, list[nextIndex].el);
|
||||||
list.splice(nextIndex, 0, style);
|
list.splice(nextIndex, 0, style);
|
||||||
|
|
|
@ -64,7 +64,14 @@
|
||||||
"run_at": "document_start",
|
"run_at": "document_start",
|
||||||
"all_frames": true,
|
"all_frames": true,
|
||||||
"match_about_blank": true,
|
"match_about_blank": true,
|
||||||
"js": ["js/polyfill.js", "js/promisify.js", "js/msg.js", "js/prefs.js", "content/apply.js"]
|
"js": [
|
||||||
|
"js/polyfill.js",
|
||||||
|
"js/promisify.js",
|
||||||
|
"js/msg.js",
|
||||||
|
"js/prefs.js",
|
||||||
|
"content/style-injector.js",
|
||||||
|
"content/apply.js"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"matches": ["http://userstyles.org/*", "https://userstyles.org/*"],
|
"matches": ["http://userstyles.org/*", "https://userstyles.org/*"],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user