Rašyti komentarą...
Nuoroda nukopijuota
× Pranešti klaidą
Kam reikia anksčiau laiko laidoti karaliene?
LT neaktuali tema.
Įdomu, kaip ruašiuasi, Lietuvos"elitas"patriacho laidotuvėms, metus bus gedulas turbūt, vietoi Cvirkos paminklo, stovės, diedules aukso raidėm iškaltas paminklas turbūt, gal bus paskelbta ne darbo diena?
Įdomu, kaip ruašiuasi, Lietuvos"elitas"patriacho laidotuvėms, metus bus gedulas turbūt, vietoi Cvirkos paminklo, stovės, diedules aukso raidėm iškaltas paminklas turbūt, gal bus paskelbta ne darbo diena?
REKLAMA
REKLAMA
<\/div>\r\n<\/div>';
var desktopAdsId = $(desktopAds).find('div').attr('id');
var mobileAds = '
REKLAMA\r\n
\r\n
<\/div>\r\n<\/div>\r\n<\/div>';
var mobileAdsId = $(mobileAds).find('.adContainer').find('div').attr('id');
var adIndex = 0;
var pageCount = 1;
$(window).scroll(function () {
$('.commentsList .mobileCommentItem.first').each(function (index) {
var elementTop = $(this).offset().top;
var elementBottom = elementTop + $(this).outerHeight();
var viewportTop = $(window).scrollTop();
var viewportBottom = viewportTop + $(window).height();
if(elementBottom > viewportTop && elementTop < viewportBottom){
var page = index;
if(lastScrollTop < $(window).scrollTop()){
page += 1;
}
if(page == 0){
page = 1;
}
var url = new URL(window.location.href);
var currentPage = url.searchParams.get('komentarai');
if(page != currentPage) {
window.dataLayer.push({
'event': 'infinity_comments_pageview'
});
url.searchParams.set('komentarai', page.toString());
window.history.pushState({}, '', url.toString());
//hitGemius(top.location.href, '');
}
}
});
lastScrollTop = $(window).scrollTop();
if(ajaxLoad) {
return false;
}
if ($(window).scrollTop() + $(window).height() >= $(document).height() - 1000) {
ajaxLoad = true;
commentsOffset = commentsPage * commentsLimit;
commentsPage++;
var order = $('.sortingMenu .bubbleButton.active')[0].id || 0;
$.when($.ajax({
type: "POST",
url: "/UComments/loadMoreComments/",
data: {
offset: commentsOffset,
limit: commentsLimit,
order: order,
objectId: 1766413583
},
success: function(data) {
if(data){
var comments = JSON.parse(data);
comments.forEach(function (element) {
initInfinityComments(element);
});
var newDesktopAd = $(desktopAds).clone();
newDesktopAd.find('div').attr('id', newDesktopAd.find('div').attr('id') + '_id_' + pageCount);
newDesktopAd.find('div').addClass('id');
$('#comments-comments').append(newDesktopAd);
var newMobileAd = $(mobileAds).clone();
newMobileAd.find('.adContainer > div').attr('id', newMobileAd.find('.adContainer > div').attr('id') + '_id_' + pageCount);
newMobileAd.find('.adContainer > div').addClass('id');
$('#comments-comments').append(newMobileAd);
pageCount += 1;
commentsBlockHeight = $('#comments-comments').outerHeight();
var heightDiff = commentsBlockHeight - oldCommentsBlockHeight;
oldCommentsBlockHeight = commentsBlockHeight;
var isOddPage = (pageCount % 2 === 1);
if(isOddPage) {
var oneAdHeight = Math.max(heightDiff / firstPartAdsCount, 600);
var minIndex = 0;
var maxIndex = firstPartAdsCount;
}
else {
var oneAdHeight = Math.max(heightDiff / secondPartAdsCount, 600);
var minIndex = firstPartAdsCount;
var maxIndex = firstPartAdsCount + secondPartAdsCount;
}
var adsIndex = 0;
if(pageCount === 2) {
$('#adsPart .right-ad:not(.init)').each(function() {
$(this).height(oneAdHeight);
$(this).addClass('init');
$(this).show();
});
}
else {
$(originalAds).each(function() {
if(adsIndex >= minIndex && adsIndex < maxIndex) {
var newAd = $(this).clone();
newAd.attr('id', newAd.attr('id') + '-' + adIndex);
newAd.height(oneAdHeight);
newAd.addClass('init');
newAd.find('.custom-stick-div').css('min-height', 'unset');
newAd.find('.custom-stick-div > div').attr('id', newAd.find('.custom-stick-div > div').attr('id') + '_id_' + adIndex);
newAd.find('.custom-stick-div > div').addClass('id');
$('#adsPart').append(newAd);
}
adsIndex += 1;
});
}
if(!isOddPage) {
adIndex += 1;
}
}
ajaxLoad = false;
}
}).done(function() {
window.dataLayer.push({
'event': 'ajaxNextNewsLoaded'
});
}));
}
});
function initInfinityComments(newComment, replyType = 'replyes', replyToName = '') {
var colorsList = ['#ff0000', '#53a527', '#006cff', '#ca4318'];
var colorChoice = colorsList[Math.floor(Math.random() * 4)];
var commentTemplate = $('.mobileCommentItem:first').clone(true);
if(replyType.startsWith('deepDeep')){
commentTemplate.addClass('mobileCommentDeepReply');
commentTemplate.removeClass('mobileCommentReply');
}
else if(replyType.startsWith('deep')){
commentTemplate.removeClass('mobileCommentDeepReply');
commentTemplate.addClass('mobileCommentReply');
}
else {
commentTemplate.removeClass('mobileCommentDeepReply');
commentTemplate.removeClass('mobileCommentReply');
}
if($('.commentsList .mobileCommentItem.first').length >= commentsPage){
commentTemplate.removeClass('first');
}
commentTemplate.find('.commentHeader').find('.usernameBubble').css('background', colorChoice);
commentTemplate[0].id = 'comment-item-id-' + newComment['id'];
commentTemplate.find('.commentHeader').find('.username')[0].innerText = newComment['username'];
commentTemplate.find('.commentHeader').find('.firstLetter')[0].innerText = newComment['username'];
commentTemplate.find('.dateAndReport').find('.date')[0].innerText = new Date(newComment['created'] * 1000).toLocaleString('lt');
if(commentTemplate.find('.dateAndReport').find('.reported-msg').length > 0){
commentTemplate.find('.dateAndReport').find('.reported-msg').remove();
var reportButton = $("");
commentTemplate.find('.dateAndReport').append(reportButton);
}
else {
commentTemplate.find('.dateAndReport').find('.reportButton').attr('onclick', 'UComments.report_v2(this, ' + newComment['id'] + ');');
}
if(replyToName === ''){
commentTemplate.find('.commentSection')[0].innerText = newComment['comment'];
}
else {
commentTemplate.find('.commentSection')[0].innerHTML = '@' + replyToName + ' ' + newComment['comment'].replace('@'+replyToName, '');
}
commentTemplate.find('.commentFooter').find('.replyText').attr('onclick', 'UComments.showMobileReplyForm(' + newComment['id'] + ');');
commentTemplate.find('.commentFooter').find('.reactions').attr('rel', newComment['emojisRating']);
commentTemplate.find('.commentFooter').find('.reaction').attr('onclick', 'UComments.showReactionChoices(' + newComment['id'] + ');');
commentTemplate.find('.commentFooter').find('.bestReactions').attr('onclick', 'UComments.showAllReactions(' + newComment['id'] + ');');
commentTemplate.find('.commentFooter').find('#fullReactionsList').attr('onclick', 'UComments.hideAllReactions(' + newComment['id'] + ');')
commentTemplate.find('.commentFooter').find('#reactionChoices').attr('onclick', 'UComments.hideReactionChoices(' + newComment['id'] + ');')
var reactionsCount = 0;
var bestReactions = [];
var reactions = [
{
index: 'reactionButtonLike',
value: newComment['likes']
},
{
index: 'reactionButtonLove',
value: newComment['loves']
},
{
index: 'reactionButtonCare',
value: newComment['cares']
},
{
index: 'reactionButtonLaugh',
value: newComment['laughs']
},
{
index: 'reactionButtonSurprise',
value: newComment['surprises']
},
{
index: 'reactionButtonSad',
value: newComment['sads']
},
{
index: 'reactionButtonAngry',
value: newComment['angries']
}
];
reactions.sort(function(a, b){
return b.value - a.value
});
var i = 0;
reactions.forEach(function (element) {
reactionsCount += parseInt(element.value);
if(element.value > 0){
if(i < 3){
var reaction = document.createElement('div');
reaction.className = element.index;
reaction.style.zIndex = (10-i).toString();
i++;
bestReactions.push(reaction);
}
}
});
var reactionsNumber = document.createElement('div');
reactionsNumber.className = 'reactionsNumber';
reactionsNumber.innerText = reactionsCount;
bestReactions.push(reactionsNumber);
if(reactionsCount == 0) {
if (commentTemplate.find('.commentFooter').find('.reaction').find('.reactionText').length == 0) {
var reactionText = document.createElement('a');
reactionText.className = 'reactionText';
reactionText.innerText = 'Reaguoti';
commentTemplate.find('.commentFooter').find('.reaction')[0].insertBefore(reactionText, commentTemplate.find('.commentFooter').find('.reaction').find('.reactionButton')[0]);
}
if(commentTemplate.find('.commentFooter').find('.reactions').find('.bestReactions').length > 0){
commentTemplate.find('.commentFooter').find('.reactions').find('.bestReactions').find('div:not(.reactionsNumber)').remove();
commentTemplate.find('.commentFooter').find('.reactions').find('.bestReactions').find('.reactionsNumber')[0].innerText = '0';
commentTemplate.find('.commentFooter').find('.reactions').find('.bestReactions').css('display', 'none');
commentTemplate.find('.commentFooter').find('#fullReactionsList').find('.reactionsList').empty();
}
}
else {
if(commentTemplate.find('.commentFooter').find('.reaction').find('.reactionText').length > 0){
commentTemplate.find('.commentFooter').find('.reaction').find('.reactionText').remove();
}
commentTemplate.find('.commentFooter').find('.reactions').find('.bestReactions').css('display', 'flex');
commentTemplate.find('.commentFooter').find('.reactions').find('.bestReactions').empty();
bestReactions.forEach(function(element) {
commentTemplate.find('.commentFooter').find('.reactions').find('.bestReactions').append(element);
});
commentTemplate.find('.commentFooter').find('#fullReactionsList').find('.reactionsList').empty();
while(reactions.length > 5){
reactions.pop();
}
reactions.forEach(function(element) {
if(element.value == 0){
return false;
} else {
var reaction = document.createElement('div');
var reactionsNumber = document.createElement('div');
reaction.className = element.index;
reactionsNumber.className = 'reactionsNumber';
reactionsNumber.innerText = element.value;
commentTemplate.find('.commentFooter').find('#fullReactionsList').find('.reactionsList').append(reaction);
commentTemplate.find('.commentFooter').find('#fullReactionsList').find('.reactionsList').append(reactionsNumber);
}
});
}
$('.commentsList').append(commentTemplate[0]);
var commentSection = $('#comment-item-id-' + newComment['id'] + ' .commentSection')[0];
if($('#comment-item-id-' + newComment['id'] + ' .commentSection').length > 1){
commentSection = $('#comment-item-id-' + newComment['id'] + ' .commentSection')[1];
}
if(commentSection.clientHeight > 54){
commentSection.style.lineHeight = '22px';
}
else{
commentSection.style.lineHeight = '';
}
if(typeof(newComment[replyType]) !== 'undefined'){
var newReplyType = replyType;
if(newReplyType.startsWith('deep')){
newReplyType = newReplyType.replace('deep', 'deepDeep');
}
else if(newReplyType === 'replyes') {
newReplyType = 'deepReplies';
}
replyToName = newComment.username;
newComment[replyType].forEach(function (element) {
initInfinityComments(element, newReplyType, replyToName);
});
}
}
-->
Skaitomiausios naujienos
Į viršų
Anglija jau ruošiasi: aiškėja, kaip viskas vyks mirus karalienei Elžbietai II