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/SBogers10/tandartsmaas.komma.pro/wwwroot/js/app/core/history.js
define('core/history',
    [
        'core/pageAnimator',
        'core/pageNavigator',
        'nProgress',
        'modules/swiper',
        'modules/googleMaps',
        'modules/isotope',
        'modules/images',
        'modules/mobileNavigation',
        'historySrc'
    ],function(pageAnimator, pageNavigator, nProcess, swiper, googleMaps, isotope, images, mobile)
{
    // Bind to State Change
    History.Adapter.bind(window,'statechange',function()
    {
        // Save old page
        var currentPage = $('body').attr('class');

        // Get history state
        var state = History.getState();

        // Start progress bar
        nProcess.start();

        // Fade out current page
        pageAnimator.animateOut(currentPage, state.data.state, function()
        {
            var url = state.url;
            if(state.data.submenuOnly) url += '?submenuOnly=1';

            // Make ajax call
            $.ajax({
                url: url,
                success: function(data)
                {
                    // Add some progress (temp)
                    nProcess.inc();

                    // Adjust the title
                    document.title = data.title;
                    pageNavigator.updateBodyClass(data.name);

                    if(typeof(ga) != "undefined")
                    {
                        // Update google analytics
                        ga('send', 'pageview', {
                            'page': state.url,
                            'title': data.title
                        });
                    }

                    // Load view
                    nProcess.done();
                    $('html,body').animate({ scrollTop: 0 },400);
                    pageAnimator.animateIn(currentPage, data, function()
                    {
                        init();
                    });
                }
            });
        }); 
    });

    init();

    // Initialise functions
    function init()
    {
        images.initialize();
        swiper.initialize();
        googleMaps.initialize();
        isotope.initialize();

        initialiseHistoryClickEvent();
    }

    // Functions
    function initialiseHistoryClickEvent()
    {
        //var $target = $('a[target!="_blank"]');
        var $target = $('a:not([target])');

        // Unbind existing click events
        $target.unbind('click');

        // Initialise click ev ent
        $target.bind('click',function(event)
        {
            if (Modernizr.history) {
                // Stop the url from following the link
                event.preventDefault();

                if(pageAnimator.allowed())
                {

                    mobile.mbCloseAll();

                    // Push a new state
                    var $this = $(this);
                    var pageName = $this.attr('data-state');
                    var submenuOnly = $this.attr('data-submenuOnly');

                    // Exception for signUp button in header
                    var special = $this.attr('data-special');
                    if (typeof special !== typeof undefined && special !== false)
                    {
                        if($('#mainNavigation a[data-state="practice"]').parent().hasClass('active'))
                        {
                            submenuOnly=1;
                        }
                    }

                    pageNavigator.updateActive(pageName);

                    History.pushState(
                        {
                            state: pageName,
                            submenuOnly: submenuOnly
                        },
                        null,
                        $this.attr('href'));
                }
            }
        });
    }
});