From 838c21e3b335ce0944321d16bf3617b983e1b156 Mon Sep 17 00:00:00 2001 From: eight Date: Sun, 14 Oct 2018 02:36:20 +0800 Subject: [PATCH] Fix: use findStyle API --- background/style-manager.js | 4 ++-- content/install-hook-userstyles.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/background/style-manager.js b/background/style-manager.js index d3651d24..c8f8fefe 100644 --- a/background/style-manager.js +++ b/background/style-manager.js @@ -118,10 +118,10 @@ const styleManager = (() => { } // used by install-hook-userstyles.js - function findStyle(filter) { + function findStyle(filter, noCode = false) { for (const style of styles.values()) { if (filterMatch(filter, style.data)) { - return style.data; + return noCode ? getStyleWithNoCode(style.data) : style.data; } } return null; diff --git a/content/install-hook-userstyles.js b/content/install-hook-userstyles.js index e4602605..7e79652d 100644 --- a/content/install-hook-userstyles.js +++ b/content/install-hook-userstyles.js @@ -145,9 +145,9 @@ function onUpdate() { return new Promise((resolve, reject) => { - API.getStylesInfo({ + API.findStyle({ md5Url: getMeta('stylish-md5-url') || location.href - }).then(([style]) => { + }, true).then(style => { saveStyleCode('styleUpdate', style.name, {id: style.id}) .then(resolve, reject); });