Sha256: 331023dd7878c66735847ee873aa768a18668191d8ec2dbdc8ed283d91565611

Contents?: true

Size: 1.27 KB

Versions: 6

Compression:

Stored size: 1.27 KB

Contents

window.conference.program = (() => {
    const updateHash = (hash) => {
        const scrollPosition = document.documentElement.scrollTop;
        window.location.hash = hash;
        document.documentElement.scrollTop = scrollPosition;
    };

    const init = () => {
        if ($('#day-list')) {
            // Switch to day if page load with hash
            const hash = window.location.hash;
            if (hash) {
                $('#day-list a[href="' + hash + '"]').tab('show');
            }

            // Switch to day if today
            else {
                let today = new Date();
                today.setHours(0,0,0,0);

                $('a[data-toggle="tab"]').each(function () {
                    let d = new Date($(this).data('date'));
                    d.setHours(0,0,0,0);

                    if (today.getTime() === d.getTime()) {
                        $(this).tab('show');
                        updateHash(this.hash);
                    }
                });
            }

            // Add current selected day as hash to URL while keeping current scrolling position
            $('a[data-toggle="tab"]').on('shown.bs.tab', function () {
                updateHash(this.hash);
            });
        }
    };

    return {
        init: init
    };
})();

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
jekyll-theme-conference-3.6.5 _includes/js/program.js
jekyll-theme-conference-3.6.4 _includes/js/program.js
jekyll-theme-conference-3.6.3 _includes/js/program.js
jekyll-theme-conference-3.6.2 _includes/js/program.js
jekyll-theme-conference-3.6.1 _includes/js/program.js
jekyll-theme-conference-3.6.0 _includes/js/program.js