• 10-01-2019, 20:56:24
    #1
    /*!
     * Project : simply-countdown
     * File : simplyCountdown
     * Date : 27/06/2015
     * License : MIT
     * Version : 1.3.2
     * Author : Vincent Loy <vincent.loy1@gmail.com>
     * Contributors : 
     *  - Justin Beasley <JustinB@harvest.org>
     *  - Nathan Smith <NathanS@harvest.org>
     */
    /*global window, document*/
    (function (exports) {
        'use strict';
    
        var // functions
            extend,
            createElements,
            createCountdownElt,
            simplyCountdown;
    
        /**
         * Function that merge user parameters with defaults one.
         * @param out
         * @returns {*|{}}
         */
        extend = function (out) {
            var i,
                obj,
                key;
            out = out || {};
    
            for (i = 1; i < arguments.length; i += 1) {
                obj = arguments[i];
    
                if (obj) {
                    for (key in obj) {
                        if (obj.hasOwnProperty(key)) {
                            if (typeof obj[key] === 'object') {
                                extend(out[key], obj[key]);
                            } else {
                                out[key] = obj[key];
                            }
                        }
                    }
                }
            }
    
            return out;
        };
    
        /**
         * Function that create a countdown section
         * @param countdown
         * @param parameters
         * @param typeClass
         * @returns {{full: (*|Element), amount: (*|Element), word: (*|Element)}}
         */
        createCountdownElt = function (countdown, parameters, typeClass) {
            var innerSectionTag,
                sectionTag,
                amountTag,
                wordTag;
    
            sectionTag = document.createElement('div');
            amountTag = document.createElement('span');
            wordTag = document.createElement('span');
            innerSectionTag = document.createElement('div');
    
            innerSectionTag.appendChild(amountTag);
            innerSectionTag.appendChild(wordTag);
            sectionTag.appendChild(innerSectionTag);
    
            sectionTag.classList.add(parameters.sectionClass);
            sectionTag.classList.add(typeClass);
            amountTag.classList.add(parameters.amountClass);
            wordTag.classList.add(parameters.wordClass);
    
            countdown.appendChild(sectionTag);
    
            return {
                full: sectionTag,
                amount: amountTag,
                word: wordTag
            };
        };
    
        /**
         * Function that create full countdown DOM elements calling createCountdownElt
         * @param parameters
         * @param countdown
         * @returns {{days: (*|Element), hours: (*|Element), minutes: (*|Element), seconds: (*|Element)}}
         */
        createElements = function (parameters, countdown) {
            var spanTag;
    
            if (!parameters.inline) {
                return {
                    days: createCountdownElt(countdown, parameters, 'simply-days-section'),
                    hours: createCountdownElt(countdown, parameters, 'simply-hours-section'),
                    minutes: createCountdownElt(countdown, parameters, 'simply-minutes-section'),
                    seconds: createCountdownElt(countdown, parameters, 'simply-seconds-section')
                };
            }
    
            spanTag = document.createElement('span');
            spanTag.classList.add(parameters.inlineClass);
            return spanTag;
        };
    
        /**
         * simplyCountdown, create and display the coundtown.
         * @param elt
         * @param args (parameters)
         */
        simplyCountdown = function (elt, args) {
            var parameters = extend({
                    year: 2019,
                    month: 1,
                    day: 10,
                    hours: 21,
                    minutes: 50,
                    seconds: 0,
                    words: {
                        days: 'day',
                        hours: 'hour',
                        minutes: 'minute',
                        seconds: 'second',
                        pluralLetter: 's'
                    },
                    plural: true,
                    inline: false,
                    enableUtc: true,
                    onEnd: function () {
                        return;
                    },
                    refresh: 1000,
                    inlineClass: 'simply-countdown-inline',
                    sectionClass: 'simply-section',
                    amountClass: 'simply-amount',
                    wordClass: 'simply-word',
                    zeroPad: false
                }, args),
                interval,
                targetDate,
                targetTmpDate,
                now,
                nowUtc,
                secondsLeft,
                days,
                hours,
                minutes,
                seconds,
                cd = document.querySelectorAll(elt);
    
            targetTmpDate = new Date(
                parameters.year,
                parameters.month - 1,
                parameters.day,
                parameters.hours,
                parameters.minutes,
                parameters.seconds
            );
    
            if (parameters.enableUtc) {
                targetDate = new Date(
                    targetTmpDate.getUTCFullYear(),
                    targetTmpDate.getUTCMonth(),
                    targetTmpDate.getUTCDate(),
                    targetTmpDate.getUTCHours(),
                    targetTmpDate.getUTCMinutes(),
                    targetTmpDate.getUTCSeconds()
                );
            } else {
                targetDate = targetTmpDate;
            }
    
            Array.prototype.forEach.call(cd, function (countdown) {
                var fullCountDown = createElements(parameters, countdown),
                    refresh;
    
                refresh = function () {
                    var dayWord,
                        hourWord,
                        minuteWord,
                        secondWord;
    
                    now = new Date();
                    if (parameters.enableUtc) {
                        nowUtc = new Date(now.getFullYear(), now.getMonth(), now.getDate(),
                            now.getHours(), now.getMinutes(), now.getSeconds());
                        secondsLeft = (targetDate - nowUtc.getTime()) / 1000;
    
                    } else {
                        secondsLeft = (targetDate - now.getTime()) / 1000;
                    }
    
                    if (secondsLeft > 0) {
                        days = parseInt(secondsLeft / 86400, 10);
                        secondsLeft = secondsLeft % 86400;
    
                        hours = parseInt(secondsLeft / 3600, 10);
                        secondsLeft = secondsLeft % 3600;
    
                        minutes = parseInt(secondsLeft / 60, 10);
                        seconds = parseInt(secondsLeft % 60, 10);
                    } else {
                        days = 0;
                        hours = 0;
                        minutes = 0;
                        seconds = 0;
                        window.clearInterval(interval);
                        parameters.onEnd();
                    }
    
                    if (parameters.plural) {
                        dayWord = days > 1
                            ? parameters.words.days + parameters.words.pluralLetter
                            : parameters.words.days;
    
                        hourWord = hours > 1
                            ? parameters.words.hours + parameters.words.pluralLetter
                            : parameters.words.hours;
    
                        minuteWord = minutes > 1
                            ? parameters.words.minutes + parameters.words.pluralLetter
                            : parameters.words.minutes;
    
                        secondWord = seconds > 1
                            ? parameters.words.seconds + parameters.words.pluralLetter
                            : parameters.words.seconds;
    
                    } else {
                        dayWord = parameters.words.days;
                        hourWord = parameters.words.hours;
                        minuteWord = parameters.words.minutes;
                        secondWord = parameters.words.seconds;
                    }
    
                    /* display an inline countdown into a span tag */
                    if (parameters.inline) {
                        countdown.innerHTML =
                            days + ' ' + dayWord + ', ' +
                            hours + ' ' + hourWord + ', ' +
                            minutes + ' ' + minuteWord + ', ' +
                            seconds + ' ' + secondWord + '.';
    
                    } else {
                        fullCountDown.days.amount.textContent = (parameters.zeroPad && days.toString().length < 2 ? '0' : '') + days;
                        fullCountDown.days.word.textContent = dayWord;
    
                        fullCountDown.hours.amount.textContent = (parameters.zeroPad && hours.toString().length < 2 ? '0' : '') + hours;
                        fullCountDown.hours.word.textContent = hourWord;
    
                        fullCountDown.minutes.amount.textContent = (parameters.zeroPad && minutes.toString().length < 2 ? '0' : '') + minutes;
                        fullCountDown.minutes.word.textContent = minuteWord;
    
                        fullCountDown.seconds.amount.textContent = (parameters.zeroPad && seconds.toString().length < 2 ? '0' : '') + seconds;
                        fullCountDown.seconds.word.textContent = secondWord;
                    }
                };
    
                // Refresh immediately to prevent a Flash of Unstyled Content
                refresh();
                interval = window.setInterval(refresh, parameters.refresh);
            });
        };
    
        exports.simplyCountdown = simplyCountdown;
    }(window));
    
    /*global $, jQuery, simplyCountdown*/
    if (window.jQuery) {
        (function ($, simplyCountdown) {
            'use strict';
    
            function simplyCountdownify(el, options) {
                simplyCountdown(el, options);
            }
    
            $.fn.simplyCountdown = function (options) {
                return simplyCountdownify(this.selector, options);
            };
        }(jQuery, simplyCountdown));
    }
    <!DOCTYPE html>
    <!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
    <!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
    <!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
    <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
    	<head>
    	<meta charset="utf-8">
    	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    	<title>Soon &mdash; 100% Free Fully Responsive HTML5 Template by FREEHTML5.co</title>
    	<meta name="viewport" content="width=device-width, initial-scale=1">
    	<meta name="description" content="Free HTML5 Template by FREEHTML5.CO" />
    	<meta name="keywords" content="free html5, free template, free bootstrap, html5, css3, mobile first, responsive" />
    	<meta name="author" content="FREEHTML5.CO" />
    
      <!-- 
    	//////////////////////////////////////////////////////
    
    	FREE HTML5 TEMPLATE 
    	DESIGNED & DEVELOPED by FREEHTML5.CO
    		
    	Website: 		http://freehtml5.co/
    	Email: 			info@freehtml5.co
    	Twitter: 		http://twitter.com/fh5co
    	Facebook: 		https://www.facebook.com/fh5co
    
    	//////////////////////////////////////////////////////
    	 -->
    
      	<!-- Facebook and Twitter integration -->
    	<meta property="og:title" content=""/>
    	<meta property="og:image" content=""/>
    	<meta property="og:url" content=""/>
    	<meta property="og:site_name" content=""/>
    	<meta property="og:description" content=""/>
    	<meta name="twitter:title" content="" />
    	<meta name="twitter:image" content="" />
    	<meta name="twitter:url" content="" />
    	<meta name="twitter:card" content="" />
    
    	<!-- <link href='https://fonts.googleapis.com/css?family=Work+Sans:400,300,600,400italic,700' rel='stylesheet' type='text/css'> -->
    	<link href="https://fonts.googleapis.com/css?family=Space+Mono" rel="stylesheet">
    	
    	<!-- Animate.css -->
    	<link rel="stylesheet" href="css/animate.css">
    	<!-- Icomoon Icon Fonts-->
    	<link rel="stylesheet" href="css/icomoon.css">
    	<!-- Bootstrap  -->
    	<link rel="stylesheet" href="css/bootstrap.css">
    	<!-- Theme style  -->
    	<link rel="stylesheet" href="css/style.css">
    
    	<!-- Modernizr JS -->
    	<script src="js/modernizr-2.6.2.min.js"></script>
    	<!-- FOR IE9 below -->
    	<!--[if lt IE 9]>
    	<script src="js/respond.min.js"></script>
    	<![endif]-->
    
    	</head>
    	<body>
    		
    	<div class="fh5co-loader"></div>
    	
    	<div id="page">
    
    	<div id="fh5co-container" class="js-fullheight">
    		<div class="countdown-wrap js-fullheight">
    			<div class="row">
    				<div class="col-md-12 text-center">
    					<div class="display-t js-fullheight">
    						<div class="display-tc animate-box">
    							<nav class="fh5co-nav" role="navigation">
    								<div id="fh5co-logo"><a href="index.html">Soon<strong>.</strong></a></div>
    							</nav>
    							<h1>We Are Coming Soon!</h1>
    							<h2>Free html5 templates Made by <a href="http://freehtml5.co/" target="_blank">freehtml5.co</a></h2>
    							<div class="simply-countdown simply-countdown-one"></div>
    							<div class="row">
    								<div class="col-md-12 desc">
    									<h2>Our webiste is opening soon. <br> Please register to notify you when it's ready!</h2>
    									<form class="form-inline" id="fh5co-header-subscribe">
    										<div class="col-md-12 col-md-offset-0">
    											<div class="form-group">
    												<input type="text" class="form-control" id="email" placeholder="Get notify by email">
    												<button type="submit" class="btn btn-primary">Subscribe</button>
    											</div>
    										</div>
    									</form>
    									<ul class="fh5co-social-icons">
    										<li><a href="#"><i class="icon-twitter-with-circle"></i></a></li>
    										<li><a href="#"><i class="icon-facebook-with-circle"></i></a></li>
    										<li><a href="#"><i class="icon-linkedin-with-circle"></i></a></li>
    										<li><a href="#"><i class="icon-dribbble-with-circle"></i></a></li>
    									</ul>
    								</div>
    							</div>
    						</div>
    					</div>
    				</div>
    			</div>
    		</div>
    		<div class="bg-cover js-fullheight" style="background-image:url(images/img_bg_1.jpg);">
    			
    		</div>
    	</div>
    	</div>
    
    	<div class="gototop js-top">
    		<a href="#" class="js-gotop"><i class="icon-arrow-up"></i></a>
    	</div>
    	
    	<!-- jQuery -->
    	<script src="js/jquery.min.js"></script>
    	<!-- jQuery Easing -->
    	<script src="js/jquery.easing.1.3.js"></script>
    	<!-- Bootstrap -->
    	<script src="js/bootstrap.min.js"></script>
    	<!-- Waypoints -->
    	<script src="js/jquery.waypoints.min.js"></script>
    
    	<!-- Count Down -->
    	<script src="js/simplyCountdown.js"></script>
    	<!-- Main -->
    	<script src="js/main.js"></script>
    
    	<script>
        var d = new Date(new Date().getTime() + 1000 * 120 * 120 * 2000);
    
        // default example
        simplyCountdown('.simply-countdown-one', {
            year: d.getFullYear(),
            month: d.getMonth() + 1,
            day: d.getDate()
        });
    
        //jQuery example
        $('#simply-countdown-losange').simplyCountdown({
            year: d.getFullYear(),
            month: d.getMonth() + 1,
            day: d.getDate(),
            enableUtc: false
        });
    </script>
    
    	</body>
    </html>
    jsdeki bölüm sanırım hedef tarih ve saat dakika ama istediğim sonucu alamıyorum html kısımda
    <script>
    var d = new Date(new Date().getTime() + 1000 * 120 * 120 * 2000);

    // default example
    simplyCountdown('.simply-countdown-one', {
    year: d.getFullYear(),
    month: d.getMonth() + 1,
    day: d.getDate()
    });

    //jQuery example
    $('#simply-countdown-losange').simplyCountdown({
    year: d.getFullYear(),
    month: d.getMonth() + 1,
    day: d.getDate(),
    enableUtc: false
    });
    </script>
    bu bölümden kaynaklanıyor sanırım ama nasıl ayarlamam gerektiğini anlayamadım yardım eder misiniz? mesala şuan 10.1.2019 20:54 benim hedefim 21:54 olsun 1 saat kaldı şeklinde görebileyim. Nerelere ne yazacağımı çözemedim
  • 03-02-2019, 22:41:07
    #2
    Busekilde olucak hocam

    simplyCountdown('.simply-countdown-one', {
    year: 2019,
    month: 11,
    day: 01
    });