diff options
author | boastful-squirrel <boastful.squirrel@gmail.com> | 2019-11-21 23:18:23 +0000 |
---|---|---|
committer | boastful-squirrel <boastful.squirrel@gmail.com> | 2019-11-21 23:18:23 +0000 |
commit | 215447b7fc43da83f9e84e84299b524cf852b096 (patch) | |
tree | 3aa2acb72cd42a6989128dee2e2e008787501ccd /src/renderer.rs | |
parent | Merge branch 'master' into fix-#173 (diff) | |
download | miniserve-215447b7fc43da83f9e84e84299b524cf852b096.tar.gz miniserve-215447b7fc43da83f9e84e84299b524cf852b096.zip |
added missing head tag
Diffstat (limited to 'src/renderer.rs')
-rw-r--r-- | src/renderer.rs | 90 |
1 files changed, 46 insertions, 44 deletions
diff --git a/src/renderer.rs b/src/renderer.rs index 1787299..1821c48 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -806,53 +806,55 @@ fn page_header( is_error: bool, ) -> Markup { html! { - meta charset="utf-8"; - meta http-equiv="X-UA-Compatible" content="IE=edge"; - meta name="viewport" content="width=device-width, initial-scale=1"; - @if is_error { - title { (serve_path) } - } @else { - title { "Index of " (serve_path) } - } - style { (css(color_scheme)) } - @if file_upload { - (PreEscaped(r#" - <script> - window.onload = function() { - const dropContainer = document.querySelector('#drop-container'); - const dragForm = document.querySelector('.drag-form'); - const fileInput = document.querySelector('#file-input'); - const collection = []; - - dropContainer.ondragover = function(e) { - e.preventDefault(); - } - - dropContainer.ondragenter = function(e) { - e.preventDefault(); - if (collection.length === 0) { - dragForm.style.display = 'initial'; + head { + meta charset="utf-8"; + meta http-equiv="X-UA-Compatible" content="IE=edge"; + meta name="viewport" content="width=device-width, initial-scale=1"; + @if is_error { + title { (serve_path) } + } @else { + title { "Index of " (serve_path) } + } + style { (css(color_scheme)) } + @if file_upload { + (PreEscaped(r#" + <script> + window.onload = function() { + const dropContainer = document.querySelector('#drop-container'); + const dragForm = document.querySelector('.drag-form'); + const fileInput = document.querySelector('#file-input'); + const collection = []; + + dropContainer.ondragover = function(e) { + e.preventDefault(); } - collection.push(e.target); - }; - dropContainer.ondragleave = function(e) { - e.preventDefault(); - collection.splice(collection.indexOf(e.target), 1); - if (collection.length === 0) { + dropContainer.ondragenter = function(e) { + e.preventDefault(); + if (collection.length === 0) { + dragForm.style.display = 'initial'; + } + collection.push(e.target); + }; + + dropContainer.ondragleave = function(e) { + e.preventDefault(); + collection.splice(collection.indexOf(e.target), 1); + if (collection.length === 0) { + dragForm.style.display = 'none'; + } + }; + + dropContainer.ondrop = function(e) { + e.preventDefault(); + fileInput.files = e.dataTransfer.files; + file_submit.submit(); dragForm.style.display = 'none'; - } - }; - - dropContainer.ondrop = function(e) { - e.preventDefault(); - fileInput.files = e.dataTransfer.files; - file_submit.submit(); - dragForm.style.display = 'none'; - }; - } - </script> - "#)) + }; + } + </script> + "#)) + } } } } |