Change modifyLinks regex to match all valid URL characters, followed by a period, followed by a-zA-Z0-9

This should catch any legal URL with a file extension on the end
pull/28/head
knotteye 2021-01-15 09:43:16 -06:00
parent ef52cbe629
commit d79eac6b57
1 changed files with 2 additions and 2 deletions

View File

@ -170,7 +170,7 @@ function handleLoad() {
function modifyLinks() {
for (var ls = document.links, numLinks = ls.length, i=0; i<numLinks; i++){
if(ls[i].href.indexOf(location.protocol+'//'+location.host) !== -1 && ls[i].href.match(new RegExp(/\/\w+\.\w+$/)) === null) {
if(ls[i].href.indexOf(location.protocol+'//'+location.host) !== -1 && ls[i].href.match(new RegExp(/\/[A-Za-z0-9_\-~]+\.[A-Za-z0-9]+$/)) === null) {
//should be a regular link
ls[i].setAttribute('onclick', 'return internalLink(\"'+ls[i].href.substring((location.protocol+'//'+location.host).length)+'\")');
}