mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-30 14:57:59 +01:00
Disable search completion by default, use setting to enable
This commit is contained in:
parent
afdcd773bd
commit
f44491685e
4 changed files with 13 additions and 8 deletions
|
@ -188,13 +188,18 @@ function getSelectedTerm() {
|
|||
}
|
||||
|
||||
function toggleSearchAutocomplete() {
|
||||
if (!store.get('disable_search_ac')) return;
|
||||
const enable = store.get('enable_search_ac');
|
||||
|
||||
for (const searchField of document.querySelectorAll('input[data-ac-mode=search]')) {
|
||||
if (enable) {
|
||||
searchField.autocomplete = 'off';
|
||||
}
|
||||
else {
|
||||
searchField.removeAttribute('data-ac');
|
||||
searchField.autocomplete = 'on';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function listenAutocomplete() {
|
||||
let timeout;
|
||||
|
|
|
@ -45,7 +45,7 @@ defmodule PhilomenaWeb.SettingController do
|
|||
|> set_cookie(user_params, "hide_uploader", "hide_uploader")
|
||||
|> set_cookie(user_params, "hide_score", "hide_score")
|
||||
|> set_cookie(user_params, "unfilter_tag_suggestions", "unfilter_tag_suggestions")
|
||||
|> set_cookie(user_params, "disable_search_ac", "disable_search_ac")
|
||||
|> set_cookie(user_params, "enable_search_ac", "enable_search_ac")
|
||||
end
|
||||
|
||||
defp set_cookie(conn, params, param_name, cookie_name) do
|
||||
|
|
|
@ -12,7 +12,7 @@ header.header
|
|||
i.fa.fa-upload
|
||||
|
||||
= form_for @conn, ~p"/search", [method: "get", class: "header__search flex flex--no-wrap flex--centered", enforce_utf8: false], fn f ->
|
||||
input.input.header__input.header__input--search#q name="q" title="For terms all required, separate with ',' or 'AND'; also supports 'OR' for optional terms and '-' or 'NOT' for negation. Search with a blank query for more options or click the ? for syntax help." value=@conn.params["q"] placeholder="Search" autocapitalize="none" autocomplete="off" data-ac="true" data-ac-min-length="3" data-ac-mode="search"
|
||||
input.input.header__input.header__input--search#q name="q" title="For terms all required, separate with ',' or 'AND'; also supports 'OR' for optional terms and '-' or 'NOT' for negation. Search with a blank query for more options or click the ? for syntax help." value=@conn.params["q"] placeholder="Search" autocapitalize="none" data-ac="true" data-ac-min-length="3" data-ac-mode="search"
|
||||
|
||||
= if present?(@conn.params["sf"]) do
|
||||
input type="hidden" name="sf" value=@conn.params["sf"]
|
||||
|
|
|
@ -175,9 +175,9 @@ h1 Content Settings
|
|||
=> checkbox f, :chan_nsfw, checked: @conn.cookies["chan_nsfw"] == "true"
|
||||
.fieldlabel: i Show streams marked as NSFW on the channels page.
|
||||
.field
|
||||
=> label f, :disable_search_ac, "Disable search auto-completion"
|
||||
=> checkbox f, :disable_search_ac, checked: @conn.cookies["disable_search_ac"] === "true"
|
||||
.fieldlabel: i Disable the auto-completion of tags in the search fields. This will bring back default browser's behaviour.
|
||||
=> label f, :enable_search_ac, "Enable search auto-completion"
|
||||
=> checkbox f, :enable_search_ac, checked: @conn.cookies["enable_search_ac"] === "true"
|
||||
.fieldlabel: i Enable the auto-completion of tags in search fields.
|
||||
= if staff?(@conn.assigns.current_user) do
|
||||
.field
|
||||
=> label f, :hide_staff_tools
|
||||
|
|
Loading…
Reference in a new issue