MediaWiki:Common.js: Difference between revisions
No edit summary Tag: Reverted |
No edit summary Tag: Reverted |
||
| Line 8: | Line 8: | ||
console.log("Before: ", content); // Log the content before cleaning | console.log("Before: ", content); // Log the content before cleaning | ||
// Remove all occurrences of {{#seo: ... }} tags, | // Remove all occurrences of {{#seo: ... }} tags, capturing multiple lines and elements | ||
content = content.replace(/{{#seo:[\s\S]*?\|[^}]*}}/g, ''); | |||
console.log("After: ", content); // Log the content after cleaning | console.log("After: ", content); // Log the content after cleaning | ||
Revision as of 03:55, 23 October 2024
/* Any JavaScript here will be loaded for all users on every page load. */
$(document).ready(function() {
// Target all search result containers
$('.searchresult').each(function() {
// Get the current content of the search result
var content = $(this).html();
console.log("Before: ", content); // Log the content before cleaning
// Remove all occurrences of {{#seo: ... }} tags, capturing multiple lines and elements
content = content.replace(/{{#seo:[\s\S]*?\|[^}]*}}/g, '');
console.log("After: ", content); // Log the content after cleaning
// Update the HTML of the search result with the cleaned content
$(this).html(content);
});
});