|
@@ -13,10 +13,11 @@ import Data.Maybe (Maybe(..))
|
|
|
import Data.Show.Generic (genericShow)
|
|
import Data.Show.Generic (genericShow)
|
|
|
import Data.Traversable (class Traversable, sequence, traverse, traverseDefault)
|
|
import Data.Traversable (class Traversable, sequence, traverse, traverseDefault)
|
|
|
import LinkedIn (DetachedNode(..))
|
|
import LinkedIn (DetachedNode(..))
|
|
|
-import LinkedIn.QueryRunner (QueryError(..), QueryRunner, chooseOne, ignoreNotFound, queryAll, queryOne, queryText)
|
|
|
|
|
|
|
+import LinkedIn.QueryRunner (QueryError(..), QueryRunner, chooseOne, chooseOne3, ignoreNotFound, queryAll, queryOne, queryText)
|
|
|
import LinkedIn.Types (ParseError(..), Parser)
|
|
import LinkedIn.Types (ParseError(..), Parser)
|
|
|
import LinkedIn.Utils (detachNonEmptyTextChild, parseDetachedNode, queryAndDetachMany, queryAndDetachOne, queryManyAndParse, queryOneAndParse)
|
|
import LinkedIn.Utils (detachNonEmptyTextChild, parseDetachedNode, queryAndDetachMany, queryAndDetachOne, queryManyAndParse, queryOneAndParse)
|
|
|
import Web.DOM (Node)
|
|
import Web.DOM (Node)
|
|
|
|
|
+import Web.DOM.Node as N
|
|
|
|
|
|
|
|
data JobsUnifiedTopCardElement a = JobsUnifiedTopCardElement {
|
|
data JobsUnifiedTopCardElement a = JobsUnifiedTopCardElement {
|
|
|
header :: a,
|
|
header :: a,
|
|
@@ -233,6 +234,14 @@ parseTopCardInsightContent n = do
|
|
|
queryTopCardInsightContentSingle :: QueryRunner (TopCardInsightContent Node)
|
|
queryTopCardInsightContentSingle :: QueryRunner (TopCardInsightContent Node)
|
|
|
queryTopCardInsightContentSingle n = pure $ TopCardInsightContentSingle n
|
|
queryTopCardInsightContentSingle n = pure $ TopCardInsightContentSingle n
|
|
|
|
|
|
|
|
|
|
+queryTopCardInsightContentButton :: QueryRunner (TopCardInsightContent Node)
|
|
|
|
|
+queryTopCardInsightContentButton n =
|
|
|
|
|
+ if type_ == "BUTTON"
|
|
|
|
|
+ then pure $ TopCardInsightContentButton n
|
|
|
|
|
+ else throwError (QNodeUnexpectedType "BUTTON" type_)
|
|
|
|
|
+
|
|
|
|
|
+ where type_ = N.nodeName n
|
|
|
|
|
+
|
|
|
queryTopCardInsightContentSecondary :: QueryRunner (TopCardInsightContent Node)
|
|
queryTopCardInsightContentSecondary :: QueryRunner (TopCardInsightContent Node)
|
|
|
queryTopCardInsightContentSecondary n = do
|
|
queryTopCardInsightContentSecondary n = do
|
|
|
primary <- queryOne ":scope > span:first-child span[aria-hidden=true]" n
|
|
primary <- queryOne ":scope > span:first-child span[aria-hidden=true]" n
|
|
@@ -242,7 +251,7 @@ queryTopCardInsightContentSecondary n = do
|
|
|
|
|
|
|
|
queryTopCardInsightContent :: QueryRunner (TopCardInsightContent Node)
|
|
queryTopCardInsightContent :: QueryRunner (TopCardInsightContent Node)
|
|
|
queryTopCardInsightContent n =
|
|
queryTopCardInsightContent n =
|
|
|
- chooseOne queryTopCardInsightContentSecondary queryTopCardInsightContentSingle n
|
|
|
|
|
|
|
+ chooseOne3 queryTopCardInsightContentSecondary queryTopCardInsightContentButton queryTopCardInsightContentSingle n
|
|
|
|
|
|
|
|
parseTopCardInsight :: Parser (TopCardInsight DetachedNode)
|
|
parseTopCardInsight :: Parser (TopCardInsight DetachedNode)
|
|
|
parseTopCardInsight n = do
|
|
parseTopCardInsight n = do
|