add score-hiding snip per request

This commit is contained in:
byte[] 2020-12-16 09:35:58 -05:00
parent 0206c410de
commit 2e8a5e92c9
3 changed files with 9 additions and 1 deletions

View file

@ -3,7 +3,7 @@
*/ */
import store from './utils/store'; import store from './utils/store';
import { $ } from './utils/dom'; import { $, $$ } from './utils/dom';
let touchMoved = false; let touchMoved = false;
@ -74,6 +74,9 @@ function setupEvents() {
const extrameta = $('#extrameta'); const extrameta = $('#extrameta');
if (store.get('hide_uploader') && extrameta) extrameta.classList.add('hidden'); if (store.get('hide_uploader') && extrameta) extrameta.classList.add('hidden');
if (store.get('hide_score')) {
$$('.upvotes,.score,.downvotes').forEach(s => s.classList.add('hidden'));
}
document.addEventListener('fetchcomplete', formResult); document.addEventListener('fetchcomplete', formResult);
document.addEventListener('click', revealSpoiler); document.addEventListener('click', revealSpoiler);

View file

@ -42,6 +42,7 @@ defmodule PhilomenaWeb.SettingController do
|> set_cookie(user_params, "chan_nsfw", "chan_nsfw") |> set_cookie(user_params, "chan_nsfw", "chan_nsfw")
|> set_cookie(user_params, "hide_staff_tools", "hide_staff_tools") |> set_cookie(user_params, "hide_staff_tools", "hide_staff_tools")
|> set_cookie(user_params, "hide_uploader", "hide_uploader") |> set_cookie(user_params, "hide_uploader", "hide_uploader")
|> set_cookie(user_params, "hide_score", "hide_score")
end end
defp set_cookie(conn, params, param_name, cookie_name) do defp set_cookie(conn, params, param_name, cookie_name) do

View file

@ -118,6 +118,10 @@ h1 Content Settings
=> label f, :hide_uploader => label f, :hide_uploader
=> checkbox f, :hide_uploader, checked: @conn.cookies["hide_uploader"] == "true" => checkbox f, :hide_uploader, checked: @conn.cookies["hide_uploader"] == "true"
.fieldlabel: i Hide the uploader and date posted information on image pages. .fieldlabel: i Hide the uploader and date posted information on image pages.
.field
=> label f, :hide_score
=> checkbox f, :hide_score, checked: @conn.cookies["hide_score"] == "true"
.fieldlabel: i Hide score information for images.
.field .field
=> label f, :chan_nsfw, "Show NSFW channels" => label f, :chan_nsfw, "Show NSFW channels"
=> checkbox f, :chan_nsfw, checked: @conn.cookies["chan_nsfw"] == "true" => checkbox f, :chan_nsfw, checked: @conn.cookies["chan_nsfw"] == "true"