-
-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
65 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
(function() { | ||
document.addEventListener('DOMContentLoaded', function(){ | ||
const targetElements = document.querySelector('main').querySelectorAll('h1, h2, h3, h4, h5, h6'); | ||
|
||
targetElements.forEach(( el ) => { | ||
if (el.id) { | ||
const headerlink = document.createElement('a'); | ||
headerlink.setAttribute('class', 'headerlink'); | ||
headerlink.setAttribute('href', '#' + el.id); | ||
headerlink.setAttribute('title', 'Permalink to this headline'); | ||
|
||
const icon = document.createElement('i'); | ||
icon.setAttribute('class', 'fas fa-hashtag'); | ||
icon.setAttribute('aria-hidden', 'true'); | ||
|
||
headerlink.append(icon); | ||
|
||
el.append(headerlink); | ||
} | ||
}); | ||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,18 @@ | ||
(function($) { | ||
$(document).ready(function() { | ||
$('.nav-prev').on( 'click', function() { | ||
location.href = $(this).attr('href'); | ||
}); | ||
$('.nav-next').on('click', function() { | ||
location.href = $(this).attr('href'); | ||
}); | ||
(function() { | ||
document.addEventListener('DOMContentLoaded', function(){ | ||
const nav_prev = document.querySelector('.nav-prev'); | ||
const nav_next = document.querySelector('.nav-next'); | ||
|
||
$(document).on( 'keydown', function(e) { | ||
// prev links - left arrow key | ||
if(e.which == '37') { | ||
$('.nav-prev').click(); | ||
// prev links - left arrow key | ||
document.addEventListener( 'keydown', event => { | ||
if (nav_prev && event.keyCode === 37) { | ||
location.href = nav_prev.getAttribute('href'); | ||
} | ||
|
||
// next links - right arrow key | ||
if(e.which == '39') { | ||
$('.nav-next').click(); | ||
if (nav_next && event.keyCode === 39) { | ||
location.href = nav_next.getAttribute('href'); | ||
} | ||
}); | ||
}); | ||
})(jQuery); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
require( './sidebar-menu.js' ); | ||
require( './keydown-nav.js' ); | ||
require( './jquery.backtothetop/jquery.backtothetop.min.js' ); | ||
require( './headerlink.js' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.