| | @@ -1,131 +1,8 @@ |
| 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 | | -<th1> |
| 8 | | - html "<script nonce='$nonce'>" |
| 9 | | - html " (function() { var home='$home'; " |
| 10 | | -</th1> |
| 11 | | - var panel = document.getElementById("hbdrop"); |
| 12 | | - if (!panel) return; // site admin might've nuked it |
| 13 | | - var panelBorder = panel.style.border; |
| 14 | | - var animate = panel.style.hasOwnProperty('transition'); |
| 15 | | - var animMS = 400; |
| 16 | | - |
| 17 | | - // Calculate panel height despite its being hidden at call time. |
| 18 | | - // Based on https://stackoverflow.com/a/29047447/142454 |
| 19 | | - var panelHeight; // computed on sitemap load |
| 20 | | - function calculatePanelHeight() { |
| 21 | | - // Get initial panel styles so we can restore them below. |
| 22 | | - var es = window.getComputedStyle(panel), |
| 23 | | - edis = es.display, |
| 24 | | - epos = es.position, |
| 25 | | - evis = es.visibility; |
| 26 | | - |
| 27 | | - // Restyle the panel so we can measure its height while invisible. |
| 28 | | - panel.style.visibility = 'hidden'; |
| 29 | | - panel.style.position = 'absolute'; |
| 30 | | - panel.style.display = 'block'; |
| 31 | | - panelHeight = panel.offsetHeight + 'px'; |
| 32 | | - |
| 33 | | - // Revert styles now that job is done. |
| 34 | | - panel.style.display = edis; |
| 35 | | - panel.style.position = epos; |
| 36 | | - panel.style.visibility = evis; |
| 37 | | - } |
| 38 | | - |
| 39 | | - // Show the panel by changing the panel height, which kicks off the |
| 40 | | - // slide-open/closed transition set up in the XHR onload handler. |
| 41 | | - // |
| 42 | | - // Schedule the change for a near-future time in case this is the |
| 43 | | - // first call, where the div was initially invisible. That causes |
| 44 | | - // the browser to consider the height change as part of the same |
| 45 | | - // state change as the visibility change, so it doesn't see a state |
| 46 | | - // *transition*, hence never kicks off the *CSS* transition: |
| 47 | | - // |
| 48 | | - // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions#JavaScript_examples |
| 49 | | - function showPanel() { |
| 50 | | - if (animate) { |
| 51 | | - setTimeout(function() { |
| 52 | | - panel.style.maxHeight = panelHeight; |
| 53 | | - panel.style.border = panelBorder; |
| 54 | | - }, 40); // 25ms is insufficient with Firefox 62 |
| 55 | | - } |
| 56 | | - else { |
| 57 | | - panel.style.display = 'block'; |
| 58 | | - } |
| 59 | | - } |
| 60 | | - |
| 61 | | - // Return true if the panel is showing. |
| 62 | | - function panelShowing() { |
| 63 | | - if (animate) { |
| 64 | | - return panel.style.maxHeight == panelHeight; |
| 65 | | - } |
| 66 | | - else { |
| 67 | | - return panel.style.display == 'block'; |
| 68 | | - } |
| 69 | | - } |
| 70 | | - |
| 71 | | - // Click handler for the hamburger button. |
| 72 | | - var needSitemapHTML = true; |
| 73 | | - document.querySelector("div.mainmenu > a").onclick = function() { |
| 74 | | - if (panelShowing()) { |
| 75 | | - // Transition back to hidden state. |
| 76 | | - if (animate) { |
| 77 | | - panel.style.maxHeight = '0'; |
| 78 | | - setTimeout(function() { |
| 79 | | - // Browsers show a 1px high border line when maxHeight == 0, |
| 80 | | - // our "hidden" state, so hide the borders in that state, too. |
| 81 | | - panel.style.border = 'none'; |
| 82 | | - }, animMS); |
| 83 | | - } |
| 84 | | - else { |
| 85 | | - panel.style.display = 'none'; |
| 86 | | - } |
| 87 | | - } |
| 88 | | - else if (needSitemapHTML) { |
| 89 | | - // Only get it once per page load: it isn't likely to |
| 90 | | - // change on us. |
| 91 | | - var xhr = new XMLHttpRequest(); |
| 92 | | - xhr.onload = function() { |
| 93 | | - var doc = xhr.responseXML; |
| 94 | | - if (doc) { |
| 95 | | - var sm = doc.querySelector("ul#sitemap"); |
| 96 | | - if (sm && xhr.status == 200) { |
| 97 | | - // Got sitemap. Insert it into the drop-down panel. |
| 98 | | - needSitemapHTML = false; |
| 99 | | - panel.innerHTML = sm.outerHTML; |
| 100 | | - if (window.setAllHrefs) { |
| 101 | | - setAllHrefs(); // don't need anti-robot defense here |
| 102 | | - } |
| 103 | | - |
| 104 | | - // Display the panel |
| 105 | | - if (animate) { |
| 106 | | - // Set up a CSS transition to animate the panel open and |
| 107 | | - // closed. Only needs to be done once per page load. |
| 108 | | - // Based on https://stackoverflow.com/a/29047447/142454 |
| 109 | | - calculatePanelHeight(); |
| 110 | | - panel.style.transition = 'max-height ' + |
| 111 | | - (animMS / 1000) + 's ease-in-out'; |
| 112 | | - panel.style.overflowY = 'hidden'; |
| 113 | | - panel.style.maxHeight = '0'; |
| 114 | | - showPanel(); |
| 115 | | - } |
| 116 | | - panel.style.display = 'block'; |
| 117 | | - } |
| 118 | | - } |
| 119 | | - // else, can't parse response as HTML or XML |
| 120 | | - } |
| 121 | | - xhr.open("GET", home + "/sitemap"); |
| 122 | | - xhr.responseType = "document"; |
| 123 | | - xhr.send(); |
| 124 | | - } |
| 125 | | - else { |
| 126 | | - showPanel(); // just show what we built above |
| 127 | | - } |
| 128 | | - return false; // prevent browser from acting on <a> click |
| 129 | | - } |
| 130 | | - })(); |
| 6 | +<script nonce="$nonce"> |
| 7 | +<th1>styleScript</th1> |
| 131 | 8 | </script> |
| 132 | 9 | |
| 133 | 10 | ADDED skins/default/js.txt |
| 134 | 11 | DELETED skins/default/script.txt |