var oldScrollY = 0; function damageLogo(execution) { var timer = 30; if (execution > 9) timer = 400; $('#logo span').animate({ opacity: Math.random().toFixed(2) }, timer, function() { if (execution > 10) noLogo(); else damageLogo(execution + 1) }); } function noLogo() { $('#logo span').css('opacity', 0); $('#logo span').text('UBATECH'); setTimeout(function() { fixLogo(); }, 1200); } function fixLogo() { $('#logo span').animate({ opacity: 1 }, 800); $('#logo img').animate({ opacity: 1 }, 800, function(){ $('#logo span').text('UBATECH'); }); } $(function(){ var nbsp = ' '; function detectMob() { const toMatch = [ /Android/i, /webOS/i, /iPhone/i, /iPad/i, /iPod/i, /BlackBerry/i, /Windows Phone/i ]; return toMatch.some(function(toMatchItem){ return navigator.userAgent.match(toMatchItem); }); } // Phone number $('#phone').append('...' + nbsp).prepend('501' + nbsp).prepend('+48'+ nbsp).append('05' + String.fromCharCode(49)); $('#phone').click(function(){ $('#phone').unbind(); $.getJSON("/phone", function( data ) { $('#phone').html($('#phone').text().replace('...', data.phone)); if (detectMob()) { $('#phone').addClass('callto'); $('#phone').attr('href', 'tel:'+$('#phone').html().replaceAll(nbsp, '')); } }); }); // Email $('#email').append('kubatech').prepend('@').prepend('biuro').append('.pl'); $('#email').attr('href', 'mailto:'+$('#email').text()); noLogo(); });