Fossil SCM

fossil-scm / skins / eagle / header.txt
Blame History Raw 112 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><th1>
75
if {[info exists login]} {
76
puts "Logged in as $login"
77
} else {
78
puts "Not logged in"
79
}
80
</th1></nobr><small><div id="clock"></div></small></div>
81
</header>
82
<th1>html "<script nonce='$nonce'>"</th1>
83
(function updateClock(){
84
var e = document.getElementById("clock");
85
if(!e) return;
86
if(!updateClock.fmt){
87
updateClock.fmt = function(n){
88
return n < 10 ? '0' + n : n;
89
};
90
}
91
var d = new Date();
92
e.innerHTML = d.getUTCFullYear()+ '-' +
93
updateClock.fmt(d.getUTCMonth() + 1) + '-' +
94
updateClock.fmt(d.getUTCDate()) + ' ' +
95
updateClock.fmt(d.getUTCHours()) + ':' +
96
updateClock.fmt(d.getUTCMinutes());
97
setTimeout(updateClock,(60-d.getUTCSeconds())*1000);
98
})();
99
</script>
100
<nav class="mainmenu" title="Main Menu">
101
<th1>
102
html "<a id='hbbtn' href='$home/sitemap' aria-label='Site Map'>&#9776;</a>\n"
103
builtin_request_js hbmenu.js
104
foreach {name url expr class} $mainmenu {
105
if {![capexpr $expr]} continue
106
if {[string match /* $url]} {set url $home$url}
107
html "<a href='$url' class='$class'>$name</a>\n"
108
}
109
</th1>
110
</nav>
111
<nav id="hbdrop" class='hbdrop' title="sitemap"></nav>
112

Keyboard Shortcuts

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