Change: getStylesInfoByUrl -> getStylesByUrl

This commit is contained in:
eight 2018-10-14 18:50:54 +08:00
parent f9dc04558f
commit 81f3e69574
4 changed files with 6 additions and 6 deletions

View File

@ -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,

View File

@ -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));
}
}

View File

@ -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
});

View File

@ -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]) => {