From 177219feb72ce604064dc2bb629157d0de0a9803 Mon Sep 17 00:00:00 2001 From: Wim Brand Date: Wed, 17 Jul 2019 23:19:57 +0200 Subject: [PATCH] Lots of style fixes --- res/static/script/ListNavigator.js | 45 +++-- res/static/script/Toolbar.js | 4 +- res/static/script/Viewer.js | 11 +- res/static/style/layout.css | 50 +++--- res/static/style/viewer.css | 222 ++++++++++++++----------- res/template/account/file_manager.html | 8 +- res/template/account/logout.html | 2 +- res/template/account/register.html | 137 --------------- res/template/account/user_files.html | 2 +- res/template/account/user_home.html | 6 +- res/template/admin.html | 1 - res/template/file_viewer.html | 165 +++++++++--------- res/template/fragments/footer.html | 2 +- res/template/fragments/form.html | 6 +- res/template/fragments/menu.html | 2 +- res/template/history.html | 7 +- res/template/home.html | 8 +- res/template/maintenance.html | 2 +- res/template/widgets.html | 10 +- webcontroller/user_style.go | 118 ++++++------- 20 files changed, 360 insertions(+), 448 deletions(-) delete mode 100644 res/template/account/register.html diff --git a/res/static/script/ListNavigator.js b/res/static/script/ListNavigator.js index b0848c0..bed875c 100644 --- a/res/static/script/ListNavigator.js +++ b/res/static/script/ListNavigator.js @@ -67,13 +67,13 @@ var ListNavigator = { this.addToHistory(index); - $("#listNavigatorItems").find("*").css("border-color", "#333"); - $("#listNavigatorItems div").eq(this.position).css("border-color", "#fff"); + $("#listNavigatorItems").find("*").removeClass("list_item_selected"); + $("#listNavigatorItems div").eq(this.position).addClass("list_item_selected"); // This centers the scroll bar exactly on the selected item $("#listNavigatorItems").animate( { - scrollLeft: (this.position * 109) - (($("#listNavigatorItems").width() / 2) - 55) + scrollLeft: ((this.position * 109) + (109/2)) - ($("#listNavigator").width() / 2) }, { duration: 1000, queue: false @@ -110,8 +110,8 @@ var ListNavigator = { }, loadThumbnails: function(index){ - var startPos = +index - 30; - var endPos = +index + 30; + var startPos = +index - 50; + var endPos = +index + 50; // fyi, the + is to let javascript know it's actually a number instead of a string if(startPos < 0){ @@ -126,12 +126,17 @@ var ListNavigator = { var navigatorItems = document.getElementById("listNavigatorItems").children for (i = startPos; i <= endPos; i++){ + if (navigatorItems[i].innerHTML.includes("listItemThumbnail")) { + console.log("skip"); + continue; + } + var thumb = "/api/file/" + this.data[i].id + "/thumbnail"; var name = this.data[i].name; var itemHtml = escapeHTML(name) + "
" + "\"""; + + "class=\"listItemThumbnail\" alt=\"" + escapeHTML(name) + "\"/>"; navigatorItems[i].innerHTML = itemHtml; } @@ -165,6 +170,22 @@ var ListNavigator = { this.setItem(0); } + var btnLastItem = document.createElement("button"); + btnLastItem.innerText = "◀"; + btnLastItem.setAttribute("id", "button_last_item"); + btnLastItem.setAttribute("class", "button_highlight"); + btnLastItem.setAttribute("onClick", "ListNavigator.previousItem();"); + + var btnNextItem = document.createElement("button"); + btnNextItem.innerText = "▶"; + btnNextItem.setAttribute("id", "button_next_item"); + btnNextItem.setAttribute("class", "button_highlight"); + btnNextItem.setAttribute("onClick", "ListNavigator.nextItem();"); + + var headerbar = document.getElementById("list_navigator_buttons"); + headerbar.appendChild(btnLastItem); + headerbar.appendChild(btnNextItem); + // Add the list download button to the toolbar var btnDownloadList = document.createElement("button"); btnDownloadList.setAttribute("id", "btnDownloadList"); @@ -199,16 +220,8 @@ var ListNavigator = { btnShuffle.appendChild(btnShuffleText); document.getElementById("btnShare").after(btnShuffle); - // We need to adjust the height of some elements to make the navigation bar fit - var navHeight = $("#listNavigator").height() + 2; - - window.setTimeout(function(){ - document.getElementById("listNavigator").style.top = "0px"; - document.getElementById("filepreview").style.top = navHeight+"px"; - document.getElementById("toolbar").style.top = navHeight+"px"; - document.getElementById("button-expand-toolbar").style.top = navHeight+"px"; - document.getElementById("sharebar").style.top = navHeight+"px"; - }, 200); + // Make the navigator visible + document.getElementById("listNavigator").style.display = "inline-block"; } }; diff --git a/res/static/script/Toolbar.js b/res/static/script/Toolbar.js index 32140af..56b58a4 100644 --- a/res/static/script/Toolbar.js +++ b/res/static/script/Toolbar.js @@ -9,7 +9,7 @@ /* global Viewer */ var Toolbar = { - visible: true, + visible: false, toggle: function () { if (this.visible) { if (Sharebar.visible) { @@ -18,11 +18,13 @@ var Toolbar = { document.getElementById("toolbar").style.left = "-9em"; document.getElementById("filepreview").style.left = "0px"; + document.getElementById("button_toggle_toolbar").classList.remove("button_highlight"); this.visible = false; } else { document.getElementById("toolbar").style.left = "0px"; document.getElementById("filepreview").style.left = "8em"; + document.getElementById("button_toggle_toolbar").classList.add("button_highlight"); this.visible = true; } diff --git a/res/static/script/Viewer.js b/res/static/script/Viewer.js index af96508..13164a4 100644 --- a/res/static/script/Viewer.js +++ b/res/static/script/Viewer.js @@ -14,7 +14,7 @@ var Viewer = { } // On small screens the toolbar takes too much space, so it collapses automatically - if($("#filepreview").width() < 400 && Toolbar.visible){ + if($("#filepreview").width() > 400 && !Toolbar.visible){ Toolbar.toggle(); } @@ -34,7 +34,14 @@ var Viewer = { }, setFile: function(file){ this.currentFile = file.id; - document.title = file.name + " ~ PixelDrain"; + var title = ""; + if (this.isList) { + title = this.title + " ~ " + file.name; + } else { + title = file.name; + } + document.title = title + " ~ PixelDrain"; + document.getElementById("file_viewer_headerbar_title").innerText = title; $.get("/u/" + file.id + "/preview", function(response){ $("#filepreview").html(response); diff --git a/res/static/style/layout.css b/res/static/style/layout.css index c50b859..39d6ddc 100644 --- a/res/static/style/layout.css +++ b/res/static/style/layout.css @@ -141,6 +141,7 @@ body{ } } +.highlight_headerbar, .highlight_dark, .highlight_middle, .highlight_light, @@ -157,17 +158,17 @@ body{ padding: .5em; z-index: 101; } +.highlight_headerbar { + background-color: var(--accent_color_headerbar); + box-shadow: 1px 1px 3px -1px var(--shadow_color);} .highlight_dark { background-color: var(--accent_color_dark); - border-color: var(--accent_color_dark_border); box-shadow: inset 1px 1px 8px -1px var(--shadow_color);} .highlight_middle { background-color: var(--accent_color_medium); - border-color: var(--accent_color_medium_border); box-shadow: inset 1px 1px 6px -1px var(--shadow_color);} .highlight_light { background-color: var(--accent_color_light); - border-color: var(--accent_color_light_border); box-shadow: 1px 1px 4px var(--shadow_color);} .highlight_green { background-color: rgba(0, 255, 0, 0.05); @@ -179,18 +180,15 @@ body{ background-color: rgba(255, 0, 0, 0.1); border-color: #B00000;} -body > .highlight_dark, -body > .highlight_middle, -body > .highlight_light, -body > .highlight_green, -body > .highlight_blue, -body > .highlight_red { - margin: 0; +.highlight_green, +.highlight_blue, +.highlight_red { + border-top-width: 1px; + border-top-style: solid; + border-bottom-width: 1px; + border-bottom-style: solid; } -.border_top {border-top-width: 1px; border-top-style: solid;} -.border_bottom {border-bottom-width: 1px; border-bottom-style: solid;} - /* Common elements */ h1, h2, h3, h4, h5, h6 { @@ -261,7 +259,7 @@ pre{ min-width: 200px; max-width: 400px; margin: 10px !important; - border-radius: 10px; + border-radius: 5px; font-size: 1.9em; font-weight: normal; line-height: 8px; @@ -303,8 +301,8 @@ pre{ margin: 6px; padding: 0; overflow: hidden; - border-radius: 0.4em; - box-shadow: 2px 2px 8px -1px var(--shadow_color); + border-radius: 5px; + box-shadow: 2px 2px 8px -3px var(--shadow_color); /* border: 1px solid var(--accent_color_dark); */ background-color: var(--file_background_color); color: #bfbfbf; /* Fallback */ @@ -342,12 +340,12 @@ input[type="color"], select{ display: inline-block; box-sizing: border-box; - border-radius: 4px; + border-radius: 2px; border: none; - margin: 2px; + margin: 3px; background: linear-gradient(var(--input_color), var(--input_color_dark)); padding: 6px 8px 6px 8px; - box-shadow: 2px 2px 6px -2px var(--shadow_color); + box-shadow: 2px 2px 6px -3px var(--shadow_color); font-weight: bold; font-size: 0.85em; overflow: hidden; @@ -375,7 +373,7 @@ select:focus{ color: #bfbfbf; /* Fallback */ color: var(--input_text_color); text-decoration: none; - box-shadow: var(--highlight_border), 2px 2px 6px -2px var(--shadow_color); + box-shadow: var(--highlight_border), 2px 2px 6px -3px var(--shadow_color); } button:active, .button:active, @@ -385,13 +383,13 @@ input[type="color"]:active, select:active{ background: linear-gradient(var(--input_color_dark), var(--input_color)); box-shadow: inset 4px 4px 8px var(--shadow_color); - padding: 11px 3px 1px 13px; /* Exactly 5px offset compared to the inactive padding to give a depth effect */ + padding: 10px 4px 2px 12px; /* Exactly 4px offset compared to the inactive padding to give a depth effect */ } -.button_full_width {width: calc(100% - 4px);} +.button_full_width {width: calc(100% - 6px);} .button_highlight {background: linear-gradient(var(--highlight_color), var(--highlight_color_dark)) !important; color: var(--highlight_text_color) !important;} .button_highlight:active{background: linear-gradient(var(--highlight_color_dark), var(--highlight_color)) !important; color: var(--highlight_text_color) !important;} -.button_red {background: linear-gradient(var(--danger_color), var(--danger_color_dark)) !important;} -.button_red:active {background: linear-gradient(var(--danger_color_dark), var(--danger_color)) !important;} +.button_red {background: linear-gradient(var(--danger_color), var(--danger_color_dark)) !important; color: var(--highlight_text_color) !important;} +.button_red:active {background: linear-gradient(var(--danger_color_dark), var(--danger_color)) !important; color: var(--highlight_text_color) !important;} /* Dropdown list of the select tag */ option{ @@ -411,7 +409,7 @@ input[type="number"]{ box-sizing: border-box; border-radius: 4px; background: linear-gradient(var(--input_color_dark), var(--input_color)); - box-shadow: inset 2px 2px 6px -2px var(--shadow_color); + box-shadow: inset 2px 2px 6px -3px var(--shadow_color); padding: 3px 5px; color: var(--input_text_color); height: 26px; @@ -431,7 +429,7 @@ input[type="text"]:focus, input[type="password"]:focus, input[type="email"]:focus, input[type="number"]:focus{ - box-shadow: var(--highlight_border), inset 3px 3px 6px -2px var(--shadow_color); + box-shadow: var(--highlight_border), inset 3px 3px 6px -3px var(--shadow_color); } input[type=file]{ diff --git a/res/static/style/viewer.css b/res/static/style/viewer.css index 3f6f444..d0fbe4e 100644 --- a/res/static/style/viewer.css +++ b/res/static/style/viewer.css @@ -7,13 +7,82 @@ body{ overflow: hidden; } -#filepreview{ +.file_viewer { position: absolute; + display: flex; + flex-direction: column; + top: 0; + right: 0; + bottom: 0; + left: 0; + overflow: hidden; +} +.file_viewer > .highlight_headerbar { + flex-grow: 0; + flex-shrink: 0; + display: flex; + flex-direction: row; + line-height: 1.9em; + text-align: left; + font-size: 1.2em; +} +.file_viewer > .highlight_headerbar > .button_toggle_toolbar { + flex-grow: 0; + flex-shrink: 0; +} +.file_viewer > .highlight_headerbar > .button_home { + flex-grow: 0; + flex-shrink: 0; + margin-right: .5em; +} +.file_viewer > .highlight_headerbar > .file_viewer_headerbar_title { + flex-grow: 1; + flex-shrink: 1; + overflow: hidden; + white-space: nowrap; + font-size: 0.8em; +} +.file_viewer > .highlight_headerbar > .list_navigator_buttons { + flex-grow: 0; + flex-shrink: 0; + display: inline-flex; +} +.file_viewer > .highlight_headerbar > .button_close_file_viewer { + flex-grow: 0; + flex-shrink: 0; + margin-left: .5em; +} +.file_viewer > .list_navigator{ + flex-grow: 0; + flex-shrink: 0; + position: relative; + display: none; /* Becomes visible if the page is a list */ + width: 100%; + height: 100px; + background-color: var(--accent_color_dark); + box-shadow: 2px 2px 8px var(--shadow_color); + text-align: center; + overflow-x: hidden; + overflow-y: hidden; + z-index: 50; + transition: top 1.5s; +} +.file_viewer > .file_viewer_window { + flex-grow: 1; + flex-shrink: 1; + position: relative; + display: inline-block; + width: auto; + height: auto; + margin: 0; +} +.file_viewer > .file_viewer_window > .file_viewer_file_preview { + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; display: inline-block; - top: 0px; - left: 8em; - right: 0px; - bottom: 0px; min-height: 100px; min-width: 100px; text-align: center; @@ -21,11 +90,44 @@ body{ transition: left 1s, top 1.5s; } +/* Toolbars */ +.file_viewer > .file_viewer_window > .file_viewer_toolbar { + position: absolute; + width: 8em; + z-index: 49; + overflow: hidden; + float: left; + background-color: var(--accent_color_dark); + left: -9em; + bottom: 0; + top: 0; + padding: 0; + text-align: left; + box-shadow: 2px 2px 8px var(--shadow_color); + transition: left 1s, top 1.5s; +} +.file_viewer > .file_viewer_window > .file_viewer_sharebar{ + position: absolute; + width: 7em; + left: -8em; + bottom: 0; + top: 0; + overflow-y: scroll; + overflow-x: hidden; + float: left; + background-color: var(--accent_color_dark); + box-shadow: 2px 2px 8px var(--shadow_color); + text-align: center; + z-index: 48; + overflow: hidden; + transition: left 1s, top 1.5s; +} + /* ===================== == FILE CONTAINERS == =====================*/ .image-container{ - position: absolute; + position: relative; top: 0px; left: 0px; right: 0px; @@ -46,7 +148,7 @@ body{ .text-container{ background: #333 none; - position: absolute; + position: relative; overflow-y: scroll; overflow-x: auto; text-align: left; @@ -94,22 +196,6 @@ body{ || TOOLBAR COMPONENTS || ======================== */ -#toolbar { - position: absolute; - width: 8em; - z-index: 52; - overflow: hidden; - float: left; - background-color: var(--background_color); - left: 0; - bottom: 0; - top: 0; - padding: 0; - text-align: left; - border-right: 2px ridge var(--highlight_color); - box-shadow: 2px 2px 8px var(--shadow_color); - transition: left 1s, top 1.5s; -} /* Workaround to hide the scrollbar in non webkit browsers, it's really ugly' */ #toolbar > div { @@ -129,14 +215,6 @@ body{ height: auto; } -#button-expand-toolbar{ - position: absolute; - left: 0; - top: 0; - cursor: pointer; - z-index: 51; -} - .toolbar_button{ text-align: left; } @@ -153,38 +231,13 @@ body{ padding-left: 10px; font-size: 0.8em; line-height: 0.7em; -} - -#sponsors{ - position: relative; - height: 600px; - width: 8em; - margin: 0; - border: none; - z-index: 9; + margin-top: 0.5em; } /* ========================= || SHAREBAR COMPONENTS || ========================= */ -#sharebar{ - position: absolute; - width: 7em; - left: -8em; - bottom: 0; - top: 0; - overflow-y: scroll; - overflow-x: hidden; - float: left; - background-color: var(--background_color); - box-shadow: 2px 2px 8px var(--shadow_color); - text-align: center; - border-right: 2px ridge var(--highlight_color); - z-index: 50; - overflow: hidden; - transition: left 1s, top 1.5s; -} .sharebar-button {text-align: center;} /* ===================== @@ -192,7 +245,7 @@ body{ ===================== */ .popup { - position: fixed; + position: absolute; visibility: hidden; display: flex; flex-direction: column; @@ -202,9 +255,9 @@ body{ border-color: var(--accent_color_dark_border); max-height: 100%; max-width: 100%; - top: 10%; + top: 20%; left: 50%; - transform: translate(-50%, -10%); + transform: translate(-50%, -20%); padding: 0; box-sizing: border-box; text-align: left; @@ -222,12 +275,12 @@ body{ .details_popup{ width: 1500px; height: 800px; - z-index: 100; + z-index: 200; } .captcha_popup{ height: auto; width: 450px; - z-index: 101; + z-index: 201; } #captcha_popup_captcha > div { display: inline-block; @@ -287,24 +340,9 @@ table > tbody > tr {border: none !important;} border: none; } -#listNavigator{ - position: absolute; - left: 0; - right: 0; - top: -100px; - height: 98px; - background-color: #000; - box-shadow: 2px 2px 8px #000000; - border-bottom: 2px ridge var(--highlight_color); - text-align: center; - overflow-x: hidden; - overflow-y: hidden; - z-index: 50; - transition: top 1.5s; -} #listNavigatorItems{ - position: absolute; + position: relative; top: 0; left: 0; right: 0; @@ -313,7 +351,7 @@ table > tbody > tr {border: none !important;} overflow-x: scroll; overflow-y: hidden; border: none; - padding: 0 40px; + padding: 0; } .listItem{ @@ -323,11 +361,15 @@ table > tbody > tr {border: none !important;} width: 100px; margin-right: 5px; text-align: center; - border: #333 solid 2px; + border: var(--input_color) solid 2px; + border-radius: 2px; font-size: 12px; overflow: hidden; cursor: pointer; } +.list_item_selected{ + border: var(--highlight_color) solid 2px; +} .listItemThumbnail{ position: relative; @@ -335,23 +377,3 @@ table > tbody > tr {border: none !important;} max-height: 84%; margin: 0; } - -#arrow-left, -#arrow-right{ - position: absolute; - display: block; - border-top: 30px solid transparent; - border-bottom: 30px solid transparent; - height: 0; - width: 0; - top: 20px; - cursor: pointer; -} -#arrow-left{ - border-right: 40px solid var(--highlight_color); - left: 10px; -} -#arrow-right{ - border-left: 40px solid var(--highlight_color); - right: 10px; -} diff --git a/res/template/account/file_manager.html b/res/template/account/file_manager.html index 464103d..ff2a990 100644 --- a/res/template/account/file_manager.html +++ b/res/template/account/file_manager.html @@ -7,7 +7,7 @@