Fossil SCM

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

Keyboard Shortcuts

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