MediaWiki:Common.js: Difference between revisions

No edit summary
No edit summary
 
(19 intermediate revisions by the same user not shown)
Line 1,375: Line 1,375:
     }
     }


     var observer = new MutationObserver(function () {
     var title = $('p').filter(function () {
        return $(this).text().trim() === 'કાવ્ય, ભજન';
    }).first();


        var section = $('.mf-section-0');
    var booksHeading = $('.wst-center.tiInherit').first();


        var authorBlock = section.children('p').filter(function () {
    if (title.length && booksHeading.length) {
            return $(this).find('span[style*="float:right"]').length;
        title.insertAfter(booksHeading);
        }).first();
    }


        var poemBlock = section.children('.Poem2-Ekatra').first();
});


        if (authorBlock.length) {
/*---------------------------22-06-2026---------------------------------------*/
            authorBlock.hide();
$(function () {
        }


        if (authorBlock.length && poemBlock.length) {
    $('.ekatra-right-author').each(function () {


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


             authorBlock.show();
             if (html === '' || html === '<br>' || html === '<br/>' || html === '<br />') {
                $(this).remove();
            } else {
                return false;
            }
        });


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


            console.log('Author block moved');
        if (p.length && p.find('br').length) {
            p.remove();
         }
         }


    });
    observer.observe(document.body, {
        childList: true,
        subtree: true
     });
     });


});
});