MediaWiki:Gadget-find-archived-section.js: Difference between revisions
Content deleted Content added
. |
escape $ in the section names, that would break JS replace(), tweak comments a bit |
||
Line 12:
var sectionName = decodeURIComponent(
window.___location.hash.slice(1) //
.replace(/_/g, ' ')
);
//
// For some strange reason,
// exactly reversible. But this should work for the vast majority of cases.
var sectionNameDotDecoded = decodeURIComponent(sectionName.replace(/\.([0-9A-F]{2})/g, '%$1'));
Line 57:
$('#mw-content-text').before(
$('<div>')
.text(msg['starter-text'].replace('$1', sectionName.replace(/\$/g, '$$$$')) + msg['finding'])
.addClass('archived-section-prompt')
.css({
Line 97:
var results = json.query.search;
if (results.length === 0) {
divHtml = msg['no-search-results'].replace('$1', mw.html.escape(sectionName).replace(/\$/g, '$$$$'));
} else {
Line 127:
});
divHtml = msg['starter-text'].replace('$1', mw.html.escape(sectionNameFound || sectionName).replace(/\$/g, '$$$$'));
if (pageTitle) { // if a section with the same name was found
Line 141:
$('.archived-section-prompt').html(divHtml);
}).
console.error('[find-archived-section]: ', JSON.stringify(err));
});
|