MediaWiki:Common.js: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 90: Line 90:
});
});


$( function(){
$( function(){
Line 97: Line 98:
if( countPoem2.length > 0 ){
if( countPoem2.length > 0 ){
for (let j = 0; j < countPoem2.length; j++) {
for (let j = 0; j < countPoem2.length; j++) {
var poemElement = $(".Poem2-Ekatra").eq(j);
var poemElement = $(".Poem2-Ekatra").eq(j);
 
if( poemElement.length ){
if( poemElement.length ){
var poemText = poemElement.html();
var poemText = poemElement.html();


var poemArray = poemText.split("\n");
var poemArray = poemText.split("\n");
poemElement.text("");
// First measure
poemArray.forEach(appendIndent);
// Second measure
poemElement.children('p').each(appendCssIndent);
}
poemElement.text("");
}
}
// First measure
function appendIndent(i){
poemArray.forEach( function(i) {
poemElement.append( '<p style="text-indent: 2em;">' + i + '</p>' );
poemElement.append( '<p style="text-indent: 2em;">' + i + '</p>' );
});
// Second measure
poemElement.children('p').each(function () {
    $(this).css('text-indent', '2em');
});
}
}
}
function appendCssIndent(i){
$(this).css('text-indent', '2em');
}
}
});
});