comparison src/site.js @ 9:88f425d261b3

add menu
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 25 Oct 2023 18:38:07 -0600
parents 8896ffd7b152
children 62dd23f0b549
comparison
equal deleted inserted replaced
8:9534dd5eda89 9:88f425d261b3
41 window.err = null; 41 window.err = null;
42 } 42 }
43 ajax( '/error_log.js', 'err='+encodeURIComponent(err) ); 43 ajax( '/error_log.js', 'err='+encodeURIComponent(err) );
44 }; 44 };
45 45
46 let currentPulldown = null;
47 let newPulldown = null;
48
49 function clickMenu(clicked,display) {
50 //console.log("clickMenu");
51 let pulldown = clicked.parentNode.querySelector('[pulldown_menu]');
52 if( pulldown !== currentPulldown ) {
53 pulldown.style.display = display || "block";
54 newPulldown = pulldown;
55 window.onclick = function() {
56 if( currentPulldown ) {
57 currentPulldown.style.display = "none";
58 if( !newPulldown )
59 window.onclick = null;
60 }
61 currentPulldown = newPulldown;
62 newPulldown = null;
63 };
64 pulldown.scrollIntoViewIfNeeded(false);
65 }
66 }
67
46 function logout() { 68 function logout() {
47 document.cookie = 'user=; Max-Age=0; path=/;'; 69 document.cookie = 'user=; Max-Age=0; path=/;';
48 location = '/'; 70 location = '/';
49 } 71 }