Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Counter</title>
- <meta charset="utf-8" />
- <meta HTTP-EQUIV=Content-Language Content=hu>
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="theme-color" content="RoyalBlue">
- <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
- <style>
- .footer {
- position: fixed;
- right: 3%;
- bottom: 10%;
- height: 5%;
- width: 20%;
- font-size: 2em;
- background-color: dark;
- color: white;
- text-align: center;
- }
- #counter {
- text-align: center;
- margin: 550px auto;
- display: block;
- font-size: 3em;
- color: #282828;
- }
- @media (max-width: 500px) {
- #counter {
- font-size: 1.5em;
- }
- }
- #counter span, #counter i {
- display: inline-block;
- vertical-align: middle;
- }
- #counter span {
- font-family: sans-serif;
- text-align: center;
- min-width: 45px;
- text-rendering: optimizeLegibility;
- position: relative;
- background-color: #353535;
- margin: 0 2px;
- padding: 5px;
- color: white;
- border-radius: 5px;
- box-shadow: inset 0 1px 0.5px rgba(255, 255, 255, 0.4);
- border: 1px solid black;
- text-shadow: 0 0 2px black;
- }
- #counter span.days {
- margin-right: 20px;
- }
- #counter span.days:before {
- content: "NAP";
- }
- #counter span.hours:before {
- content: "ÓRA";
- }
- #counter span.minutes:before {
- content: "PERC";
- }
- #counter span.seconds:before {
- content: "SEC";
- }
- #counter span:before {
- top: -20px;
- position: absolute;
- left: 0;
- right: 0;
- display: block;
- color: black;
- font-size: 0.35em;
- text-shadow: none;
- }
- #counter span:after {
- content: "";
- position: absolute;
- top: 50%;
- left: 0;
- right: 0;
- height: 1px;
- margin-top: 0.5px;
- background-color: black;
- box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);
- }
- #counter i {
- font-style: normal;
- }
- body {
- width: 100%;
- height: 100%;
- position: fixed;
- background-color: #34495e;
- }
- .content {
- position: absolute;
- top: 30%;
- left: 50%;
- -webkit-transform: translate(-50%, -50%);
- transform: translate(-50%, -50%);
- height: 160px;
- overflow: hidden;
- font-family: 'Lato', sans-serif;
- font-size: 35px;
- line-height: 40px;
- color: #ecf0f1;
- }
- .content__container {
- font-weight: 600;
- overflow: hidden;
- height: 40px;
- padding: 0 40px;
- }
- .content__container:before {
- content: '[';
- left: 0;
- }
- .content__container:after {
- content: ']';
- position: absolute;
- right: 0;
- }
- .content__container:after, .content__container:before {
- position: absolute;
- top: 0;
- color: #16a085;
- font-size: 42px;
- line-height: 40px;
- -webkit-animation-name: opacity;
- -webkit-animation-duration: 2s;
- -webkit-animation-iteration-count: infinite;
- animation-name: opacity;
- animation-duration: 2s;
- animation-iteration-count: infinite;
- }
- .content__container__text {
- display: inline;
- float: left;
- margin: 0;
- }
- .content__container__list {
- margin-top: 0;
- padding-left: 10px;
- text-align: left;
- list-style: none;
- -webkit-animation-name: change;
- -webkit-animation-duration: 10s;
- -webkit-animation-iteration-count: infinite;
- animation-name: change;
- animation-duration: 10s;
- animation-iteration-count: infinite;
- }
- .content__container__list__item {
- line-height: 40px;
- margin: 0;
- }
- @-webkit-keyframes opacity {
- 0%, 100% {
- opacity: 0;
- }
- 50% {
- opacity: 1;
- }
- }
- @-webkit-keyframes change {
- 0%, 12.66%, 100% {
- -webkit-transform: translate3d(0, 0, 0);
- transform: translate3d(0, 0, 0);
- }
- 16.66%, 29.32% {
- -webkit-transform: translate3d(0, -25%, 0);
- transform: translate3d(0, -25%, 0);
- }
- 33.32%,45.98% {
- -webkit-transform: translate3d(0, -50%, 0);
- transform: translate3d(0, -50%, 0);
- }
- 49.98%,62.64% {
- -webkit-transform: translate3d(0, -75%, 0);
- transform: translate3d(0, -75%, 0);
- }
- 66.64%,79.3% {
- -webkit-transform: translate3d(0, -50%, 0);
- transform: translate3d(0, -50%, 0);
- }
- 83.3%,95.96% {
- -webkit-transform: translate3d(0, -25%, 0);
- transform: translate3d(0, -25%, 0);
- }
- }
- @keyframes opacity {
- 0%, 100% {
- opacity: 0;
- }
- 50% {
- opacity: 1;
- }
- }
- @keyframes change {
- 0%, 12.66%, 100% {
- -webkit-transform: translate3d(0, 0, 0);
- transform: translate3d(0, 0, 0);
- }
- 16.66%, 29.32% {
- -webkit-transform: translate3d(0, -25%, 0);
- transform: translate3d(0, -25%, 0);
- }
- 33.32%,45.98% {
- -webkit-transform: translate3d(0, -50%, 0);
- transform: translate3d(0, -50%, 0);
- }
- 49.98%,62.64% {
- -webkit-transform: translate3d(0, -75%, 0);
- transform: translate3d(0, -75%, 0);
- }
- 66.64%,79.3% {
- -webkit-transform: translate3d(0, -50%, 0);
- transform: translate3d(0, -50%, 0);
- }
- 83.3%,95.96% {
- -webkit-transform: translate3d(0, -25%, 0);
- transform: translate3d(0, -25%, 0);
- }
- }
- .btn {
- background-color: #34495e;
- border: none;
- color: white;
- padding: 12px 16px;
- font-size: 25px;
- cursor: pointer;
- border-radius: 12px;
- }
- .btn:hover {
- background-color: RoyalBlue;
- }
- </style>
- </head>
- <body>
- <form action="/">
- <button href="/" class="btn"><i class="fa fa-home"></i> Home</button>
- </form>
- <div class="content">
- <div class="content__container">
- <ul class="content__container__list">
- <li class="content__container__list__item">A doboz</li>
- <li class="content__container__list__item">Kinyilásáig</li>
- <li class="content__container__list__item">Hátralévő</li>
- <li class="content__container__list__item">Idő</li>
- </ul>
- </div>
- </div>
- <div id="counter"></div>
- <div class="footer bg-dark">
- <dt>Doboz Ébren:</dt><span id="uptime">up</span>
- </div>
- </body>
- <script>
- function sendData(e){
- var t=new XMLHttpRequest;t.onreadystatechange=function()
- {4==this.readyState&&200==this.status&&(document.getElementById("LEDState").innerHTML=this.responseText)
- },ledstate="setLED?LEDstate="+e,t.open("GET",ledstate,!0),t.send()}function getData()
- {var e;
- (e=new XMLHttpRequest).onreadystatechange=function(){4==this.readyState&&200==this.status&&(document.getElementById("uptime").innerHTML=this.responseText)},
- e.open("GET","readtimestring",!0),e.send()
- }setInterval(function(){getData()},1e3);
- //counts up or down depending on date entered in //format at the bottom
- function counter(date) {
- var theDate = new Date(date);
- var _second = 1000;
- var _minute = _second * 60;
- var _hour = _minute * 60;
- var _day = _hour * 24;
- var timer;
- function count() {
- var now = new Date();
- if (theDate > now) {
- var distance = theDate - now;
- if(distance <= 1500){
- //window.location.href = "motor";
- }
- if (distance < 0) {
- clearInterval(timer);
- return;
- }
- } else {
- var distance = now - theDate;
- if (distance < 0) {
- clearInterval(timer);
- return;
- }
- }
- var days = Math.floor(distance / _day);
- var hours = Math.floor((distance % _day) / _hour);
- if (hours < 10) {
- hours = '0' + hours;
- console.log(hours);
- }
- var minutes = Math.floor((distance % _hour) / _minute);
- if (minutes < 10) {
- minutes = '0' + minutes;
- console.log(minutes);
- }
- var seconds = Math.floor((distance % _minute) / _second);
- if (seconds < 10) {
- seconds = '0' + seconds;
- console.log(seconds);
- }
- var daytext = '';
- if (days > 1) {
- daytext = ' days ';
- } else {
- daytext = ' day ';
- }
- if (days > 0) {
- document.getElementById('counter').innerHTML = '<span class="days">' + days + '</span>' + '<span class="hours">' + hours + '</span>' + '<i> : </i>' + '<span class="minutes">' + minutes + '</span>' + '<i> : </i>' + '<span class="seconds">' + seconds + '</span>';
- } else {
- document.getElementById('counter').innerHTML = '<span class="hours">' + hours + '</span>' + '<i> : </i>' + '<span class="minutes">' + minutes + '</span>' + '<i> : </i>' + '<span class="seconds">' + seconds + '</span>';
- }
- }
- timer = setInterval(count, 1000);
- }
- counter('03/21/2019 21:11:00 UTC+1 (CET)');
- </script>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement