diff --git a/src/themes/elife/lib/downloads.ts b/src/themes/elife/lib/downloads.ts index 899f0c47f..8421e02ba 100644 --- a/src/themes/elife/lib/downloads.ts +++ b/src/themes/elife/lib/downloads.ts @@ -22,7 +22,7 @@ const deriveUrl = (type: string, id: string, title = ''): string => { const buildLinkToFiguresPdf = (url: string): void => { after( select('[data-is-download-pdf-list-item]')[0], - create('li', null, create('a', { href: url }, 'Figures PDF')) + create('li', null, createSimpleLink(url, 'Figures PDF')) ) } @@ -32,6 +32,8 @@ const buildMenu = ( pdfUrl: string, menuId: string ): void => { + const pdfLink = createSimpleLink(pdfUrl, 'Article PDF') + pdfLink.setAttribute('data-is-download-pdf-list-item', 'true') after( select(':--references')[0], create( @@ -40,15 +42,7 @@ const buildMenu = ( create('h2', null, 'Download links'), create('h3', null, 'Downloads'), - create( - 'ul', - null, - create( - 'li', - { 'data-is-download-pdf-list-item': true }, - create('a', { href: pdfUrl }, 'Article PDF') - ) - ), + create('ul', null, create('li', null, pdfLink)), create('h3', null, 'Download citations'), create( 'ul', @@ -56,13 +50,9 @@ const buildMenu = ( create( 'li', null, - create('a', { href: `${deriveUrl('bibtex', articleId)}` }, 'BibTeX') + createSimpleLink(deriveUrl('bibtex', articleId), 'BibTeX') ), - create( - 'li', - null, - create('a', { href: `${deriveUrl('ris', articleId)}` }, 'RIS') - ) + create('li', null, createSimpleLink(deriveUrl('ris', articleId), 'RIS')) ), create('h3', null, 'Open citations'), create( @@ -71,27 +61,18 @@ const buildMenu = ( create( 'li', null, - create( - 'a', - { href: `${deriveUrl('mendeley', articleId)}` }, - 'Mendeley' - ) + createSimpleLink(deriveUrl('mendeley', articleId), 'Mendeley') ), create( 'li', null, - create( - 'a', - { href: `${deriveUrl('readcube', articleId)}` }, - 'ReadCube' - ) + createSimpleLink(deriveUrl('readcube', articleId), 'ReadCube') ), create( 'li', null, - create( - 'a', - { href: `${deriveUrl('papers', articleId, articleTitle)}` }, + createSimpleLink( + deriveUrl('papers', articleId, articleTitle), 'Papers' ) ) @@ -125,6 +106,9 @@ const buildLinkToMenu = (menuId: string): Promise => { return Promise.resolve() } +const createSimpleLink = (href: string, text: string): Element => + create('a', { href, target: '_parent' }, text) + export const build = (articleTitle: string, articleId: string): void => { const menuId = 'downloadMenu' try {