function addTime(url) {
var now = new Date();
var time = now.getHours()+''+now.getMinutes()+''+now.getSeconds();
if (url.indexOf('?') > -1 && url.indexOf('cachetimer') <= -1)
url = url + '&cachetimer='+time;
else if(url.indexOf('cachetimer') <= -1)
url = url + '?cachetimer='+time;
return url;
}
function setCookie(key, value, expiry) {
var expires = new Date();
expires.setTime(expires.getTime() + (expiry * 24 * 60 * 60 * 1000));
document.cookie = key + '=' + value + ';expires=' + expires.toUTCString();
}
function getCookie(key) {
var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
return keyValue ? keyValue[2] : null;
}
function eraseCookie(key) {
var keyValue = getCookie(key);
setCookie(key, keyValue, '-1');
}
function expandMenu(element = null, name = null) {
if ($('.topbar .menu').is(':visible')) {
$('.topbar .menu').slideUp(300);
// if (element == null) {
$('.topbar .menuButton').removeClass('active');
// } else {
// $(element).removeClass('active');
// }
if (topBarActiveElement != name && name != null) {
setTimeout(()=>{
expandMenu(element, name);
}, 0);
}
} else if (element != null) {
$('.menuLinkBox').css('display', 'none');
$('.menuLinkBox.' + name).css('display', 'table');
$('.topbar .menu').slideDown(300);
$(element).addClass('active');
topBarActiveElement = name;
resizeMenu();
}
}
function isNumberKey(evt){
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
}
return true;
}
function isNumberDotKey(element, evt){
var charCode = (evt.which) ? evt.which : evt.keyCode;
if ($(element).val().indexOf('.') > -1 && (charCode == 46 || charCode == 44)) {
return false;
}
if (charCode == 46 || charCode == 44) {
return true;
}
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
}
return true;
}
function expandSmallMenu(element = null) {
if (element == null) {
$(".smallMenu:visible").each(function( index ) {
$(this).siblings('.select').click();
});
} else {
if ($(element).siblings('.smallMenu').is(':visible')) {
$(element).siblings('.smallMenu').slideUp(300);
} else {
$(element).siblings('.smallMenu').slideDown(300);
}
}
}
function checkCityList(onFocus = false) {
$(".cityList > div").each(function( index ) {
if ($(this).hasClass('emptyValue')) {
return;
}
if ($(this).html().toLowerCase().indexOf($('.exchangeMapBox .input input').val().toLowerCase()) > -1) {
$(this).fadeIn(0);
} else {
$(this).fadeOut(0);
}
});
if (onFocus == false) {
if ($(".cityList > div:not(.emptyValue):visible").length == 0) {
$(".cityList > div.emptyValue").fadeIn(0);
} else if ($(".cityList > div.emptyValue").is(':visible')) {
$(".cityList > div.emptyValue").fadeOut(0);
}
}
}
function setCheckbox(element) {
var isChecked = $(element).find('div').first().hasClass('active');
if (isChecked) {
$(element).find('div').first().removeClass('active');
} else {
$(element).find('div').first().addClass('active');
}
}
function changeRegisterProfile(type, element) {
if ($(element).hasClass('active')) {
return;
} else {
if (type == 'individual') {
$('.companyProfileHeader').removeClass('active');
$('.individualProfileHeader').addClass('active');
$('.companyProfileBox').fadeOut(300, function(){
$('.individualProfileBox').fadeIn(300);
});
} else {
$('.individualProfileHeader').removeClass('active');
$('.companyProfileHeader').addClass('active');
$('.individualProfileBox').fadeOut(300, function(){
$('.companyProfileBox').fadeIn(300);
});
}
}
}
function changeLoginForm(type) {
if (type == 'rememberPassword') {
$('.loginFormBox').fadeOut(300, function(){
$('.rememberPasswordFormBox').fadeIn(300);
});
} else {
$('.rememberPasswordFormBox').fadeOut(300, function(){
$('.loginFormBox').fadeIn(300);
});
}
}
function collapseJobOffer(element, event = null) {
if (event != null && event.target != null && $(event.target).hasClass('goldButton')) {
return;
}
var height = $(element).attr('data-height');
if (!$(element).hasClass('active')) {
$(element).addClass('active');
height = $(element).find('.jobOfferCollapse > div:first-of-type').height()
} else {
$(element).removeClass('active');
}
$(element).find('.jobOfferCollapse').animate({height: height + 'px'}, 300);
}
function resizeExchangeInput() {
if ($(window).width() > 900) {
$('.exchangeMapBox .input input').width($('.exchangeMapBox .infoBox #map').width() - ($('.exchangeMapBox .input .goldButton').outerWidth() * 2) - 104 + 'px');
} else if ($(window).width() > 550) {
$('.exchangeMapBox .input input').width($('.exchangeMapBox .infoBox #map').width() - $('.exchangeMapBox .input .goldButton').outerWidth() - 84 + 'px');
} else {
$('.exchangeMapBox .input input').width($(window).width() - 100 + 'px');
}
$('.exchangeMapBox .input .arrow').css('right', $('.exchangeMapBox .input .goldButton').outerWidth() + 40 + 'px');
$('.exchangeMapBox .cityList').width($('.exchangeMapBox .input input').outerWidth() - 4 + 'px');
}
function resizeNewsletterInput() {
if ($(window).width() > 550) {
$('.footer .knewsletter > tbody > tr > td:last-of-type .input').removeAttr('style');
$('.footer .knewsletter > tbody > tr > td:last-of-type .input input').width($('.footer .knewsletter > tbody > tr > td:last-of-type .input').width() - $('.footer .knewsletter > tbody > tr > td:last-of-type .input .goldButton').outerWidth() - 56 + 'px');
} else {
$('.footer .knewsletter > tbody > tr > td:last-of-type .input').width($(window).width() - 60 + 'px');
$('.footer .knewsletter > tbody > tr > td:last-of-type .input input').width($('.footer .knewsletter > tbody > tr > td:last-of-type .input').width() - $('.footer .knewsletter > tbody > tr > td:last-of-type .input .goldButton').outerWidth() - 56 + 'px');
}
}
function resizeMainGoldButton() {
var width = 0;
$('.mainSubBox .goldButton').each(function( index ) {
if ($(this).width() > width) {
width = $(this).width();
}
});
$('.mainSubBox .goldButton').width(width + 'px');
}
function resizeBox() {
if ($(window).width() < 550) {
$('.box, .partnersBox .slider, .writeAboutBox .slider, .newsBox .slider, .currentRatesBox .slider, .footer .knewsletter, .footer .footerLinks, .menu .menuLinks, .footer .horizontalLine, .footer .copyrightInfo').width($(window).width() - 40 + 'px');
} else if ($(window).width() < 1024) {
$('.box, .partnersBox .slider, .writeAboutBox .slider, .newsBox .slider, .currentRatesBox .slider, .footer .knewsletter, .footer .footerLinks, .menu .menuLinks, .footer .horizontalLine, .footer .copyrightInfo').width($(window).width() - 80 + 'px');
} else {
$('.box, .partnersBox .slider, .writeAboutBox .slider, .newsBox .slider, .currentRatesBox .slider, .footer .knewsletter, .footer .footerLinks, .menu .menuLinks, .footer .horizontalLine, .footer .copyrightInfo').removeAttr('style');
}
}
function resizeNewsType(){
$('.newsTable1').each(function() {
var newsTypeHeight = 0;
$(this).find('.newsType .body').height('auto');
$(this).find('.newsType').each(function() {
if ($(this).find('.body').height() > newsTypeHeight) {
newsTypeHeight = $(this).find('.body').height();
}
});
$(this).find('.newsType .body').height(newsTypeHeight + 'px');
});
$('.newsType2').each(function( index ) {
$(this).css('width', $('.newsListBox').width());
$(this).find('.image').css('height', $(this).find('.body').outerHeight());
$(this).find('.image').css('width', $('.newsType1:first').width());
$(this).find('.body').css('width', $(this).width() - $(this).find('.image').width() - (parseInt($(this).find('.body').css('padding-left')) * 2) - 2);
});
}
function resizeJobOfferCollapse(){
$('.careerBox .jobOffer:not(.active)').each(function( index ) {
var height = $(this).find('.jobOfferBasicInfo').height();
$(this).attr('data-height', height)
$(this).find('.jobOfferCollapse').height(height);
});
}
function resizeContact(){
$('.contactBox .useContactBox > div:last-of-type .image').height($('.contactBox .contactFormBox').outerHeight());
}
function resizeMenu(){
// setTimeout(()=>{
// $('.menu .menuLinkBox').width($('.topbar > div:first-of-type').width());
// $('.menu .menuLinkBox').each(function( index ) {
// var titleBox = $(this).find('.title').find('span').textWidth();
// var menuTableWidth = 0;
// $(this).find('.menuTable').each(function( index ) {
// var linkWidth = 0;
// $(this).find('.link a').each(function( index ) {
// if ($(this).textWidth() > linkWidth) {
// linkWidth = $(this).textWidth();
// }
// });
// menuTableWidth += linkWidth;
// });
// var menuTableLength = $(this).find('.menuTable').length;
// var width = ($(this).width() - (menuTableWidth + titleBox)) / (menuTableLength + 1);
// $(this).find('.title').width((width + titleBox - 100) + 'px');
// $(this).find('.menuTable').css('margin-left', width - 100 + 'px');
// });
// }, 0);
setTimeout(()=>{
$('.menu .menuLinkBox:visible').each(function( index ) {
var menuTableHeight = 0;
$(this).find('.menuTable').each(function( index ) {
if ($(this).height() > menuTableHeight) {
menuTableHeight = $(this).height();
}
});
if (menuTableHeight > 0) {
$(this).find('.title').first().height(menuTableHeight - 15 + 'px');
}
});
}, 0);
}
$.fn.textWidth = function(text){
var org = $(this)
var html = $('<span style="postion:absolute;width:auto;left:-9999px">' + (text || org.html()) + '</span>');
if (!text) {
html.css("font-family", org.css("font-family"));
html.css("font-size", org.css("font-size"));
}
$('body').append(html);
var width = html.width();
html.remove();
return width;
}
function toggleMobileMenu() {
if ($('.mobileMenu').is(':visible')) {
$('.mobileMenu').slideUp(300);
} else {
$('.mobileMenu').slideDown(300);
}
}
function toggleLanguageMenu(element, hide = false) {
if ($('.topbar .languageButtonList').is(':visible') || hide == true) {
$('.topbar .languageButtonList').slideUp(300);
$(element).removeClass('active');
} else {
$('.topbar .languageButtonList').slideDown(300);
$(element).addClass('active');
}
}
function toggleMobileSubMenu(name = null) {
if (name == null) {
$('.mobileSubMenu').fadeOut(300);
} else {
$('.mobileSubMenu.' + name).fadeIn(300);
}
}
function showDocuments(id, element) {
$('.documentsBox .document').fadeOut(300);
$('.documentHeader > div').removeClass('active');
$(element).addClass('active');
setTimeout(()=>{
$('.documentsBox .document.documentType' + id).fadeIn(300);
}, 300);
}
function generateSlider1() {
$('.slider1').slick({
arrows: false,
dots: false,
speed: 500,
slidesToShow: 4,
slidesToScroll: 1,
autoplaySpeed: 4000,
infinite: false,
autoplay: true,
responsive: [
{
breakpoint: 1400,
settings: {
slidesToShow: 3,
slidesToScroll: 1
}
},
{
breakpoint: 1024,
settings: {
slidesToShow: 2,
slidesToScroll: 1
}
},
{
breakpoint: 550,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
]
});
}
function isEmail(email) {
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
return regex.test(email);
}
function savePresale(element){
if ($(element).hasClass('disabledButton')) {
return;
}
var email = $(element).siblings('input[type="email"]').val();
if (email == null || email == '') {
notifyPresale(emailEmpty, 'error');
return;
} else if (!isEmail(email)) {
notifyPresale(emailNotValid, 'error');
return;
}
$(element).addClass('disabledButton loaderButton');
$.ajax({
url: addTime('/actionPresale/' + email),
type: 'GET',
success: function (res)
{
$(element).removeClass('disabledButton loaderButton');
if (res['result'] == 'success') {
notifyPresale(res['message'], 'success');
$(element).siblings('input[type="email"]').val('');
} else {
notifyPresale(res['message'], 'error');
}
},
error: function () {
$(element).removeClass('disabledButton loaderButton');
notifyPresale('Błąd serwera', 'error');
}
});
}
function notifyPresale(msg, type) {
if (msg == null || msg == '' || $('.presale .message').is(':visible')) {
return;
}
if (type == 'error') {
$('.presale .message').removeClass('successMessage').addClass('errorMessage');
$('.presale .message td:first-of-type').html('<i class="far fa-exclamation-circle"></i>');
} else {
$('.presale .message').removeClass('errorMessage').addClass('successMessage');
$('.presale .message td:first-of-type').html('<i class="far fa-check-circle"></i>');
}
$('.presale .message td:last-of-type').html(msg);
$('.presale .message').fadeIn(300);
setTimeout(()=>{
$('.presale .message').fadeOut(300);
}, 4000);
}
function saveNewsletter(element) {
if ($(element).hasClass('disabledButton')) {
return;
}
var email = $(element).siblings('input[type="email"]').val();
if (email == null || email == '') {
notifyNewsletter(emailEmpty, 'error');
return;
} else if (!isEmail(email)) {
notifyNewsletter(emailNotValid, 'error');
return;
}
$(element).addClass('disabledButton loaderButton');
$.ajax({
url: addTime('/actionNewsletter/' + email),
type: 'GET',
success: function (res)
{
$(element).removeClass('disabledButton loaderButton');
if (res['result'] == 'success') {
notifyNewsletter(res['message'], 'success');
$(element).siblings('input[type="email"]').val('');
} else {
notifyNewsletter(res['message'], 'error');
}
},
error: function () {
$(element).removeClass('disabledButton loaderButton');
notifyNewsletter('Błąd serwera', 'error');
}
});
}
function notifyNewsletter(msg, type) {
if (msg == null || msg == '' || $('.knewsletter .message').is(':visible')) {
return;
}
if (type == 'error') {
$('.knewsletter .message').removeClass('successMessage').addClass('errorMessage');
$('.knewsletter .message td:first-of-type').html('<i class="far fa-exclamation-circle"></i>');
} else {
$('.knewsletter .message').removeClass('errorMessage').addClass('successMessage');
$('.knewsletter .message td:first-of-type').html('<i class="far fa-check-circle"></i>');
}
$('.knewsletter .message td:last-of-type').html(msg);
$('.knewsletter .message').fadeIn(300);
setTimeout(()=>{
$('.knewsletter .message').fadeOut(300);
}, 4000);
}
function generateExchangeMap(){
$.ajax({
url: exchangeKangaUrl,
type: 'GET',
success: function (res)
{
mapLocations = res;
mapboxgl.accessToken = 'pk.eyJ1IjoicHppZWxpbnNraSIsImEiOiJjbDE2dWRqeWsxYnFiM2NzNm8waHluZjdxIn0.wrH3NT4jYhKmKHF0I01yMA';
map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/pzielinski/cl16uhh2i000214pha4r6u4lv',
center: [20.004868, 52.05],
zoom: 5
});
generateMarkers(null, true);
$(".cityList > div").click(function() {
$('.exchangeMapBox .input input[type="text"]').val($(this).html());
generateMarkers($(this).html());
});
}
});
}
function generateMarkers(city = null, firstLoad = false) {
var cantorList = new Array();
var cityList = new Array();
var uniqueCityList = new Array();
for (var i = 0; i < mapLocations.length; i++) {
cityList.push(mapLocations[i]['city']);
if ((city != null && mapLocations[i]['city'] != null && mapLocations[i]['city'].toLowerCase().indexOf(city.toLowerCase()) > -1) || city == null || city == '') {
for (var j = 0; j < mapLocations[i]['locations'].length; j++) {
if (mapLocations[i]['locations'][j]['long'] != null && mapLocations[i]['locations'][j]['lat'] != null) {
var long = mapLocations[i]['locations'][j]['long'];
var lat = mapLocations[i]['locations'][j]['lat'];
var open = new Array();
for (var k = 0; k < mapLocations[i]['locations'][j]['open'].length; k++) {
if (mapLocations[i]['locations'][j]['open'][k]['days']['pl'] != null && mapLocations[i]['locations'][j]['open'][k]['hours'] != null) {
open.push(mapLocations[i]['locations'][j]['open'][k]['days']['pl'] + ' ' + mapLocations[i]['locations'][j]['open'][k]['hours']);
}
}
var bonInfo = "<div class='mapBonInfo'><b>"+kantorInfo+"</b><br><a class='goldButton' href='/bon-kantorowy'>"+kantorInfoButton+"</a></div>";
var description = (mapLocations[i]['locations'][j]['street'] != null && mapLocations[i]['locations'][j]['street'] != '' ? 'ul. ' + mapLocations[i]['locations'][j]['street'] : '') + (mapLocations[i]['locations'][j]['postalCode'] != null && mapLocations[i]['locations'][j]['postalCode'] != '' ? ((mapLocations[i]['locations'][j]['street'] != null && mapLocations[i]['locations'][j]['street'] != '' ? '<br>' : '') + mapLocations[i]['locations'][j]['postalCode']) : '');
cantorList.push({
type: 'CurrencyExchange',
geometry: {
type: 'Point',
coordinates: [long.replace(',', ''), lat.replace(',', '')]
},
properties: {
city: mapLocations[i]['city'],
title: mapLocations[i]['locations'][j]['name'] + (mapLocations[i]['locations'][j]['group']['name'] != null && mapLocations[i]['locations'][j]['group']['name'] != '' ? '<br><i style="font-weight: normal">' + (mapLocations[i]['locations'][j]['group']['name'] == 'kanga local' ? '(Kanga Local)</i>' : '(Kantor)</i>') : ''),
description: description + (description == null || description == '' ? '' : '<br>') + bonInfo
}
});
}
}
}
}
const geojson = {
type: 'CurrencyExchangeCollection',
currencyExchanges: cantorList
};
mapMarkers.forEach((marker) => marker.remove());
mapMarkers = new Array();
for (const currencyExchange of geojson.currencyExchanges) {
const el = document.createElement('div');
el.className = 'marker';
var marker = new mapboxgl.Marker(el)
.setLngLat(currencyExchange.geometry.coordinates)
.setPopup(
new mapboxgl.Popup({offset: 25}) // add popups
.setHTML(
`<h3>${currencyExchange.properties.title}</h3><p>${currencyExchange.properties.description}</p>`
)
)
.addTo(map);
mapMarkers.push(marker);
}
if (firstLoad == true) {
$.each(cityList, function(i, el){
if($.inArray(el, uniqueCityList) === -1) uniqueCityList.push(el);
});
for (let i = 0; i < uniqueCityList.length; i++) {
$('.exchangeMapBox .cityList').prepend('<div>' + uniqueCityList[i] + '</div>');
}
}
}
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
function goToElement(element, activeElement = null) {
$('html, body').animate({ scrollTop: $(element).offset().top - 100}, 300);
if (activeElement != null) {
$(activeElement).parent().find('.active').removeClass('active');
$(activeElement).addClass('active');
}
}
function resizeKrypton() {
if ($(window).width() > 950) {
$('.kryptonBox .kryptonTable1 .kryptonImage').height($('.kryptonBox .kryptonTable1 tr td:first-of-type').height());
} else {
$('.kryptonBox .kryptonTable1 .kryptonImage').height('300px');
}
if ($(window).width() <= 1200 && $('.kryptonChanged1200').length == 0) {
var kr1 = $('.kryptonRoadmap6').html();
var kr2 = $('.kryptonRoadmap4').html();
var kr3 = $('.kryptonRoadmap14').html();
var kr4 = $('.kryptonRoadmap12').html();
$('.kryptonRoadmap6').html(kr2);
$('.kryptonRoadmap4').html(kr1);
$('.kryptonRoadmap14').html(kr4);
$('.kryptonRoadmap12').html(kr3);
$('.kryptonRoadmap6, .kryptonRoadmap4, .kryptonRoadmap14, .kryptonRoadmap12').addClass('kryptonChanged1200');
} else if ($('.kryptonChanged1200').length > 0) {
var kr1 = $('.kryptonRoadmap6').html();
var kr2 = $('.kryptonRoadmap4').html();
var kr3 = $('.kryptonRoadmap14').html();
var kr4 = $('.kryptonRoadmap12').html();
$('.kryptonRoadmap6').html(kr2);
$('.kryptonRoadmap4').html(kr1);
$('.kryptonRoadmap14').html(kr4);
$('.kryptonRoadmap12').html(kr3);
$('.kryptonRoadmap6, .kryptonRoadmap4, .kryptonRoadmap14, .kryptonRoadmap12').removeClass('kryptonChanged1200');
}
if ($(window).width() <= 800) {
$('.kryptonRoadmap.kryptonRoadmapMobile').html($('.kryptonRoadmap:not(.kryptonRoadmapMobile)').html());
$('.kryptonRoadmap:not(.kryptonRoadmapMobile)').css('display', 'none');
$('.kryptonRoadmap.kryptonRoadmapMobile').css('display', 'block');
$('.kryptonRoadmap.kryptonRoadmapMobile > div:not(.kryptonRoadMapClearBoth1200):not(.kryptonRoadMapClearBoth)').each(function( index ) {
$(this).height(($(window).width() <= 400 ? 180 : 220) + $(this).find('div').first().outerHeight() + 'px');
});
} else {
$('.kryptonRoadmap.kryptonRoadmapMobile').css('display', 'none');
$('.kryptonRoadmap.kryptonRoadmapMobile').html('');
$('.kryptonRoadmap:not(.kryptonRoadmapMobile)').css('display', 'block');
}
setTimeout(()=>{
if ($(window).width() > 950) {
var height = 0;
$('.kryptonParameters > tbody > tr > td > div').each(function( index ) {
if ($(this).outerHeight() > height) {
height = $(this).outerHeight();
}
});
$('.kryptonParameters > tbody > tr > td > div').height(height - 80);
$('.kryptonParameters > tbody > tr > td:last-of-type > div').height(height);
} else {
$('.kryptonParameters > tbody > tr > td > div').height('auto');
}
if ($(window).width() > 700) {
height = 0;
$('.kryptonTeam .kryptonPerson').each(function( index ) {
if ($(this).height() > height) {
height = $(this).height();
}
});
$('.kryptonTeam .kryptonPerson').height(height);
} else {
$('.kryptonTeam .kryptonPerson').height('auto');
}
}, 0);
}
function getKryptonSupply() {
$.ajax({
url: addTime(apiURL + '/api-public/currencies/krpl/supply'),
type: 'GET',
success: function (res)
{
var totalSupply = parseFloat(res['totalSupply']).toString();
var sold = parseFloat(res['sold']);
var percentage = parseInt(((parseFloat(res['sold']) / parseFloat(res['totalSupply'])) * 100));
$('.kryptonGoalInfo1 span:first-of-type').text(sold);
$('.kryptonGoalInfo1 span:first-of-type').width($('.kryptonGoalInfo1 span:first-of-type').width() + 25 + 'px');
$('.kryptonGoalInfo1 span:first-of-type').prop('Counter',0).animate({
Counter: $('.kryptonGoalInfo1 span:first-of-type').text()
}, {
duration: 3000,
easing: 'swing',
step: function (now) {
$('.kryptonGoalInfo1 span:first-of-type').text(numberWithSpaces(Math.ceil(now)));
}
});
$('.kryptonGoalInfo1 span:last-of-type').text(percentage);
$('.kryptonGoalInfo1 span:last-of-type').prop('Counter',0).animate({
Counter: $('.kryptonGoalInfo1 span:last-of-type').text()
}, {
duration: 3000,
easing: 'swing',
step: function (now) {
$('.kryptonGoalInfo1 span:last-of-type').text('(' + Math.ceil(now) + '%)');
}
});
$('.kryptonGoalSlider > div').animate({ width: percentage + '%' }, 3000);
if (totalSupply.length >= 6) {
$('.kryptonGoalInfo2 span').html(totalSupply.slice(0, -6) + ' mln');
} else {
$('.kryptonGoalInfo2 span').html(totalSupply.slice(0, -3) + ' tys.');
}
},
error: function () {
}
});
}
function generateKryptonDeadline() {
// get total seconds between the times
var delta = Math.abs(new Date(kryptonDeadline) - new Date()) / 1000;
// calculate (and subtract) whole days
var days = Math.floor(delta / 86400);
delta -= days * 86400;
// calculate (and subtract) whole hours
var hours = Math.floor(delta / 3600) % 24;
delta -= hours * 3600;
// calculate (and subtract) whole minutes
var minutes = Math.floor(delta / 60) % 60;
delta -= minutes * 60;
// what's left is seconds
var seconds = delta % 60; // in theory the modulus is not required
$('.kryptonPcTimerDays > span:first-of-type').html(parseInt(days));
$('.kryptonPcTimerHours > span:first-of-type').html(parseInt(hours));
$('.kryptonPcTimerMinutes > span:first-of-type').html(parseInt(minutes));
$('.kryptonPcTimerSeconds > span:first-of-type').html(parseInt(seconds));
$('.kryptonMobileTimerDays > span:first-of-type').html(parseInt(days));
$('.kryptonMobileTimerHours > span:first-of-type').html(parseInt(hours));
$('.kryptonMobileTimerMinutes > span:first-of-type').html(parseInt(minutes));
$('.kryptonMobileTimerSeconds > span:first-of-type').html(parseInt(seconds));
}
function numberWithSpaces(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
}
function generateTabelaOplat() {
$.ajax({
url: addTime(apiURL + '/api-public/currencies/basic'),
type: 'GET',
success: function (res)
{
var table = '<table>'
table += '<tr><th>'+walutaWirtualna+'</th><th>'+oplataTransferowa+'</th></tr>';
if (res != null && res['currencies'] != null) {
for (var i = 0; i < res['currencies'].length; i++) {
table += '<tr><td>'+res['currencies'][i]['shortName']+'</td><td>'+(parseFloat(res['currencies'][i]['fee']) + ' ' + res['currencies'][i]['shortName'])+'</td></tr>';
}
}
table += '</table>';
$('.tabela-oplat-dynamic').html(table);
},
error: function () {
}
});
}
function infobarPrev() {
clearInterval(infobarInterval);
var curIndex = parseInt($('.infobar > div:visible').attr('class').replace('infobarElement', ''));
$('.infobar .infobarElement' + curIndex).animate({left: infobarWidth + 'px', opacity: 0}, 500, function(){
$(this).css('display', 'none');
});
setTimeout(()=>{
curIndex -= 1;
if ($('.infobar .infobarElement' + curIndex).length == 0) {
curIndex = ($('.infobar > div').length - 1);
}
$('.infobar .infobarElement' + curIndex).css({left: '-' + infobarWidth + 'px', opacity: 0, display: 'block'});
$('.infobar .infobarElement' + curIndex).animate({left: 0, opacity: 1}, 500);
infobarInterval = setInterval(infobarNext, 4000);
}, 400);
}
function infobarNext() {
clearInterval(infobarInterval);
var curIndex = parseInt($('.infobar > div:visible').attr('class').replace('infobarElement', ''));
$('.infobar .infobarElement' + curIndex).animate({right: infobarWidth + 'px', opacity: 0}, 500, function(){
$(this).css('display', 'none');
});
setTimeout(()=>{
curIndex += 1;
if ($('.infobar .infobarElement' + curIndex).length == 0) {
curIndex = 0;
}
$('.infobar .infobarElement' + curIndex).css({right: '-' + infobarWidth + 'px', opacity: 0, display: 'block'});
$('.infobar .infobarElement' + curIndex).animate({right: 0, opacity: 1}, 500);
infobarInterval = setInterval(infobarNext, 4000);
}, 400);
}