Skip to content
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.

Commit

Permalink
feat(Elife): Obtain article id & use in download menu links
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcmoulton committed Mar 27, 2020
1 parent cdabec1 commit 87df483
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/themes/elife/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { first, ready } from '../../util'
import {first, ready, select} from '../../util'
import * as downloads from './downloads'
import DateTimeFormat = Intl.DateTimeFormat

Expand All @@ -15,11 +15,17 @@ const formatDate = (dateEl: Element | null): void => {
}
}

const getArticleId = (): string => {
const selector =
':--identifier meta[content="https://registry.identifiers.org/registry/publisher-id"] ~ [itemprop="value"]'
return first(selector)?.innerHTML ?? ''
}

ready((): void => {
formatDate(first(':--datePublished'))

downloads.build(
'TheArticleId',
getArticleId(),
first(':--title')?.getAttribute('content') ?? ''
)
})

0 comments on commit 87df483

Please sign in to comment.