variables for url parts

This commit is contained in:
antelle 2017-04-18 19:24:17 +02:00
parent ef44bd95d7
commit 9f21842a68
1 changed files with 8 additions and 9 deletions

View File

@ -47,21 +47,20 @@ AutoTypeFilter.prototype.getEntryRank = function(entry) {
if (this.urlParts && entry.url) {
const entryUrlParts = urlPartsRegex.exec(entry.url.toLowerCase());
if (entryUrlParts) {
// domain
if (entryUrlParts[2] === this.urlParts[2]) {
const [, scheme, domain, path] = entryUrlParts;
const [, thisScheme, thisDomain, thisPath] = entryUrlParts;
if (domain === thisDomain) {
rank += 10;
// path
if (entryUrlParts[3] === this.urlParts[3]) {
if (path === thisPath) {
rank += 10;
} else if (entryUrlParts[3] && this.urlParts[3]) {
if (entryUrlParts[3].lastIndexOf(this.urlParts[3], 0) === 0) {
} else if (path && thisPath) {
if (path.lastIndexOf(thisPath, 0) === 0) {
rank += 5;
} else if (this.urlParts.lastIndexOf(entryUrlParts[3], 0) === 0) {
} else if (thisPath.lastIndexOf(path, 0) === 0) {
rank += 3;
}
}
// scheme
if (entryUrlParts[1] === this.urlParts[1]) {
if (scheme === thisScheme) {
rank += 1;
}
} else {