1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
<?php /* Copyright (c) 2024 Freya Murphy */ ?>
<?php /* vim: syntax=php */ ?>
<?php
$self = $this->main->user();
$this->view('header_empty', $data);
?>
<header class="nav">
<div class="nav-left">
<span class="logo">xssbook</span>
</div>
<div class="nav-center" :class="{hidden: !visible}">
<a
id="action-home"
class="btn<?=$this->main->info['app'] == 'home' ? ' btn-blue btn-border' : ''?>"
href="/home"
title="<?=ucfirst(lang('action_home_tip'))?>"
>
<i class="mi mi-lg">home</i>
<span><?=ucfirst(lang('action_home_text'))?></span>
</a>
<a
id="action-people"
class="btn<?=$this->main->info['app'] == 'people' ? ' btn-blue btn-border' : ''?>"
href="/people"
title="<?=ucfirst(lang('action_people_tip'))?>"
>
<i class="mi mi-lg">people</i>
<span><?=ucfirst(lang('action_people_text'))?></span>
</a>
<!--a
id="action-chat"
class="btn<?=$this->main->info['app'] == 'chat' ? ' btn-blue btn-border' : ''?>"
href="/chat"
title="<?=lang('action_chat_tip')?>"
>
<i class="mi mi-lg">chat</i>
<span><?=lang('action_chat_text')?></span>
</a-->
</div>
<div class="nav-right">
<button
id="action-hamburger"
title="<?=ucfirst(lang('action_hamburger_tip'))?>"
class="btn mr"
>
<i class="mi mi-lg">menu</i>
</button>
<?php if($self): ?>
<script>
var userMenu = null;
var toggleUserMenu = () => {
userMenu.toggleClass('hidden');
}
</script>
<?=pfp($self, FALSE, 'toggleUserMenu()')?>
<div class="card col hidden" id="user-menu">
<span class="row mr" id="user-menu-header">
<?=pfp($self, FALSE)?>
<span class="col">
<strong><?=$this->format_model->name($self)?></strong>
<span class="dim"><?=$self['username']?></span>
</span>
</span>
<hr>
<?=ilang(
'action_profile',
id: 'action-profile',
class: 'btn',
href: '/profile?id=' . $self['id']
)?>
<?=ilang(
'action_xssbook_about',
id: 'action-xssbook-about',
class: 'btn',
click: 'viewAbout'
)?>
<?=ilang(
'action_settings',
id: 'action-settings',
class: 'btn',
href: '/settings'
)?>
<?=ilang(
'action_logout',
id: 'action-logout',
class: 'btn',
href: '/auth/logout'
)?>
</div>
<?php else: ?>
<?=ilang('action_login', class: 'btn', href: '/auth/login')?>
<?php endif; ?>
</div>
<script>
$('#action-xssbook-about').on('click', function() {
$.get( "/modal/about", function (data) {
$(document.body).append(data);
});
})
$('#action-hamburger').on('click', function() {
let menu = $('.nav-center');
menu.toggleClass('visible');
});
</script>
</header>
<script>
userMenu = $('#user-menu');
var nav = $('.nav');
document.onclick = function(event) {
let outside = !(nav[0].contains(event.target));
if (outside) {
userMenu.addClass('hidden');
}
};
</script>
|