Skip to content

Commit

Permalink
Merge f36d2e2 into a6b57a7
Browse files Browse the repository at this point in the history
  • Loading branch information
shinyichen committed Apr 22, 2021
2 parents a6b57a7 + f36d2e2 commit e9ae586
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
23 changes: 18 additions & 5 deletions src/js/widgets/list_of_things/item_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ define([
'mouseenter .letter-icon': 'showLinks',
'mouseleave .letter-icon': 'hideLinks',
'focusout .letter-icon': 'hideLinks',
'click .letter-icon a': 'emitAnalyticsEvent',
'click .letter-icon': 'toggleShowLinksWithClick',
'click .show-all-authors': 'showAllAuthors',
'click .show-less-authors': 'showLessAuthors',
// only relevant to results view for the moment
Expand Down Expand Up @@ -204,12 +204,25 @@ define([
}
},

toggleShowLinksWithClick: function(e) {
// only allows open drop down with click using mobile
// in desktop, mouse over will show dropdown
if (this.model.get('isMobileOrTablet')) {
if (
$(e.currentTarget)
.find('ul')
.hasClass('hidden')
) {
this.showLinks(e);
} else {
this.hideLinks(e);
}
}
},

showLinks: function(e) {
var $c = $(e.currentTarget);
if (
!$c.find('.active-link').length ||
this.model.get('isMobileOrTablet')
) {
if (!$c.find('.active-link').length) {
return;
}

Expand Down
6 changes: 3 additions & 3 deletions src/js/widgets/list_of_things/templates/item-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

{{#if links.text}}

<a href="{{links.text.[0].url}}" target="_blank" rel="noreferrer noopener" class="btn-link active-link s-active-link" aria-disabled="false">
<a class="btn-link active-link s-active-link" aria-disabled="false">
<i class="s-text-icon" aria-hidden="true"></i>
<span class="sr-only">quick access to full text links</span>
</a>
Expand Down Expand Up @@ -81,7 +81,7 @@

{{#if links.list}}

<a href="{{links.list.[0].url}}" class="btn-link active-link s-active-link" aria-disabled="false">
<a class="btn-link active-link s-active-link" aria-disabled="false">
<i class="s-list-icon" aria-hidden="true"></i>
<span class="sr-only">quick links to lists of references, citations and more</span>
</a>
Expand Down Expand Up @@ -109,7 +109,7 @@

{{#if links.data}}

<a href="{{links.data.[0].url}}" target="_blank" rel="noreferrer noopener" class="btn-link active-link s-active-link" aria-disabled="false">
<a class="btn-link active-link s-active-link" aria-disabled="false">
<i class="s-data-icon" aria-hidden="true"></i>
<span class="sr-only">quick links to data associated with this article</span>
</a>
Expand Down

0 comments on commit e9ae586

Please sign in to comment.