Extract thread and post only selectors

pull/73/head
MillenniumEarl 2021-03-02 11:48:45 +01:00
parent 95e9eaedce
commit 64591eeba6
1 changed files with 91 additions and 6 deletions

View File

@ -1,10 +1,4 @@
export const selectors = { export const selectors = {
GT_IMAGES: "img:not([title])[data-src^=\"https://attachments.f95zone.to\"][data-url=\"\"]",
GT_TAGS: "a.tagItem",
GT_TITLE: "h1.p-title-value",
GT_TITLE_PREFIXES: "h1.p-title-value > a.labelLink > span[dir=\"auto\"]",
GT_LAST_CHANGELOG: "b:contains('Changelog') + br + div > div",
GT_JSONLD: "script[type=\"application/ld+json\"]",
WT_FILTER_POPUP_BUTTON: "a.filterBar-menuTrigger", WT_FILTER_POPUP_BUTTON: "a.filterBar-menuTrigger",
WT_NEXT_PAGE: "a.pageNav-jump--next", WT_NEXT_PAGE: "a.pageNav-jump--next",
WT_URLS: "a[href^=\"/threads/\"][data-tp-primary]", WT_URLS: "a[href^=\"/threads/\"][data-tp-primary]",
@ -18,4 +12,95 @@ export const selectors = {
UD_AVATAR_PIC: "a[href=\"/account/\"] > span.avatar > img[class^=\"avatar\"]", UD_AVATAR_PIC: "a[href=\"/account/\"] > span.avatar > img[class^=\"avatar\"]",
LOGIN_MESSAGE_ERROR: "div.blockMessage.blockMessage--error.blockMessage--iconic", LOGIN_MESSAGE_ERROR: "div.blockMessage.blockMessage--error.blockMessage--iconic",
LU_TAGS_SCRIPT: "script:contains('latestUpdates')", LU_TAGS_SCRIPT: "script:contains('latestUpdates')",
BK_RESULTS: "ol.listPlain > * div.contentRow-main",
BK_POST_URL: "div.contentRow-title > a",
BK_DESCRIPTION: "div.contentRow-snippet",
BK_POST_OWNER: "div.contentRow-minor > * a.username",
BK_TAGS: "div.contentRow-minor > * a.tagItem",
/**
* Attribute `datetime` contains an ISO date.
*/
BK_TIME: "div.contentRow-minor > * time",
};
export const THREAD = {
/**
* Number of pages in the thread (as text of the element).
*
* Two identical elements are identified.
*/
LAST_PAGE: "ul.pageNav-main > li:last-child > a",
/**
* Identify the creator of the thread.
*
* The ID is contained in the `data-user-id` attribute.
*/
OWNER_ID: "div.uix_headerInner > * a.username[data-user-id]",
/**
* Contains the creation date of the thread.
*
* The date is contained in the `datetime` attribute as an ISO string.
*/
CREATION: "div.uix_headerInner > * time",
/**
* List of tags assigned to the thread.
*/
TAGS: "a.tagItem",
/**
* List of prefixes assigned to the thread.
*/
PREFIXES: "h1.p-title-value > a.labelLink > span[dir=\"auto\"]",
/**
* Thread title.
*/
TITLE: "h1.p-title-value",
/**
* JSON containing thread information.
*
* Two different elements are found.
*/
JSONLD: "script[type=\"application/ld+json\"]",
/**
* Posts on the current page.
*/
POSTS_IN_PAGE: "article.message",
}
export const POST = {
/**
* Unique post number for the current thread.
*
* For use within a `threads.POSTS_IN_PAGE` selector.
*/
NUMBER: "* ul.message-attribution-opposite > li > a:not([id])[rel=\"nofollow\"]",
/**
* Unique ID of the post in the F95Zone platform.
*
* For use within a `threads.POSTS_IN_PAGE` selector.
*/
ID: "span[id^=\"post\"]",
/**
* Main body of the post where the message written by the user is contained.
*
* For use within a `threads.POSTS_IN_PAGE` selector.
*/
BODY: "* article.message-body > div.bbWrapper",
/**
* Publication date of the post contained in the `datetime` attribute as an ISO date.
*
* For use within a `threads.POSTS_IN_PAGE` selector.
*/
PUBLISH_DATE: "* div.message-attribution-main > a > time",
/**
* Last modified date of the post contained in the `datetime` attribute as the ISO date.
*
* For use within a `threads.POSTS_IN_PAGE` selector.
*/
LAST_EDIT: "* div.message-lastEdit > time",
/**
* Gets the element only if the post has been bookmarked.
*
* For use within a `threads.POSTS_IN_PAGE` selector.
*/
BOOKMARKED: "* ul.message-attribution-opposite >li > a[title=\"Bookmark\"].is-bookmarked",
}; };