HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/yoda-ict/yoda-ict.nl/wwwroot/public/js/main.js
/**
 * Created by Komma Mediadesign.
 * Author: mike
 * Date: 19/03/14
 */


// iPad, iPhone or any other touch device?
var isTouch = (navigator.userAgent.match(/iPad/i) != null) || (navigator.userAgent.match(/iPhone/i) != null);

// Basic functions

if( ! isTouch)
    {
    // Home functions
    if(onPage('home'))
    {
        initHomeAnimation();
        resizeHome();
        $(window).resize(resizeHome);
    }

    // About functions
    if(onPage('about'))
    {
        initAboutAnimation();
    }

    // Services functions
    if(onPage('services') || onPage('service_detail'))
    {
        initServiceAnimation();
    }

    // References functions
    if(onPage('references'))
    {
        initReferenceAnimation();
    }

    // Contact
    if(onPage('contact'))
    {
        initContactAnimation();
        initTextFields();
        resizeContact();
        $(window).resize(resizeContact);


    }

    if(onPage('offer'))
    {
        initTextFields();
    }

    if(onPage('terms') || onPage('disclaimer') || onPage('privacy') || onPage('sitemap') || onPage('page_not_found'))
    {
        checkAboutAnimation(0);

        $(window).scroll(function(){
            checkAboutAnimation(1);
        });
    }

    // Forms
    if(onPage('contact') || onPage('offer'))
    {
        if($('form').size()){
            $('<input type="hidden" />').attr({
                name: 'secretcode',
                id: 'secretcode',
                value: 'spamcheckkomma'
            }).appendTo("form");
        }
    }

}
else
{
    $('#why_yoda').children().css({ left: 0, opacity: 1 });
    $('#blocks').children().css({ top: 0, opacity: 1 });
    $('#reasons').children().css({ left: 0, opacity: 1 });
}



/************************** GENERAL **************************/

/**
 *
 * @param page
 * @returns {boolean}
 */
function onPage(page)
{
    return $("#" + page).size() > 0;
}

/************************** HOME **************************/


/**
 * Make elements on page animate by page scroll
 */
function initHomeAnimation()
{
    $('#banner').scrollDelay({ delay : 0.6 });
    $('#clouds').scrollDelay({ delay : -0.2, trigger: 500 });
    $('#snowbank').scrollDelay({ delay : -0.4, trigger: 700, anchor: 'bottom' });

    checkHomeAnimation(0);

    $(window).scroll(function(){
        $('#banner').data('sd').delay();
        $('#clouds').data('sd').delay();
        $('#snowbank').data('sd').delay();

        checkHomeAnimation(1);
    });

    var $slider = $('#client_slider')
    $slider.clientSlider();

    var int;
    $('#next').hover(function()
    {
        $slider.data('cs').next();
        int = setInterval(function(){
            $slider.data('cs').next();
        },1000);
    },function()
    {
        clearInterval(int);
    });

    $('#prev').hover(function(){
        $slider.data('cs').prev();
        int = setInterval(function(){
            $slider.data('cs').prev();
        },1000);
    },function()
    {
        clearInterval(int);
    });
}

function checkHomeAnimation(ani)
{
    // Define triggerLine
    var scrollTop = $(document).scrollTop();
    var wh = $(window).height();
    var triggerLine = wh + scrollTop;

    if(triggerLine > $('#why_yoda').offset().top)
    {
        // Animate Why Yoda
        animateWhyYoda(ani);
    }

    if(triggerLine > $('#blocks').offset().top)
    {
        // Animate Why Yoda
        animateBlocks(ani);
    }
}

/**
 * Animate 5 reasons
 */
function animateWhyYoda(ani)
{
    if(ani)
    {
        var delay = 0;
        for(var i=0;i<5;i++)
        {
            animateWhyYodaLi(i,delay);

            // Rise delay
            delay+=100;
        }
    }
    else
    {
        $('#why_yoda').children().css({ left: 0, opacity: 1 });
    }
}
function animateWhyYodaLi(index,delay)
{
    // Ani, wait for it...
    setTimeout(function()
    {
        // mate!
        var $obj = $('#why_yoda').children().eq(index);
        if($obj.css('left') == '-800px' )
        $obj.stop().animate({ left : 0, opacity: 1 },800);
    },delay);
}


/**
 * Handle Home resize
 */
function resizeHome()
{
    if( $(window).width() >= 600)
    {
        var mt = Math.floor($('header').height() + parseInt($('#banner').css('paddingBottom')));
        $('.introduction').css({ marginTop: mt+'px'});
        $('#banner').css({ top: '60px', bottom: 'auto' });
    }
    else
    {
        $('.introduction').css({ marginTop: 0});
        $('#banner').css({ top: '0', bottom: 'auto' });

    }
}


/************************** ABOUT **************************/


/**
 * Make elements on page animate by page scroll
 */
function initAboutAnimation()
{
    // Set delay for banner
    $('#clouds').scrollDelay({ delay : 0.6 });
    $('#snowbank').scrollDelay({ delay : -0.4, trigger: 700, anchor: 'bottom' });

    checkAboutAnimation(0);

    $(window).scroll(function(){
        $('#clouds').data('sd').delay();
        $('#snowbank').data('sd').delay();

        checkAboutAnimation(1);
    });
}

function checkAboutAnimation(ani)
{
    // Define triggerLine
    var scrollTop = $(document).scrollTop();
    var wh = $(window).height();
    var triggerLine = wh + scrollTop;

    if(triggerLine > $('#blocks').offset().top)
    {
        // Animate Why Yoda
        animateBlocks(ani);
    }
}

/************************** SERVICES **************************/


/**
 * Make elements on page animate by page scroll
 */
function initServiceAnimation()
{
    // Set delay for banner
    if($('#clouds').size()) $('#clouds').scrollDelay({ delay : -0.3, anchor: 'bottom' });
    checkServiceAnimation(0);
    $(window).scroll(function(){
        if($('#clouds').size()) $('#clouds').data('sd').delay();

        checkServiceAnimation(1);

        // Menu slide down
        var fixedMenu = $('.services_menu.fixed');
        var fixedSubmenu = $('.services_submenu.fixed');
        var scrollTop = $(document).scrollTop();
        var trigger = 100;
        var subTrigger = 220;

        if(scrollTop > trigger){ fixedMenu.css({ top: '60px'}); }else{ fixedMenu.css({ top: 0}); }
        if(scrollTop > subTrigger){ fixedSubmenu.css({ top: '100px'}); }else{ fixedSubmenu.css({ top: 0}); }

    });
}

function checkServiceAnimation(ani)
{
    // Define triggerLine
    var scrollTop = $(document).scrollTop();
    var wh = $(window).height();
    var triggerLine = wh + scrollTop;

    if($('#blocks').size())
    {
        if(triggerLine > $('#blocks').offset().top)
        {
            // Animate Why Yoda
            animateBlocks(ani);
        }
    }

    if($('#reasons').size())
    {
        // Always ( no trigger line)
        animateReasons();

    }
}

/************************** REFERENCES **************************/


/**
 * Make elements on page animate by page scroll
 */
function initReferenceAnimation()
{
    // Set delay for banner
    $('#clouds').scrollDelay({ delay : -0.3, anchor: 'bottom' });
   // $('#snowbank').scrollDelay({ delay : 0.8});

    $(window).scroll(function(){
        $('#clouds').data('sd').delay();
        //$('#snowbank').data('sd').delay();
    });
}

/************************** CONTACT **************************/

/**
 * Make elements on page animate by page scroll
 */
function initContactAnimation()
{
    // Set delay for banner
    $('#banner').scrollDelay({ delay : 0.6 });

    $(window).scroll(function(){
        $('#banner').data('sd').delay();
    });
}

function resizeContact()
{
    if( $(window).width() >= 600)
    {
        var mt = Math.floor($('header').height() + parseInt($('#banner').css('paddingBottom')));
        $('.introduction').css({ marginTop: mt+'px'});
    }
    else
    {
        $('.introduction').css({ marginTop: 0});
    }
}

/**
 * Initialize text fields
 */
function initTextFields()
{
    // Text field
    var $textField = $('input[type=text], textarea');

    if( ! isIphone())
    {
        $textField.siblings('.placeholder').click(function()
        {
            $(this).siblings('input').focus();
            $(this).siblings('textarea').focus();
        });

        // Check starting values
        $textField.each(function(){
            if($(this).val() != '')
            {
                $(this).parent().children('.placeholder').html('');
            }
        });

        // On focus
        $textField.focus(function()
            {
                // Focus
                $(this).parent().addClass('focus');
            }
        ).keydown(function()
            {
                // Empty placeholder
                $(this).parent().children('.placeholder').html('');
            }
        );
        $textField.blur(
            function()
            {
                // Blur
                $(this).parent().removeClass('focus');

                // Restore placeholder if field is empty
                var label = $(this).attr('data-label');
                if($(this).val()=="")
                {
                    $(this).parent().children('.placeholder').html(label);
                }
            }
        );
    }
    else
    {
        $textField.parent().children('.placeholder').html('');
    }
}

/**
 * Animate Service blocks
 * Fade In / Slide up
 */

function animateBlocks(ani)
{
    if(ani)
    {
        var delay = 0;
        for(var i=0;i<4;i++)
        {
            animateBlocksLi(i,delay);

            // Rise delay
            delay+=100;
        }
    }
    else
    {
        $('ul#blocks').children().css({ top: 0, opacity: 1 });
    }
}
function animateBlocksLi(index,delay)
{
    // Ani, wait for it...
    setTimeout(function()
    {
        // mate!
        var $obj = $('ul#blocks').children().eq(index);
        if($obj.css('top') == '200px')
            $obj.stop().animate({ top : 0, opacity: 1 },400);
    },delay);
}


/**
 * Animate Service blocks
 * Fade In / Slide up
 */

function animateReasons()
{
    var delay = 0;
    for(var i=0;i<4;i++)
    {
        animateReasonsLi(i,delay);

        // Rise delay
        delay+=100;
    }
}
function animateReasonsLi(index,delay)
{
    // Ani, wait for it...
    setTimeout(function()
    {
        // mate!
        var $obj = $('ul#reasons').children().eq(index);
        if($obj.css('left') == '-800px')
            $obj.stop().animate({ left : 0, opacity: 1 },400);
    },delay);
}

/**
 * Hover on service blocks
 */
var $blocks = $('#blocks');
if($blocks.size() > 0)
{
    $blocks.children('li').hover(function()
    {
        $('.blurred_image',this).css({ opacity: 0 });
        $('.icon',this).css({ top: '150%' });
        $('.title',this).css({ color: '#FD8241' });
        //$('p',this).css({ color: '#FD8241' });
        $('.btn',this).css({ background: '#FD8241' });
    },function()
    {
        $('.blurred_image',this).css({ opacity: 1 });
        $('.icon',this).css({ top: '50%' });
        $('.title',this).css({ color: '#97D458' });
        //$('p',this).css({ color: '#575C5C' });
        $('.btn',this).css({ background: '#97D458' });
    });
}

function isIphone()
{
    //return ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) );
    return ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)));
}