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

added fixed navbar #46

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Changes from 16 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
41 changes: 37 additions & 4 deletions source-browser.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@
<link rel="stylesheet" href="https://unpkg.com/basscss@7.1.1/css/basscss.min.css" integrity="sha384-/biuPsPEkt10QoeOExIADuWNrpFFXALKPgBhEDkRdKDJdQOPpbNU3uUeFbL/KPJg" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/hint.css/2.5.0/hint.base.min.css" integrity="sha256-ODFgZG+Y3V10lzZu+7J8epM4SdW0w3p8qbVmmShNrtk=" crossorigin="anonymous">
<style type="text/css">
#navbar li a {
padding: 14px 16px;
}
.topic {
padding-top: 75px;
margin-top: -75px;
}
#content {
margin-top: 75px;
margin-bottom: 100px;
Copy link
Member

Choose a reason for hiding this comment

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

Instead of using 3 margin rules, just use one with 4 values.

overflow-x: hidden;
}
#logo-text {
Expand Down Expand Up @@ -42,6 +50,8 @@
</style>
</head>
<body class="m2">
<ul class="fixed m0 p0 overflow-hidden bg-black bottom-0 col-12 z2" id="navbar">
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<ul class="fixed m0 p0 overflow-hidden bg-black bottom-0 col-12 z2" id="navbar">
<ul id="navbar" class="fixed m0 p0 overflow-hidden bg-black bottom-0 col-12 z2"></ul>

</ul>
<div class="fixed top-0 col-12 py1 mr3 bg-white z1">
<a href="https://apertium.org" target="_blank" rel="noopener" class="mt2 text-decoration-none nowrap"> <!-- apertium.org is slow and hosts a large version -->
<img id="logo" alt="Apertium" height="50" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEUAAAA8CAYAAAAwoHcgAAAZlElEQVR42t2beZQcV5Xmf++9WDKzdlVJpX2xZMu2MF7kDYzd8tYGm6WBkVi6ATdwzOme03C6m57hADOUB6anBwZo4AwcaJYeVqOCocG0he0GlbEEeJFly9plqbSUSkupqlSVlUss7935IyOldKlklWVgmIlz3onIiMiXcb/47nfve+8mvPhNAXrSOd1wjSmuKf4f2sx5fk8awBHgj4AEGJ8EgAbcCwD2B7np8/hOHliegSHZuQuBNzSApLLmgBVAd3Ze//8GSv3eVwHvAC7IDF0AzJ50Tx2w64HVwFuAtgykP3jGeC/SZQCeBa4G/gzYlrGgADwOpA333wVc0/A9//+SjY2s/Z1oigImgAPAssyNmoGjwDqgCuQyZrw8A6Qf+GaD3shv2dhz3VNnrWlw73N+6XxczmXsuAoIgaeAUWAGsCZzJwc8A/x4CtH9bQQIO01AZgKzMlZPvvZbiz51wYyBgxkTqsAi4G1AZ2b8I8BD0wRETfMFmfqbX7VqlRfHca5YLCYvIA0OeC/w59kzLAT2nIsQ5xsN6oJZB/Uq4K1AawbWT4Bfvgh/lnPQuv6cFmDx4sVX7Nu376O+7998FjtUpm8dwGuzF1fJdO6/T9LIFxRa1bB302RM/b7Z2QMcA34E7J+CHeosD6OAecDJTK/O5q4sWbLk8jRNbxWRpUAgIqNn6VNnAL4LOAR8MDv/Y+D7WV71yNnc0JvCx6RBkKYrij/L7t2cie5UgMhZ/DkAXplp1D9PAZ674IILLkrT9E5r7cVKKeOcG9NaR865+fPmzes8fPjwcEO/KjO0E3g18OGsn1zm5kcbUoiz0rIOwGzgI8CSzCCZhp9Lgzuty35QTZHFSiZ2yyaBAxABa7OkcH7Dy1AAixYtek2SJO8XkZcBJ0Vks1LKAKKUalFKLZ3UX92l/zQ7fjbbVzP3XgrsfCEXavTFPwVuBz6b6QPTBAbg4iwKNY516mDns/NNk5I8ach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2D5fXf3VbZAiRtGt9o0pH0lIGVrJWyVm5o9XsapwnOn/H8njYBtenLK726GD/+yWtmt+ZzH3vi6cFbH964f8M3d9pfAcMdhrTNp7i/ylj2x4JSBkbdaPcS7BP+EDcR1JNfXtn4d9zCeb7Ms7WXvP0fVkUKEGhETG4AAAAASUVORK5CYII">
Expand Down Expand Up @@ -132,7 +142,7 @@ <h1 id="loading" class="m1 center display-none">⌛</h1>
$('#topics').append(
$('<div class="topic flex-auto">').append(
$('<div>').append(
$('<h2 class="inline-block m0">').text(name),
$('<h2 class="inline-block m0 topic">', {id: name}).text(name),
$('<a class="ml1 text-decoration-none" target="_blank" rel="noopener">🔗</a>', {
href: repoUrl,
}),
Expand Down Expand Up @@ -182,20 +192,43 @@ <h1 id="loading" class="m1 center display-none">⌛</h1>
}

$(document).ready(() => {
sushain97 marked this conversation as resolved.
Show resolved Hide resolved
$(window).on('scroll resize', () => {
const top = $(window).scrollTop();
const bottom = top + $(window).height();
TOPICS.forEach(({name}) => {
const navLinkPosition = $(`#${name}`).position().top;
$(`#${name}-nav-link`)
.text(`${name} ${navLinkPosition > bottom ? '↓' : '↑'}`)
.toggle(top >= navLinkPosition || navLinkPosition >= bottom);
});
});

TOPICS.map(({name}) => {
$('#navbar').append(
Copy link
Member

Choose a reason for hiding this comment

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

When I suggested using map, I didn't mean directly instead of forEach. You should map to create the <li> elements and then append that list to #navbar.

Copy link
Author

@nathanchi nathanchi Nov 20, 2018

Choose a reason for hiding this comment

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

So something like this?
$('#navbar').append(
TOPICS.map(({ name }) => {

Copy link
Author

@nathanchi nathanchi Nov 20, 2018

Choose a reason for hiding this comment

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

The js syntax seems to not work when I do that, however. Do you have any suggestions on how to do this?

Copy link
Member

Choose a reason for hiding this comment

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

It should work. What is the error and where is it occurring?

Copy link
Author

@nathanchi nathanchi Nov 20, 2018

Choose a reason for hiding this comment

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

Okay, that's interesting:

$('#navbar').append(TOPICS.map(({name}) => {
$('<li class="left">').append(
$('<a class="inline-block white center btn:hover">', {
id:${name}-nav-link,
href:#${name},
}).text(name)
)
});
);

That is the code that I edited.

The error message was "Uncaught SyntaxError: missing ) after argument list," which is strange, because I'm pretty sure every bracket and parentheses is closed.

Copy link
Author

Choose a reason for hiding this comment

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

Do you know what the error might be?

Copy link
Member

@sushain97 sushain97 Nov 20, 2018

Choose a reason for hiding this comment

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

You shouldn't have multiple semicolons in one statement. That is, your first semicolon should probably be removed.

Copy link
Author

@nathanchi nathanchi Nov 20, 2018

Choose a reason for hiding this comment

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

I edited the jquery as you suggested, and now the code looks like this:

https://pastebin.com/T1RPg36n

It still doesn't work, though...I'm pretty sure the syntax is correct, though. Every parentheses/bracket is balanced and closed.

The error message is still the same, however.

Copy link
Member

@sushain97 sushain97 Nov 20, 2018

Choose a reason for hiding this comment

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

Please just paste code here using the code formatting (4 spaces).

I don't understand why you have two lines that are almost identical? Also, your arrow function needs a return if you use braces. If you omit them (which is fine here), you can also omit the return.

Copy link
Author

Choose a reason for hiding this comment

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

Alright, I've fixed it.

$('<li class = "left">').append(
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
$('<li class = "left">').append(
$('<li class="left">').append(

$('<a class = "inline-block white center btn:hover">', {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
$('<a class = "inline-block white center btn:hover">', {
$('<a class="inline-block white center btn:hover">', {

id: `${name}-nav-link`,
href: `#${name}`,
class: `inline-block white center btn:hover`
Copy link
Member

Choose a reason for hiding this comment

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

This isn't needed anymore?

Copy link
Author

Choose a reason for hiding this comment

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

I'm sorry, I'm not quite sure if I understand. Why don't I need it?

Copy link
Member

Choose a reason for hiding this comment

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

You already have it above in the string.

Copy link
Author

Choose a reason for hiding this comment

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

On 200? It doesn't define the id, href, or class.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not saying the id and href aren't needed. This comment is on the line with the class.

Copy link
Author

Choose a reason for hiding this comment

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

Oh, I'm sorry, I misunderstood what you meant.

}).text(name)
)
);
});

$('#github-link').attr('href', `https://github.com/${ORGANIZATION}`);
$('#refresh').click(({ currentTarget }) => {
$('#refresh').click(({currentTarget}) => {
Copy link
Member

Choose a reason for hiding this comment

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

Can you use the proper prettifier settings to revert this change and also use the same spacing elsewhere?

currentTarget.blur();
refreshTopics();
});

Copy link
Member

Choose a reason for hiding this comment

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

Revert spacing change here.

$('#search').on('input', showTopics);
$(document.body).keypress(({ target, altKey, ctrlKey, metaKey, key }) => {
$(document.body).keypress(({target, altKey, ctrlKey, metaKey, key}) => {
if (target === document.body && !altKey && !ctrlKey && !metaKey) {
showSearchInput();
}
});
$(window).keydown(event => {
const { keyCode, ctrlKey, metaKey } = event;
const {keyCode, ctrlKey, metaKey} = event;
if (keyCode === 114 || ((ctrlKey || metaKey) && keyCode === 70)) {
event.preventDefault();
showSearchInput();
Expand Down