From 7b70ceefbf9ea9414b8add57a813cc5db053a6f6 Mon Sep 17 00:00:00 2001
From: clragon
Date: Mon, 10 Feb 2025 05:18:23 +0100
Subject: [PATCH 01/26] [UserFeedback] Fix filtering nil during restoration
(#901)
---
...3_convert_staffnote_to_deleted_feedback.rb | 23 +++++++++++--------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/db/fixes/123_convert_staffnote_to_deleted_feedback.rb b/db/fixes/123_convert_staffnote_to_deleted_feedback.rb
index 420e05fa2..77c698afa 100755
--- a/db/fixes/123_convert_staffnote_to_deleted_feedback.rb
+++ b/db/fixes/123_convert_staffnote_to_deleted_feedback.rb
@@ -8,23 +8,26 @@ destroyed_feedback_ids = []
CurrentUser.as_system do
ModAction.where(action: "user_feedback_destroy")
# On July 24, 2024, we deployed the ability to soft-delete feedback records.
- # We only care about restoring destroyed feedbacks that were destroyed before this date.
- # Any entries after this are "real" destructions, that do not need to be restored.
+ # We only restore feedback that was destroyed before this date.
+ # Any entries after this are intentional destructions that do not need to be restored.
.where("created_at < ?", CUTOFF_DATE = Date.new(2024, 8, 1))
.find_in_batches(batch_size: 10_000) do |batch|
- feedback_data = batch.map do |mod_action|
- record_id = mod_action.values["record_id"].to_i
+ feedback_data = batch.filter_map do |mod_action|
+ record_id = mod_action.values["record_id"]
+ category = mod_action.values["type"]
+ body = mod_action.values["reason"]
+
+ # Old mod actions do not contain the necessary information. Skip them.
+ next if record_id.nil? || category.nil? || body.nil?
+
destroyed_feedback_ids << record_id
- # old mod actions do not contain the necessary information. we skip them.
- next if mod_action.values["type"].nil? || mod_action.values["reason"].nil?
-
{
- id: record_id,
+ id: record_id.to_i,
user_id: mod_action.values["user_id"].to_i,
creator_id: User.system.id, # placeholder
- category: mod_action.values["type"],
- body: mod_action.values["reason"]&.strip,
+ category: category,
+ body: body.strip,
created_at: Date.new(1970, 1, 1), # placeholder
updated_at: mod_action.created_at,
updater_id: mod_action.creator_id,
From 1879a4c1f3d3b2c182ab6461c6a23873a020b483 Mon Sep 17 00:00:00 2001
From: Cinder
Date: Sun, 9 Feb 2025 20:32:33 -0800
Subject: [PATCH 02/26] [CSS] Begin refactoring view-specific styles (#902)
---
app/javascript/src/styles/base.scss | 4 +-
app/javascript/src/styles/base/_themable.scss | 12 +
.../src/styles/specific/post_index.scss | 287 ------------------
.../src/styles/views/posts/_posts.scss | 15 +
.../views/posts/index/_index.desktop.scss | 32 ++
.../src/styles/views/posts/index/_index.scss | 112 +++++++
.../posts/index/partials/_fullscreen.scss | 31 ++
.../posts/index/partials/_mode_menu.scss} | 2 +-
.../posts/index/partials/_wiki_excerpt.scss | 97 ++++++
9 files changed, 302 insertions(+), 290 deletions(-)
delete mode 100644 app/javascript/src/styles/specific/post_index.scss
create mode 100644 app/javascript/src/styles/views/posts/_posts.scss
create mode 100644 app/javascript/src/styles/views/posts/index/_index.desktop.scss
create mode 100644 app/javascript/src/styles/views/posts/index/_index.scss
create mode 100644 app/javascript/src/styles/views/posts/index/partials/_fullscreen.scss
rename app/javascript/src/styles/{specific/post_mode_menu.scss => views/posts/index/partials/_mode_menu.scss} (99%)
create mode 100644 app/javascript/src/styles/views/posts/index/partials/_wiki_excerpt.scss
diff --git a/app/javascript/src/styles/base.scss b/app/javascript/src/styles/base.scss
index 6ec5cfc2f..227cdab7f 100644
--- a/app/javascript/src/styles/base.scss
+++ b/app/javascript/src/styles/base.scss
@@ -42,6 +42,8 @@
@import "common/user_styles.scss";
@import "common/voting.scss";
+@import "views/posts/posts";
+
@import "specific/admin_dashboards.scss";
@import "specific/api_keys.scss";
@import "specific/artists.scss";
@@ -68,8 +70,6 @@
@import "specific/popular.scss";
@import "specific/post_delete.scss";
@import "specific/post_flags.scss";
-@import "specific/post_index.scss";
-@import "specific/post_mode_menu.scss";
@import "specific/posts.scss";
@import "specific/post_replacements.scss";
@import "specific/post_versions.scss";
diff --git a/app/javascript/src/styles/base/_themable.scss b/app/javascript/src/styles/base/_themable.scss
index 2c7dee3aa..4634774d1 100644
--- a/app/javascript/src/styles/base/_themable.scss
+++ b/app/javascript/src/styles/base/_themable.scss
@@ -19,3 +19,15 @@
@function themed($key) {
@return var(--#{$key});
}
+
+@mixin with-theme($key, $value) {
+ body[data-th-#{$key}="#{$value}"] {
+ @content;
+ }
+}
+
+@mixin with-setting($key, $value) {
+ body[data-st-#{$key}="#{$value}"] {
+ @content;
+ }
+}
diff --git a/app/javascript/src/styles/specific/post_index.scss b/app/javascript/src/styles/specific/post_index.scss
deleted file mode 100644
index 751a66ef5..000000000
--- a/app/javascript/src/styles/specific/post_index.scss
+++ /dev/null
@@ -1,287 +0,0 @@
-body.c-posts.a-index, body.c-favorites.a-index {
- #page {
- // Override the theme to instead
- // project it upon the content area
- background: none;
- padding: 0;
- }
-
- // Exhibit A
- // Makes the content area take up the
- // full height of the page. Yes, really.
- #page, #c-posts, #c-favorites, #a-index {
- // I hate both this and myself
- display: flex;
- flex-flow: column;
- flex: 1;
- }
-}
-
-.post-index {
- display: grid;
-
- grid-template-areas:
- "search "
- "content"
- "sidebar";
- grid-template-columns: 1fr;
- grid-template-rows: min-content 1fr min-content;
-
- flex: 1; // See Exhibit A
-
- // 1. Searchbox
- .search {
- grid-area: search;
-
- padding: 0.5rem 0.25rem;
- background-color: #152f56;
- background-color: themed("color-foreground");
- box-shadow: inset 0px -0.25rem 0.25rem -0.25rem themed("color-background");
-
- h1 {
- font-size: $h3-size;
- }
-
- .search-controls {
- display: none;
- flex-flow: column;
- }
- }
-
- // 2. Content
- .content {
- display: flex; // See Exhibit A
- flex-flow: column;
-
- grid-area: content;
-
- // Imported from #page
- padding: 0.5rem 0.25rem themed("content-padding-bottom");
- background-color: #152f56;
- background-color: themed("color-foreground");
- background-image: themed("image-foreground");
- background-position: themed("image-foreground-position");
- background-repeat: themed("image-foreground-repeat");
-
- // Quick tag edit
- #edit-dialog textarea {
- margin-bottom: 0.25rem;
- }
-
- // Actual content area:
- // posts and pagination
- .post-index-gallery {
- display: flex;
- flex-flow: column;
- gap: 1rem;
-
- flex: 1; // See Exhibit A
-
- .posts-container {
- flex: 1; // See Exhibit A
- grid-auto-rows: min-content;
- }
- }
- }
-
- // 3. Sidebar
- .sidebar {
- grid-area: sidebar;
-
- display: flex;
- flex-flow: column;
- gap: 1em;
-
- padding: 0.5rem 0.25rem;
- background-color: #152f56;
- background-color: themed("color-foreground");
- box-shadow: inset 0px 0.25rem 0.25rem -0.25rem themed("color-background");
-
- // Mode selection
- #mode-box-mode, #mode-box #set-id {
- width: 100%;
-
- // Match the searchbox
- padding: 0.5em;
- font-family: Verdana, sans-serif;
- font-size: 1.05em;
- }
- }
-}
-
-
-// Desktop
-.post-index {
- @include window-larger-than(50rem) {
- grid-template-areas:
- "search content"
- "sidebar content";
- grid-template-columns: 14rem 1fr;
- grid-template-rows: min-content 1fr;
-
- .search {
- box-shadow: inset -0.25rem 0px 0.25rem -0.25rem themed("color-background");
- margin-top: 0.25rem;
- border-top-left-radius: 0.25rem;
- padding: 0.5rem;
-
- .search-controls {
- display: flex;
- margin-top: 0.5rem;
- }
- }
-
- .sidebar {
- box-shadow: inset -0.25rem 0px 0.25rem -0.25rem themed("color-background");
- margin-bottom: 0.25rem;
- border-bottom-left-radius: 0.25rem;
- padding: 0.5rem
- }
-
- .content {
- border-radius: 0.25rem;
- }
- }
-}
-
-
-// Fullscreen
-body.c-posts.a-index[data-st-fullscreen="true"] {
- // Desktop-only, for obvious reasons
- @include window-larger-than(50rem) {
- .post-index {
- grid-template-areas:
- "search "
- "content";
- grid-template-columns: 1fr;
-
- .search {
- display: flex;
-
- border-radius: 0.25rem 0.25rem 0 0;
- box-shadow: inset 0px -0.25rem 0.25rem -0.25rem themed("color-background");
-
- .post-search {
- flex: 1;
- }
-
- .search-controls {
- display: flex;
- justify-content: right;
- align-self: end;
- margin: 0 0 0 0.5rem;
-
- .st-button.w100 {
- width: unset;
- span { display: none; }
- }
- }
- }
- .sidebar { display: none; }
- .content {
- border-radius: 0 0 0.25rem 0.25rem;
- }
- }
- }
-}
-
-
-// FEATURES
-// Wiki Excerpt
-.wiki-excerpt {
- display: flex;
- flex-flow: column;
- position: relative;
-
- background: themed("color-section");
- border-radius: 0.25rem;
-
- &.hidden { display: none; }
-
- // header
- h3 {
- display: flex;
- align-items: center;
-
- font-size: 1rem;
- padding: 0.5rem;
-
- cursor: pointer;
-
- & > svg {
- transition: transform 0.25s;
-
- height: 1.5rem;
- width: 1.5rem;
- }
-
- .wiki-excerpt-dismiss { margin-left: auto; }
- }
-
- // body
- .styled-dtext {
- background: linear-gradient(to top, themed("color-section"), themed("color-text"));
- -webkit-background-clip: text;
- background-clip: text;
- color: transparent;
-
- min-height: 0rem;
- max-height: 0rem;
- max-width: 50rem;
- overflow: hidden;
- padding: 0 0.5rem;
-
- transition: max-height 0.25s;
-
- // Disable links
- pointer-events: none;
- cursor: unset;
-
- a {
- color: unset;
- text-decoration: underline;
- &::after { content: none; }
- }
-
- p:last-child { margin-bottom: 0; }
- }
-
- // wiki link
- .wiki-excerpt-readmore {
- display: flex;
- justify-content: center;
- align-items: center;
-
- position: absolute;
- bottom: 0;
- left: 0;
- right: 0;
-
- height: 3rem;
- max-width: 50rem;
- box-sizing: border-box;
-
- // Makes the button appear in the middle of the animation
- transition: visibility 0s 0.125s;
- visibility: hidden;
-
- span {
- padding: 0.5rem 1rem;
- background: themed("color-section");
- border-radius: 0.25rem;
- }
- }
-
- &.open{
- .wiki-excerpt-toggle svg { transform: rotate(90deg); }
- .styled-dtext {
- max-height: 10rem;
- min-height: 2rem;
- }
- .wiki-excerpt-readmore { visibility: visible; }
- }
-
- &.loading {
- h3::after, .styled-dtext { transition: none; }
- }
-}
diff --git a/app/javascript/src/styles/views/posts/_posts.scss b/app/javascript/src/styles/views/posts/_posts.scss
new file mode 100644
index 000000000..833ab2586
--- /dev/null
+++ b/app/javascript/src/styles/views/posts/_posts.scss
@@ -0,0 +1,15 @@
+// Main themes
+@import "index/index";
+@include window-larger-than(50rem) {
+ @import "index/index.desktop";
+}
+
+// Features
+@import "index/partials/mode_menu";
+@import "index/partials/wiki_excerpt";
+
+@include window-larger-than(50rem) {
+ @include with-setting("fullscreen", "true") {
+ @import "index/partials/fullscreen";
+ }
+}
diff --git a/app/javascript/src/styles/views/posts/index/_index.desktop.scss b/app/javascript/src/styles/views/posts/index/_index.desktop.scss
new file mode 100644
index 000000000..ccb999563
--- /dev/null
+++ b/app/javascript/src/styles/views/posts/index/_index.desktop.scss
@@ -0,0 +1,32 @@
+// Desktop-only
+// Rollout at 50rem
+.post-index {
+ grid-template-areas:
+ "search content"
+ "sidebar content";
+ grid-template-columns: 14rem 1fr;
+ grid-template-rows: min-content 1fr;
+
+ .search {
+ box-shadow: inset -0.25rem 0px 0.25rem -0.25rem themed("color-background");
+ margin-top: 0.25rem;
+ border-top-left-radius: 0.25rem;
+ padding: 0.5rem;
+
+ .search-controls {
+ display: flex;
+ margin-top: 0.5rem;
+ }
+ }
+
+ .sidebar {
+ box-shadow: inset -0.25rem 0px 0.25rem -0.25rem themed("color-background");
+ margin-bottom: 0.25rem;
+ border-bottom-left-radius: 0.25rem;
+ padding: 0.5rem
+ }
+
+ .content {
+ border-radius: 0.25rem;
+ }
+}
diff --git a/app/javascript/src/styles/views/posts/index/_index.scss b/app/javascript/src/styles/views/posts/index/_index.scss
new file mode 100644
index 000000000..0d75e5c0e
--- /dev/null
+++ b/app/javascript/src/styles/views/posts/index/_index.scss
@@ -0,0 +1,112 @@
+body.c-posts.a-index, body.c-favorites.a-index {
+ #page {
+ // Override the theme to instead
+ // project it upon the content area
+ background: none;
+ padding: 0;
+ }
+
+ // Exhibit A
+ // Makes the content area take up the
+ // full height of the page. Yes, really.
+ #page, #c-posts, #c-favorites, #a-index {
+ // I hate both this and myself
+ display: flex;
+ flex-flow: column;
+ flex: 1;
+ }
+}
+
+
+// Post gallery
+.post-index {
+ display: grid;
+
+ grid-template-areas:
+ "search "
+ "content"
+ "sidebar";
+ grid-template-columns: 1fr;
+ grid-template-rows: min-content 1fr min-content;
+
+ flex: 1; // See Exhibit A
+
+ // 1. Searchbox
+ .search {
+ grid-area: search;
+
+ padding: 0.5rem 0.25rem;
+ background-color: #152f56;
+ background-color: themed("color-foreground");
+ box-shadow: inset 0px -0.25rem 0.25rem -0.25rem themed("color-background");
+
+ h1 {
+ font-size: $h3-size;
+ }
+
+ .search-controls {
+ display: none;
+ flex-flow: column;
+ }
+ }
+
+ // 2. Content
+ .content {
+ display: flex; // See Exhibit A
+ flex-flow: column;
+
+ grid-area: content;
+
+ // Imported from #page
+ padding: 0.5rem 0.25rem themed("content-padding-bottom");
+ background-color: #152f56;
+ background-color: themed("color-foreground");
+ background-image: themed("image-foreground");
+ background-position: themed("image-foreground-position");
+ background-repeat: themed("image-foreground-repeat");
+
+ // Quick tag edit
+ #edit-dialog textarea {
+ margin-bottom: 0.25rem;
+ }
+
+ // Actual content area:
+ // posts and pagination
+ .post-index-gallery {
+ display: flex;
+ flex-flow: column;
+ gap: 1rem;
+
+ flex: 1; // See Exhibit A
+
+ .posts-container {
+ flex: 1; // See Exhibit A
+ grid-auto-rows: min-content;
+ }
+ }
+ }
+
+ // 3. Sidebar
+ .sidebar {
+ grid-area: sidebar;
+
+ display: flex;
+ flex-flow: column;
+ gap: 1em;
+
+ padding: 0.5rem 0.25rem;
+ background-color: #152f56;
+ background-color: themed("color-foreground");
+ box-shadow: inset 0px 0.25rem 0.25rem -0.25rem themed("color-background");
+
+ // Mode selection
+ #mode-box-mode, #mode-box #set-id {
+ width: 100%;
+
+ // Match the searchbox
+ padding: 0.5em;
+ font-family: Verdana, sans-serif;
+ font-size: 1.05em;
+ }
+ }
+}
diff --git a/app/javascript/src/styles/views/posts/index/partials/_fullscreen.scss b/app/javascript/src/styles/views/posts/index/partials/_fullscreen.scss
new file mode 100644
index 000000000..6730b7019
--- /dev/null
+++ b/app/javascript/src/styles/views/posts/index/partials/_fullscreen.scss
@@ -0,0 +1,31 @@
+// Fullscreen mode
+// Only relevant on desktop
+.post-index {
+ grid-template-areas:
+ "search "
+ "content";
+ grid-template-columns: 1fr;
+
+ .search {
+ display: flex;
+ border-radius: 0.25rem 0.25rem 0 0;
+ box-shadow: inset 0px -0.25rem 0.25rem -0.25rem themed("color-background");
+ .post-search {
+ flex: 1;
+ }
+ .search-controls {
+ display: flex;
+ justify-content: right;
+ align-self: end;
+ margin: 0 0 0 0.5rem;
+ .st-button.w100 {
+ width: unset;
+ span { display: none; }
+ }
+ }
+ }
+ .sidebar { display: none; }
+ .content {
+ border-radius: 0 0 0.25rem 0.25rem;
+ }
+}
diff --git a/app/javascript/src/styles/specific/post_mode_menu.scss b/app/javascript/src/styles/views/posts/index/partials/_mode_menu.scss
similarity index 99%
rename from app/javascript/src/styles/specific/post_mode_menu.scss
rename to app/javascript/src/styles/views/posts/index/partials/_mode_menu.scss
index 467f43954..2bf3f62b8 100644
--- a/app/javascript/src/styles/specific/post_mode_menu.scss
+++ b/app/javascript/src/styles/views/posts/index/partials/_mode_menu.scss
@@ -32,4 +32,4 @@ $modes: (
input { flex: 1; }
button { padding: 0 0.25em; }
-}
\ No newline at end of file
+}
diff --git a/app/javascript/src/styles/views/posts/index/partials/_wiki_excerpt.scss b/app/javascript/src/styles/views/posts/index/partials/_wiki_excerpt.scss
new file mode 100644
index 000000000..4160e55a6
--- /dev/null
+++ b/app/javascript/src/styles/views/posts/index/partials/_wiki_excerpt.scss
@@ -0,0 +1,97 @@
+.wiki-excerpt {
+ display: flex;
+ flex-flow: column;
+ position: relative;
+
+ background: themed("color-section");
+ border-radius: 0.25rem;
+
+ &.hidden { display: none; }
+
+ // header
+ h3 {
+ display: flex;
+ align-items: center;
+
+ font-size: 1rem;
+ padding: 0.5rem;
+
+ cursor: pointer;
+
+ & > svg {
+ transition: transform 0.25s;
+
+ height: 1.5rem;
+ width: 1.5rem;
+ }
+
+ .wiki-excerpt-dismiss { margin-left: auto; }
+ }
+
+ // body
+ .styled-dtext {
+ background: linear-gradient(to top, themed("color-section"), themed("color-text"));
+ -webkit-background-clip: text;
+ background-clip: text;
+ color: transparent;
+
+ min-height: 0rem;
+ max-height: 0rem;
+ max-width: 50rem;
+ overflow: hidden;
+ padding: 0 0.5rem;
+
+ transition: max-height 0.25s;
+
+ // Disable links
+ pointer-events: none;
+ cursor: unset;
+
+ a {
+ color: unset;
+ text-decoration: underline;
+ &::after { content: none; }
+ }
+
+ p:last-child { margin-bottom: 0; }
+ }
+
+ // wiki link
+ .wiki-excerpt-readmore {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ right: 0;
+
+ height: 3rem;
+ max-width: 50rem;
+ box-sizing: border-box;
+
+ // Makes the button appear in the middle of the animation
+ transition: visibility 0s 0.125s;
+ visibility: hidden;
+
+ span {
+ padding: 0.5rem 1rem;
+ background: themed("color-section");
+ border-radius: 0.25rem;
+ }
+ }
+
+ &.open{
+ .wiki-excerpt-toggle svg { transform: rotate(90deg); }
+ .styled-dtext {
+ max-height: 10rem;
+ min-height: 2rem;
+ }
+ .wiki-excerpt-readmore { visibility: visible; }
+ }
+
+ &.loading {
+ h3::after, .styled-dtext { transition: none; }
+ }
+}
From 6c95fdd8e376e0135ce38cb5e47832df9edcb1f1 Mon Sep 17 00:00:00 2001
From: Cinder
Date: Tue, 11 Feb 2025 22:25:35 -0800
Subject: [PATCH 03/26] [Takedowns] Fix a couple of buttons linebreaking (#900)
---
app/javascript/src/javascripts/takedowns.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/javascript/src/javascripts/takedowns.js b/app/javascript/src/javascripts/takedowns.js
index 54335d012..437c5a19c 100644
--- a/app/javascript/src/javascripts/takedowns.js
+++ b/app/javascript/src/javascripts/takedowns.js
@@ -39,8 +39,8 @@ Takedown.add_posts_by_tags_preview = function (id) {
$("#takedown-add-posts-tags-warning").html(preview_text).show();
$("#takedown-add-posts-tags").prop("disabled", true);
$("#takedown-add-posts-tags-preview").hide();
- $("#takedown-add-posts-tags-confirm").show();
- $("#takedown-add-posts-tags-cancel").show();
+ $("#takedown-add-posts-tags-confirm").css("display", "inline-block");
+ $("#takedown-add-posts-tags-cancel").css("display", "inline-block");
}).fail(function (data) {
Utility.error(data.responseText);
});
From ac38fd11e74beb9bde7b0ef0d0067c18fea1203d Mon Sep 17 00:00:00 2001
From: Cinder
Date: Tue, 11 Feb 2025 22:25:46 -0800
Subject: [PATCH 04/26] [Posts] Add an approximate result counter (#903)
---
app/helpers/pagination_helper.rb | 23 +++++++++++++++++++
.../src/styles/views/posts/_posts.scss | 1 +
.../views/posts/index/partials/_stats.scss | 13 +++++++++++
app/views/posts/index.html.erb | 1 +
.../posts/partials/index/_stats.html.erb | 3 +++
5 files changed, 41 insertions(+)
create mode 100644 app/javascript/src/styles/views/posts/index/partials/_stats.scss
create mode 100644 app/views/posts/partials/index/_stats.html.erb
diff --git a/app/helpers/pagination_helper.rb b/app/helpers/pagination_helper.rb
index d293d422a..919014c6c 100644
--- a/app/helpers/pagination_helper.rb
+++ b/app/helpers/pagination_helper.rb
@@ -1,6 +1,29 @@
# frozen_string_literal: true
module PaginationHelper
+ def approximate_count(records)
+ return "" if records.pagination_mode != :numbered
+
+ if records.total_pages > records.max_numbered_pages
+ pages = records.max_numbered_pages
+ schar = "over "
+ count = pages * records.records_per_page
+ title = "Over #{count} results found.\nActual result count may be much larger."
+ else
+ pages = records.total_pages
+ schar = "~"
+ count = pages * records.records_per_page
+ title = "Approximately #{count} results found.\nActual result count may differ."
+ end
+
+ tag.span(class: "approximate-count", title: title, data: { count: count, pages: pages, per: records.max_numbered_pages }) do
+ concat schar
+ concat number_to_human(count, precision: 2, format: "%n%u", units: { thousand: "k" })
+ concat " "
+ concat "result".pluralize(count)
+ end
+ end
+
def sequential_paginator(records)
tag.nav(class: "pagination sequential", aria: { label: "Pagination" }) do
return "" if records.try(:none?)
diff --git a/app/javascript/src/styles/views/posts/_posts.scss b/app/javascript/src/styles/views/posts/_posts.scss
index 833ab2586..0508e64b5 100644
--- a/app/javascript/src/styles/views/posts/_posts.scss
+++ b/app/javascript/src/styles/views/posts/_posts.scss
@@ -7,6 +7,7 @@
// Features
@import "index/partials/mode_menu";
@import "index/partials/wiki_excerpt";
+@import "index/partials/stats";
@include window-larger-than(50rem) {
@include with-setting("fullscreen", "true") {
diff --git a/app/javascript/src/styles/views/posts/index/partials/_stats.scss b/app/javascript/src/styles/views/posts/index/partials/_stats.scss
new file mode 100644
index 000000000..5f7b55196
--- /dev/null
+++ b/app/javascript/src/styles/views/posts/index/partials/_stats.scss
@@ -0,0 +1,13 @@
+.posts-index-stats {
+ display: flex;
+ justify-content: end;
+
+ margin: -0.5rem 0rem 0.25rem;
+
+ font-size: 0.75rem;
+ line-height: 0.75rem;
+ color: #fffa;
+ font-family: monospace;
+
+ & > span { cursor: help; }
+}
diff --git a/app/views/posts/index.html.erb b/app/views/posts/index.html.erb
index 1d452ab0d..f85cc74a5 100644
--- a/app/views/posts/index.html.erb
+++ b/app/views/posts/index.html.erb
@@ -24,6 +24,7 @@
<%= render "ads/leaderboard", tag_string: @post_set.ad_tag_string %>
<%= render "posts/partials/index/edit" %>
+ <%= render "posts/partials/index/stats", :post_set => @post_set %>
<%= render "posts/partials/index/posts", :post_set => @post_set %>
diff --git a/app/views/posts/partials/index/_stats.html.erb b/app/views/posts/partials/index/_stats.html.erb
new file mode 100644
index 000000000..d788206da
--- /dev/null
+++ b/app/views/posts/partials/index/_stats.html.erb
@@ -0,0 +1,3 @@
+
+ <%= approximate_count(post_set.posts) %>
+
From 54c490b57319f95468a7d442afe4f4c157c6416c Mon Sep 17 00:00:00 2001
From: Cinder
Date: Tue, 11 Feb 2025 22:25:58 -0800
Subject: [PATCH 05/26] [Pagination] Fix the keyboard shortcuts (#904)
---
app/helpers/pagination_helper.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/helpers/pagination_helper.rb b/app/helpers/pagination_helper.rb
index 919014c6c..8b55b9e01 100644
--- a/app/helpers/pagination_helper.rb
+++ b/app/helpers/pagination_helper.rb
@@ -87,12 +87,12 @@ module PaginationHelper
html = "".html_safe
if disabled
- html << tag.span(class: "next", id: "paginator-next", data: { shortcut: "a left" }) do
+ html << tag.span(class: "next", id: "paginator-next", data: { shortcut: "d right" }) do
concat tag.span("Next")
concat svg_icon(:chevron_right)
end
else
- html << link_to(link, class: "next", id: "paginator-prev", rel: "next", data: { shortcut: "a left" }) do
+ html << link_to(link, class: "next", id: "paginator-next", rel: "next", data: { shortcut: "d right" }) do
concat tag.span("Next")
concat svg_icon(:chevron_right)
end
From bac331d1087124c6b7e23ffa7f8f9f56618d52ef Mon Sep 17 00:00:00 2001
From: Cinder
Date: Tue, 11 Feb 2025 22:26:09 -0800
Subject: [PATCH 06/26] [Pagination] Restore sequential pagination labels
(#905)
---
app/javascript/src/styles/common/paginator.scss | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/javascript/src/styles/common/paginator.scss b/app/javascript/src/styles/common/paginator.scss
index f00e19abe..84c7084e3 100644
--- a/app/javascript/src/styles/common/paginator.scss
+++ b/app/javascript/src/styles/common/paginator.scss
@@ -102,7 +102,7 @@ nav.pagination {
// Sequential paginator
-.paginator.sequential {
+nav.pagination.sequential {
gap: 5rem;
a span { display: block; }
}
From a730b46c6c296be57ed8578c7ca8a35e56f156d7 Mon Sep 17 00:00:00 2001
From: Cinder
Date: Tue, 11 Feb 2025 22:26:29 -0800
Subject: [PATCH 07/26] [Posts] Replace the old Google RIS link with Lens
(#906)
---
app/views/posts/show.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb
index 5a191268a..0233be6bf 100644
--- a/app/views/posts/show.html.erb
+++ b/app/views/posts/show.html.erb
@@ -40,7 +40,7 @@
<%= link_to "Visually similar on E6", iqdb_queries_path(search: { post_id: @post.id }), rel: "nofollow" %>
<% end %>
<% if @post.visible? && @post.is_image? %>
- Reverse Google Search
+ Reverse Google Search
Reverse SauceNAO Search
Reverse Derpibooru Search
Reverse Kheina Search
From a98b97aaf6f5312ed228c6e7d056c0b46ba4dde8 Mon Sep 17 00:00:00 2001
From: Cinder
Date: Tue, 11 Feb 2025 22:26:41 -0800
Subject: [PATCH 08/26] [Posts] Fix a bug caused by quotes in a wiki excerpt
(#907)
---
.../src/styles/views/posts/index/partials/_wiki_excerpt.scss | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/app/javascript/src/styles/views/posts/index/partials/_wiki_excerpt.scss b/app/javascript/src/styles/views/posts/index/partials/_wiki_excerpt.scss
index 4160e55a6..4beb26345 100644
--- a/app/javascript/src/styles/views/posts/index/partials/_wiki_excerpt.scss
+++ b/app/javascript/src/styles/views/posts/index/partials/_wiki_excerpt.scss
@@ -53,6 +53,10 @@
&::after { content: none; }
}
+ // Quote visual bug
+ blockquote { background: unset; }
+
+ // Remove offset caused by paragraphs
p:last-child { margin-bottom: 0; }
}
From 436eb260e8e29537a0fbc743281d62e90f45e56e Mon Sep 17 00:00:00 2001
From: Cinder
Date: Tue, 11 Feb 2025 22:26:53 -0800
Subject: [PATCH 09/26] [Footer] Adjust logo border (#908)
---
app/javascript/src/styles/common/_footer.scss | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/javascript/src/styles/common/_footer.scss b/app/javascript/src/styles/common/_footer.scss
index 31c2c6935..53cf3473e 100644
--- a/app/javascript/src/styles/common/_footer.scss
+++ b/app/javascript/src/styles/common/_footer.scss
@@ -29,7 +29,7 @@ footer.footer-wrapper {
margin-right: -3.25rem;
background: themed("color-background") themed("image-background");
- border-radius: 50%;
+ border-radius: 25%;
padding: 0.5rem;
}
}
From aa606b7125f91fa2960e1094ae55199af3628e7f Mon Sep 17 00:00:00 2001
From: Cinder
Date: Tue, 11 Feb 2025 22:27:03 -0800
Subject: [PATCH 10/26] [Posts] Add redirect support to wiki excerpts (#909)
---
app/controllers/posts_controller.rb | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb
index 843ee2dec..0952c00c1 100644
--- a/app/controllers/posts_controller.rb
+++ b/app/controllers/posts_controller.rb
@@ -19,6 +19,12 @@ class PostsController < ApplicationController
@query = tag_query.nil? ? [] : tag_query.strip.split(/ /, 2).compact_blank
if @query.length == 1
@wiki_page = WikiPage.titled(@query[0])
+
+ # redirect?
+ if @wiki_page.present? && @wiki_page.parent.present?
+ @wiki_page = WikiPage.titled(@wiki_page.parent)
+ end
+
@wiki_text = @wiki_page.present? ? @wiki_page.body : ""
if @wiki_text.present?
@wiki_text = @wiki_text
From 9135ccd4b9f6d359c1ba91e8184900a9fce5650a Mon Sep 17 00:00:00 2001
From: Cinder
Date: Tue, 11 Feb 2025 22:27:16 -0800
Subject: [PATCH 11/26] [Posts] Replace the search submit icon with a lucide
one (#910)
---
app/helpers/icon_helper.rb | 1 +
.../src/styles/common/post_search.scss | 22 +++++++++++++------
app/javascript/src/styles/specific/home.scss | 13 +++++++----
.../posts/partials/common/_search.html.erb | 2 +-
app/views/static/home.html.erb | 2 +-
5 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/app/helpers/icon_helper.rb b/app/helpers/icon_helper.rb
index 077752253..34bc65282 100644
--- a/app/helpers/icon_helper.rb
+++ b/app/helpers/icon_helper.rb
@@ -28,6 +28,7 @@ module IconHelper
ellipsis: %(),
# Posts
+ search: %(),
fullscreen: %(),
}.freeze
diff --git a/app/javascript/src/styles/common/post_search.scss b/app/javascript/src/styles/common/post_search.scss
index 68ce953d4..ede222255 100644
--- a/app/javascript/src/styles/common/post_search.scss
+++ b/app/javascript/src/styles/common/post_search.scss
@@ -30,7 +30,7 @@
// Disable manual resizing
resize: none;
- border-radius: 3px 0 0 3px;
+ border-radius: 0.25rem 0 0 0.25rem;
box-sizing: border-box;
flex: 1;
@@ -43,19 +43,27 @@
font-size: unset;
max-width: unset;
- font-size: 1rem;
- line-height: 1rem;
+ display: flex;
+ align-items: center;
padding: 0.5rem;
- border-radius: 0 3px 3px 0;
+ border-radius: 0 0.25rem 0.25rem 0;
background: white;
+ color: black;
- span { display: none; }
+ svg {
+ height: 1.5rem;
+ width: 1.5rem;
+ margin: -0.25rem 0 -0.25rem;
+ }
}
@include window-larger-than(800px) {
- textarea, button[type="submit"] {
- font-size: 0.85rem;
+ textarea { font-size: 0.85rem; }
+ button[type="submit"] svg {
+ height: 1.25rem;
+ width: 1.25rem;
+ margin: -0.125rem 0 -0.125rem;
}
}
}
diff --git a/app/javascript/src/styles/specific/home.scss b/app/javascript/src/styles/specific/home.scss
index 94dd52ea2..9b6a95b85 100644
--- a/app/javascript/src/styles/specific/home.scss
+++ b/app/javascript/src/styles/specific/home.scss
@@ -39,7 +39,7 @@ body.c-static.a-home {
input[type="text"] {
flex: 1;
border: 0;
- border-radius: 3px 0 0 3px;
+ border-radius: 0.25rem 0 0 0.25rem;
padding: 0.5rem;
font-size: 1rem;
@@ -53,9 +53,14 @@ body.c-static.a-home {
button[type="submit"] {
background: white;
- border-radius: 0 3px 3px 0;
- padding: 0 0.5em;
- font-size: 1rem;
+ border-radius: 0 0.25rem 0.25rem 0;
+ padding: 0 0.5rem;
+
+ svg {
+ height: 1.25rem;
+ width: 1.25rem;
+ margin: -0.125rem 0 -0.125rem;
+ }
}
}
diff --git a/app/views/posts/partials/common/_search.html.erb b/app/views/posts/partials/common/_search.html.erb
index 051a9a259..3c4266be7 100644
--- a/app/views/posts/partials/common/_search.html.erb
+++ b/app/views/posts/partials/common/_search.html.erb
@@ -10,6 +10,6 @@
<% end %>
<%= text_area_tag("tags", tags, placeholder: "Search posts by tag", rows: 1, data: { shortcut: "q", autocomplete: "tag-query" }) %>
- <%= tag.button(tag.i(class: "fa-solid fa-magnifying-glass"), type: "submit", title: "Search") %>
+ <%= tag.button(svg_icon(:search), type: "submit", title: "Search") %>
<% end %>
diff --git a/app/views/static/home.html.erb b/app/views/static/home.html.erb
index 244aed43f..41f8e4e0f 100644
--- a/app/views/static/home.html.erb
+++ b/app/views/static/home.html.erb
@@ -9,7 +9,7 @@
<%= text_field_tag("tags", "", autofocus: "autofocus", placeholder: "Search posts by tag", data: { shortcut: "q", autocomplete: "tag-query" }) %>
- <%= tag.button(tag.i(class: "fa-solid fa-magnifying-glass"), type: "submit") %>
+ <%= tag.button(svg_icon(:search), type: "submit") %>
From af5ef523166592c68189202679025b57aaf24b3b Mon Sep 17 00:00:00 2001
From: Cinder
Date: Tue, 11 Feb 2025 22:27:26 -0800
Subject: [PATCH 12/26] [Posts] Add an option for a sticky searchbar (#911)
---
app/helpers/icon_helper.rb | 1 +
app/javascript/src/javascripts/post_search.js | 7 +++++
.../src/javascripts/utility/storage.js | 3 ++
app/javascript/src/styles/common/tables.scss | 2 --
.../src/styles/views/posts/_posts.scss | 3 ++
.../views/posts/index/_index.desktop.scss | 30 +++++++++++++++++--
.../src/styles/views/posts/index/_index.scss | 5 +---
.../posts/index/partials/_fullscreen.scss | 24 +++++++--------
.../views/posts/index/partials/_sticky.scss | 16 ++++++++++
app/views/layouts/_theme_include.html.erb | 1 +
.../posts/partials/index/_controls.html.erb | 6 ++--
11 files changed, 76 insertions(+), 22 deletions(-)
create mode 100644 app/javascript/src/styles/views/posts/index/partials/_sticky.scss
diff --git a/app/helpers/icon_helper.rb b/app/helpers/icon_helper.rb
index 34bc65282..4a628f9ad 100644
--- a/app/helpers/icon_helper.rb
+++ b/app/helpers/icon_helper.rb
@@ -30,6 +30,7 @@ module IconHelper
# Posts
search: %(),
fullscreen: %(),
+ anchor: %(),
}.freeze
def svg_icon(name, *args)
diff --git a/app/javascript/src/javascripts/post_search.js b/app/javascript/src/javascripts/post_search.js
index b5b3e6a17..55421cfec 100644
--- a/app/javascript/src/javascripts/post_search.js
+++ b/app/javascript/src/javascripts/post_search.js
@@ -67,6 +67,13 @@ PostSearch.initialize_controls = function () {
$("body").attr("data-st-fullscreen", fullscreen);
LStorage.Posts.Fullscreen = fullscreen;
});
+
+ let stickySearch = LStorage.Posts.StickySearch;
+ $("#search-sticky").on("click", () => {
+ stickySearch = !stickySearch;
+ $("body").attr("data-st-stickysearch", stickySearch);
+ LStorage.Posts.StickySearch = stickySearch;
+ });
};
$(() => {
diff --git a/app/javascript/src/javascripts/utility/storage.js b/app/javascript/src/javascripts/utility/storage.js
index 62847cc6a..55c65e4ab 100644
--- a/app/javascript/src/javascripts/utility/storage.js
+++ b/app/javascript/src/javascripts/utility/storage.js
@@ -91,6 +91,9 @@ LStorage.Posts = {
/** @returns {boolean} True if the search should be displayed in fullscreen */
Fullscreen: ["e6.posts.fusk", false],
+
+ /** @returns {boolean} True if the search should be displayed in fullscreen */
+ StickySearch: ["e6.posts.stickysearch", false],
};
StorageUtils.bootstrapMany(LStorage.Posts);
diff --git a/app/javascript/src/styles/common/tables.scss b/app/javascript/src/styles/common/tables.scss
index e08ec9a00..6092e32fb 100644
--- a/app/javascript/src/styles/common/tables.scss
+++ b/app/javascript/src/styles/common/tables.scss
@@ -92,8 +92,6 @@ table.search {
}
table.aligned-vertical {
- @extend .search;
-
tr {
height: 1.75em;
}
diff --git a/app/javascript/src/styles/views/posts/_posts.scss b/app/javascript/src/styles/views/posts/_posts.scss
index 0508e64b5..56c38dadb 100644
--- a/app/javascript/src/styles/views/posts/_posts.scss
+++ b/app/javascript/src/styles/views/posts/_posts.scss
@@ -13,4 +13,7 @@
@include with-setting("fullscreen", "true") {
@import "index/partials/fullscreen";
}
+ @include with-setting("stickysearch", "true") {
+ @import "index/partials/sticky";
+ }
}
diff --git a/app/javascript/src/styles/views/posts/index/_index.desktop.scss b/app/javascript/src/styles/views/posts/index/_index.desktop.scss
index ccb999563..60f429ece 100644
--- a/app/javascript/src/styles/views/posts/index/_index.desktop.scss
+++ b/app/javascript/src/styles/views/posts/index/_index.desktop.scss
@@ -13,9 +13,35 @@
border-top-left-radius: 0.25rem;
padding: 0.5rem;
+ // Align the controls properly
+ position: relative;
+
.search-controls {
display: flex;
- margin-top: 0.5rem;
+ flex-flow: row;
+ justify-content: right;
+
+ position: absolute;
+ bottom: -1.633rem;
+ right: 0.25rem;
+
+ padding: 0.25rem;
+ gap: 0.5rem;
+
+ background: themed("color-foreground");
+ border-radius: 0 0 0.25rem 0.25rem;
+
+ button {
+ height: 1.5rem;
+ padding: 0;
+
+ svg {
+ height: 1.25rem;
+ width: 1.25rem;
+ padding: 0.25rem;
+ margin: -0.125rem 0;
+ }
+ }
}
}
@@ -23,7 +49,7 @@
box-shadow: inset -0.25rem 0px 0.25rem -0.25rem themed("color-background");
margin-bottom: 0.25rem;
border-bottom-left-radius: 0.25rem;
- padding: 0.5rem
+ padding: 0.5rem;
}
.content {
diff --git a/app/javascript/src/styles/views/posts/index/_index.scss b/app/javascript/src/styles/views/posts/index/_index.scss
index 0d75e5c0e..8c7da8df3 100644
--- a/app/javascript/src/styles/views/posts/index/_index.scss
+++ b/app/javascript/src/styles/views/posts/index/_index.scss
@@ -44,10 +44,7 @@ body.c-posts.a-index, body.c-favorites.a-index {
font-size: $h3-size;
}
- .search-controls {
- display: none;
- flex-flow: column;
- }
+ .search-controls { display: none; }
}
// 2. Content
diff --git a/app/javascript/src/styles/views/posts/index/partials/_fullscreen.scss b/app/javascript/src/styles/views/posts/index/partials/_fullscreen.scss
index 6730b7019..a8e68dd72 100644
--- a/app/javascript/src/styles/views/posts/index/partials/_fullscreen.scss
+++ b/app/javascript/src/styles/views/posts/index/partials/_fullscreen.scss
@@ -10,18 +10,18 @@
display: flex;
border-radius: 0.25rem 0.25rem 0 0;
box-shadow: inset 0px -0.25rem 0.25rem -0.25rem themed("color-background");
- .post-search {
- flex: 1;
- }
- .search-controls {
- display: flex;
- justify-content: right;
- align-self: end;
- margin: 0 0 0 0.5rem;
- .st-button.w100 {
- width: unset;
- span { display: none; }
- }
+
+ margin: 0.25rem 0 0;
+ padding: 0.5rem;
+
+ flex-wrap: wrap;
+ justify-content: right;
+
+ .post-search { width: 100%; }
+
+ #search-fullscreen {
+ background: themed("color-button-active");
+ color: black;
}
}
.sidebar { display: none; }
diff --git a/app/javascript/src/styles/views/posts/index/partials/_sticky.scss b/app/javascript/src/styles/views/posts/index/partials/_sticky.scss
new file mode 100644
index 000000000..35674c99d
--- /dev/null
+++ b/app/javascript/src/styles/views/posts/index/partials/_sticky.scss
@@ -0,0 +1,16 @@
+.post-index .search {
+ position: sticky;
+ top: 0;
+
+ // on top of thumbnail labels
+ z-index: 11;
+
+ #search-sticky {
+ background: themed("color-button-active");
+ color: black;
+ }
+}
+
+&[data-th-sheader="true"] {
+ .post-index .search { top: 3.75rem; }
+}
diff --git a/app/views/layouts/_theme_include.html.erb b/app/views/layouts/_theme_include.html.erb
index bf5b3eb85..d6bcd97fa 100644
--- a/app/views/layouts/_theme_include.html.erb
+++ b/app/views/layouts/_theme_include.html.erb
@@ -12,6 +12,7 @@
// Settings
"st-fullscreen": localStorage.getItem("e6.posts.fusk") || false,
+ "st-stickysearch": localStorage.getItem("e6.posts.stickysearch") || false,
};
var b = document.body;
diff --git a/app/views/posts/partials/index/_controls.html.erb b/app/views/posts/partials/index/_controls.html.erb
index 31667a67b..34d22d434 100644
--- a/app/views/posts/partials/index/_controls.html.erb
+++ b/app/views/posts/partials/index/_controls.html.erb
@@ -1,6 +1,8 @@
-
From 2c66906a8aaa70c00787657a5a6462be6c74d3cb Mon Sep 17 00:00:00 2001
From: Cinder
Date: Tue, 11 Feb 2025 22:27:38 -0800
Subject: [PATCH 13/26] [UI] Fix the main menu layering over the post notes
(#912)
---
app/javascript/src/styles/common/navigation.scss | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/javascript/src/styles/common/navigation.scss b/app/javascript/src/styles/common/navigation.scss
index 160d6001a..ea3bdc8d1 100644
--- a/app/javascript/src/styles/common/navigation.scss
+++ b/app/javascript/src/styles/common/navigation.scss
@@ -5,7 +5,7 @@ nav.navigation {
grid-template-rows: min-content min-content min-content min-content auto;
width: 100%; // otherwise narrow when fixed
- z-index: 20; // otherwise post labels layered above
+ z-index: 200; // above post labels and notes
position: relative;
From 3cb527d0b1017e39ef7e87c47bea2cb1437151cb Mon Sep 17 00:00:00 2001
From: Cinder
Date: Tue, 11 Feb 2025 22:42:10 -0800
Subject: [PATCH 14/26] [Posts] Increase the sidebar font size on mobile.
(#913)
---
.../src/styles/views/posts/index/_index.desktop.scss | 2 ++
app/javascript/src/styles/views/posts/index/_index.scss | 3 +++
2 files changed, 5 insertions(+)
diff --git a/app/javascript/src/styles/views/posts/index/_index.desktop.scss b/app/javascript/src/styles/views/posts/index/_index.desktop.scss
index 60f429ece..20f1a0bdd 100644
--- a/app/javascript/src/styles/views/posts/index/_index.desktop.scss
+++ b/app/javascript/src/styles/views/posts/index/_index.desktop.scss
@@ -50,6 +50,8 @@
margin-bottom: 0.25rem;
border-bottom-left-radius: 0.25rem;
padding: 0.5rem;
+
+ font-size: 100%;
}
.content {
diff --git a/app/javascript/src/styles/views/posts/index/_index.scss b/app/javascript/src/styles/views/posts/index/_index.scss
index 8c7da8df3..9be82a05f 100644
--- a/app/javascript/src/styles/views/posts/index/_index.scss
+++ b/app/javascript/src/styles/views/posts/index/_index.scss
@@ -96,6 +96,9 @@ body.c-posts.a-index, body.c-favorites.a-index {
background-color: themed("color-foreground");
box-shadow: inset 0px 0.25rem 0.25rem -0.25rem themed("color-background");
+ // By popular demand
+ font-size: 150%;
+
// Mode selection
#mode-box-mode, #mode-box #set-id {
width: 100%;
From 50cbc498e7f178d3c16753dfc62bf11fe40aab2f Mon Sep 17 00:00:00 2001
From: Cinder
Date: Wed, 12 Feb 2025 07:01:41 -0800
Subject: [PATCH 15/26] [Themes] Add a toggle for WikiExcerpt in theme settings
(#914)
---
app/javascript/src/javascripts/post_search.js | 2 +-
app/javascript/src/javascripts/themes.js | 48 ++++++-------
.../src/javascripts/utility/storage.js | 2 +-
.../src/styles/views/posts/_posts.scss | 2 +-
app/views/layouts/_theme_include.html.erb | 2 +-
app/views/static/theme.html.erb | 67 ++++++++++---------
6 files changed, 65 insertions(+), 58 deletions(-)
diff --git a/app/javascript/src/javascripts/post_search.js b/app/javascript/src/javascripts/post_search.js
index 55421cfec..045d641d8 100644
--- a/app/javascript/src/javascripts/post_search.js
+++ b/app/javascript/src/javascripts/post_search.js
@@ -71,7 +71,7 @@ PostSearch.initialize_controls = function () {
let stickySearch = LStorage.Posts.StickySearch;
$("#search-sticky").on("click", () => {
stickySearch = !stickySearch;
- $("body").attr("data-st-stickysearch", stickySearch);
+ $("body").attr("data-st-ssearch", stickySearch);
LStorage.Posts.StickySearch = stickySearch;
});
};
diff --git a/app/javascript/src/javascripts/themes.js b/app/javascript/src/javascripts/themes.js
index a329e109e..ccff3abeb 100644
--- a/app/javascript/src/javascripts/themes.js
+++ b/app/javascript/src/javascripts/themes.js
@@ -3,17 +3,23 @@ import LStorage from "./utility/storage";
const Theme = {};
-Theme.Values = ["Main", "Extra", "StickyHeader", "ForumNotif", "Palette", "Navbar", "Gestures"];
+Theme.Values = {
+ "Theme": ["Main", "Extra", "Palette", "StickyHeader", "Navbar", "Gestures", "ForumNotif"],
+ "Posts": ["WikiExcerpt", "StickySearch"],
+};
-for (const one of Theme.Values) {
- Object.defineProperty(Theme, one, {
- get () { return LStorage.Theme[one]; },
- set (value) {
- // No value checking, we die like men
- LStorage.Theme[one] = value;
- $("body").attr("data-th-" + one.toLowerCase(), value);
- },
- });
+for (const [label, settings] of Object.entries(Theme.Values)) {
+ for (const one of settings) {
+ Object.defineProperty(Theme, one, {
+ get () { return LStorage.Theme[one]; },
+ set (value) {
+ // This has the unintended side effect of setting
+ // attribute values that don't exist on the body.
+ LStorage[label][one] = value;
+ $("body").attr("data-th-" + one.toLowerCase(), value);
+ },
+ });
+ }
}
Theme.initialize_selector = function () {
@@ -24,13 +30,15 @@ Theme.initialize_selector = function () {
return false;
}
- for (const one of Theme.Values) {
- $("#theme_" + one.toLowerCase())
- .val(LStorage.Theme[one] + "")
- .on("change", (event) => {
- const data = event.target.value;
- Theme[one] = data;
- });
+ for (const [label, settings] of Object.entries(Theme.Values)) {
+ for (const one of settings)
+ $(`#${label}_${one}`)
+ .val(LStorage[label][one] + "")
+ .on("change", (event) => {
+ const data = event.target.value;
+ console.log("change", one, data);
+ Theme[one] = data;
+ });
}
};
@@ -42,12 +50,6 @@ Theme.initialize_buttons = function () {
LStorage.Site.Mascot = 0;
$("#mascot-value").text(LStorage.Site.Mascot);
});
-
- $("#wiki-excerpt-value").text(LStorage.Posts.WikiExcerpt);
- $("#wiki-excerpt-reset").on("click", () => {
- LStorage.Posts.WikiExcerpt = 1;
- $("#wiki-excerpt-value").text(LStorage.Posts.WikiExcerpt);
- });
};
$(() => {
diff --git a/app/javascript/src/javascripts/utility/storage.js b/app/javascript/src/javascripts/utility/storage.js
index 55c65e4ab..d02ef5170 100644
--- a/app/javascript/src/javascripts/utility/storage.js
+++ b/app/javascript/src/javascripts/utility/storage.js
@@ -93,7 +93,7 @@ LStorage.Posts = {
Fullscreen: ["e6.posts.fusk", false],
/** @returns {boolean} True if the search should be displayed in fullscreen */
- StickySearch: ["e6.posts.stickysearch", false],
+ StickySearch: ["e6.posts.ssearch", false],
};
StorageUtils.bootstrapMany(LStorage.Posts);
diff --git a/app/javascript/src/styles/views/posts/_posts.scss b/app/javascript/src/styles/views/posts/_posts.scss
index 56c38dadb..f6dcef481 100644
--- a/app/javascript/src/styles/views/posts/_posts.scss
+++ b/app/javascript/src/styles/views/posts/_posts.scss
@@ -13,7 +13,7 @@
@include with-setting("fullscreen", "true") {
@import "index/partials/fullscreen";
}
- @include with-setting("stickysearch", "true") {
+ @include with-setting("ssearch", "true") {
@import "index/partials/sticky";
}
}
diff --git a/app/views/layouts/_theme_include.html.erb b/app/views/layouts/_theme_include.html.erb
index d6bcd97fa..4add60a81 100644
--- a/app/views/layouts/_theme_include.html.erb
+++ b/app/views/layouts/_theme_include.html.erb
@@ -12,7 +12,7 @@
// Settings
"st-fullscreen": localStorage.getItem("e6.posts.fusk") || false,
- "st-stickysearch": localStorage.getItem("e6.posts.stickysearch") || false,
+ "st-ssearch": localStorage.getItem("e6.posts.ssearch") || false,
};
var b = document.body;
diff --git a/app/views/static/theme.html.erb b/app/views/static/theme.html.erb
index 8344f356d..fd9087cf9 100644
--- a/app/views/static/theme.html.erb
+++ b/app/views/static/theme.html.erb
@@ -16,8 +16,8 @@
This means that they will not persist across multiple devices, or in incognito mode.
-
-