MediaWiki:Gadget-find-archived-section.js: Difference between revisions

Content deleted Content added
tweak cmt
update: add tilde (~) in search string to correctly handle section names where an article/redirect of the same name exists; remove hashColonFix as no longer necessary; also correctly handles section names beginning with a word then a colon (like "User:")
Line 1:
$.when($.ready).then(function() {
 
var addsection = document.getElementById('ca-addsection');
var correctNs = mw.config.get('wgNamespaceNumber') % 2 === 1 || mw.config.get('wgNamespaceNumber') === 4;
Line 21 ⟶ 22:
prefix = encodeURIComponent(prefix);
 
var search = encodeURIComponent('~"' + hashColonFixedhash.replace(/_/g, ' ') + '"');
var hashColonFixed = hash.replace(/^([A-Za-z]+):/, '$1'); // remove colon that may get interpreted as an interwiki link, causing the search link to go straight to the interwiki page.
var search = encodeURIComponent('"' + hashColonFixed.replace(/_/g, ' ') + '"');
 
var searchLink = mw.config.get('wgScript')