User:Js/urldecoder.js: Difference between revisions

Content deleted Content added
Js (talk | contribs)
 
Js (talk | contribs)
corrections
Line 6:
var bt = document.createElement('input')
bt.type = 'button'; bt.onclick = urlDecoderRun
bt.value = '%→[\[]]'; bt.id = 'urlDecoder'
bt.title = 'Decode URL before cursor or all URLs in selected text or one URL just before cursor'
bt.style.cssText = 'background:#adbede; height:22px; vertical-align:top; padding:0'
tlb.appendChild(bt)
Line 107:
 
function decodeLink(url, name){ //name is optional
var parts, endingDots, result, prefix = '', colon = ''
if (name) name = name.replace(/^ +| +$/g,'') //trim spaces
//secure Wikimedia link into non-secure
Line 138:
if (linkPrefix[1] && (linkPrefix[1] != localPrefix[1])) prefixes += ':'+linkPrefix[1]
if (prefixes) prefixes += ':'
if (!prefixes && isColonNeeded(title)) prefixprefixes = ':' //leading colon for cat/file
//return result
result = '[\[' + prefixes + title
Line 227:
ns = ns.join('|').toLowerCase()
urlDecoderNS[wgContentLanguage] = ns
showMsg('"<code>urlDecoderNS[" = {'"+wgContentLanguage+'"] = "':'"+ns+'"'}<code>'"+whatsthis)
return ns
}
Line 241:
}
dv.innerHTML = htm; dv.style.display = ''
setTimeout(hideMsg, 1000015000)
}