Skip to content

Commit

Permalink
Merge pull request #25 from saif-malik-01/master
Browse files Browse the repository at this point in the history
Close links div when there is no links - #23
  • Loading branch information
dit7ya authored Oct 17, 2021
2 parents 57ce823 + e4d3ce9 commit ccfd26a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ browser.runtime.onMessage.addListener(() => {
});
});

const toggleSidebar = () => {
const toggleSidebar = (length) => {
const hnmain = document.getElementById('hnmain');
const linksDiv = document.getElementsByClassName('linksDiv')[0];
if (hnmain.align === 'left') {
if (length === undefined || length === 0 || hnmain.align === 'left') {
linksDiv.style.display = 'none';
hnmain.width = '85%';
hnmain.align = 'center';
Expand Down Expand Up @@ -215,7 +215,7 @@ function createLinksArrayElement (linksArray) {

const linksArray = createLinksArray();
createLinksArrayElement(linksArray);
toggleSidebar();
toggleSidebar(linksArray.length);

// Ellipsify the comment texts to three lines

Expand Down

0 comments on commit ccfd26a

Please sign in to comment.