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 3 years ago
parent ef52cbe629
commit d79eac6b57
  1. 2
      site/index.js

@ -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)+'\")');
}