MediaWiki:Common.js: Difference between revisions

No edit summary
No edit summary
 
(36 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,369: Line 1,370:
});
});
/*----------------------------8-6-2026---------------------------------------*/
/*----------------------------8-6-2026---------------------------------------*/
$(document).ready(function () {
$(function () {


     if (mw.config.get('skin') !== 'minerva') {
     if (mw.config.get('skin') !== 'minerva') {
Line 1,375: Line 1,376:
     }
     }


     var section = $('.mf-section-0');
     var title = $('p').filter(function () {
        return $(this).text().trim() === 'કાવ્ય, ભજન';
    }).first();
 
    var booksHeading = $('.wst-center.tiInherit').first();


     if (!section.length) {
     if (title.length && booksHeading.length) {
         return;
         title.insertAfter(booksHeading);
     }
     }


    var authorBlock = section.children('p').filter(function () {
});


        return $(this).find('span[style*="float:right"]').length > 0;
/*---------------------------22-06-2026---------------------------------------*/
$(function () {


     }).first();
     $('.ekatra-right-author').each(function () {


    if (!authorBlock.length) {
        // Remove blank <p> inside Poem2 after author
        return;
        $(this).nextAll('p').each(function () {
    }
            var html = $.trim($(this).html());


    // Hide immediately
            if (html === '' || html === '<br>' || html === '<br/>' || html === '<br />') {
    authorBlock.addClass('author-temp-hide');
                $(this).remove();
            } else {
                return false;
            }
        });


    var moveAuthor = function () {
        // Remove blank <p><br></p> after Poem2 block
        var p = $(this).closest('.Poem2-Ekatra').next('p');


         var poemBlock = section.children('.Poem2-Ekatra').first();
         if (p.length && p.find('br').length) {
            p.remove();
        }


        if (poemBlock.length) {
    });


            poemBlock.after(authorBlock);
});
 
/*-----------------------------------------01-07-2026-------------------------------------------*/
            authorBlock.removeClass('author-temp-hide');
/* Keep WikiEditor toolbar sticky below the Ekatra toolbar */
$(function () {


            console.log('Author block moved');
    function stickyToolbar() {
        var $toolbar = $('.wikiEditor-ui-top');


             return true;
        if (!$toolbar.length) {
             return;
         }
         }


         return false;
         $toolbar.css({
    };
            position: 'sticky',
            top: $('#editpage-specialchars').outerHeight() + 'px',
            zIndex: 999,
            background: '#fff'
        });


    // Try immediately
        clearInterval(timer);
    if (moveAuthor()) {
        return;
     }
     }


     // Retry for dynamically loaded content
     var timer = setInterval(stickyToolbar, 100);
     var tries = 0;
 
    $(window).on('resize', stickyToolbar);
 
});
 
/*----------------------------------08-07-2026----------------------------------*/
/* Remove blank <p><br></p> after Author template without removing TemplateStyles */
$(function () {
 
     $('.ekatra-author').next('p').each(function () {
 
        var $p = $(this);


    var timer = setInterval(function () {
        // Move TemplateStyles outside the paragraph
        $p.children('style[data-mw-deduplicate]').each(function () {
            $(this).insertBefore($p);
        });


         tries++;
         // Remove only <br>
        $p.children('br').remove();


         if (moveAuthor() || tries > 20) {
         // Remove the paragraph only if it is now empty
             clearInterval(timer);
        if (
            $.trim($p.text()) === '' &&
            $p.children().length === 0
        ) {
             $p.remove();
         }
         }


     }, 200);
     });


});
});