-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
1 parent
e59d478
commit 36eb227
Showing
3 changed files
with
20 additions
and
33 deletions.
There are no files selected for viewing
11 changes: 0 additions & 11 deletions
11
pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs/redirects.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,3 @@ | ||
// the following code matches the current page's anchor against the set of redirects. | ||
// | ||
// it is written to minimize the latency between page load and redirect. | ||
// therefore we avoid function calls, copying data, and unnecessary loops. | ||
|
||
// anchor starts with the hash character (`#`), | ||
// but our redirect declarations don't, so we strip it. | ||
// example: | ||
// document.location.hash -> '#foo' | ||
// document.location.hash.substring(1) -> 'foo' | ||
const anchor = document.location.hash.substring(1); | ||
|
||
const redirects = REDIRECTS_PLACEHOLDER; | ||
if (redirects[anchor]) document.location.href = redirects[anchor]; |
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