Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide div when there is no links - #20. #23

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).

const hnmain = document.getElementById('hnmain');
const linksDiv = document.getElementsByClassName('linksDiv')[0];
if (hnmain.align === 'left') {
if (hnmain.align === 'left' || length === 0) {
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