From edc42ea35d05b536c2bebfcb78d1bf6007445e85 Mon Sep 17 00:00:00 2001 From: lolcat Date: Wed, 13 Sep 2023 09:01:23 -0400 Subject: added autocomplete --- settings.php | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 76 insertions(+), 15 deletions(-) (limited to 'settings.php') diff --git a/settings.php b/settings.php index f6abb12..bce3af0 100644 --- a/settings.php +++ b/settings.php @@ -58,6 +58,56 @@ $settings = [ [ "name" => "Scrapers to use", "settings" => [ + [ + "description" => "Autocomplete
Picking
Auto
changes the source dynamically depending of the page's scraper
Picking
Disabled
disables this feature
", + "parameter" => "scraper_ac", + "options" => [ + [ + "value" => "disabled", + "text" => "Disabled" + ], + [ + "value" => "auto", + "text" => "Auto" + ], + [ + "value" => "brave", + "text" => "Brave" + ], + [ + "value" => "ddg", + "text" => "DuckDuckGo" + ], + [ + "value" => "yandex", + "text" => "Yandex" + ], + [ + "value" => "google", + "text" => "Google" + ], + [ + "value" => "qwant", + "text" => "Qwant" + ], + [ + "value" => "yep", + "text" => "Yep" + ], + [ + "value" => "marginalia", + "text" => "Marginalia" + ], + [ + "value" => "yt", + "text" => "YouTube" + ], + [ + "value" => "sc", + "text" => "SoundCloud" + ] + ] + ], [ "description" => "Web", "parameter" => "scraper_web", @@ -183,8 +233,13 @@ $settings = [ if($_POST){ $loop = &$_POST; -}else{ +}elseif(count($_GET) !== 0){ + + // redirect user to front page + $loop = &$_GET; + header("Location: /"); +}else{ // refresh cookie dates $loop = &$_COOKIE; } @@ -245,7 +300,7 @@ echo '' . '' . 'Settings' . - '' . + '' . '' . '' . '' . @@ -260,14 +315,14 @@ $left = 'By clicking
Update settings!
, a plaintext
key=value
cookie will be stored on your browser. When selecting a default setting, the parameter is removed from your cookies.'; $c = count($_COOKIE); +$code = ""; + if($c !== 0){ $left .= '

Your current cookie looks like this:' . '
'; - $code = ""; - $ca = 0; foreach($_COOKIE as $key => $value){ @@ -326,17 +381,23 @@ $left .= '
' . '
' . '' . - '< Return to main page' . + '< Return to front page' . '
' . ''; -echo - $frontend->load( - "search.html", - [ - "class" => "", - "right-left" => "", - "right-right" => "", - "left" => $left - ] - ); +if(count($_GET) === 0){ + + echo + $frontend->load( + "search.html", + [ + "class" => "", + "right-left" => + '

Preference link

Follow this link to auto-apply all cookies. Useful if your browser clears out cookies after a browsing session. Following this link will redirect you to the front page, unless no settings are set.

' . + 'Bookmark me!' . + '
', + "right-right" => "", + "left" => $left + ] + ); +} -- cgit v1.2.3