Skip to content

Commit

Permalink
Change: getStylesInfoByUrl -> getStylesByUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
eight04 committed Oct 14, 2018
1 parent f9dc045 commit 81f3e69
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion background/background.js
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion background/search-db.js
Expand Up @@ -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));
}
}
Expand Down
6 changes: 3 additions & 3 deletions background/style-manager.js
Expand Up @@ -58,7 +58,7 @@ const styleManager = (() => {
toggleStyle,
setStyleExclusions,
getAllStyles, // used by import-export
getStylesInfoByUrl, // used by popup
getStylesByUrl, // used by popup
styleExists,
});

Expand Down Expand Up @@ -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 = [];
Expand Down Expand Up @@ -308,7 +308,7 @@ const styleManager = (() => {
}
if (sectionMatched) {
result.push({
data: getStyleWithNoCode(style.data),
data: noCode ? getStyleWithNoCode(style.data) : style.data,
excluded,
sloppy
});
Expand Down
2 changes: 1 addition & 1 deletion popup/popup.js
Expand Up @@ -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]) => {
Expand Down

0 comments on commit 81f3e69

Please sign in to comment.