Jump to content
  • 0

Contador de Tempo Online


Nosifero
 Share

Question

Olá pessoal postando aqui meu contador, para inauguração do servidor!
 

                	<div id="Themeboxes">
						<!-- Countdown INICIO -->
							<div id="CountDownBox" class="Themebox" style="background-image: url('layouts/tibiarl/images/themeboxes/countdown/countdown_box.png');">
							<span class="countdowntext">Inauguração!</span>
							<div style="background:url(./layouts/tibiarl/images/themeboxes/countdown/Cuckoo_Clock.gif);width: 43px;height: 32px;position: absolute;margin-left: -2px;margin-top: 2px;"></div>
								<div class="Bottom" style="background-image: url('layouts/tibiarl/images/general/box-bottom.gif');"></div>
								<div id="countdown">
									<div style="margin-top: 39px;margin-left: 8px;">
										<b><span class="days" style="margin-left: 5px;"></span></b>
									</div>
									<div>
										<div class="Separator" style="background-image: url(./layouts/tibiarl/images/themeboxes/countdown/separator.png);"></div>
										<b><span class="hours"></span></b>
									</div>
									<div>
										<div class="Separator" style="background-image: url(./layouts/tibiarl/images/themeboxes/countdown/separator.png);left: 0px;"></div>
										<b><span class="minutes"></span></b>
									</div>
									<div>
										<div class="Separator" style="background-image: url(./layouts/tibiarl/images/themeboxes/countdown/separator.png);margin-left: -7px;"></div>
										<b><span class="seconds"></span></b>
									</div>
								</div>
								<script>
									jQuery(function($) {
										function getTimeRemaining(endtime) {
												var t = Date.parse(endtime) - Date.parse(new Date());
												var seconds = Math.floor((t / 1000) % 60);
												var minutes = Math.floor((t / 1000 / 60) % 60);
												var hours = Math.floor((t / (1000 * 60 * 60)) % 24);
												var days = Math.floor(t / (1000 * 60 * 60 * 24));
											return {
											'total': t,
											'days': days,
											'hours': hours,
											'minutes': minutes,
											'seconds': seconds
											};
										}

										function initializeClock(id, endtime, message) {
											var clock = document.getElementById(id);
											var daysSpan = clock.querySelector('.days');
											var hoursSpan = clock.querySelector('.hours');
											var minutesSpan = clock.querySelector('.minutes');
											var secondsSpan = clock.querySelector('.seconds');

											function updateClock() {
												var t = getTimeRemaining(endtime);

												daysSpan.innerHTML = t.days;
												hoursSpan.innerHTML = ('0' + t.hours).slice(-2);
												minutesSpan.innerHTML = ('0' + t.minutes).slice(-2);
												secondsSpan.innerHTML = ('0' + t.seconds).slice(-2);

												if(t.total<=0){
													clearInterval(timeinterval);
													document.getElementById(id).innerHTML = message;
												}
											}

											updateClock();
											var timeinterval = setInterval(updateClock, 1000);
										}

										var deadline = 'March 20 2019 15:00:00';
										initializeClock('countdown', deadline, '<div style="margin-top: 30px;margin-left: 45px;"><small><small><b>Servidor Iniciado!</b></small></small></div>')
									});
								</script>
							</div>
							<!-- Countdown FIM -->

 

Ficando assim no site.

image.png.18cdb76139ac65533b4627f5856239ab.png

 

 

Teria como modifica pra ele, fica registrando os dias que servidor está online?!
Inaugurei meu servidor dia 06/01/2019.
Isso seria importante pra mim, que mostra-se quantos dias está online...

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Opa, daora mano, ficou top!
Mas cadê os arquivos de imagens que serão necessários ? Só o script não adianta pra fucnionar =/
onde ta esses arquivos? ex:

/layouts/tibiarl/images/themeboxes/countdown/Cuckoo_Clock.gif
Link to comment
Share on other sites

 Share

×
×
  • Create New...