From 287b5af6fbf600b37801582dc398a44a25a4ac22 Mon Sep 17 00:00:00 2001 From: Wim Brand Date: Mon, 18 Feb 2019 13:37:41 +0100 Subject: [PATCH] Some optimizations. Improve font loading and embed global.css directly --- res/static/script/paste.js | 4 ++++ res/static/style/layout.css | 18 ++++++++++++++++-- res/template/404.html | 1 + res/template/500.html | 1 + res/template/account/file_manager.html | 1 + res/template/account/login.html | 1 + res/template/account/logout.html | 1 + res/template/account/register.html | 1 + res/template/account/user_files.html | 1 + res/template/account/user_home.html | 1 + res/template/account/user_lists.html | 1 + res/template/account/user_settings.html | 1 + res/template/apidoc.html | 1 + res/template/file_not_found.html | 1 + res/template/file_viewer.html | 4 +++- .../{metatags.html => meta_tags.html} | 1 - res/template/fragments/user_style.html | 5 +++++ res/template/history.html | 1 + res/template/home.html | 1 + res/template/paste.html | 1 + webcontroller/template_data.go | 2 ++ webcontroller/{style.go => user_style.go} | 17 +++++------------ webcontroller/web_controller.go | 1 - 23 files changed, 50 insertions(+), 17 deletions(-) rename res/template/fragments/{metatags.html => meta_tags.html} (96%) create mode 100644 res/template/fragments/user_style.html rename webcontroller/{style.go => user_style.go} (94%) diff --git a/res/static/script/paste.js b/res/static/script/paste.js index c31276c..68d51cc 100644 --- a/res/static/script/paste.js +++ b/res/static/script/paste.js @@ -5,6 +5,10 @@ function uploadText() { var text = $("#textarea").val(); + if(!text.endsWith("\n")){ + text += "\n"; + } + var blob = new Blob([text], {type: "text/plain"}); startFileUpload(blob); diff --git a/res/static/style/layout.css b/res/static/style/layout.css index 7f6a9aa..bc109bf 100644 --- a/res/static/style/layout.css +++ b/res/static/style/layout.css @@ -13,13 +13,27 @@ font-family: 'Ubuntu'; font-style: normal; font-weight: 400; - src: local('Ubuntu Regular'), local('Ubuntu-Regular'), local('Ubuntu'), url(/res/misc/Ubuntu-R.ttf) format('truetype'); + font-display: auto; + src: + local('Ubuntu'), + local('Ubuntu Regular'), + local('Ubuntu, Regular'), + local('Ubuntu-Regular'), + url(/res/misc/Ubuntu-R.ttf) format('truetype'); } @font-face { font-family: 'Lato'; font-style: normal; font-weight: 100; - src: local('Lato Hairline'), local('Lato-Hairline'), url(/res/misc/Lato-Hairline.ttf) format('truetype'); + font-display: auto; + src: + local('Lato Thin'), + local('Lato, Thin'), + local('Lato-Thin'), + local('Lato Hairline'), + local('Lato, Hairline'), + local('Lato-Hairline'), + url(/res/misc/Lato-Hairline.ttf) format('truetype'); } /* Page rendering configuration */ diff --git a/res/template/404.html b/res/template/404.html index f1e59c1..a79ced3 100644 --- a/res/template/404.html +++ b/res/template/404.html @@ -2,6 +2,7 @@ {{template "meta_tags" "Not Found"}} + {{template "user_style" .}} diff --git a/res/template/500.html b/res/template/500.html index 8bcf266..65192fd 100644 --- a/res/template/500.html +++ b/res/template/500.html @@ -2,6 +2,7 @@ {{template "meta_tags" "Internal Server Error"}} + {{template "user_style" .}} diff --git a/res/template/account/file_manager.html b/res/template/account/file_manager.html index 477bf28..5848e4d 100644 --- a/res/template/account/file_manager.html +++ b/res/template/account/file_manager.html @@ -2,6 +2,7 @@ {{template "meta_tags" "File Manager"}} + {{template "user_style" .}} diff --git a/res/template/fragments/metatags.html b/res/template/fragments/meta_tags.html similarity index 96% rename from res/template/fragments/metatags.html rename to res/template/fragments/meta_tags.html index 6b06561..9b0ac15 100644 --- a/res/template/fragments/metatags.html +++ b/res/template/fragments/meta_tags.html @@ -2,7 +2,6 @@ {{.}} ~ PixelDrain - diff --git a/res/template/fragments/user_style.html b/res/template/fragments/user_style.html new file mode 100644 index 0000000..7eb0e1e --- /dev/null +++ b/res/template/fragments/user_style.html @@ -0,0 +1,5 @@ +{{define "user_style"}} + +{{end}} diff --git a/res/template/history.html b/res/template/history.html index a8c4dd7..aa82831 100644 --- a/res/template/history.html +++ b/res/template/history.html @@ -2,6 +2,7 @@ {{template "meta_tags" "Upload History"}} + {{template "user_style" .}} diff --git a/res/template/home.html b/res/template/home.html index 56bd868..24967b3 100644 --- a/res/template/home.html +++ b/res/template/home.html @@ -3,6 +3,7 @@ {{template "meta_tags" "Free file sharing service"}} + {{template "user_style" .}} diff --git a/res/template/paste.html b/res/template/paste.html index 6063756..92254de 100644 --- a/res/template/paste.html +++ b/res/template/paste.html @@ -3,6 +3,7 @@ {{template "meta_tags" "Text Upload"}} + {{template "user_style" .}}