%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/shaban/laviva/wp-content/themes/levelup/assets/js/
Upload File :
Create Path :
Current File : /var/www/html/shaban/laviva/wp-content/themes/levelup/assets/js/counters.js

/* Counters */

(function(a){"use strict";a.fn.absoluteCounter=function(b){b=a.extend({},a.fn.absoluteCounter.defaults,b||{});return a(this).each(function(){var d=this,g=b.speed,f=b.setStyles,e=b.delayedStart,c=b.fadeInDelay;if(f){a(d).css({display:"block",position:"relative",overflow:"hidden"}).addClass('animated')}a(d).css("opacity","0");a(d).animate({opacity:0},e,function(){var l=a(d).text();a(d).text("");for(var k=0;k<l.length;k++){var n=l.charAt(k);var m="";if(parseInt(n,10)>=0){m='<span class="onedigit p'+(l.length-k)+" d"+n+'">';for(var h=0;h<=parseInt(n,10);h++){m+='<span class="n'+(h%10)+'">'+(h%10)+"</span>"}m+="</span>"}else{m='<span class="onedigit p'+(l.length-k)+' char"><span class="c">'+n+"</span></span>"}a(d).append(m)}a(d).animate({opacity:1},c);a("span.onedigit",d).each(function(i,o){if(f){a(o).css({"float":"left",position:"relative"});a("span",a(o)).css({display:"block"})}var p=a("span",a(o)).length,j=a(d).height();a(o).css({height:(p*j)+"px",top:"0"});a("span",a(o)).css({height:j+"px"});a(o).animate({top:-1*((p-1)*j)+"px"},g,function(){if(typeof(b.onComplete)==="function"){b.onComplete.call(d)}})})})})};a.fn.absoluteCounter.defaults={speed:2000,setStyles:true,onComplete:null,delayedStart:0,fadeInDelay:0}}(jQuery));


(function($) {
    "use strict";

    $.fn.countTo = function(options) {
        // merge the default plugin settings with the custom options
        options = $.extend({}, $.fn.countTo.defaults, options || {});

        // how many times to update the value, and how much to increment the value on each update
        var loops = Math.ceil(options.speed / options.refreshInterval),
            increment = (options.to - options.from) / loops;

        return $(this).each(function() {
            var _this = this,
                loopCount = 0,
                value = options.from,
                interval = setInterval(updateTimer, options.refreshInterval);

            function updateTimer() {
                value += increment;
                loopCount++;
                $(_this).html(value.toFixed(options.decimals));

                if (typeof(options.onUpdate) === 'function') {
                    options.onUpdate.call(_this, value);
                }

                if (loopCount >= loops) {
                    clearInterval(interval);
                    value = options.to;

                    if (typeof(options.onComplete) === 'function') {
                        options.onComplete.call(_this, value);
                    }
                }
            }
        });
    };

    $.fn.countTo.defaults = {
        from: 0,  // the number the element should start at
        to: 100,  // the number the element should end at
        speed: 1000,  // how long it should take to count between the target numbers
        refreshInterval: 100,  // how often the element should be updated
        decimals: 0,  // the number of decimal places to show
        onUpdate: null,  // callback method for every time the element is updated,
        onComplete: null  // callback method for when the element finishes updating
    };
})(jQuery);


(function($)
{
    "use strict";

    var _units	= ['weeks','days','hours','minutes','seconds'],
        _second = 1000,
        _minute = _second * 60,
        _hour 	= _minute * 60,
        _day 	= _hour * 24,
        _week	= _day * 7,
        ticker	= function(_self)
        {
            var _time		= {},
                _now 		= new Date(),
                _timestamp  = _self.end - _now;

            if(_timestamp <= 0)
            {
                clearInterval(_self.countdown);
                return;
            }

            _self.time.weeks   	= Math.floor( _timestamp / _week);
            _self.time.days 	= Math.floor((_timestamp % _week) / _day);
            _self.time.hours	= Math.floor((_timestamp % _day) / _hour);
            _self.time.minutes 	= Math.floor((_timestamp % _hour) / _minute);
            _self.time.seconds 	= Math.floor((_timestamp % _minute) / _second);

            switch(_self.data.maximum)
            {
                case 1: _self.time.seconds 	= Math.floor(_timestamp / _second); break;
                case 2: _self.time.minutes 	= Math.floor(_timestamp / _minute); break;
                case 3: _self.time.hours	= Math.floor(_timestamp / _hour); 	break;
                case 4: _self.time.days 	= Math.floor(_timestamp / _day); 	break;
            }

            for (var i in _self.time)
            {
                if(typeof _self.update[i] == "object")
                {
                    if(_self.firstrun || _self.oldtime[i] != _self.time[i])
                    {
                        var labelkey = ( _self.time[i] === 1 ) ? "single" : "multi";

                        _self.update[i].time_container.text(_self.time[i]);
                        _self.update[i].label_container.text(_self.update[i][labelkey]);
                    }
                }
            }

            //show ticker
            if(_self.firstrun) _self.container.addClass('rdy-countdown-active')

            _self.oldtime 	= $.extend( {}, _self.time );
            _self.firstrun	= false;
        };


    $.fn.rdyCountdown = function( options )
    {
        if(!this.length) return;

        return this.each(function()
        {
            var _self 			= {};
            _self.update		= {};
            _self.time			= {};
            _self.oldtime		= {};
            _self.firstrun		= true;

            _self.container		= $(this);
            _self.data			= _self.container.data();
            _self.end			= new Date(_self.data.year, _self.data.month, _self.data.day, _self.data.hour, _self.data.minute );

            for (var i in _units)
            {
                _self.update[_units[i]] = {
                    time_container:  _self.container.find('.rdy-countdown-' + _units[i] + ' .rdy-countdown-time'),
                    label_container: _self.container.find('.rdy-countdown-' + _units[i] + ' .rdy-countdown-time-label'),
                };

                if(_self.update[_units[i]].label_container.length)
                {
                    _self.update[_units[i]].single = _self.update[_units[i]].label_container.data('label');
                    _self.update[_units[i]].multi  = _self.update[_units[i]].label_container.data('label-multi');
                }
            }

            ticker(_self);
            _self.countdown 	= setInterval(function(){ ticker(_self); }, _self.data.interval);


        });
    }

}(jQuery));

Zerion Mini Shell 1.0