Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <head>
- <!--
- chronos — misc page i: countdowns
- by divinethemes
- › do not steal any part of this code
- › edit however you want, but only for personal use
- › send any questions to divinethemes.tumblr.com/ask
- › thank you for using! <3
- -------
- › find :root for changing accent and countdown background color
- › most colors are also labeled in case you want things to be different colors
- › pls read directions for setting up countdowns carefully
- -->
- <title>countdowns — {Name}</title>
- <link rel="shortcut icon" href="{Favicon}">
- <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
- <!-- tooltips script-->
- <script src="http://static.tumblr.com/rzl30kg/eAxm7a751/jquery.style-my-tooltips.js"></script>
- <script>
- (function($){
- $(document).ready(function(){
- $("[title]").style_my_tooltips({
- tip_follows_cursor:true,
- tip_delay_time:200,
- tip_fade_speed:300
- }
- );
- });
- })(jQuery);
- </script>
- <!--font awesome -->
- <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css" integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous">
- <!-- honeybee icons by @suiomi -->
- <link href="//dl.dropbox.com/s/vpi3f9s7nhpe7v7/honeybee.css" rel="stylesheet">
- <!--fonts-->
- <link href="https://fonts.googleapis.com/css?family=Fira+Sans:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
- <link href="https://fonts.googleapis.com/css?family=Karla:400,400i,700,700i" rel="stylesheet">
- <link href="https://fonts.googleapis.com/css?family=Playfair+Display:400,400i,700,700i,900,900i" rel="stylesheet">
- <style type="text/css">
- @keyframes fadein {from {opacity:0;}to {opacity:1;}}
- @-moz-keyframes fadein {from {opacity:0;}to {opacity:1;}}
- @-webkit-keyframes fadein {from {opacity:0;}to {opacity:1;}}
- @-o-keyframes fadein {from {opacity:0;}to {opacity: 1;}}
- /*-- scrollbar --*/
- ::-webkit-scrollbar {
- width:11px;
- background:var(--countdown);
- }
- ::-webkit-scrollbar-thumb {
- background:var(--accent);
- }
- ::-webkit-scrollbar,::-webkit-scrollbar-thumb {
- border:5px solid #fff;
- }
- /*-- selection --*/
- ::-moz-selection { background:#eaeaea; color:#222; }
- ::selection { background:#eaeaea; color:#222; }
- /*-- hide tumblr controls --*/
- .tmblr-iframe, .iframe-controls–desktop {display:none !important;}
- /*-- tooltips --*/
- #s-m-t-tooltip {
- position:absolute;
- padding:0px 5px 0px 5px;
- margin-top:30px;
- color:#444;
- background-color:#f8f8f8;
- font-family:'Fira Sans', sans-serif;
- font-size:9.5px;
- font-style:italic;
- text-transform:lowercase;
- text-align:center;
- border:1px solid #eee;
- letter-spacing:0.5px;
- z-index:999999;
- }
- /*--general--*/
- body {
- background-color:#fff;
- font-family:'Fira Sans', sans-serif;
- font-size:11px;
- font-weight:400;
- line-height:190%;
- text-decoration:none;
- color:#555; /* text color */
- -moz-osx-font-smoothing:grayscale;
- -webkit-font-smoothing:antialiased;
- font-smoothing:antialiased;
- animation: fadein 2s;
- -moz-animation: fadein 2s;
- -webkit-animation: fadein 2s;
- -o-animation: fadein 2s;
- }
- /*-- change colors here! --*/
- :root {
- --accent:#d0cfed;
- --countdown:#f8f8f8; /* countdown background */
- }
- body, * {
- cursor:auto;
- }
- a {
- text-decoration:none;
- color:#999; /* link color */
- -webkit-transition:0.4s ease-in;
- -moz-transition:0.4s ease-in;
- -o-transition:0.4s ease-in;
- }
- a:hover {
- color:var(--accent); /* link hover */
- text-decoration:none;
- cursor:pointer;
- -webkit-transition:0.4s ease-in;
- -moz-transition:0.4s ease-in;
- -o-transition:0.4s ease-in;
- }
- b, strong {
- font-weight:700;
- color:#222;
- }
- i, em {
- font-style:italic;
- }
- blockquote {
- padding-left:10px;
- border-left:1px solid #eee;
- margin:0px;
- }
- /*-- credit // don't touch --*/
- .c {
- position:fixed;
- bottom:15px;
- right:20px;
- font-size:10.5px;
- -webkit-transition:0.7s ease-in;
- -moz-transition:0.7s ease-in;
- -o-transition:0.7s ease-in;
- }
- .c:hover {
- transform:rotate(540deg);
- -webkit-transition:0.7s ease-in;
- -moz-transition:0.7s ease-in;
- -o-transition:0.7s ease-in;
- }
- .c i:hover {
- cursor:pointer;
- }
- /*-- content --*/
- #cont {
- margin:5% auto;
- width:480px;
- }
- /*-- header --*/
- #header {
- margin:60px 0 0 0;
- }
- .icon {
- border-radius:50%;
- background:var(--countdown); /* clock icon background color */
- height:70px;
- width:70px;
- z-index:999999;
- font-size:40px;
- }
- .icon span {
- margin:15px 15px;
- color:var(--accent); /* clock icon color */
- }
- /* icon shaking hover effect from w3schools */
- #header:hover .icon span {
- animation: shake 0.7s;
- animation-iteration-count: infinite;
- }
- @keyframes shake {
- 0% { transform: translate(1px, 1px) rotate(0deg); }
- 10% { transform: translate(-1px, -2px) rotate(-1deg); }
- 20% { transform: translate(-3px, 0px) rotate(1deg); }
- 30% { transform: translate(3px, 2px) rotate(0deg); }
- 40% { transform: translate(1px, -1px) rotate(1deg); }
- 50% { transform: translate(-1px, 2px) rotate(-1deg); }
- 60% { transform: translate(-3px, 1px) rotate(0deg); }
- 70% { transform: translate(3px, 1px) rotate(-1deg); }
- 80% { transform: translate(-1px, -1px) rotate(1deg); }
- 90% { transform: translate(1px, 2px) rotate(0deg); }
- 100% { transform: translate(1px, -2px) rotate(-1deg); }
- }
- #header h1 {
- font-family:'Playfair Display', serif;
- font-size:16px;
- letter-spacing:1.5px;
- font-weight:600;
- color:#444;
- margin-left:100px;
- margin-top:-65px;
- float:left;
- }
- .links {
- float:left;
- margin-left:100px;
- margin-top:-35px;
- }
- .links a {
- padding:3px 4px;
- background:var(--countdown); /* header link color */
- margin:5px 8px 0 0;
- text-transform:lowercase;
- }
- .links a:hover {
- background:var(--accent); /* header link hover color */
- color:#444;
- }
- /*-- countdowns --*/
- .event {
- margin:60px 0;
- height:70px;
- width:400px;
- }
- .date {
- background:var(--accent); /* date background color */
- text-transform:uppercase;
- height:60px;
- width:70px;
- padding-top:10px;
- text-align:center;
- float:left;
- line-height:170%;
- border-radius:50%;
- font-size:10px;
- }
- .date:before {
- content:'';
- background:var(--accent);
- width:1px;
- height:60px;
- position:absolute;
- margin-top:-70px;
- margin-left:8px;
- }
- .date b {
- font-size:21px;
- font-weight:400;
- display:block;
- }
- .info {
- background:var(--countdown); /* countdown background color */
- width:calc((480px + 20px) - 160px);
- height:30px;
- padding:20px;
- margin-left:100px;
- }
- .info:before {
- content:'';
- position:absolute;
- width:0;
- height:0;
- margin-top:5px;
- margin-left:-30px;
- border-top: 10px solid transparent;
- border-bottom: 10px solid transparent;
- border-right:10px solid var(--countdown);
- -webkit-transition:0.3s ease-in;
- -moz-transition:0.3s ease-in;
- -o-transition:0.3s ease-in;
- }
- .event:hover .info:before {
- border-top: 10px solid transparent;
- border-bottom: 10px solid transparent;
- border-right:25px solid var(--countdown);
- margin-left:-45px;
- -webkit-transition:0.3s ease-in;
- -moz-transition:0.3s ease-in;
- -o-transition:0.3s ease-in;
- }
- .event h1 {
- font-family:'Karla', sans-serif;
- font-style:italic;
- font-size:16px;
- font-weight:400;
- float:right;
- margin-top:65px;
- margin-right:-10px;
- background:2px var(--accent); /* date "highlight" color */
- line-height:50%;
- }
- .countdown {
- font-size:13px;
- margin-top:5px;
- }
- /*-- media queries --*/
- @media only screen
- and (max-width: 736px){
- .info {
- width:55vw;
- }
- .countdown {
- margin-top:0;
- }
- }
- @media only screen
- and (max-width: 568px){
- .info {
- width:50vw;
- }
- }
- @media only screen
- and (max-width: 667px){
- .info {
- height:50px;
- }
- .countdown {
- margin-top:0;
- }
- .event h1 {
- margin-top:85px;
- }
- }
- </style>
- </head>
- <body>
- <!-- content start -->
- <div id="cont">
- <!-- header -->
- <div id="header">
- <div class="icon"><span class="th th-alarm-clock-1-o"></span></div>
- <h1>countdowns</h1> <!-- page title -->
- <div class="links"> <!-- add or remove as you please, links outside of your blog have to start with http:// -->
- <a href="/">index</a>
- <a href="/ask">ask</a>
- <a href="">link</a>
- <a href="http://divinethemes.tumblr.com">credit</a>
- </div>
- </div>
- <!-- header end -->
- <!------------------------- countdowns start ----------------------------------
- EVENT TEMPLATE
- EVENT TEMPLATE
- <div class="event">
- <div data-date="apr 15 2020" class="date">apr <b>15</b> 2020</div>
- <div class="info">
- <h1>event name</h1>
- <div class="countdown"></div>
- </div>
- </div>
- › where it says "apr 15 2020," insert the date in either of the following formats
- ISO date : 2020-01-29
- short date : 01/29/20
- long date : jan 29 2020 OR january 29 2020
- with time : 2020-01-29T12:34:30Z (UTC time)
- › for the date that shows on this page, you must abbreviate write it as shown
- › you don't have time to put anything inside the "countdown" div - if you do it won't show up anyway
- › countdowns at least a day old will show "expired" and events that are today will show "today"
- -->
- <div class="event">
- <div data-date="apr 15 2020" class="date">apr<b>15</b>2020</div>
- <div class="info">
- <h1>event name</h1>
- <div class="countdown"></div>
- </div>
- </div>
- </div>
- <!-------------------------- countdowns end ---------------------------------->
- <!-- do not touch thank you -->
- <div class="c"><a title="divine themes" target="_blank" href="http://divinethemes.tumblr.com"><i class="fas fa-crown"></i></a>
- </div>
- </body>
- <script>
- // get countdown dates
- var i;
- var countdowns = document.getElementsByClassName('date').length;
- var date;
- // start loop
- for (i = 0; i < countdowns; i++) {
- (function (i) {
- // get each countdown date
- date = document.getElementsByClassName('date')[i].getAttribute('data-date');
- var countdownDate = new Date(date).getTime();
- // update every 1 second
- setInterval(
- function countdown () {
- // now
- var today = new Date().getTime();
- // get time difference
- var timeUntil = countdownDate - today;
- var msDay = 1000 * 60 * 60 * 24;
- var msHour = 1000 * 60 * 60;
- var msMin = 1000 * 60;
- // calculate times
- var days = Math.floor(timeUntil / msDay);
- var hours = Math.floor(timeUntil % msDay / msHour);
- var minutes = Math.floor(timeUntil % msHour / msMin);
- var seconds = Math.floor(timeUntil % msMin / 1000);
- // plural or singular
- var daysTxt = ' day';
- var hoursTxt = ' hour';
- var minutesTxt = ' minute';
- var secondsTxt = ' second';
- function plural (txt) {
- return txt += 's ';
- }
- function singular (txt) {
- return txt += ' ';
- }
- function which (time, txt) {
- if (time > 1) {
- return txt = plural(txt);
- } else {
- return txt = singular(txt);
- }
- }
- daysTxt = which(days, daysTxt);
- hoursTxt = which(hours, hoursTxt);
- minutesTxt = which(minutes, minutesTxt);
- secondsTxt = which(seconds, secondsTxt);
- if (days < -1) {
- document.getElementsByClassName('countdown')[i].innerHTML = 'expired';
- } else if (days === -1) {
- document.getElementsByClassName('countdown')[i].innerHTML = 'today';
- } else {
- document.getElementsByClassName('countdown')[i].innerHTML = days + daysTxt + hours + hoursTxt + minutes + minutesTxt + seconds + secondsTxt;
- }
- }, 1000); // end loop
- })(i); // end function (i)
- } // end for loop
- </script>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment