MediaWiki:Common.js: Difference between revisions

No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1,186: Line 1,186:


});
});
/*-----------------------------------------28-05-2026--------------------------------/
/*-----------------------------------------28-05-2026--------------------------------*/


/*--------------------------------------swati---------------------------------------*/
/*--------------------------------------swati---------------------------------------*/
/* hide sub suggestion in global searchbox */
/* hide sub suggestion in global searchbox */
$(function () {
/*$(function () {


     function removeSubpageResults() {
     function removeSubpageResults() {
Line 1,232: Line 1,232:


});
});
 
*/
/* hide sub suggestion in search page */
/* hide sub suggestion in search page */
$(document).ready(function () {
/*$(document).ready(function () {


     // Inject CSS instantly
     // Inject CSS instantly
Line 1,277: Line 1,277:


});
});
 
*/
$(document).ready(function () {
/*$(document).ready(function () {


     // Override broken REST API search
     // Override broken REST API search
Line 1,310: Line 1,310:


});
});
 
*/
/*
$(function () {
$(function () {


Line 1,339: Line 1,340:


});
});
 
*/
/*--------------------------------------chirag---------------------------------------*/
/*--------------------------------------chirag---------------------------------------*/
$(function () {
$(function () {
Line 1,441: Line 1,442:


/*----------------------------------08-07-2026----------------------------------*/
/*----------------------------------08-07-2026----------------------------------*/
/* Remove blank <p><br></p> after Author template */
/* Remove blank <p><br></p> after Author template without removing TemplateStyles */
$(function () {
$(function () {


Line 1,448: Line 1,449:
         var $p = $(this);
         var $p = $(this);


         // Remove <br> first
        // Move TemplateStyles outside the paragraph
         $p.find('br').remove();
        $p.children('style[data-mw-deduplicate]').each(function () {
            $(this).insertBefore($p);
        });
 
         // Remove only <br>
         $p.children('br').remove();


         // If only <style> (or nothing) remains, remove the paragraph
         // Remove the paragraph only if it is now empty
         if (
         if (
             $p.children().length === 0 ||
             $.trim($p.text()) === '' &&
            (
            $p.children().length === 0
                $p.children().length === 1 &&
                $p.children('style[data-mw-deduplicate]').length === 1
            )
         ) {
         ) {
             $p.remove();
             $p.remove();