User:Js/urldecoder.js: Difference between revisions

Content deleted Content added
updating per editprotected request. please let me know if this breaks anything
support https links
Line 236:
 
//check if we can convert to internal link with WM prefixes
var ma = /^(httphttps?:\/\/[^\/]+)\/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 = /^httphttps?:\/\/([a-z\.]+)\.org/.exec( url.toLowerCase() )
if( !dd ) return null
dd = dd[1].split('.') //domains, e.g. ['en','wikipedia']