MediaWiki:Common.js: Difference between revisions

No edit summary
No edit summary
Line 1,369: Line 1,369:
});
});
/*----------------------------8-6-2026---------------------------------------*/
/*----------------------------8-6-2026---------------------------------------*/
$(document).ready(function () {
$(function () {


     if (mw.config.get('skin') !== 'minerva') {
     if (mw.config.get('skin') !== 'minerva') {
Line 1,383: Line 1,383:
     var authorBlock = section.children('p').filter(function () {
     var authorBlock = section.children('p').filter(function () {


         return $(this).find('span[style*="float:right"]').length > 0;
         return $(this).find('span[style*="float:right"]').length;


     }).first();
     }).first();


    if (!authorBlock.length) {
     var poemBlock = section.children('.Poem2-Ekatra').first();
        return;
    }
 
    // Hide immediately
    authorBlock.addClass('author-temp-hide');
 
     var moveAuthor = function () {
 
        var poemBlock = section.children('.Poem2-Ekatra').first();
 
        if (poemBlock.length) {
 
            poemBlock.after(authorBlock);
 
            authorBlock.removeClass('author-temp-hide');


            console.log('Author block moved');
    if (authorBlock.length && poemBlock.length) {


            return true;
        poemBlock.after(authorBlock);
        }


         return false;
         console.log('Author block moved');
    };


    // Try immediately
    if (moveAuthor()) {
        return;
     }
     }
    // Retry for dynamically loaded content
    var tries = 0;
    var timer = setInterval(function () {
        tries++;
        if (moveAuthor() || tries > 20) {
            clearInterval(timer);
        }
    }, 200);


});
});