PageSourceSearch

https://thaineqas.com/js/navbar.js

js thaineqas.com collected 2026-10-09 00:35:36 UTC 2,345 bytes, 82 lines download raw bytes

1import * as common from './common/common.js';
2import * as auth from './common/auth.js';
3import { LOGGEDIN_NAV, NOTLOGGEDIN_NAV } from './common/constant.js';
4import { Collapse } from './bootstrap/bootstrap.esm.min.js';
5
6try {
7    window.navbar_shown = false;
8    document.querySelector('.navbar-toggler').addEventListener('click', (e) => {
9        e.preventDefault();
10        if(!window.nav_bar)
11            window.nav_bar = document.querySelector('#main_navbar');
12
13        try {
14            let nav_bar = window.nav_bar;
15            if(!window.navbar_shown) {
16                nav_bar.style.display = '';
17                window.navbar_shown = true;
18            } else {
19                nav_bar.style.display = 'none';
20                window.navbar_shown = false;
21            }
22        } catch(error) {
23            console.error(error);
24        }
25    });
26} catch(error) {
27    console.error(error);
28}
29async function OnLogoutClick(event)
30{
31    let ret = await auth.logout();
32
33    if(!ret) {
34        console.error("We found a problem.");
35        console.error(ret);
36    }
37
38    location.href = '/';
39}
40
41function OnFAQClick(event)
42{
43    event.preventDefault();
44    location.href = "/faq.html";
45}
46
47function OnIntroduceClick(event)
48{
49    event.preventDefault();
50    // window.open("https://www.si.mahidol.ac.th/th/department/clinical_pathology/eqa_main.asp", '_blank');
51    window.open("https://sites.google.com/mahidol.edu/thneqasbloodcoagulation", '_blank');
52}
53
54function load_nav(isloggedin)
55{
56    let main_nav = document.getElementById('main_navbar');
57    main_nav.innerHTML = (isloggedin) ? LOGGEDIN_NAV : NOTLOGGEDIN_NAV;
58}
59
60async function NavBarLoaded()
61{
62    let payload_data = await common.isLoggedin();
63    if(payload_data) {
64        if(!payload_data['login'])
65            load_nav(false);
66        else
67            load_nav(payload_data['status'] === 'login');
68    } else {
69        load_nav(false);
70    }
71
72    document.querySelector('#faq_nav').addEventListener('click', OnFAQClick);
73    document.querySelector('#introduce_nav').addEventListener('click', OnIntroduceClick);
74
75    try {
76        document.querySelector('#logout_nav').addEventListener('click', OnLogoutClick);
77    } catch(error) {
78        console.error("No Logout Loaded. :P")
79    }
80}
81
82NavBarLoaded();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.