var httpRegExp = '((?:https?:)?\\/\\/[^\\]\\[\\n\\r<>" ]+)' // any chars except []<>" and \n and spaces
var localPrefix = WMPrefixes( unSecure( mw.config.get( 'wgServer' ).replace(/^\/\//,'http://') + mw.config.get( 'wgScript' ) ) )
var oldText, newText, isBeforeCursor, colonNS
var decodingFailed //need to skip some strange percent-encoded URIs
url = unSecure(url)
//percent-decoding
return [proj, lang]
}
function unSecure(url){
var mm = /https:\/\/secure\.wikimedia\.org\/(\w+)\/(\w+)\/([^\]\|\n\r ]+)/i.exec( url )
if( !mm) return url
var ___domain = mm[1].toLowerCase(), sub = mm[2].toLowerCase()
if( ! wmDomainM[___domain] ) return url //___domain not recognized
if( ___domain == 'wikipedia' ) //handle some special cases
switch( sub ){
case 'mediawiki': sub = 'www'; ___domain = 'mediawiki'; break
case 'foundation': sub = ''; ___domain = 'wikimediafoundation'; break
case 'sources': sub = ''; ___domain = 'wikisource'; break
default:
if( wmSubDomains.test(sub) ) ___domain = 'wikimedia' // .../wikipedia/meta -> meta.wikimedia.org
//otherwise: consider it language: .../wikipedia/en
}
return 'https://' + (sub ? sub + '.' : '') + ___domain + '.org/' + mm[3]
}
|