Fossil SCM

fossil-scm / skins / xekri / header.txt
Blame History Raw 121 lines
1
<header>
2
<div class="logo">
3
<th1>
4
##
5
## NOTE: The purpose of this procedure is to take the base URL of the
6
## Fossil project and return the root of the entire web site using
7
## the same URI scheme as the base URL (e.g. http or https).
8
##
9
proc getLogoUrl { baseurl } {
10
set idx(first) [string first // $baseurl]
11
if {$idx(first) != -1} {
12
##
13
## NOTE: Skip second slash.
14
##
15
set idx(first+1) [expr {$idx(first) + 2}]
16
##
17
## NOTE: (part 1) The [string first] command does NOT actually
18
## support the optional startIndex argument as specified
19
## in the TH1 support manual; therefore, we fake it by
20
## using the [string range] command and then adding the
21
## necessary offset to the resulting index manually
22
## (below). In Tcl, we could use the following instead:
23
##
24
## set idx(next) [string first / $baseurl $idx(first+1)]
25
##
26
set idx(nextRange) [string range $baseurl $idx(first+1) end]
27
set idx(next) [string first / $idx(nextRange)]
28
if {$idx(next) != -1} {
29
##
30
## NOTE: (part 2) Add the necessary offset to the result of
31
## the search for the next slash (i.e. the one after
32
## the initial search for the two slashes).
33
##
34
set idx(next) [expr {$idx(next) + $idx(first+1)}]
35
##
36
## NOTE: Back up one character from the next slash.
37
##
38
set idx(next-1) [expr {$idx(next) - 1}]
39
##
40
## NOTE: Extract the URI scheme and host from the base URL.
41
##
42
set scheme [string range $baseurl 0 $idx(first)]
43
set host [string range $baseurl $idx(first+1) $idx(next-1)]
44
##
45
## NOTE: Try to stay in SSL mode if we are there now.
46
##
47
if {[string compare $scheme http:/] == 0} {
48
set scheme http://
49
} else {
50
set scheme https://
51
}
52
set logourl $scheme$host/
53
} else {
54
set logourl $baseurl
55
}
56
} else {
57
set logourl $baseurl
58
}
59
return $logourl
60
}
61
if {1} {
62
# Link logo to the top of the current domain
63
set logourl [getLogoUrl $baseurl]
64
} else {
65
# Link logo to the top of the current repo
66
set logourl $baseurl
67
}
68
</th1>
69
<a href="$logourl">
70
<img src="$logo_image_url" border="0" alt="$<project_name>">
71
</a>
72
</div>
73
<div class="title">$<title></div>
74
<div class="status"><nobr>
75
<th1>
76
if {[info exists login]} {
77
puts "Logged in as $login"
78
} else {
79
puts "Not logged in"
80
}
81
</th1>
82
</nobr><small><div id="clock"></div></small></div>
83
</header>
84
<th1>html "<script nonce='$nonce'>"</th1>
85
function updateClock(){
86
var e = document.getElementById("clock");
87
if(e){
88
var d = new Date();
89
function f(n) {
90
return n < 10 ? '0' + n : n;
91
}
92
e.innerHTML = d.getUTCFullYear()+ '-' +
93
f(d.getUTCMonth() + 1) + '-' +
94
f(d.getUTCDate()) + ' ' +
95
f(d.getUTCHours()) + ':' +
96
f(d.getUTCMinutes());
97
setTimeout(updateClock,(60-d.getUTCSeconds())*1000);
98
}
99
}
100
updateClock();
101
</script>
102
<nav class="mainmenu" title="Main Menu">
103
<th1>
104
set sitemap 0
105
foreach {name url expr class} $mainmenu {
106
if {![capexpr $expr]} continue
107
if {[string match /* $url]} {
108
if {[string match $url\[/?#\]* /$current_page/]} {
109
set class "active $class"
110
}
111
set url $home$url
112
}
113
html "<a href='$url' class='$class'>$name</a>\n"
114
if {[string match */sitemap $url]} {set sitemap 1}
115
}
116
if {!$sitemap} {
117
html "<a href='$home/sitemap'>...</a>\n"
118
}
119
</th1>
120
</nav>
121

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button