commit d5b9293196e5a329fa3d785743ba0caa9df9c5de
parent 9c7f5dfba93cbac831dea4f335edc08a46b62b1d
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Fri, 18 Oct 2024 12:07:15 +0200
fix: use "fallback" instead of "default" to refer to the standard search
Diffstat:
3 files changed, 45 insertions(+), 44 deletions(-)
diff --git a/assets/js/filter_engines.js b/assets/js/filter_engines.js
@@ -1,28 +1,28 @@
-/* Script for selecting default Search Engine ------------------------------- */
+/* Script for selecting fallback Search Engine ------------------------------ */
-make_default = function(selection) {
+make_fallback = function(selection) {
// Set a cookie for the selection
- document.cookie = "default_search=" + selection + ";" +
+ document.cookie = "fallback=" + selection + ";" +
"Max-Age=31536000;" + // 60 x 60 x 24 x 365 = 1 year
"Domain=" + document.domain + ";" +
"SameSite=Strict;";
// Set value in searchbar
- document.querySelector("input[name=default_search]").value = selection;
+ document.querySelector("input[name=fallback]").value = selection;
// Gather Entries of Search Engines list
var entries = document.querySelectorAll("article");
- // Remove pre-existing "Default" Markers
- document.querySelectorAll("#default_category").forEach(
+ // Remove pre-existing "Fallback" Markers
+ document.querySelectorAll("#fallback_marker").forEach(
function(obj){ obj.remove(); }
);
- // Create "Default" Marker
+ // Create "Fallback" Marker
let marker = document.createElement("mark");
- marker.id = "default_category";
- marker.innerText = "#Default";
+ marker.id = "fallback_marker";
+ marker.innerText = "#Fallback";
// Update Search Engines List
for (let i = 0; i < entries.length; i++) {
diff --git a/config/config.php b/config/config.php
@@ -657,7 +657,7 @@ $categories = array(
/* Default Search Engine
* Search Engine to use when no (known) keyword is given
*/
-$default_search = "qwantweb";
+$fallback = "qwantweb";
/* Pre-generated mapping files */
$searchkeys_file = "./config/keys_to_search.json";
diff --git a/index.php b/index.php
@@ -20,17 +20,17 @@
$query = null;
}
- /* Handle Default Search Engine via cookie or GET argument
+ /* Handle Fallback Search Engine via cookie or GET argument
* Fallback is always defined in config/configs.php
*/
- if (!is_null($_GET["default_search"])) {
- $default_search = $_GET["default_search"];
- } elseif (!is_null($_COOKIE["default_search"])) {
- $default_search = $_COOKIE["default_search"];
+ if (!is_null($_GET["fallback"])) {
+ $fallback = $_GET["fallback"];
+ } elseif (!is_null($_COOKIE["fallback"])) {
+ $fallback = $_COOKIE["fallback"];
/* refresh cookie */
header(
"Set-Cookie: " .
- "default_search=" . $default_search . "; " .
+ "fallback=" . $fallback . "; " .
"Max-Age=" . 31536000 . "; " . /* 60 x 60 x 24 x 365 = 1 year */
"Domain=" . $_SERVER["SERVER_NAME"] . "; " .
"SameSite=Strict;"
@@ -51,7 +51,7 @@
if (array_search($keyword, array_keys($searchkeys)) !== false) {
$search = $searchkeys[$keyword];
} else {
- $search = $default_search;
+ $search = $fallback;
}
/* Strip keyword from search term */
@@ -133,10 +133,10 @@
onkeydown="if(event.keyCode===13)return this.form.submit(),!1"
>
<input
- name="default_search"
- id="default_search"
+ name="fallback"
+ id="fallback"
type="hidden"
- value="<?php echo $default_search; ?>"
+ value="<?php echo $fallback; ?>"
>
<input
id="searchbutton"
@@ -187,13 +187,14 @@
<div class="notice">
<p>
Exploring the available search engines with the filter bar
- above as well as choosing your default search engine
+ above as well as choosing your fallback search engine
requires javascript.
<strong>However, using serĉi itself does not</strong>!
</p>
<p>
- Read the <a href="#faqs">FAQs</a> on how to choose a default
- search engine when javascript and cookies are disabled.
+ Read the <a href="#faqs">FAQs</a> on how to choose a
+ fallback search engine when javascript or cookies are
+ disabled.
</p>
</div>
</noscript>
@@ -204,12 +205,12 @@
<div class="row">
- <!-- Always insert a "Default" category button -->
+ <!-- Always insert a "Fallback" category button -->
<button
- onclick="filter_category('Default');"
+ onclick="filter_category('Fallback');"
title="Search Engine that is choosen as fallback"
>
- #Default
+ #Fallback
</button>
<!-- List all configured categories -->
@@ -238,7 +239,7 @@
?>
<article
id="<?php echo $sid; ?>"
- class="<?php if ($sid == $default_search) { echo "selected"; }?>"
+ class="<?php if ($sid == $fallback) { echo "selected"; }?>"
>
<!-- Entry-Head -->
<h3>
@@ -254,10 +255,10 @@
<div class="categories">
<?php
- /* If current entry is the default search, add the Mark */
- if ($sid == $default_search) {
+ /* If current entry is the fallback search, add the Mark */
+ if ($sid == $fallback) {
?>
- <mark id="default_category">#Default</mark>
+ <mark id="fallback_marker">#Fallback</mark>
<?php
}
?>
@@ -288,9 +289,9 @@
</code>
<br><br>
- <!-- "Make-Default" Button -->
- <button onclick="make_default('<?php echo $sid; ?>')">
- Choose as Default
+ <!-- "Make-Fallback" Button -->
+ <button onclick="make_fallback('<?php echo $sid; ?>')">
+ Choose as fallback
</button>
</article>
@@ -352,10 +353,10 @@
</p>
<!-- no js or cookies -->
- <h4>Choosing a default search without cookies or Javascript</h4>
+ <h4>Choosing a fallback search without cookies or Javascript</h4>
<p>
- You can simply choose a default search by adding the
- <code>default_search</code> URL parameter. For example, if you
+ You can simply choose a fallback search by adding the
+ <code>fallback</code> URL parameter. For example, if you
wanted to use
<a
href="<?php echo $searches[$rsi]["website"]; ?>"
@@ -363,14 +364,14 @@
>
<?php echo $searches[$rsi]["name"]; ?>
</a>
- as your default search, you can simply add
- <code>/?default_search=<?php echo $rsi; ?></code> to the serĉi
+ as your fallback search, you can simply add
+ <code>/?fallback=<?php echo $rsi; ?></code> to the serĉi
URL:
<br>
- <a href="/?default_search=<?php echo $rsi; ?>">
+ <a href="/?fallback=<?php echo $rsi; ?>">
<?php
echo "https://" . $_SERVER["SERVER_NAME"] .
- "/?default_search=" . $rsi;
+ "/?fallback=" . $rsi;
?>
</a>
</p>
@@ -401,11 +402,11 @@
Some browsers (for example Firefox on Android / Fennec) allow to
configure custom search engines via a so-called search URL.
Simply list following URL as <emph>search-URL</emph> there and
- choose it as your default search option:
+ choose it as your fallback search option:
</p>
<pre>https://<?php echo $_SERVER["SERVER_NAME"]; ?>/?q=%s</pre>
<p>
- You can also choose the default search engine, used by serĉi as
+ You can also choose the fallback search engine, used by serĉi as
fallback, when no keyword is given, through the URL instead of
choosing it from the <a href="#engines">list above</a>, in case
you do not want serĉi to store any cookie on your device. For
@@ -416,11 +417,11 @@
>
<?php echo $searches[$rsi]["name"]; ?>
</a>
- as your default search, you could use following search-URL:
+ as your fallback search, you could use following search-URL:
</p>
<pre><?php
echo "https://" . $_SERVER["SERVER_NAME"] .
- "/?default_search=" . $rsi . "&q=%s";
+ "/?fallback=" . $rsi . "&q=%s";
?></pre>
</section>