Compare commits

..

2 Commits

Author SHA1 Message Date
0b426487ca changed text decoration and animation 2026-03-24 18:22:46 +00:00
48faeb3e01 added styling bcs better 2026-03-24 18:14:06 +00:00
7 changed files with 555 additions and 887 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
/bin /bin
/obj /obj
config.ini config.ini
.session

View File

@@ -20,7 +20,7 @@
#define MD5_HASH_LEN 32 #define MD5_HASH_LEN 32
#define HEX_CHARS "0123456789abcdef" #define HEX_CHARS "0123456789abcdef"
#define INFOBOX_FIELD_COUNT 5 #define INFOBOX_FIELD_COUNT 4
#define MAX_RESULTS_PER_ENGINE 10 #define MAX_RESULTS_PER_ENGINE 10
#define CURL_TIMEOUT_SECS 15L #define CURL_TIMEOUT_SECS 15L

View File

@@ -27,12 +27,6 @@ typedef struct {
char *(*url_construct_fn)(const char *query); char *(*url_construct_fn)(const char *query);
} InfoBoxHandler; } InfoBoxHandler;
enum {
RESULT_FIELD_COUNT = 6,
LINK_FIELD_COUNT = 3,
PAGER_WINDOW_SIZE = 5,
};
static InfoBox fetch_wiki_wrapper(char *query) { static InfoBox fetch_wiki_wrapper(char *query) {
char *url = construct_wiki_url(query); char *url = construct_wiki_url(query);
if (!url) if (!url)
@@ -59,31 +53,7 @@ static InfoBox fetch_unit_wrapper(char *query) {
static InfoBox fetch_currency_wrapper(char *query) { static InfoBox fetch_currency_wrapper(char *query) {
return fetch_currency_data(query); return fetch_currency_data(query);
} }
char *get_base_url(const char *input) {
if (!input) return NULL;
const char *start = input;
const char *protocol_pos = strstr(input, "://");
if (protocol_pos) {
start = protocol_pos + 3;
}
const char *end = start;
while (*end && *end != '/' && *end != '?' && *end != '#') {
end++;
}
size_t len = end - start;
char *domain = (char *)malloc(len + 1);
if (!domain) return NULL;
strncpy(domain, start, len);
domain[len] = '\0';
return domain;
}
static int is_calculator_query(const char *query) { static int is_calculator_query(const char *query) {
if (!query) if (!query)
return 0; return 0;
@@ -180,72 +150,11 @@ static int add_infobox_to_collection(InfoBox *infobox, char ****collection,
(*collection)[current_count][2] = (*collection)[current_count][2] =
infobox->extract ? strdup(infobox->extract) : NULL; infobox->extract ? strdup(infobox->extract) : NULL;
(*collection)[current_count][3] = infobox->url ? strdup(infobox->url) : NULL; (*collection)[current_count][3] = infobox->url ? strdup(infobox->url) : NULL;
(*collection)[current_count][4] = infobox->url ? strdup(infobox->url) : NULL;
(*inner_counts)[current_count] = INFOBOX_FIELD_COUNT; (*inner_counts)[current_count] = INFOBOX_FIELD_COUNT;
return current_count + 1; return current_count + 1;
} }
static int add_link_to_collection(const char *href, const char *label,
const char *class_name, char ****collection,
int **inner_counts, int current_count) {
char ***old_collection = *collection;
int *old_inner_counts = *inner_counts;
char ***new_collection =
(char ***)malloc(sizeof(char **) * (current_count + 1));
int *new_inner_counts =
(int *)malloc(sizeof(int) * (current_count + 1));
if (!new_collection || !new_inner_counts) {
free(new_collection);
free(new_inner_counts);
return current_count;
}
if (*collection && current_count > 0) {
memcpy(new_collection, *collection, sizeof(char **) * current_count);
}
if (*inner_counts && current_count > 0) {
memcpy(new_inner_counts, *inner_counts, sizeof(int) * current_count);
}
*collection = new_collection;
*inner_counts = new_inner_counts;
(*collection)[current_count] =
(char **)malloc(sizeof(char *) * LINK_FIELD_COUNT);
if (!(*collection)[current_count]) {
*collection = old_collection;
*inner_counts = old_inner_counts;
free(new_collection);
free(new_inner_counts);
return current_count;
}
(*collection)[current_count][0] = strdup(href ? href : "");
(*collection)[current_count][1] = strdup(label ? label : "");
(*collection)[current_count][2] = strdup(class_name ? class_name : "");
if (!(*collection)[current_count][0] || !(*collection)[current_count][1] ||
!(*collection)[current_count][2]) {
free((*collection)[current_count][0]);
free((*collection)[current_count][1]);
free((*collection)[current_count][2]);
free((*collection)[current_count]);
*collection = old_collection;
*inner_counts = old_inner_counts;
free(new_collection);
free(new_inner_counts);
return current_count;
}
(*inner_counts)[current_count] = LINK_FIELD_COUNT;
free(old_collection);
free(old_inner_counts);
return current_count + 1;
}
static int add_warning_to_collection(const char *engine_name, static int add_warning_to_collection(const char *engine_name,
const char *warning_message, const char *warning_message,
char ****collection, int **inner_counts, char ****collection, int **inner_counts,
@@ -307,113 +216,9 @@ static const char *warning_message_for_job(const ScrapeJob *job) {
} }
} }
static int engine_id_matches(const char *left, const char *right) {
if (!left || !right)
return 0;
while (*left && *right) {
char l = *left;
char r = *right;
if (l >= 'A' && l <= 'Z')
l = l - 'A' + 'a';
if (r >= 'A' && r <= 'Z')
r = r - 'A' + 'a';
if (l != r)
return 0;
left++;
right++;
}
return *left == *right;
}
static const SearchEngine *find_enabled_engine(const char *engine_id) {
if (!engine_id || engine_id[0] == '\0' || engine_id_matches(engine_id, "all"))
return NULL;
for (int i = 0; i < ENGINE_COUNT; i++) {
if (ENGINE_REGISTRY[i].enabled &&
engine_id_matches(ENGINE_REGISTRY[i].id, engine_id)) {
return &ENGINE_REGISTRY[i];
}
}
return NULL;
}
static char *build_search_href(const char *query, const char *engine_id,
int page) {
const char *safe_query = query ? query : "";
int use_engine = engine_id && engine_id[0] != '\0' &&
!engine_id_matches(engine_id, "all");
size_t needed = strlen("/search?q=") + strlen(safe_query) + 1;
if (use_engine)
needed += strlen("&engine=") + strlen(engine_id);
if (page > 1)
needed += strlen("&p=") + 16;
char *href = (char *)malloc(needed);
if (!href)
return NULL;
snprintf(href, needed, "/search?q=%s", safe_query);
if (use_engine) {
strcat(href, "&engine=");
strcat(href, engine_id);
}
if (page > 1) {
char page_buf[16];
snprintf(page_buf, sizeof(page_buf), "%d", page);
strcat(href, "&p=");
strcat(href, page_buf);
}
return href;
}
static char *build_result_sources(unsigned int source_mask, ScrapeJob *jobs,
int job_count) {
size_t needed = 1;
int source_count = 0;
for (int i = 0; i < job_count; i++) {
if (source_mask & (1u << i)) {
needed += strlen(jobs[i].engine->name);
if (source_count > 0)
needed += strlen(" · ");
source_count++;
}
}
char *sources = (char *)malloc(needed);
if (!sources)
return NULL;
sources[0] = '\0';
source_count = 0;
for (int i = 0; i < job_count; i++) {
if (source_mask & (1u << i)) {
if (source_count > 0)
strcat(sources, " · ");
strcat(sources, jobs[i].engine->name);
source_count++;
}
}
return sources;
}
int results_handler(UrlParams *params) { int results_handler(UrlParams *params) {
TemplateContext ctx = new_context(); TemplateContext ctx = new_context();
char *raw_query = ""; char *raw_query = "";
const char *selected_engine_id = "all";
int page = 1; int page = 1;
int btnI = 0; int btnI = 0;
@@ -425,8 +230,6 @@ int results_handler(UrlParams *params) {
int parsed = atoi(params->params[i].value); int parsed = atoi(params->params[i].value);
if (parsed > 1) if (parsed > 1)
page = parsed; page = parsed;
} else if (strcmp(params->params[i].key, "engine") == 0) {
selected_engine_id = params->params[i].value;
} else if (strcmp(params->params[i].key, "btnI") == 0) { } else if (strcmp(params->params[i].key, "btnI") == 0) {
btnI = atoi(params->params[i].value); btnI = atoi(params->params[i].value);
} }
@@ -434,9 +237,19 @@ int results_handler(UrlParams *params) {
} }
context_set(&ctx, "query", raw_query); context_set(&ctx, "query", raw_query);
char page_str[16];
char page_str[16], prev_str[16], next_str[16], two_prev_str[16],
two_next_str[16];
snprintf(page_str, sizeof(page_str), "%d", page); snprintf(page_str, sizeof(page_str), "%d", page);
snprintf(prev_str, sizeof(prev_str), "%d", page > 1 ? page - 1 : 0);
snprintf(next_str, sizeof(next_str), "%d", page + 1);
snprintf(two_prev_str, sizeof(two_prev_str), "%d", page > 2 ? page - 2 : 0);
snprintf(two_next_str, sizeof(two_next_str), "%d", page + 2);
context_set(&ctx, "page", page_str); context_set(&ctx, "page", page_str);
context_set(&ctx, "prev_page", prev_str);
context_set(&ctx, "next_page", next_str);
context_set(&ctx, "two_prev_page", two_prev_str);
context_set(&ctx, "two_next_page", two_next_str);
if (!raw_query || strlen(raw_query) == 0) { if (!raw_query || strlen(raw_query) == 0) {
send_response("<h1>No query provided</h1>"); send_response("<h1>No query provided</h1>");
@@ -444,23 +257,6 @@ int results_handler(UrlParams *params) {
return -1; return -1;
} }
const SearchEngine *selected_engine = find_enabled_engine(selected_engine_id);
if (!selected_engine)
selected_engine_id = "all";
context_set(&ctx, "selected_engine", selected_engine_id);
char *search_href = build_search_href(raw_query, selected_engine_id, 1);
context_set(&ctx, "search_href", search_href ? search_href : "/search");
free(search_href);
int enabled_engine_count = 0;
for (int i = 0; i < ENGINE_COUNT; i++) {
if (ENGINE_REGISTRY[i].enabled &&
(!selected_engine || &ENGINE_REGISTRY[i] == selected_engine)) {
enabled_engine_count++;
}
}
pthread_t infobox_threads[HANDLER_COUNT]; pthread_t infobox_threads[HANDLER_COUNT];
InfoBoxThreadData infobox_data[HANDLER_COUNT]; InfoBoxThreadData infobox_data[HANDLER_COUNT];
@@ -477,13 +273,19 @@ int results_handler(UrlParams *params) {
} }
} }
int enabled_engine_count = 0;
for (int i = 0; i < ENGINE_COUNT; i++) {
if (ENGINE_REGISTRY[i].enabled) {
enabled_engine_count++;
}
}
ScrapeJob jobs[ENGINE_COUNT]; ScrapeJob jobs[ENGINE_COUNT];
SearchResult *all_results[ENGINE_COUNT]; SearchResult *all_results[ENGINE_COUNT];
int engine_idx = 0; int engine_idx = 0;
for (int i = 0; i < ENGINE_COUNT; i++) { for (int i = 0; i < ENGINE_COUNT; i++) {
if (ENGINE_REGISTRY[i].enabled && if (ENGINE_REGISTRY[i].enabled) {
(!selected_engine || &ENGINE_REGISTRY[i] == selected_engine)) {
all_results[engine_idx] = NULL; all_results[engine_idx] = NULL;
jobs[engine_idx].engine = &ENGINE_REGISTRY[i]; jobs[engine_idx].engine = &ENGINE_REGISTRY[i];
jobs[engine_idx].query = raw_query; jobs[engine_idx].query = raw_query;
@@ -501,56 +303,8 @@ int results_handler(UrlParams *params) {
} }
} }
int filter_engine_count = 0; if (enabled_engine_count > 0) {
for (int i = 0; i < ENGINE_COUNT; i++) { scrape_engines_parallel(jobs, enabled_engine_count);
if (ENGINE_REGISTRY[i].enabled)
filter_engine_count++;
}
if (filter_engine_count > 1) {
char ***filter_matrix = NULL;
int *filter_inner_counts = NULL;
int filter_count = 0;
char *all_href = build_search_href(raw_query, "all", 1);
filter_count = add_link_to_collection(
all_href, "All",
selected_engine ? "engine-filter" : "engine-filter active",
&filter_matrix, &filter_inner_counts, filter_count);
free(all_href);
for (int i = 0; i < ENGINE_COUNT; i++) {
if (!ENGINE_REGISTRY[i].enabled)
continue;
char *filter_href =
build_search_href(raw_query, ENGINE_REGISTRY[i].id, 1);
const char *filter_class =
(selected_engine && &ENGINE_REGISTRY[i] == selected_engine)
? "engine-filter active"
: "engine-filter";
filter_count = add_link_to_collection(filter_href, ENGINE_REGISTRY[i].name,
filter_class, &filter_matrix,
&filter_inner_counts, filter_count);
free(filter_href);
}
if (filter_count > 0) {
context_set_array_of_arrays(&ctx, "engine_filters", filter_matrix,
filter_count, filter_inner_counts);
for (int i = 0; i < filter_count; i++) {
for (int j = 0; j < LINK_FIELD_COUNT; j++)
free(filter_matrix[i][j]);
free(filter_matrix[i]);
}
free(filter_matrix);
free(filter_inner_counts);
}
}
if (engine_idx > 0) {
scrape_engines_parallel(jobs, engine_idx);
} }
if (page == 1) { if (page == 1) {
@@ -560,7 +314,7 @@ int results_handler(UrlParams *params) {
} }
if (btnI) { if (btnI) {
for (int i = 0; i < engine_idx; i++) { for (int i = 0; i < enabled_engine_count; i++) {
if (jobs[i].results_count > 0 && all_results[i][0].url) { if (jobs[i].results_count > 0 && all_results[i][0].url) {
char *redirect_url = strdup(all_results[i][0].url); char *redirect_url = strdup(all_results[i][0].url);
for (int j = 0; j < enabled_engine_count; j++) { for (int j = 0; j < enabled_engine_count; j++) {
@@ -674,17 +428,13 @@ int results_handler(UrlParams *params) {
char ***results_matrix = (char ***)malloc(sizeof(char **) * total_results); char ***results_matrix = (char ***)malloc(sizeof(char **) * total_results);
int *results_inner_counts = (int *)malloc(sizeof(int) * total_results); int *results_inner_counts = (int *)malloc(sizeof(int) * total_results);
char **seen_urls = (char **)malloc(sizeof(char *) * total_results); char **seen_urls = (char **)malloc(sizeof(char *) * total_results);
unsigned int *source_masks = if (!results_matrix || !results_inner_counts || !seen_urls) {
(unsigned int *)calloc(total_results, sizeof(unsigned int));
if (!results_matrix || !results_inner_counts || !seen_urls || !source_masks) {
if (results_matrix) if (results_matrix)
free(results_matrix); free(results_matrix);
if (results_inner_counts) if (results_inner_counts)
free(results_inner_counts); free(results_inner_counts);
if (seen_urls) if (seen_urls)
free(seen_urls); free(seen_urls);
if (source_masks)
free(source_masks);
char *html = render_template("results.html", &ctx); char *html = render_template("results.html", &ctx);
if (html) { if (html) {
send_response(html); send_response(html);
@@ -712,7 +462,6 @@ int results_handler(UrlParams *params) {
for (int k = 0; k < unique_count; k++) { for (int k = 0; k < unique_count; k++) {
if (strcmp(seen_urls[k], display_url) == 0) { if (strcmp(seen_urls[k], display_url) == 0) {
is_duplicate = 1; is_duplicate = 1;
source_masks[k] |= (1u << i);
break; break;
} }
} }
@@ -732,7 +481,7 @@ int results_handler(UrlParams *params) {
continue; continue;
} }
results_matrix[unique_count] = results_matrix[unique_count] =
(char **)malloc(sizeof(char *) * RESULT_FIELD_COUNT); (char **)malloc(sizeof(char *) * INFOBOX_FIELD_COUNT);
if (!results_matrix[unique_count]) { if (!results_matrix[unique_count]) {
free(seen_urls[unique_count]); free(seen_urls[unique_count]);
free(all_results[i][j].url); free(all_results[i][j].url);
@@ -741,7 +490,6 @@ int results_handler(UrlParams *params) {
continue; continue;
} }
char *pretty_url = pretty_display_url(display_url); char *pretty_url = pretty_display_url(display_url);
char *base_url = get_base_url(display_url);
results_matrix[unique_count][0] = strdup(display_url); results_matrix[unique_count][0] = strdup(display_url);
results_matrix[unique_count][1] = strdup(pretty_url); results_matrix[unique_count][1] = strdup(pretty_url);
@@ -751,14 +499,10 @@ int results_handler(UrlParams *params) {
results_matrix[unique_count][3] = results_matrix[unique_count][3] =
all_results[i][j].snippet ? strdup(all_results[i][j].snippet) all_results[i][j].snippet ? strdup(all_results[i][j].snippet)
: strdup(""); : strdup("");
results_matrix[unique_count][4] = strdup(base_url ? base_url : "");
results_matrix[unique_count][5] = NULL;
source_masks[unique_count] = (1u << i); results_inner_counts[unique_count] = INFOBOX_FIELD_COUNT;
results_inner_counts[unique_count] = RESULT_FIELD_COUNT;
free(pretty_url); free(pretty_url);
free(base_url);
free(all_results[i][j].url); free(all_results[i][j].url);
free(all_results[i][j].title); free(all_results[i][j].title);
free(all_results[i][j].snippet); free(all_results[i][j].snippet);
@@ -768,68 +512,9 @@ int results_handler(UrlParams *params) {
free(all_results[i]); free(all_results[i]);
} }
for (int i = 0; i < unique_count; i++) {
results_matrix[i][5] =
build_result_sources(source_masks[i], jobs, enabled_engine_count);
if (!results_matrix[i][5])
results_matrix[i][5] = strdup("");
}
context_set_array_of_arrays(&ctx, "results", results_matrix, unique_count, context_set_array_of_arrays(&ctx, "results", results_matrix, unique_count,
results_inner_counts); results_inner_counts);
char ***pager_matrix = NULL;
int *pager_inner_counts = NULL;
int pager_count = 0;
int pager_start = page <= 3 ? 1 : page - 2;
int pager_end = pager_start + PAGER_WINDOW_SIZE - 1;
if (page > 3) {
char *first_href = build_search_href(raw_query, selected_engine_id, 1);
pager_count = add_link_to_collection(first_href, "First", "pagination-btn",
&pager_matrix, &pager_inner_counts,
pager_count);
free(first_href);
}
if (page > 1) {
char *prev_href =
build_search_href(raw_query, selected_engine_id, page - 1);
pager_count = add_link_to_collection(prev_href, "Prev", "pagination-btn",
&pager_matrix, &pager_inner_counts,
pager_count);
free(prev_href);
}
for (int i = pager_start; i <= pager_end; i++) {
char label[16];
snprintf(label, sizeof(label), "%d", i);
char *page_href = build_search_href(raw_query, selected_engine_id, i);
pager_count = add_link_to_collection(
page_href, label,
i == page ? "pagination-btn pagination-current" : "pagination-btn",
&pager_matrix, &pager_inner_counts, pager_count);
free(page_href);
}
char *next_href = build_search_href(raw_query, selected_engine_id, page + 1);
pager_count = add_link_to_collection(next_href, "Next", "pagination-btn",
&pager_matrix, &pager_inner_counts,
pager_count);
free(next_href);
if (pager_count > 0) {
context_set_array_of_arrays(&ctx, "pagination_links", pager_matrix,
pager_count, pager_inner_counts);
for (int i = 0; i < pager_count; i++) {
for (int j = 0; j < LINK_FIELD_COUNT; j++)
free(pager_matrix[i][j]);
free(pager_matrix[i]);
}
free(pager_matrix);
free(pager_inner_counts);
}
char *html = render_template("results.html", &ctx); char *html = render_template("results.html", &ctx);
if (html) { if (html) {
send_response(html); send_response(html);
@@ -837,13 +522,12 @@ int results_handler(UrlParams *params) {
} }
for (int i = 0; i < unique_count; i++) { for (int i = 0; i < unique_count; i++) {
for (int j = 0; j < RESULT_FIELD_COUNT; j++) for (int j = 0; j < INFOBOX_FIELD_COUNT; j++)
free(results_matrix[i][j]); free(results_matrix[i][j]);
free(results_matrix[i]); free(results_matrix[i]);
free(seen_urls[i]); free(seen_urls[i]);
} }
free(seen_urls); free(seen_urls);
free(source_masks);
free(results_matrix); free(results_matrix);
free(results_inner_counts); free(results_inner_counts);
} else { } else {

View File

@@ -1,36 +1,43 @@
@import url("https://cdn.jsdelivr.net/npm/@catppuccin/palette/css/catppuccin.css");
:root { :root {
--bg-main: #ffffff; --bg-main: var(--ctp-latte-base);
--bg-card: #f8f9fa; --bg-card: var(--ctp-latte-overlay0);
--border: #e0e0e0; --border: var(--ctp-latte-overlay2);
--text-primary: #1a1a1a; --text-primary: var(--ctp-latte-text);
--text-secondary: #5f6368; --text-secondary: var(--ctp-latte-subtext0);
--text-muted: #757575; --text-muted: var(--ctp-latte-overlay1);
--accent: #202124; --accent: var(--ctp-latte-mauve);
--accent-glow: rgba(0,0,0,0.05); --accent-glow: rgba(0, 0, 0, 0.05);
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
:root { :root {
--bg-main: #121212; --bg-main: var(--ctp-mocha-base);
--bg-card: #1e1e1e; --bg-card: var(--ctp-mocha-surface1);
--border: #333333; --border: var(--ctp-mocha-overlay2);
--text-primary: #ffffff; --text-primary: var(--ctp-mocha-text);
--text-secondary: #a0a0a0; --text-secondary: var(--ctp-mocha-subtext0);
--text-muted: #d1d1d1; --text-muted: var(--ctp-mocha-subtext1);
--accent: #e2e2e2; --accent: var(--ctp-mocha-mauve);
--accent-glow: rgba(255,255,255,0.1); --accent-glow: rgba(0, 0, 0, 0.05);
} }
} }
*, *::before, *::after { *,
*::before,
*::after {
box-sizing: border-box; box-sizing: border-box;
} }
body { body {
background-color:var(--bg-main); background-color: var(--bg-main);
color:var(--text-primary); color: var(--text-primary);
font-family:system-ui,-apple-system,sans-serif; font-family:
margin:0; system-ui,
padding:0; -apple-system,
sans-serif;
margin: 0;
padding: 0;
-webkit-tap-highlight-color: transparent; -webkit-tap-highlight-color: transparent;
} }
@@ -38,13 +45,22 @@ img[src=""] {
display: none; display: none;
} }
#header-icon {
text-decoration: none;
color: var(--text-primary);
}
.view-home { .view-home {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
min-height: 100vh; min-height: 100vh;
padding: 20px; padding: 20px;
background: radial-gradient(circle at top right, var(--bg-card) 0%, var(--bg-main) 100%); background: radial-gradient(
circle at top right,
var(--accent) 0%,
var(--bg-main) 100%
);
} }
.view-home .container { .view-home .container {
@@ -57,10 +73,10 @@ img[src=""] {
} }
.view-home .hero-logo { .view-home .hero-logo {
font-size:4.5rem; font-size: 4.5rem;
margin-bottom:30px; margin-bottom: 30px;
letter-spacing:-3px; letter-spacing: -3px;
font-weight:800; font-weight: 800;
} }
.view-home .search-input-wrapper { .view-home .search-input-wrapper {
width: 100%; width: 100%;
@@ -68,63 +84,65 @@ img[src=""] {
} }
.view-home .search-box { .view-home .search-box {
font-size:1.1rem; font-size: 1.1rem;
padding:16px 28px; padding: 16px 28px;
box-shadow:0 4px 6px -1px rgba(0,0,0,0.1),0 2px 4px -1px rgba(0,0,0,0.06); box-shadow:
0 4px 6px -1px rgba(0, 0, 0, 0.1),
0 2px 4px -1px rgba(0, 0, 0, 0.06);
} }
.view-home .buttons { .view-home .buttons {
display:flex; display: flex;
gap:12px; gap: 12px;
justify-content:center; justify-content: center;
} }
.view-home button { .view-home button {
padding:10px 24px; padding: 10px 24px;
border-radius:8px; border-radius: 8px;
font-weight:600; font-weight: 600;
font-size:0.9rem; font-size: 0.9rem;
cursor:pointer; cursor: pointer;
transition:all 0.2s; transition: all 0.2s;
border:1px solid transparent; border: 1px solid transparent;
touch-action:manipulation; touch-action: manipulation;
} }
.view-home .btn-primary { .view-home .btn-primary {
background:var(--accent); background: var(--accent);
color:var(--bg-main); color: var(--bg-main);
} }
.view-home .btn-primary:hover { .view-home .btn-primary:hover {
filter:brightness(1.1); filter: brightness(1.1);
transform:translateY(-1px); transform: translateY(-1px);
} }
.view-home .btn-secondary { .view-home .btn-secondary {
background:var(--bg-card); background: var(--bg-card);
color:var(--text-primary); color: var(--text-primary);
border-color:var(--border); border-color: var(--border);
} }
.view-home .btn-secondary:hover { .view-home .btn-secondary:hover {
background:var(--border); background: var(--border);
border-color:var(--text-secondary); border-color: var(--text-secondary);
} }
header { header {
display:flex; display: flex;
align-items:center; align-items: center;
gap:20px; gap: 20px;
padding:15px 60px; padding: 15px 60px;
border-bottom:1px solid var(--border); border-bottom: 1px solid var(--border);
background:var(--bg-main); background: var(--bg-main);
} }
.search-form { .search-form {
flex-grow:1; flex-grow: 1;
max-width:600px; max-width: 600px;
} }
h1 { h1 {
font-size:1.5rem; font-size: 1.5rem;
margin:0; margin: 0;
letter-spacing:-1px; letter-spacing: -1px;
white-space:nowrap; white-space: nowrap;
} }
h1 span { h1 span {
color:var(--accent); color: var(--accent);
} }
.search-box { .search-box {
width: 100%; width: 100%;
@@ -134,73 +152,77 @@ h1 span {
background: var(--bg-card); background: var(--bg-card);
color: var(--text-primary); color: var(--text-primary);
outline: none; outline: none;
transition: border-color 0.2s, box-shadow 0.2s; transition:
border-color 0.2s,
box-shadow 0.2s;
} }
.search-box:focus { .search-box:focus {
border-color:var(--accent); border-color: var(--accent);
box-shadow:0 0 0 4px var(--accent-glow); box-shadow: 0 0 0 4px var(--accent-glow);
} }
.nav-tabs { .nav-tabs {
padding:0 60px; padding: 0 60px;
border-bottom:1px solid var(--border); border-bottom: 1px solid var(--border);
background:var(--bg-main); background: var(--bg-main);
} }
.nav-container { .nav-container {
display:flex; display: flex;
gap:30px; gap: 30px;
max-width:1200px; max-width: 1200px;
} }
.nav-tabs a { .nav-tabs a {
padding:14px 0; padding: 14px 0;
color:var(--text-secondary); color: var(--text-secondary);
text-decoration:none; text-decoration: none;
font-size:0.9rem; font-size: 0.9rem;
font-weight:500; font-weight: 500;
border-bottom:2px solid transparent; border-bottom: 2px solid transparent;
transition:color 0.2s; transition: color 0.2s;
touch-action: manipulation; touch-action: manipulation;
} }
.nav-tabs a:hover { .nav-tabs a:hover {
color:var(--text-primary); color: var(--text-primary);
} }
.nav-tabs a.active { .nav-tabs a.active {
color:var(--accent); color: var(--accent);
border-bottom-color:var(--accent); border-bottom-color: var(--accent);
} }
.image-results-container { .image-results-container {
padding:30px 60px; padding: 30px 60px;
} }
.image-grid { .image-grid {
display:grid; display: grid;
grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
gap:24px; gap: 24px;
max-width:1600px; max-width: 1600px;
margin:0 auto; margin: 0 auto;
} }
.image-card { .image-card {
background:var(--bg-card); background: var(--bg-card);
border-radius:12px; border-radius: 12px;
overflow:hidden; overflow: hidden;
border:1px solid var(--border); border: 1px solid var(--border);
transition:transform 0.2s ease,border-color 0.2s; transition:
transform 0.2s ease,
border-color 0.2s;
} }
.image-card:hover { .image-card:hover {
transform:translateY(-4px); transform: translateY(-4px);
border-color:var(--accent); border-color: var(--accent);
} }
.image-wrapper { .image-wrapper {
position:relative; position: relative;
aspect-ratio:4/3; aspect-ratio: 4/3;
background:#000; background: #000;
overflow:hidden; overflow: hidden;
} }
.image-wrapper img { .image-wrapper img {
width:100%; width: 100%;
height:100%; height: 100%;
object-fit:cover; object-fit: cover;
display:block; display: block;
transition:opacity 0.3s; transition: opacity 0.3s;
} }
.image-overlay { .image-overlay {
position: absolute; position: absolute;
@@ -214,79 +236,104 @@ h1 span {
pointer-events: none; pointer-events: none;
} }
.image-card:hover .image-overlay { .image-card:hover .image-overlay {
opacity:1; opacity: 1;
pointer-events: auto; pointer-events: auto;
} }
.overlay-buttons { .overlay-buttons {
display:flex; display: flex;
flex-direction:column; flex-direction: column;
gap:10px; gap: 10px;
width:70%; width: 70%;
} }
.overlay-btn { .overlay-btn {
padding:8px 16px; padding: 8px 16px;
border-radius:20px; border-radius: 20px;
font-size:0.8rem; font-size: 0.8rem;
font-weight:700; font-weight: 700;
text-decoration:none; text-decoration: none;
text-align:center; text-align: center;
transition:filter 0.2s; transition: filter 0.2s;
touch-action: manipulation; touch-action: manipulation;
} }
.overlay-btn:hover { .overlay-btn:hover {
filter:brightness(1.1); filter: brightness(1.1);
} }
.overlay-btn.primary { .overlay-btn.primary {
background:var(--accent); background: var(--accent);
color:var(--bg-main); color: var(--bg-main);
} }
.overlay-btn.secondary { .overlay-btn.secondary {
background:rgba(255,255,255,0.1); background: rgba(255, 255, 255, 0.1);
color:white; color: white;
backdrop-filter:blur(4px); backdrop-filter: blur(4px);
border:1px solid rgba(255,255,255,0.2); border: 1px solid rgba(255, 255, 255, 0.2);
} }
.image-info { .image-info {
padding:12px; padding: 12px;
} }
.image-caption { .image-caption {
display:block; display: block;
font-size:0.85rem; font-size: 0.85rem;
color:var(--text-primary); color: var(--text-primary);
white-space:nowrap; white-space: nowrap;
overflow:hidden; overflow: hidden;
text-overflow:ellipsis; text-overflow: ellipsis;
margin-bottom:4px; margin-bottom: 4px;
} }
.image-source { .image-source {
display:block; display: block;
font-size:0.75rem; font-size: 0.75rem;
color:var(--text-secondary); color: var(--text-secondary);
white-space:nowrap; white-space: nowrap;
overflow:hidden; overflow: hidden;
text-overflow:ellipsis; text-overflow: ellipsis;
} }
.content-layout { .content-layout {
display:grid; display: grid;
grid-template-columns:140px minmax(0,700px) 450px; grid-template-columns: 140px minmax(0, 700px) 450px;
gap:60px; gap: 60px;
padding:30px 60px; padding: 30px 60px;
} }
.result-header { .results-container {
grid-column: 2;
}
.engine-warning-list {
display: flex; display: flex;
align-items: center; flex-direction: column;
gap: 8px; gap: 12px;
margin-bottom: 2px; margin-bottom: 24px;
position: relative;
} }
.result-favicon { .engine-warning {
width: 16px; background: var(--bg-card);
height: 16px; border: 1px solid var(--border);
flex-shrink: 0; border-radius: 12px;
background-size: cover; padding: 14px 16px;
background-position: center; }
position: absolute; .engine-warning-title {
left: -24px; display: block;
font-size: 0.95rem;
font-weight: 700;
margin-bottom: 4px;
}
.engine-warning-copy {
color: var(--text-muted);
line-height: 1.5;
margin: 0;
}
.result {
margin-bottom: 32px;
}
.result > a {
color: var(--accent);
text-decoration: underline;
text-decoration-color: transparent;
font-size: 1.25rem;
display: inline-block;
margin-bottom: 4px;
transition: text-decoration-color 0.1s;
}
.result > a:hover {
text-decoration-color: var(--accent);
} }
.url { .url {
color: var(--text-secondary); color: var(--text-secondary);
@@ -294,113 +341,35 @@ h1 span {
display: block; display: block;
margin-bottom: 4px; margin-bottom: 4px;
} }
.result-sources {
color:var(--text-secondary);
display:block;
font-size:0.78rem;
margin-bottom:8px;
}
@media (max-width: 768px) {
.result-favicon {
width: 14px;
height: 14px;
left: -20px;
}
}
@media (max-width: 480px) {
.result-favicon {
width: 12px;
height: 12px;
left: -16px;
}
}
.results-container {
grid-column:2;
}
.engine-filter-list {
display:flex;
flex-wrap:wrap;
gap:10px;
margin-bottom:24px;
}
.engine-filter {
background:var(--bg-card);
color:var(--text-secondary);
border:1px solid var(--border);
border-radius:999px;
padding:6px 12px;
text-decoration:none;
font-size:0.85rem;
font-weight:600;
}
.engine-filter.active {
background:var(--accent);
border-color:var(--accent);
color:var(--bg-main);
}
.engine-warning-list {
display:flex;
flex-direction:column;
gap:12px;
margin-bottom:24px;
}
.engine-warning {
background:var(--bg-card);
border:1px solid var(--border);
border-radius:12px;
padding:14px 16px;
}
.engine-warning-title {
display:block;
font-size:0.95rem;
font-weight:700;
margin-bottom:4px;
}
.engine-warning-copy {
color:var(--text-muted);
line-height:1.5;
margin:0;
}
.result {
margin-bottom:32px;
}
.result > a {
color:var(--accent);
text-decoration:none;
font-size:1.25rem;
display:inline-block;
margin-bottom:4px;
}
.desc { .desc {
color:var(--text-muted); color: var(--text-muted);
line-height:1.6; line-height: 1.6;
margin:0; margin: 0;
} }
.cached { .cached {
color: var(--text-secondary); color: var(--text-secondary);
font-size:0.85rem; font-size: 0.85rem;
display:inline-block; display: inline-block;
text-decoration: underline; text-decoration: underline;
} }
.infobox { .infobox {
grid-column:3; grid-column: 3;
background:var(--bg-card); background: var(--bg-card);
border:1px solid var(--border); border: 1px solid var(--border);
border-radius:12px; border-radius: 12px;
align-self:start; align-self: start;
margin-bottom: 10px; margin-bottom: 10px;
} }
.infobox-header { .infobox-header {
padding:20px; padding: 20px;
border-bottom:1px solid var(--border); border-bottom: 1px solid var(--border);
} }
.infobox-title { .infobox-title {
font-size:1.5rem; font-size: 1.5rem;
font-weight:600; font-weight: 600;
margin:0; margin: 0;
} .infobox-content { }
.infobox-content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 12px; gap: 12px;
@@ -416,25 +385,26 @@ h1 span {
.read-more:hover { .read-more:hover {
text-decoration: underline; text-decoration: underline;
} .infobox-main { }
display:flex; .infobox-main {
gap:15px; display: flex;
padding:20px; gap: 15px;
padding: 20px;
} }
.infobox-image { .infobox-image {
width:120px; width: 120px;
height:120px; height: 120px;
min-width:120px; min-width: 120px;
border-radius:8px; border-radius: 8px;
border:1px solid var(--border); border: 1px solid var(--border);
object-fit:cover; object-fit: cover;
} }
.infobox-summary { .infobox-summary {
display: block; display: block;
font-size:0.95rem; font-size: 0.95rem;
line-height:1.5; line-height: 1.5;
color:var(--text-muted); color: var(--text-muted);
margin:0; margin: 0;
} }
.pagination { .pagination {
@@ -464,201 +434,200 @@ h1 span {
border-color: var(--text-secondary); border-color: var(--text-secondary);
} }
.pagination-current { .pagination-current {
background: var(--accent); background: var(--bg-card);
border-color: var(--accent); color: var(--text-primary);
color: var(--bg-main); border: 1px solid var(--border);
padding: 4px 12px;
border-radius: 8px;
text-decoration: none;
font-size: 1.2rem;
font-weight: 600;
transition: all 0.2s;
touch-action: manipulation;
} }
.pagination-current:hover { .pagination-current:hover {
background: var(--accent); background: var(--border);
border-color: var(--accent); border-color: var(--text-secondary);
} }
@media (max-width: 1200px) {
@media (max-width:1200px) {
body {
padding-left: 16px;
padding-right: 16px;
}
.content-layout { .content-layout {
grid-template-columns:1fr; grid-template-columns: 1fr;
padding:20px 30px; padding: 20px 30px;
gap:20px; gap: 20px;
} }
.results-container,.infobox-sidebar { .results-container,
grid-column:1; .infobox-sidebar {
max-width:100%; grid-column: 1;
max-width: 100%;
} }
.infobox-sidebar { .infobox-sidebar {
order:-1; order: -1;
} }
.nav-tabs,.image-results-container { .nav-tabs,
padding:0 30px; .image-results-container {
padding: 0 30px;
} }
header { header {
padding:15px 30px; padding: 15px 30px;
} }
} }
@media (max-width:768px) { @media (max-width: 768px) {
body {
padding-left: 16px;
padding-right: 16px;
}
header { header {
flex-direction:column; flex-direction: column;
gap:12px; gap: 12px;
padding:12px 16px; padding: 12px 16px;
text-align:center; text-align: center;
} }
h1 { h1 {
font-size:1.3rem; font-size: 1.3rem;
} }
.search-form { .search-form {
width:100%; width: 100%;
max-width:100%; max-width: 100%;
} }
.search-form .search-box { .search-form .search-box {
width:100%; width: 100%;
} }
.nav-tabs { .nav-tabs {
overflow-x:auto; overflow-x: auto;
-webkit-overflow-scrolling:touch; -webkit-overflow-scrolling: touch;
padding:0 16px; padding: 0 16px;
} }
.nav-container { .nav-container {
gap:24px; gap: 24px;
min-width:max-content; min-width: max-content;
} }
.nav-tabs a { .nav-tabs a {
padding:12px 0; padding: 12px 0;
font-size:0.95rem; font-size: 0.95rem;
} }
.content-layout { .content-layout {
padding:16px; padding: 16px;
gap:16px; gap: 16px;
} }
.result { .result {
margin-bottom:24px; margin-bottom: 24px;
} }
.engine-warning { .engine-warning {
padding:12px 14px; padding: 12px 14px;
} }
.result > a { .result > a {
font-size:1.1rem; font-size: 1.1rem;
word-break:break-word; word-break: break-word;
} }
.url { .url {
font-size:0.8rem; font-size: 0.8rem;
word-break:break-all; word-break: break-all;
} }
.desc { .desc {
font-size:0.9rem; font-size: 0.9rem;
} }
.cached { .cached {
font-size:0.8rem; font-size: 0.8rem;
} }
.infobox { .infobox {
margin-bottom:16px; margin-bottom: 16px;
} }
.infobox-header { .infobox-header {
padding:16px; padding: 16px;
} }
.infobox-title { .infobox-title {
font-size:1.2rem; font-size: 1.2rem;
} }
.infobox-main { .infobox-main {
flex-direction:column; flex-direction: column;
padding:16px; padding: 16px;
gap:12px; gap: 12px;
} }
.infobox-image { .infobox-image {
width:100%; width: 100%;
height:auto; height: auto;
min-width:unset; min-width: unset;
max-width:200px; max-width: 200px;
} }
.image-results-container { .image-results-container {
padding:16px; padding: 16px;
} }
.pagination { .pagination {
flex-wrap:wrap; flex-wrap: wrap;
gap:8px; gap: 8px;
padding:0 8px; padding: 0 8px;
} }
.pagination-btn { .pagination-btn {
padding:10px 14px; padding: 10px 14px;
font-size:0.85rem; font-size: 0.85rem;
} }
.view-home { .view-home {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
transform: translateY(-5vh); transform: translateY(-5vh);
padding:20px 16px; padding: 20px 16px;
min-height: 100vh; min-height: 100vh;
} }
.view-home .container { .view-home .container {
padding:0; padding: 0;
width:100%; width: 100%;
max-width:580px; max-width: 580px;
} }
.view-home .hero-logo { .view-home .hero-logo {
font-size:3rem; font-size: 3rem;
margin-bottom:24px; margin-bottom: 24px;
} }
.view-home .search-input-wrapper { .view-home .search-input-wrapper {
margin-bottom:16px; margin-bottom: 16px;
} }
.view-home .search-box { .view-home .search-box {
width:100%; width: 100%;
font-size:1rem; font-size: 1rem;
padding:14px 20px; padding: 14px 20px;
} }
.view-home .buttons { .view-home .buttons {
gap:10px; gap: 10px;
} }
.view-home button { .view-home button {
padding:12px 20px; padding: 12px 20px;
} }
} }
@media (max-width:600px) { @media (max-width: 600px) {
header { header {
padding:12px 12px; padding: 12px 12px;
} }
.search-box { .search-box {
font-size:0.95rem; font-size: 0.95rem;
} }
.view-home .search-box { .view-home .search-box {
width:100%; width: 100%;
} }
.view-home { .view-home {
padding:20px 16px; padding: 20px 16px;
} }
.image-grid { .image-grid {
grid-template-columns:repeat(auto-fill,minmax(140px,1fr)); grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
gap:10px; gap: 10px;
} }
.image-card { .image-card {
border-radius:8px; border-radius: 8px;
} }
.image-info { .image-info {
padding:8px 10px; padding: 8px 10px;
} }
.image-caption { .image-caption {
font-size:0.8rem; font-size: 0.8rem;
} }
.image-source { .image-source {
font-size:0.7rem; font-size: 0.7rem;
} }
.overlay-buttons { .overlay-buttons {
width:80%; width: 80%;
} }
.overlay-btn { .overlay-btn {
padding:6px 12px; padding: 6px 12px;
font-size:0.75rem; font-size: 0.75rem;
} }
} }

View File

@@ -18,7 +18,7 @@
<div class="view-home"> <div class="view-home">
<div class="container"> <div class="container">
<h1 class="hero-logo"> <h1 class="hero-logo">
Omni<span>Search</span> <span>Void</span>arc
</h1> </h1>
<form action="/search" class="home-search-form"> <form action="/search" class="home-search-form">
<div class="search-input-wrapper"> <div class="search-input-wrapper">

View File

@@ -14,7 +14,7 @@
<body class="images-view"> <body class="images-view">
<header> <header>
<h1> <h1>
Omni<span>Search</span> <a id="header-icon" href="/"><span>Void</span>arc</a>
</h1> </h1>
<form action="/images" method="GET" class="search-form"> <form action="/images" method="GET" class="search-form">
<input name="q" autocomplete="off"="text" class="search-box" placeholder="Search for images..." <input name="q" autocomplete="off"="text" class="search-box" placeholder="Search for images..."

View File

@@ -17,17 +17,16 @@
<body class="results-view"> <body class="results-view">
<header> <header>
<h1> <h1>
Omni<span>Search</span> <a id="header-icon" href="/"><span>Void</span>arc</a>
</h1> </h1>
<form action="/search" method="GET" class="search-form"> <form action="/search" method="GET" class="search-form">
<input name="engine" type="hidden" value="{{selected_engine}}">
<input name="q" type="text" class="search-box" autocomplete="off" placeholder="Search the web..." <input name="q" type="text" class="search-box" autocomplete="off" placeholder="Search the web..."
value="{{query}}"> value="{{query}}">
</form> </form>
</header> </header>
<nav class="nav-tabs"> <nav class="nav-tabs">
<div class="nav-container"> <div class="nav-container">
<a href="{{search_href}}" class="active"> <a href="/search?q={{query}}" class="active">
All All
</a> </a>
<a href="/images?q={{query}}"> <a href="/images?q={{query}}">
@@ -39,16 +38,6 @@
<aside class="sidebar-spacer"> <aside class="sidebar-spacer">
</aside> </aside>
<main class="results-container"> <main class="results-container">
{{if exists engine_filters}}
<nav class="engine-filter-list">
{{for filter in engine_filters}}
<a href="{{filter[0]}}" class="{{filter[2]}}">
{{filter[1]}}
</a>
{{endfor}}
</nav>
{{endif}}
{{if exists engine_warnings}} {{if exists engine_warnings}}
<section class="engine-warning-list"> <section class="engine-warning-list">
{{for warning in engine_warnings}} {{for warning in engine_warnings}}
@@ -66,17 +55,9 @@
{{for result in results}} {{for result in results}}
<div class="result"> <div class="result">
<div class="result-header">
<div class="result-favicon"
style="background-image: url('https://{{result[4]}}/favicon.ico'), url('https://{{result[4]}}/favicon.png');">
</div>
<span class="url"> <span class="url">
{{result[1]}} {{result[1]}}
</span> </span>
<span class="result-sources">
{{result[5]}}
</span>
</div>
<a href="{{result[0]}}"> <a href="{{result[0]}}">
{{result[2]}} {{result[2]}}
</a> </a>
@@ -89,15 +70,48 @@
</div> </div>
{{endfor}} {{endfor}}
{{if exists pagination_links}}
<nav class="pagination"> <nav class="pagination">
{{for link in pagination_links}} <a class="pagination-btn prev" href="/search?q={{query}}&p={{prev_page}}">
<a class="{{link[2]}}" href="{{link[0]}}"> &larr;
{{link[1]}} </a>
{{if two_prev_page != 0}}
<a class="pagination-btn prev" href="/search?q={{query}}&p={{two_prev_page}}">
{{two_prev_page}}
</a> </a>
{{endfor}}
</nav>
{{endif}} {{endif}}
{{if prev_page != 0}}
<a class="pagination-btn prev" href="/search?q={{query}}&p={{prev_page}}">
{{prev_page}}
</a>
{{endif}}
<a class="pagination-current" href="/search?q={{query}}&p={{page}}">
{{page}}
</a>
<a class="pagination-btn next" href="/search?q={{query}}&p={{next_page}}">
{{next_page}}
</a>
<a class="pagination-btn next" href="/search?q={{query}}&p={{two_next_page}}">
{{two_next_page}}
</a>
{{if prev_page == 0}}
<a class="pagination-btn prev" href="/search?q={{query}}&p=4">
4
</a>
{{endif}}
{{if two_prev_page == 0}}
<a class="pagination-btn prev" href="/search?q={{query}}&p=5">
5
</a>
{{endif}}
<a class="pagination-btn next" href="/search?q={{query}}&p={{next_page}}">
&rarr;
</a>
</nav>
</main> </main>
<aside class="infobox-sidebar"> <aside class="infobox-sidebar">
{{if exists infoboxes}} {{if exists infoboxes}}