parent
d8c8b6696a
commit
83a651e732
|
@ -11,9 +11,9 @@ proc parseTimelineProfile*(node: XmlNode): Profile =
|
||||||
fullname: profile.getName(pre & "nameLink"),
|
fullname: profile.getName(pre & "nameLink"),
|
||||||
username: profile.getUsername(pre & "screenname"),
|
username: profile.getUsername(pre & "screenname"),
|
||||||
joinDate: profile.getDate(pre & "joinDateText"),
|
joinDate: profile.getDate(pre & "joinDateText"),
|
||||||
location: profile.selectText(pre & "locationText").stripText(),
|
|
||||||
website: profile.selectAttr(pre & "urlText a", "title"),
|
website: profile.selectAttr(pre & "urlText a", "title"),
|
||||||
bio: profile.getBio(pre & "bio"),
|
bio: profile.getBio(pre & "bio"),
|
||||||
|
location: getLocation(profile),
|
||||||
userpic: node.getAvatar(".profile-picture img"),
|
userpic: node.getAvatar(".profile-picture img"),
|
||||||
verified: isVerified(profile),
|
verified: isVerified(profile),
|
||||||
protected: isProtected(profile),
|
protected: isProtected(profile),
|
||||||
|
|
|
@ -92,6 +92,14 @@ proc getBio*(profile: XmlNode; selector: string; fallback=""): string =
|
||||||
bio = profile.selectText(fallback)
|
bio = profile.selectText(fallback)
|
||||||
stripText(bio)
|
stripText(bio)
|
||||||
|
|
||||||
|
proc getLocation*(profile: XmlNode): string =
|
||||||
|
let sel = ".ProfileHeaderCard-locationText"
|
||||||
|
result = profile.selectText(sel).stripText()
|
||||||
|
|
||||||
|
let link = profile.selectAttr(sel & " a", "data-place-id")
|
||||||
|
if link.len > 0:
|
||||||
|
result &= ":" & link
|
||||||
|
|
||||||
proc getAvatar*(profile: XmlNode; selector: string): string =
|
proc getAvatar*(profile: XmlNode; selector: string): string =
|
||||||
profile.selectAttr(selector, "src").getUserpic()
|
profile.selectAttr(selector, "src").getUserpic()
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,12 @@ proc renderProfileCard*(profile: Profile; prefs: Prefs): VNode =
|
||||||
|
|
||||||
if profile.location.len > 0:
|
if profile.location.len > 0:
|
||||||
tdiv(class="profile-location"):
|
tdiv(class="profile-location"):
|
||||||
span: icon "location", profile.location
|
span: icon "location"
|
||||||
|
let loc = profile.location.split(":")
|
||||||
|
if loc.len > 1:
|
||||||
|
a(href=("/search?q=place:" & loc[1])): text loc[0]
|
||||||
|
else:
|
||||||
|
span: text loc[0]
|
||||||
|
|
||||||
if profile.website.len > 0:
|
if profile.website.len > 0:
|
||||||
tdiv(class="profile-website"):
|
tdiv(class="profile-website"):
|
||||||
|
|
Loading…
Reference in New Issue