MediaWiki:Common.js: Difference between revisions
No edit summary |
No edit summary |
||
| Line 1,369: | Line 1,369: | ||
}); | }); | ||
/*----------------------------8-6-2026---------------------------------------*/ | /*----------------------------8-6-2026---------------------------------------*/ | ||
$(function () { | $(document).ready(function () { | ||
if (mw.config.get('skin') !== 'minerva') { | if (mw.config.get('skin') !== 'minerva') { | ||
| Line 1,382: | Line 1,382: | ||
var authorBlock = section.children('p').filter(function () { | var authorBlock = section.children('p').filter(function () { | ||
return $(this).find('span[style*="float:right"]').length; | |||
return $(this).find('span[style*="float:right"]').length > 0; | |||
}).first(); | }).first(); | ||
if (!authorBlock.length) { | |||
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'); | |||
return true; | |||
} | |||
return false; | |||
}; | |||
// 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); | |||
}); | }); | ||