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

Content deleted Content added
prevent search for section names beginning with interwiki prefix followed by colon (such as "RfC:") to lead outside the wiki; remove mw.util dependency
fix colon problem
Line 19:
prefix = encodeURIComponent(prefix);
 
var hashColonFixed = hash.replace(/^([A-Za-z]+):/, '$1'); // remove colon that may get interpreted as an interwiki links, otherwise the search link will go straight to the interwiki page.
// .replace(/(\w+):/, '$1') to search for "RfC something" instead of "RfC: something" because the latter
var search = encodeURIComponent('"' + hash.replace(/(\w+):/, '$1')hashColonFixed.replace(/_/g, ' ') + '"');
// gets treated as an interwiki link
var search = encodeURIComponent('"' + hash.replace(/(\w+):/, '$1').replace(/_/g, ' ') + '"');
 
var searchLink = mw.config.get('wgScript')