Fix: use findStyle API
This commit is contained in:
parent
93a4cdf595
commit
838c21e3b3
|
@ -118,10 +118,10 @@ const styleManager = (() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// used by install-hook-userstyles.js
|
// used by install-hook-userstyles.js
|
||||||
function findStyle(filter) {
|
function findStyle(filter, noCode = false) {
|
||||||
for (const style of styles.values()) {
|
for (const style of styles.values()) {
|
||||||
if (filterMatch(filter, style.data)) {
|
if (filterMatch(filter, style.data)) {
|
||||||
return style.data;
|
return noCode ? getStyleWithNoCode(style.data) : style.data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -145,9 +145,9 @@
|
||||||
|
|
||||||
function onUpdate() {
|
function onUpdate() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
API.getStylesInfo({
|
API.findStyle({
|
||||||
md5Url: getMeta('stylish-md5-url') || location.href
|
md5Url: getMeta('stylish-md5-url') || location.href
|
||||||
}).then(([style]) => {
|
}, true).then(style => {
|
||||||
saveStyleCode('styleUpdate', style.name, {id: style.id})
|
saveStyleCode('styleUpdate', style.name, {id: style.id})
|
||||||
.then(resolve, reject);
|
.then(resolve, reject);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user