Fossil SCM
Ajaxy animated hamburger button as requested by drh on the forum: https://fossil-scm.org/forum/forumpost/40a18bd742
Commit
d7c43c5aa7761cbc1ab4ce04fed48e48951ad465450ad4d448a375e0a13b77e2
Parent
dc5e06ff71b2a3a…
5 files changed
+14
+34
+2
-4
+1
-1
+1
-1
+14
| --- skins/default/css.txt | ||
| +++ skins/default/css.txt | ||
| @@ -83,10 +83,11 @@ | ||
| 83 | 83 | border:1px solid #eaeaea; |
| 84 | 84 | border-radius:5px; |
| 85 | 85 | overflow-x: auto; |
| 86 | 86 | overflow-y: hidden; |
| 87 | 87 | white-space: nowrap; |
| 88 | + z-index: 21; /* just above hbdrop */ | |
| 88 | 89 | } |
| 89 | 90 | |
| 90 | 91 | .mainmenu a { |
| 91 | 92 | text-decoration:none; |
| 92 | 93 | color: #777; |
| @@ -95,10 +96,23 @@ | ||
| 95 | 96 | .mainmenu a.active, |
| 96 | 97 | .mainmenu a:hover { |
| 97 | 98 | color: #000; |
| 98 | 99 | border-bottom:2px solid #D26911; |
| 99 | 100 | } |
| 101 | + | |
| 102 | +div#hbdrop { | |
| 103 | + background-color: white; | |
| 104 | + border: 1px solid black; | |
| 105 | + border-top: white; | |
| 106 | + border-radius: 0 0 0.5em 0.5em; | |
| 107 | + display: none; | |
| 108 | + font-size: 80%; | |
| 109 | + left: 2em; | |
| 110 | + max-width: 33%; | |
| 111 | + position: absolute; | |
| 112 | + z-index: 20; /* just below mainmenu, but above timeline bubbles */ | |
| 113 | +} | |
| 100 | 114 | |
| 101 | 115 | .submenu { |
| 102 | 116 | font-size: .7em; |
| 103 | 117 | padding: 10px; |
| 104 | 118 | border-bottom: 1px solid #ccc; |
| 105 | 119 |
| --- skins/default/css.txt | |
| +++ skins/default/css.txt | |
| @@ -83,10 +83,11 @@ | |
| 83 | border:1px solid #eaeaea; |
| 84 | border-radius:5px; |
| 85 | overflow-x: auto; |
| 86 | overflow-y: hidden; |
| 87 | white-space: nowrap; |
| 88 | } |
| 89 | |
| 90 | .mainmenu a { |
| 91 | text-decoration:none; |
| 92 | color: #777; |
| @@ -95,10 +96,23 @@ | |
| 95 | .mainmenu a.active, |
| 96 | .mainmenu a:hover { |
| 97 | color: #000; |
| 98 | border-bottom:2px solid #D26911; |
| 99 | } |
| 100 | |
| 101 | .submenu { |
| 102 | font-size: .7em; |
| 103 | padding: 10px; |
| 104 | border-bottom: 1px solid #ccc; |
| 105 |
| --- skins/default/css.txt | |
| +++ skins/default/css.txt | |
| @@ -83,10 +83,11 @@ | |
| 83 | border:1px solid #eaeaea; |
| 84 | border-radius:5px; |
| 85 | overflow-x: auto; |
| 86 | overflow-y: hidden; |
| 87 | white-space: nowrap; |
| 88 | z-index: 21; /* just above hbdrop */ |
| 89 | } |
| 90 | |
| 91 | .mainmenu a { |
| 92 | text-decoration:none; |
| 93 | color: #777; |
| @@ -95,10 +96,23 @@ | |
| 96 | .mainmenu a.active, |
| 97 | .mainmenu a:hover { |
| 98 | color: #000; |
| 99 | border-bottom:2px solid #D26911; |
| 100 | } |
| 101 | |
| 102 | div#hbdrop { |
| 103 | background-color: white; |
| 104 | border: 1px solid black; |
| 105 | border-top: white; |
| 106 | border-radius: 0 0 0.5em 0.5em; |
| 107 | display: none; |
| 108 | font-size: 80%; |
| 109 | left: 2em; |
| 110 | max-width: 33%; |
| 111 | position: absolute; |
| 112 | z-index: 20; /* just below mainmenu, but above timeline bubbles */ |
| 113 | } |
| 114 | |
| 115 | .submenu { |
| 116 | font-size: .7em; |
| 117 | padding: 10px; |
| 118 | border-bottom: 1px solid #ccc; |
| 119 |
+34
| --- skins/default/footer.txt | ||
| +++ skins/default/footer.txt | ||
| @@ -1,5 +1,39 @@ | ||
| 1 | 1 | <div class="footer"> |
| 2 | 2 | This page was generated in about |
| 3 | 3 | <th1>puts [expr {([utime]+[stime]+1000)/1000*0.001}]</th1>s by |
| 4 | 4 | Fossil $release_version $manifest_version $manifest_date |
| 5 | 5 | </div> |
| 6 | + | |
| 7 | +<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | |
| 8 | +<th1> | |
| 9 | + html "<script nonce='$nonce'>" | |
| 10 | + html " (function() { var home='$home'; " | |
| 11 | +</th1> | |
| 12 | + var panel = $("div#hbdrop"); | |
| 13 | + | |
| 14 | + function hidePanel() { panel.slideUp() } | |
| 15 | + function showPanel() { panel.slideDown() } | |
| 16 | + | |
| 17 | + panel.on('click', hidePanel); | |
| 18 | + | |
| 19 | + var needSitemapHTML = true; | |
| 20 | + $("div.mainmenu > a").first().on('click', function() { | |
| 21 | + if (panel.is(":visible")) { | |
| 22 | + // Hamburger button clicked a second time. | |
| 23 | + hidePanel(); | |
| 24 | + } | |
| 25 | + else if (needSitemapHTML) { | |
| 26 | + // Only get it once per page load: it isn't likely to | |
| 27 | + // change on us. | |
| 28 | + $.get(home + '/sitemap', function(reply) { | |
| 29 | + panel.html($("ul#sitemap", reply)); | |
| 30 | + needSitemapHTML = false; | |
| 31 | + showPanel(); | |
| 32 | + }); | |
| 33 | + } | |
| 34 | + else { | |
| 35 | + showPanel(); // just show what we built above | |
| 36 | + } | |
| 37 | + }); | |
| 38 | + })(); | |
| 39 | +</script> | |
| 6 | 40 |
| --- skins/default/footer.txt | |
| +++ skins/default/footer.txt | |
| @@ -1,5 +1,39 @@ | |
| 1 | <div class="footer"> |
| 2 | This page was generated in about |
| 3 | <th1>puts [expr {([utime]+[stime]+1000)/1000*0.001}]</th1>s by |
| 4 | Fossil $release_version $manifest_version $manifest_date |
| 5 | </div> |
| 6 |
| --- skins/default/footer.txt | |
| +++ skins/default/footer.txt | |
| @@ -1,5 +1,39 @@ | |
| 1 | <div class="footer"> |
| 2 | This page was generated in about |
| 3 | <th1>puts [expr {([utime]+[stime]+1000)/1000*0.001}]</th1>s by |
| 4 | Fossil $release_version $manifest_version $manifest_date |
| 5 | </div> |
| 6 | |
| 7 | <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> |
| 8 | <th1> |
| 9 | html "<script nonce='$nonce'>" |
| 10 | html " (function() { var home='$home'; " |
| 11 | </th1> |
| 12 | var panel = $("div#hbdrop"); |
| 13 | |
| 14 | function hidePanel() { panel.slideUp() } |
| 15 | function showPanel() { panel.slideDown() } |
| 16 | |
| 17 | panel.on('click', hidePanel); |
| 18 | |
| 19 | var needSitemapHTML = true; |
| 20 | $("div.mainmenu > a").first().on('click', function() { |
| 21 | if (panel.is(":visible")) { |
| 22 | // Hamburger button clicked a second time. |
| 23 | hidePanel(); |
| 24 | } |
| 25 | else if (needSitemapHTML) { |
| 26 | // Only get it once per page load: it isn't likely to |
| 27 | // change on us. |
| 28 | $.get(home + '/sitemap', function(reply) { |
| 29 | panel.html($("ul#sitemap", reply)); |
| 30 | needSitemapHTML = false; |
| 31 | showPanel(); |
| 32 | }); |
| 33 | } |
| 34 | else { |
| 35 | showPanel(); // just show what we built above |
| 36 | } |
| 37 | }); |
| 38 | })(); |
| 39 | </script> |
| 40 |
+2
-4
| --- skins/default/header.txt | ||
| +++ skins/default/header.txt | ||
| @@ -17,10 +17,11 @@ | ||
| 17 | 17 | html "<a href='$home$url' class='active $cls'>$name</a>\n" |
| 18 | 18 | } else { |
| 19 | 19 | html "<a href='$home$url' class='$cls'>$name</a>\n" |
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | +html "<a href='#'>☰</a>" | |
| 22 | 23 | menulink $index_page Home {} |
| 23 | 24 | if {[anycap jor]} { |
| 24 | 25 | menulink /timeline Timeline {} |
| 25 | 26 | } |
| 26 | 27 | if {[hascap oh]} { |
| @@ -39,13 +40,10 @@ | ||
| 39 | 40 | if {[hascap j]} { |
| 40 | 41 | menulink /wiki Wiki wideonly |
| 41 | 42 | } |
| 42 | 43 | if {[hascap s]} { |
| 43 | 44 | menulink /setup Admin {} |
| 44 | - menulink /sitemap More... wideonly | |
| 45 | 45 | } elseif {[hascap a]} { |
| 46 | 46 | menulink /setup_ulist Users {} |
| 47 | - menulink /sitemap More... {} | |
| 48 | -} else { | |
| 49 | - menulink /sitemap More... {} | |
| 50 | 47 | } |
| 51 | 48 | </th1></div> |
| 49 | +<div id='hbdrop'></div> | |
| 52 | 50 |
| --- skins/default/header.txt | |
| +++ skins/default/header.txt | |
| @@ -17,10 +17,11 @@ | |
| 17 | html "<a href='$home$url' class='active $cls'>$name</a>\n" |
| 18 | } else { |
| 19 | html "<a href='$home$url' class='$cls'>$name</a>\n" |
| 20 | } |
| 21 | } |
| 22 | menulink $index_page Home {} |
| 23 | if {[anycap jor]} { |
| 24 | menulink /timeline Timeline {} |
| 25 | } |
| 26 | if {[hascap oh]} { |
| @@ -39,13 +40,10 @@ | |
| 39 | if {[hascap j]} { |
| 40 | menulink /wiki Wiki wideonly |
| 41 | } |
| 42 | if {[hascap s]} { |
| 43 | menulink /setup Admin {} |
| 44 | menulink /sitemap More... wideonly |
| 45 | } elseif {[hascap a]} { |
| 46 | menulink /setup_ulist Users {} |
| 47 | menulink /sitemap More... {} |
| 48 | } else { |
| 49 | menulink /sitemap More... {} |
| 50 | } |
| 51 | </th1></div> |
| 52 |
| --- skins/default/header.txt | |
| +++ skins/default/header.txt | |
| @@ -17,10 +17,11 @@ | |
| 17 | html "<a href='$home$url' class='active $cls'>$name</a>\n" |
| 18 | } else { |
| 19 | html "<a href='$home$url' class='$cls'>$name</a>\n" |
| 20 | } |
| 21 | } |
| 22 | html "<a href='#'>☰</a>" |
| 23 | menulink $index_page Home {} |
| 24 | if {[anycap jor]} { |
| 25 | menulink /timeline Timeline {} |
| 26 | } |
| 27 | if {[hascap oh]} { |
| @@ -39,13 +40,10 @@ | |
| 40 | if {[hascap j]} { |
| 41 | menulink /wiki Wiki wideonly |
| 42 | } |
| 43 | if {[hascap s]} { |
| 44 | menulink /setup Admin {} |
| 45 | } elseif {[hascap a]} { |
| 46 | menulink /setup_ulist Users {} |
| 47 | } |
| 48 | </th1></div> |
| 49 | <div id='hbdrop'></div> |
| 50 |
+1
-1
| --- src/sitemap.c | ||
| +++ src/sitemap.c | ||
| @@ -46,11 +46,11 @@ | ||
| 46 | 46 | login_check_credentials(); |
| 47 | 47 | srchFlags = search_restrict(SRCH_ALL); |
| 48 | 48 | style_header("Site Map"); |
| 49 | 49 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 50 | 50 | @ <div class="columns" style="column-width:20em"> |
| 51 | - @ <ul> | |
| 51 | + @ <ul id="sitemap"> | |
| 52 | 52 | @ <li>%z(href("%R/home"))Home Page</a> |
| 53 | 53 | for(i=0; i<sizeof(aExtra)/sizeof(aExtra[0]); i++){ |
| 54 | 54 | char *z = db_get(aExtra[i].zProperty,0); |
| 55 | 55 | if( z==0 || z[0]==0 ) continue; |
| 56 | 56 | if( !inSublist ){ |
| 57 | 57 |
| --- src/sitemap.c | |
| +++ src/sitemap.c | |
| @@ -46,11 +46,11 @@ | |
| 46 | login_check_credentials(); |
| 47 | srchFlags = search_restrict(SRCH_ALL); |
| 48 | style_header("Site Map"); |
| 49 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 50 | @ <div class="columns" style="column-width:20em"> |
| 51 | @ <ul> |
| 52 | @ <li>%z(href("%R/home"))Home Page</a> |
| 53 | for(i=0; i<sizeof(aExtra)/sizeof(aExtra[0]); i++){ |
| 54 | char *z = db_get(aExtra[i].zProperty,0); |
| 55 | if( z==0 || z[0]==0 ) continue; |
| 56 | if( !inSublist ){ |
| 57 |
| --- src/sitemap.c | |
| +++ src/sitemap.c | |
| @@ -46,11 +46,11 @@ | |
| 46 | login_check_credentials(); |
| 47 | srchFlags = search_restrict(SRCH_ALL); |
| 48 | style_header("Site Map"); |
| 49 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 50 | @ <div class="columns" style="column-width:20em"> |
| 51 | @ <ul id="sitemap"> |
| 52 | @ <li>%z(href("%R/home"))Home Page</a> |
| 53 | for(i=0; i<sizeof(aExtra)/sizeof(aExtra[0]); i++){ |
| 54 | char *z = db_get(aExtra[i].zProperty,0); |
| 55 | if( z==0 || z[0]==0 ) continue; |
| 56 | if( !inSublist ){ |
| 57 |
+1
-1
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -391,11 +391,11 @@ | ||
| 391 | 391 | @ <html> |
| 392 | 392 | @ <head> |
| 393 | 393 | @ <base href="$baseurl/$current_page" /> |
| 394 | 394 | @ <meta http-equiv="Content-Security-Policy" \ |
| 395 | 395 | @ content="default-src 'self' data: ; \ |
| 396 | -@ script-src 'self' 'nonce-$<nonce>' ;\ | |
| 396 | +@ script-src 'self' 'nonce-$<nonce>' ajax.googleapis.com ;\ | |
| 397 | 397 | @ style-src 'self' 'unsafe-inline'" /> |
| 398 | 398 | @ <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 399 | 399 | @ <title>$<project_name>: $<title></title> |
| 400 | 400 | @ <link rel="alternate" type="application/rss+xml" title="RSS Feed" \ |
| 401 | 401 | @ href="$home/timeline.rss" /> |
| 402 | 402 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -391,11 +391,11 @@ | |
| 391 | @ <html> |
| 392 | @ <head> |
| 393 | @ <base href="$baseurl/$current_page" /> |
| 394 | @ <meta http-equiv="Content-Security-Policy" \ |
| 395 | @ content="default-src 'self' data: ; \ |
| 396 | @ script-src 'self' 'nonce-$<nonce>' ;\ |
| 397 | @ style-src 'self' 'unsafe-inline'" /> |
| 398 | @ <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 399 | @ <title>$<project_name>: $<title></title> |
| 400 | @ <link rel="alternate" type="application/rss+xml" title="RSS Feed" \ |
| 401 | @ href="$home/timeline.rss" /> |
| 402 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -391,11 +391,11 @@ | |
| 391 | @ <html> |
| 392 | @ <head> |
| 393 | @ <base href="$baseurl/$current_page" /> |
| 394 | @ <meta http-equiv="Content-Security-Policy" \ |
| 395 | @ content="default-src 'self' data: ; \ |
| 396 | @ script-src 'self' 'nonce-$<nonce>' ajax.googleapis.com ;\ |
| 397 | @ style-src 'self' 'unsafe-inline'" /> |
| 398 | @ <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 399 | @ <title>$<project_name>: $<title></title> |
| 400 | @ <link rel="alternate" type="application/rss+xml" title="RSS Feed" \ |
| 401 | @ href="$home/timeline.rss" /> |
| 402 |