MediaWiki:Common.js: Difference between revisions
No edit summary Tag: Reverted |
No edit summary Tag: Reverted |
||
| Line 6: | Line 6: | ||
// Get the current content of the search result | // Get the current content of the search result | ||
var content = $(this).html(); | var content = $(this).html(); | ||
console.log("Before: ", content); // Log the content before cleaning | |||
// Remove | // Remove multiple SEO tags, including multiline and inline with other HTML | ||
content = content.replace(/{{#seo:[\s\S]*?}}/g, ''); | content = content.replace(/{{#seo:.*?}}/g, ''); // Inline SEO tags | ||
content = content.replace(/{{#seo:[\s\S]*?}}/g, ''); // Multi-line SEO tags | |||
console.log("After: ", content); // Log the content after cleaning | |||
// Update the HTML of the search result with the cleaned content | // Update the HTML of the search result with the cleaned content | ||
Revision as of 03:51, 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 multiple SEO tags, including multiline and inline with other HTML
content = content.replace(/{{#seo:.*?}}/g, ''); // Inline SEO tags
content = content.replace(/{{#seo:[\s\S]*?}}/g, ''); // Multi-line SEO tags
console.log("After: ", content); // Log the content after cleaning
// Update the HTML of the search result with the cleaned content
$(this).html(content);
});
});