From e7df61a2541a435be5779fc191cbe7265f4bb5fb Mon Sep 17 00:00:00 2001 From: perennial Date: Mon, 14 Oct 2024 17:29:09 +1100 Subject: [PATCH] novel styling fix wip --- assets/css/bootstrap-style.css | 1 + assets/css/bootstrap-style.scss | 1 + assets/views/novel.jet.html | 64 ++++++++++++++++----------------- core/novel.go | 18 ++++++++-- i18n/locale/en/template.json | 1 + 5 files changed, 51 insertions(+), 34 deletions(-) diff --git a/assets/css/bootstrap-style.css b/assets/css/bootstrap-style.css index 81dcd26..a444fe6 100644 --- a/assets/css/bootstrap-style.css +++ b/assets/css/bootstrap-style.css @@ -14183,6 +14183,7 @@ h6, .h6 { writing-mode: vertical-rl; text-orientation: upright; direction: rtl; + max-height: 90vh; } #loading-indicator { diff --git a/assets/css/bootstrap-style.scss b/assets/css/bootstrap-style.scss index 11002f3..34119e9 100644 --- a/assets/css/bootstrap-style.scss +++ b/assets/css/bootstrap-style.scss @@ -389,6 +389,7 @@ h6 { writing-mode: vertical-rl; text-orientation: upright; direction: rtl; + max-height: 90vh; /// limit height so that only horizontal scrolling is needed } /// Loading indicator for hx-requests diff --git a/assets/views/novel.jet.html b/assets/views/novel.jet.html index 4488967..a441bd0 100644 --- a/assets/views/novel.jet.html +++ b/assets/views/novel.jet.html @@ -204,50 +204,50 @@ -
+
-
-
-
-

{{ .Novel.Title }}

-

{{ .User.Name }}

-

- {{ .Novel.WordCount }} word(s) · {{ floor: .Novel.ReadingTime / 60 }} mins -

+
+
+
+

{{ .Novel.Title }}

+

{{ .User.Name }}

+

+ {{ .Novel.WordCount }} word(s) · {{ floor: .Novel.ReadingTime / 60 }} mins +

+
+ + + + + +
- - - - - -
-
-

- {{- raw: renderNovel(.Novel.Content) }} -

+
+
+ {{- raw: renderNovel(.Novel.Content) }}> +
-
{{- if .Novel.SeriesNavData }} diff --git a/core/novel.go b/core/novel.go index 23ace0b..731f964 100644 --- a/core/novel.go +++ b/core/novel.go @@ -177,13 +177,27 @@ func GetNovelByID(r *http.Request, id string) (Novel, error) { // make [pixivimage:illustid-index] jump to anchor link := fmt.Sprintf("/artworks/%s", strings.ReplaceAll(illustid, "-", "#")) - return fmt.Sprintf(`%s`, link, url, s) + + imgClass := "img-fluid w-100" + if novel.Settings.ViewMode == 1 { + imgClass = "img-fluid h-50 w-50 rounded" + } + + return fmt.Sprintf(`%s`, link, url, s, imgClass) }) novel.Content = re_u.ReplaceAllStringFunc(novel.Content, func(s string) string { imageId := re_id.FindString(s) if val, ok := novel.TextEmbeddedImages[imageId]; ok { - return fmt.Sprintf(`%s`, val.Urls.Original, s) + // Styling for horizontal text + imgClass := "img-fluid h-50 w-50 rounded" + wrapperClass := "d-flex justify-content-start w-100 my-3" + // Styling for vertical text + if novel.Settings.ViewMode == 2 { + imgClass = "img-fluid h-100 w-100 rounded" + wrapperClass = "d-flex justify-content-start h-100 ms-3 me-3" + } + return fmt.Sprintf(`
%s
`, wrapperClass, val.Urls.Original, s, imgClass) } return s }) diff --git a/i18n/locale/en/template.json b/i18n/locale/en/template.json index cfb059b..6c362e1 100644 --- a/i18n/locale/en/template.json +++ b/i18n/locale/en/template.json @@ -163,6 +163,7 @@ "assets/views/novel.jet.html:fwJjmTkfPFo": "{{ seriesWorks }} works in this series", "assets/views/novel.jet.html:kZv9k39fa4s": "ยท", "assets/views/novel.jet.html:nu2CR4aefnc": "Options", + "assets/views/novel.jet.html:uq0P-PyMGRE": "{{- raw: renderNovel(.Novel.Content) }}>", "assets/views/novel.jet.html:y6pXNsQLNSg": "Forces the text to be displayed horizontally, left-to-right. This is common for most languages and easier to read on smaller screens or for those more accustomed to Western text layouts.", "assets/views/novelDiscovery.jet.html:6A6XAFPz7qQ": "Refresh", "assets/views/novelDiscovery.jet.html:ifjfMyvWvyA": "Discovery",