-
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.
Make NN parsing work on uppercase NNs (#51)
This makes nn713, OR NN713 work.
- Loading branch information
1 parent
30ac088
commit dc7b1c8
Showing
1 changed file
with
8 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
window.onload = function() { | ||
// Define a regular expression to match the "nn713" format | ||
var regex = /nn(\d+)/g; | ||
var capRegex = /NN(\d+)/g; | ||
|
||
// Get the HTML content of the entire page | ||
var pageContent = document.body.innerHTML; | ||
|
||
// Replace all occurrences of "nn713" with the link | ||
var replacedContent = pageContent.replace(regex, function(match, number) { | ||
return '<a target="_blank" href="https://www.nycmesh.net/map/nodes/' + number + '">' + match + '</a>'; | ||
}); | ||
var replacedContent = pageContent.replace(regex, parseNode); | ||
replacedContent = replacedContent.replace(capRegex, parseNode); | ||
|
||
// Update the HTML content of the page with the modified content | ||
document.body.innerHTML = replacedContent; | ||
}; | ||
}; | ||
|
||
function parseNode(match, number) { | ||
return '<a target="_blank" href="https://www.nycmesh.net/map/nodes/' + number + '">' + match + '</a>'; | ||
} |