-1) {
var s = strcode.indexOf("", e);
scripts.push(strcode.substring(s_e+1, e));
strcode = strcode.substring(0, s) + strcode.substring(e_e+1);
}
for(var i=0; i
{
if (result.value) {
$.ajax({
type: 'post',
url: base_url + "api-handler/?api_id=gallery-comment",
data: {
CSRFtoken: CSRFtoken,
id_komentu: id_komentu
},
success: function () {
showKoment(predmet, id_predmet);
}
});
}
});
};
$(document).ready(function () {
showMainFoto(13, '15543798905ca5f4726744e','0');
showKoment("koment-foto",13);
$('#stripko').slick('slickGoTo',12,false);
});
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
$(document).ready(function() {
/* APROVED srdiecko fake double click on mobile ;) */
var touchtime = 0;
$(document).on("click", ".approved", function (e) {
var form = $(this).closest('form');
var srdiecko = $(form).find('span');
var typ_id = $(form).find("input[name='typ_id']");
var typ_id_val = $(typ_id).val();
var icon = $('#srdiecko_' + typ_id_val);
var icon_fa_prefix = icon.attr('data-prefix');
var like_count = $('#like_count_' + typ_id_val);
var count = +$(like_count).text();
if (touchtime == 0) {
touchtime = new Date().getTime(); // set first click
} else {
// compare first click to this click and see if they occurred within double click threshold
if (((new Date().getTime()) - touchtime) < 1000) {
// double click occurred
$(srdiecko).show( "bounce", {distance:20,times:4}, 1000);
$(srdiecko).hide("fade", {}, 500);
e.preventDefault();
$.ajax({
type: 'post',
url: base_url + "api-handler/?api_id=gallery-like",
data: $(form).serialize(),//token included in form
success: function () {
if (icon_fa_prefix === 'fa-solid') {
icon.removeClass('beat1').addClass('beat2');
}
else {
icon.attr('data-prefix', 'fa-solid');
like_count[0].innerHTML = count+1;
$(icon).css('color', 'var(--my-tomato)');
icon.removeClass('beat1').addClass('beat2');
}
}
});
touchtime = 0;
} else {
// not a double click so set as a new first click
touchtime = new Date().getTime();
}
}
});
$(this).keydown(function(e) {
//e.preventDefault();
if(e.keyCode == 37) { $(".slick-prev").click();return false;}
if(e.keyCode == 39) { $(".slick-next").click();return false; }
});
$(document).on("click", ".srdiecko", function (e) {
var form = $(this).closest('form');
var icon = $(this);
var icon_fa_prefix = icon.attr('data-prefix');
var like_count = $(form).find('div.like_count');
var count = +$(like_count).text();
if (icon_fa_prefix === 'fa-solid') {
icon.attr('data-prefix', 'fa-regular');
like_count[0].innerHTML = count-1;
$(this).css('color', 'dimgray');
icon.removeClass('beat2').addClass('beat1');
}
else {
icon.attr('data-prefix', 'fa-solid');
like_count[0].innerHTML = count+1;
$(this).css('color', 'var(--my-tomato)');
icon.removeClass('beat1').addClass('beat2');
}
e.preventDefault();
$.ajax({
type: "post",
url: base_url + "api-handler/?api_id=gallery-like",
data: $(form).serialize(),//token included in form
success: function (data) {
}
});
});
$(document).on("click", ".inspired", function (e) {
var form = $(this).closest('form');
var icon = $(this);
var icon_fa_prefix = icon.attr('data-prefix');
icon.addClass('beat1');
if (icon_fa_prefix === 'fa-solid') {
icon.attr('data-prefix', 'fa-regular');
$(this).css('color', 'dimgray');
}
else {
icon.attr('data-prefix', 'fa-solid');
$(this).css('color', 'var(--my-gold)');
}
e.preventDefault();
$.ajax({
type: "post",
url: base_url + "api-handler/?api_id=gallery-like",
data: $(form).serialize(),//token included in form
success: function (data) {
}
});
});
});
function JSalert_html(html){
Swal.fire({
title: 'Who likes this photo',
html: html,
showConfirmButton: true,
showCloseButton: true,
showCancelButton: false,
focusConfirm: true
})
};