<div id='my_timer'>1:0:2</div>
<script>
function showTimeLess ()
{
function addZero (x) {return ((x < 10)? '0' : '') + x}
var t = Math.round (.001 * (sessionStorage.getItem ('timeset') - performance.now ()));
console.log(t);
document.getElementById ('my_timer').textContent = [addZero(Math.floor (t / 3600)), addZero(Math.floor ((t / 60) % 60)), addZero (t % 60)].join (':');
if (t) setTimeout (showTimeLess, 345);
}
var t = document.getElementById ('my_timer').textContent.split (':');
sessionStorage.setItem ('timeset', (t [0] * 3600 + t [1] * 60 + +t [2]) * 1000);
showTimeLess ();
</script>
//То что должны удалить
var target;
jQuery('.open_win_idea').click(function () {
target = $(this).parent();
jQuery('#popup_idea, .bg_body').fadeIn();
});
jQuery('.close_win_butt_no').click(function () {
jQuery('#popup_idea, .bg_body').fadeOut();
});
jQuery('.close_win_butt_yes').click(function () {
//Удаляем
$(target).remove();
jQuery('#popup_idea, .bg_body').fadeOut();
});
$("#myform").validate({
invalidHandler: function(event, validator) {
// 'this' refers to the form
var errors = validator.numberOfInvalids();
if (errors) {
var message = errors == 1
? 'You missed 1 field. It has been highlighted'
: 'You missed ' + errors + ' fields. They have been highlighted';
$("div.error span").html(message);
$("div.error").show();
} else {
$("div.error").hide();
}
}
});
slide: function( event, ui ) {
$( "НУЖНЫЙ БЛОК" ).val( "$" + ui.value );
}
$( ".selector" ).on( "slide", function( event, ui ) {} );
$(window).scroll(function() {
var the_top = $(document).scrollTop();
if (the_top > $('.container-fluid.header-top').height()) {
$('.header-down').addClass('navbar-fixed-top');
$('header').css({'margin-top':parseInt($('.header-down').height())+20+'px'});
}
else {
$('.header-down').removeClass('navbar-fixed-top');
$('header').css({'margin-top':0});
}
})
setInterval(function(){
$.ajax({
url: '../core/remote_ip.txt',
success: function(data) {
if(data != $("#txtIP").val())
{
var colors = ['#ff0000', '#00ff00', '#0000ff'];
var random_color = colors[Math.floor(Math.random() * colors.length)];
$('#txtIP').css('color', random_color);
$("#txtIP").val(data);
}
}
});
}, 1000);