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

Commit

Permalink
feat(Elife): Begin download list skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcmoulton committed Mar 12, 2020
1 parent b8d2267 commit d802289
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions src/themes/elife/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import '../../extensions/headings'
import '../../extensions/person'
import { first, ready } from '../../util'
// import { first, ready } from '../../util'
import * as util from '../../util'
import DateTimeFormat = Intl.DateTimeFormat

const dateFormatter = new DateTimeFormat('en-US', {
Expand All @@ -13,9 +14,41 @@ const formatDate = (date: Date): string => {
return dateFormatter.format(date)
}

ready((): void => {
const dateEl = first(':--Date')
const buildDownloads = (): void => {
util.append(
util.select(':--references')[0],
util.create('h2', null, 'Download links'),
util.create('h3', null, 'Downloads'),
util.create(
'ul',
null,
util.create('li', null, util.create('a', { href: '#' }, 'Article PDF')),
util.create('li', null, util.create('a', { href: '#' }, 'Figures PDF'))
),
util.create('h3', null, 'Download citations'),
util.create(
'ul',
null,
util.create('li', null, util.create('a', { href: '#' }, 'BibTeX')),
util.create('li', null, util.create('a', { href: '#' }, 'RIS'))
),
util.create('h3', null, 'Open citations'),
util.create(
'ul',
null,
util.create('li', null, util.create('a', { href: '#' }, 'Mendeley')),
util.create('li', null, util.create('a', { href: '#' }, 'ReadCube')),
util.create('li', null, util.create('a', { href: '#' }, 'Papers')),
util.create('li', null, util.create('a', { href: '#' }, 'CiteULike'))
)
)
}

util.ready((): void => {
const dateEl = util.first(':--Date')
if (!(dateEl instanceof Element)) return
const date = new Date(dateEl.innerHTML)
dateEl.innerHTML = formatDate(date)

buildDownloads()
})

0 comments on commit d802289

Please sign in to comment.