Skip to content

Commit

Permalink
TW-1192 Replace 'shouldUseParent' property with 'parentDepth'
Browse files Browse the repository at this point in the history
  • Loading branch information
keshan3262 committed Dec 15, 2023
1 parent 3db84a4 commit b1fa297
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/advertising/slise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface SliseAdPlacesRule {
selector: {
isMultiple: boolean;
cssString: string;
shouldUseResultParent: boolean;
parentDepth: number;
shouldUseDivWrapper: boolean;
};
}
Expand Down
19 changes: 11 additions & 8 deletions src/routers/slise-ad-rules/ad-places.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { hostnamesListSchema, sliseAdPlacesRulesDictionarySchema } from '../../u
* required:
* - isMultiple
* - cssString
* - shouldUseResultParent
* - parentDepth
* - shouldUseDivWrapper
* properties:
* isMultiple:
Expand All @@ -27,9 +27,12 @@ import { hostnamesListSchema, sliseAdPlacesRulesDictionarySchema } from '../../u
* cssString:
* type: string
* description: CSS selector
* shouldUseResultParent:
* type: boolean
* description: Whether the results parents should be used as ads containers
* parentDepth:
* type: number
* description: >
* Indicates the depth of the parent element of the selected element, i. e. 0 means that the selected
* elements are ads containers themselves, 1 means that the selected elements are ads containers' direct
* children and so on.
* shouldUseDivWrapper:
* type: boolean
* description: Whether the ads banner should be wrapped in a div
Expand All @@ -52,7 +55,7 @@ import { hostnamesListSchema, sliseAdPlacesRulesDictionarySchema } from '../../u
* selector:
* isMultiple: false
* cssString: 'main > section div.row > div:nth-child(2) > div'
* shouldUseResultParent: false
* parentDepth: 0
* shouldUseDivWrapper: false
* SliseAdPlacesRulesDictionary:
* type: object
Expand All @@ -67,22 +70,22 @@ import { hostnamesListSchema, sliseAdPlacesRulesDictionarySchema } from '../../u
* selector:
* isMultiple: false
* cssString: 'main > section div.row > div:nth-child(2) > div'
* shouldUseResultParent: false
* parentDepth: 0
* shouldUseDivWrapper: false
* www.dextools.io:
* - urlRegexes:
* - '^https://www\.dextools\.io/app/[A-z]{2}/[0-9A-z-]+/pair-explorer'
* selector:
* isMultiple: true
* cssString: 'app-header-banner'
* shouldUseResultParent: true
* parentDepth: 1
* shouldUseDivWrapper: false
* - urlRegexes:
* - '^https://www\.dextools\.io/app/[A-z]{2}/[0-9A-z-]+/pairs'
* selector:
* isMultiple: false
* cssString: 'div.left-container > app-pe-banner:nth-child(2)'
* shouldUseResultParent: false
* parentDepth: 0
* shouldUseDivWrapper: true
*/

Expand Down
3 changes: 2 additions & 1 deletion src/utils/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
array as arraySchema,
ArraySchema as IArraySchema,
boolean as booleanSchema,
number as numberSchema,
object as objectSchema,
ObjectSchema as IObjectSchema,
Schema,
Expand Down Expand Up @@ -66,7 +67,7 @@ const sliseAdPlacesRulesSchema = arraySchema()
selector: objectSchema().shape({
isMultiple: booleanSchema().required(),
cssString: cssSelectorSchema.clone().required(),
shouldUseResultParent: booleanSchema().required(),
parentDepth: numberSchema().integer().min(0).required(),
shouldUseDivWrapper: booleanSchema().required()
})
})
Expand Down

0 comments on commit b1fa297

Please sign in to comment.