summaryrefslogtreecommitdiff
path: root/ext/bg/js/profile-conditions.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-09-10 19:55:14 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-09-18 19:14:04 -0400
commitdcfe722ba626a439db621385005aaa57b61835ca (patch)
tree7da108355eb69ae6b9ef26cbf4e7a8064ea5bb3a /ext/bg/js/profile-conditions.js
parent8c4fb28a300b84ce876c35c370bd43daf2e65228 (diff)
Add support for using optionsContext to select which profile to use
Diffstat (limited to 'ext/bg/js/profile-conditions.js')
-rw-r--r--ext/bg/js/profile-conditions.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/ext/bg/js/profile-conditions.js b/ext/bg/js/profile-conditions.js
index 86bafa95..5daa904e 100644
--- a/ext/bg/js/profile-conditions.js
+++ b/ext/bg/js/profile-conditions.js
@@ -32,27 +32,27 @@ const profileConditionsDescriptor = {
operators: {
equal: {
name: '=',
- test: (value, optionValue) => (value === optionValue)
+ test: ({depth}, optionValue) => (depth === optionValue)
},
notEqual: {
name: '\u2260',
- test: (value, optionValue) => (value !== optionValue)
+ test: ({depth}, optionValue) => (depth !== optionValue)
},
lessThan: {
name: '<',
- test: (value, optionValue) => (value < optionValue)
+ test: ({depth}, optionValue) => (depth < optionValue)
},
greaterThan: {
name: '>',
- test: (value, optionValue) => (value > optionValue)
+ test: ({depth}, optionValue) => (depth > optionValue)
},
lessThanOrEqual: {
name: '\u2264',
- test: (value, optionValue) => (value <= optionValue)
+ test: ({depth}, optionValue) => (depth <= optionValue)
},
greaterThanOrEqual: {
name: '\u2265',
- test: (value, optionValue) => (value >= optionValue)
+ test: ({depth}, optionValue) => (depth >= optionValue)
}
}
},
@@ -69,7 +69,7 @@ const profileConditionsDescriptor = {
transform: (optionValue) => optionValue.split(/[,;\s]+/).map(v => v.trim().toLowerCase()).filter(v => v.length > 0),
transformReverse: (transformedOptionValue) => transformedOptionValue.join(', '),
validateTransformed: (transformedOptionValue) => (transformedOptionValue.length > 0),
- test: (value, transformedOptionValue) => (transformedOptionValue.indexOf(new URL(value).hostname.toLowerCase()) >= 0)
+ test: ({url}, transformedOptionValue) => (transformedOptionValue.indexOf(new URL(url).hostname.toLowerCase()) >= 0)
},
matchRegExp: {
name: 'Matches RegExp',
@@ -78,7 +78,7 @@ const profileConditionsDescriptor = {
transformCache: {},
transform: (optionValue) => new RegExp(optionValue, 'i'),
transformReverse: (transformedOptionValue) => transformedOptionValue.source,
- test: (value, transformedOptionValue) => (transformedOptionValue !== null && transformedOptionValue.test(value))
+ test: ({url}, transformedOptionValue) => (transformedOptionValue !== null && transformedOptionValue.test(url))
}
}
}