mirror of
https://git.waldn.net/git/knotteye/satyr.git
synced 2025-06-15 11:55:17 +00:00
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
This commit is contained in:
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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user