function showTab()

in harness/app-assets/templates/assets/js/bootstraps/common.js [500:560]


    function showTab(tab, tabContainer, evt) {
        var showElem,
            hideElem,
            href,
            activeTab,
            tabId,
            isAndroid = document.body.classList.contains('android');

        evt.preventDefault();
        
        if (tab.getAttribute('aria-selected') !== 'true') {
            activeTab = tabContainer.querySelector('[aria-selected="true"]');
            tabId = tab.getAttribute('id');

            if (activeTab) {
                href = activeTab.getAttribute('href');
                if (href) {
                    hideElem = document.querySelector(href);
                    if (hideElem) {
                        hideElem.style.display = 'none';
                        activeTab.setAttribute('aria-selected', false);
                    }
                }
            }

            href = tab.getAttribute('href');

            if (href) {
                showElem = document.querySelector(href);
                if (showElem) {
                    showElem.style.display = 'block';
                    tab.setAttribute('aria-selected', true);
                }
            }

            switch(tabId) {
                case 'football__tab--article':
                    window.location.href = 'x-gu://football_tab_report';
                    break;
                case 'football__tab--stats':
                    setPieChartSize();
                    window.location.href = 'x-gu://football_tab_stats';
                    break;
                case 'football__tab--liveblog':
                    window.location.href = 'x-gu://football_tab_liveblog';
                    break;
                case 'cricket__tab--liveblog':
                    if (isAndroid) {
                        window.GuardianJSInterface.cricketTabChanged('overbyover');
                    }
                    break;
                case 'cricket__tab--stats':
                    if (isAndroid) {
                        window.GuardianJSInterface.cricketTabChanged('scorecard');
                    }
                    break;
                default:
                    window.location.href = 'x-gu://football_tab_unknown';
            }
        }
    }