forked from async-aws/aws
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Small improvments on js (async-aws#461)
- Loading branch information
Showing
5 changed files
with
26 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
module.exports = function(dom) { | ||
dom.window.document.querySelectorAll('h2, h3').forEach((headline) => { | ||
for(const headline of dom.window.document.querySelectorAll('h2, h3')) { | ||
const id = headline.getAttribute('id'); | ||
const link = dom.window.document.createElement('a'); | ||
|
||
let id = headline.getAttribute('id'); | ||
let link = dom.window.document.createElement('a'); | ||
link.setAttribute('href', '#' + id); | ||
link.setAttribute('title', 'Permalink to this headline'); | ||
link.setAttribute('class', 'headerlink'); | ||
link.innerHTML = '¶'; | ||
headline.innerHTML = headline.innerHTML + link.outerHTML; | ||
}); | ||
headline.append(link); | ||
} | ||
}; | ||
|
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