Content deleted Content added
support https links |
and support protocol relative |
||
Line 236:
//check if we can convert to internal link with WM prefixes
var ma = /^((?:https?:)?\/\/[^\/]+)\/wiki\/([^?]+)$/.exec( url )// 1:'http://___domain.org' 2:part after /wiki/
if( !ma ) return null
var linkPrefix = WMPrefixes( ma[1] )
Line 290:
function WMPrefixes(url){ // http: //en.wikipedia.org/wiki/... -> [ 'w', 'en']
var dd = /^(?:https?:)?\/\/([a-z\.]+)\.org/.exec( url.toLowerCase() )
if( !dd ) return null
dd = dd[1].split('.') //domains, e.g. ['en','wikipedia']
Line 345:
}
return '
}
|