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

Commit

Permalink
fix: fix typo in frontend.ts that resulted in duplicate elements
Browse files Browse the repository at this point in the history
Closes #279
  • Loading branch information
dsifford committed Jan 20, 2017
1 parent f4198d0 commit 189a1e5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/lib/css/citations.styl
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ body:not(#tinymce)
position: relative
font-size: 30px
top: 5px
&.abt-hidden:before
content: '\f139'
.abt-bibliography__heading_toggle--closed:before
content: '\f139'

// Deprecations
// @stylint off
Expand Down
6 changes: 6 additions & 0 deletions src/lib/css/frontend.styl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
@require 'collections/variables'
@require 'citations'

.abt-bibligraphy__container
display: block

.abt-bibligraphy__container--hidden
display: none

.abt-tooltip
border-radius: 3px
box-shadow: $citation-tooltip
Expand Down
13 changes: 7 additions & 6 deletions src/lib/js/Frontend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,22 +109,23 @@ class Citations {
private enableToggle(): void {
const citations = document.querySelectorAll('#abt-bibliography>div, #abt-smart-bib>div');
const heading = document.querySelector('.abt-bibliography__heading_toggle, #abt-smart-bib>h3.toggle');
let container = document.getElementById('abt-bibibliography__container');
let container = document.getElementById('abt-bibliography__container');

if (!container) {
container = document.createElement('div');
container.id = 'abt-bibibliography__container';
container.id = 'abt-bibliography__container';
this.bibliography.appendChild(container);
for (const el of citations) {
container.appendChild(el);
}
}
container.style.display = 'none';
heading.classList.toggle('abt-hidden');

container.classList.toggle('abt-bibligraphy__container--hidden');
heading.classList.toggle('abt-bibliography__heading_toggle--closed');

heading.addEventListener('click', () => {
container.style.display = container.style.display === 'none' ? '' : 'none';
heading.classList.toggle('abt-hidden');
container.classList.toggle('abt-bibligraphy__container--hidden');
heading.classList.toggle('abt-bibliography__heading_toggle--closed');
});
}
}
Expand Down

0 comments on commit 189a1e5

Please sign in to comment.