|
|
@@ -0,0 +1,40 @@
|
|
|
+module LinkedIn.ArtDecoCardAlt where
|
|
|
+
|
|
|
+import Prelude
|
|
|
+
|
|
|
+import Data.Either (note)
|
|
|
+import Data.Generic.Rep (class Generic)
|
|
|
+import Data.List (List)
|
|
|
+import Data.List.Types (NonEmptyList)
|
|
|
+import Data.Maybe (Maybe)
|
|
|
+import Data.Show.Generic (genericShow)
|
|
|
+import LinkedIn (DetachedNode)
|
|
|
+import LinkedIn.ArtDeco (ArtDecoPvsEntity, parseArtDecoPvsEntity)
|
|
|
+import LinkedIn.ArtDeco as AD
|
|
|
+import LinkedIn.Types (Parser, QueryError(..), QueryRunner)
|
|
|
+import LinkedIn.Utils (queryOne, queryOneAndParse)
|
|
|
+import Web.DOM (Node)
|
|
|
+import Web.DOM.Node (nodeName)
|
|
|
+
|
|
|
+
|
|
|
+data ArtDecoCardAltElement a = ArtDecoCardAltElement {
|
|
|
+ pvs_entity :: a
|
|
|
+}
|
|
|
+
|
|
|
+derive instance Generic (ArtDecoCardAltElement a) _
|
|
|
+derive instance Eq a => Eq (ArtDecoCardAltElement a)
|
|
|
+instance Show (ArtDecoCardAltElement Node) where
|
|
|
+ show (ArtDecoCardAltElement {pvs_entity}) = "ArtDecoCardAltElement(Node " <> nodeName pvs_entity <> ")"
|
|
|
+else instance Show a => Show (ArtDecoCardAltElement a) where
|
|
|
+ show = genericShow
|
|
|
+instance Functor ArtDecoCardAltElement where
|
|
|
+ map f (ArtDecoCardAltElement {pvs_entity}) =
|
|
|
+ ArtDecoCardAltElement ({pvs_entity: f pvs_entity})
|
|
|
+
|
|
|
+queryArtDecoCardAlt :: QueryRunner (ArtDecoCardAltElement Node)
|
|
|
+queryArtDecoCardAlt n = do
|
|
|
+ pvs <- queryOne ":scope div.pvs-entity--padded" n
|
|
|
+
|
|
|
+ pure $ ado
|
|
|
+ p <- note (QNodeNotFoundError "stuff") pvs
|
|
|
+ in ArtDecoCardAltElement {pvs_entity: p}
|