Javascript ptr mai multe promoted links

In aceeasi pagina un script editor cu

http://code.jquery.com/jquery-1.10.2.min.js

$(document).ready(function () {
var currentRow = 1
$('.ms-promlink-root').each(function () {
if ($(this).html() != "") {
var numberOfLinksPerRow = 4;
// local variables
var pre = "

";
var numberOfLinksInCurrentRow = numberOfLinksPerRow;
// find the number of promoted links we're displaying
var numberOfPromotedLinks = $(this).find('.ms-promlink-body > .ms-tileview-tile-root').length;
// if we have more links then we want in a row, let's continue
if (numberOfPromotedLinks > numberOfLinksPerRow) {
// we don't need the header anymore, no cycling through links
$(this).find('.ms-promlink-header').empty();
// let's iterate through all the links after the maximum displayed link
for (i = numberOfLinksPerRow + 1; i tbody:last').append(pre + currentRow + post);
// reset the number of links for the current row
numberOfLinksInCurrentRow = 0
} // move the Nth (numberOfLinksPerRow + 1) div to the current table row
$(this).find('.ms-promlink-body > .ms-tileview-tile-root:nth-child(' + (numberOfLinksPerRow + 1) + ')').appendTo($('#promlink_row_' + currentRow));
// increment the number of links in the current row
numberOfLinksInCurrentRow++;
}
}
}
});
});

Anunțuri