From 58e3984ffc643b1e052d45cd0fdb20dcdfe22b9c Mon Sep 17 00:00:00 2001 From: Wim Brand Date: Tue, 12 Oct 2021 21:25:43 +0200 Subject: [PATCH] Globally define theme colours --- res/include/script/dependencies/drawGraph.js | 2 +- res/include/script/file_viewer/Skyscraper.js | 9 ++++++++- res/template/file_viewer.html | 2 +- res/template/fragments/user_style.html | 16 ++++++++++++++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/res/include/script/dependencies/drawGraph.js b/res/include/script/dependencies/drawGraph.js index f3e9309..4252869 100644 --- a/res/include/script/dependencies/drawGraph.js +++ b/res/include/script/dependencies/drawGraph.js @@ -18,7 +18,7 @@ function drawGraph(element, label, dataType) { datasets: [ { label: label, - backgroundColor: highlightColor, + backgroundColor: "#" + window.style.highlightColor, borderWidth: 0, lineTension: 0, fill: true, diff --git a/res/include/script/file_viewer/Skyscraper.js b/res/include/script/file_viewer/Skyscraper.js index 5509893..ec2e5d3 100644 --- a/res/include/script/file_viewer/Skyscraper.js +++ b/res/include/script/file_viewer/Skyscraper.js @@ -19,9 +19,16 @@ Skyscraper.prototype.open = function () { } if (skyscraperType === "a-ads") { + let adsColours = "&background_color=" + window.style.layer2Color + + "&text_color=" + window.style.textColor + + "&title_color=" + window.style.highlightColor + + "&title_hover_color=" + window.style.highlightColor + + "&link_color=" + window.style.highlightColor + + "&link_hover_color=" + window.style.highlightColor + this.divAdSpace.innerHTML = `` } else { diff --git a/res/template/file_viewer.html b/res/template/file_viewer.html index e841c0b..7aca5b0 100644 --- a/res/template/file_viewer.html +++ b/res/template/file_viewer.html @@ -8,6 +8,7 @@ {{ template "opengraph" .OGData }} {{ template "user_style" . }} + {{ template "user_style_js" . }} @@ -324,7 +325,6 @@ let captchaKey = '{{.Other.CaptchaKey}}'; let embeddedViewer = {{.Other.Embedded}}; let userAuthenticated = {{.Authenticated}}; - let highlightColor = '#{{.Style.HighlightColor.RGB}}'; let skyscraperType = "{{.Other.AdSkyscraperType}}" {{template `util.js`}} diff --git a/res/template/fragments/user_style.html b/res/template/fragments/user_style.html index 689cd21..f7e1efb 100644 --- a/res/template/fragments/user_style.html +++ b/res/template/fragments/user_style.html @@ -4,3 +4,19 @@ {{template "layout.css" .}} {{end}} + +{{ define "user_style_js" }} + +{{ end }}