diff --git a/background/background.js b/background/background.js index 25944231..b6c090dd 100644 --- a/background/background.js +++ b/background/background.js @@ -15,7 +15,7 @@ window.API_METHODS = Object.assign(window.API_METHODS || {}, { getAllStyles: styleManager.getAllStyles, // used by importer getSectionsByUrl: styleManager.getSectionsByUrl, getStyle: styleManager.get, - getStylesInfoByUrl: styleManager.getStylesInfoByUrl, + getStylesByUrl: styleManager.getStylesByUrl, importStyle: styleManager.importStyle, installStyle: styleManager.installStyle, styleExists: styleManager.styleExists, diff --git a/background/search-db.js b/background/search-db.js index b9c14678..78a721f9 100644 --- a/background/search-db.js +++ b/background/search-db.js @@ -25,7 +25,7 @@ if (/^url:/i.test(query)) { matchUrl = query.slice(query.indexOf(':') + 1).trim(); if (matchUrl) { - return styleManager.getStylesInfoByUrl(matchUrl) + return styleManager.getStylesByUrl(matchUrl, true) .then(results => results.map(r => r.data.id)); } } diff --git a/background/style-manager.js b/background/style-manager.js index 74c2697c..f58ef822 100644 --- a/background/style-manager.js +++ b/background/style-manager.js @@ -58,7 +58,7 @@ const styleManager = (() => { toggleStyle, setStyleExclusions, getAllStyles, // used by import-export - getStylesInfoByUrl, // used by popup + getStylesByUrl, // used by popup styleExists, }); @@ -277,7 +277,7 @@ const styleManager = (() => { } // get styles matching a URL, including sloppy regexps and excluded items. - function getStylesInfoByUrl(url) { + function getStylesByUrl(url, noCode = false) { // FIXME: do we want to cache this? Who would like to open popup rapidly // or search the DB with the same URL? const result = []; @@ -308,7 +308,7 @@ const styleManager = (() => { } if (sectionMatched) { result.push({ - data: getStyleWithNoCode(style.data), + data: noCode ? getStyleWithNoCode(style.data) : style.data, excluded, sloppy }); diff --git a/popup/popup.js b/popup/popup.js index 032c3691..7cf59b58 100644 --- a/popup/popup.js +++ b/popup/popup.js @@ -25,7 +25,7 @@ getActiveTab() ) .then(url => Promise.all([ (tabURL = URLS.supported(url) ? url : '') && - API.getStylesInfoByUrl(tabURL), + API.getStylesByUrl(tabURL, true), onDOMready().then(initPopup), ])) .then(([results]) => {