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 endpull/28/head
parent
ef52cbe629
commit
d79eac6b57
|
@ -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)+'\")');
|
||||
}
|
||||
|
@ -231,4 +231,4 @@ function onErrorEvent(event) {
|
|||
function onError(error) {
|
||||
// Log the error.
|
||||
console.error('Error code', error.code, 'object', error);
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue