diff --git a/inc/mdEmbeds.php b/inc/mdEmbeds.php index 9276845..c378817 100644 --- a/inc/mdEmbeds.php +++ b/inc/mdEmbeds.php @@ -382,8 +382,43 @@ function searchMDObjects(array $arguments, array $settings):string { $contents = json_decode(queryCachePage($settings['mdVersion'] . "?$srcArgs", "search", $settings), true); - $output = ' + if (!isset($contents[0])) return ""; + + $output = '
+
+ '; + + if (isset($_GET['startwert']) and $_GET['startwert'] % 24 === 0) $current = $_GET['startwert']; + else $current = 0; + + $toDisplay = []; + for ($i = 0; $i <= 7; $i++) { + $toDisplay[] = $current + (-72 + 24 * $i); + } + + $i = 0; + $lastToDisplay = end($toDisplay); + while ($i < $contents[0]['total']) { + + if (!in_array($i, $toDisplay)) { + $i += 24; continue; + } + + $output .= ' + ' . strval($i / 24) . ' + '; + + $i += 24; + if ($i == $lastToDisplay) break; + } + + // Generate pagination + $output .= ' + +
'; foreach ($contents as $object) { diff --git a/js/main.js b/js/main.js index 521a038..9c3d4d5 100644 --- a/js/main.js +++ b/js/main.js @@ -31,6 +31,7 @@ document.addEventListener("DOMContentLoaded", function() { "SearchingFor" : "Searching for", "Hits" : "Hits:", "ResultsInPages" : "Results in texts", + "ResultsInObjects" : "Results in objects", "... who" : "... who", "... where" : "... where", "... when" : "... when", @@ -54,6 +55,7 @@ document.addEventListener("DOMContentLoaded", function() { "SearchingFor" : "Suche nach", "Hits" : "Treffer:", "ResultsInPages" : "Treffer in Texten", + "ResultsInObjects" : "Treffer in Objekten", "... who" : "... wer", "... where" : "... wo", "... when" : "... wann", diff --git a/search.php b/search.php index b26e111..ec46b42 100644 --- a/search.php +++ b/search.php @@ -51,6 +51,9 @@ if (!isset($_GET['q'])) { } else { + $getArgsForMD = []; + foreach ($_GET as $key => $value) $getArgsForMD[] = "$key=$value"; + echo '

"' . $_GET['q'] . '"

@@ -61,7 +64,7 @@ else {

- ' . searchMDObjects(["sv=" . $_GET['q']], $settings) . ' + ' . searchMDObjects(array_merge(["sv=" . $_GET['q']], $getArgsForMD), $settings) . '
'; diff --git a/themes/default/mdEmbeds.css b/themes/default/mdEmbeds.css index 6473fe5..86488e7 100644 --- a/themes/default/mdEmbeds.css +++ b/themes/default/mdEmbeds.css @@ -11,6 +11,17 @@ .searchGrid .objTile { margin-bottom: 1em; vertical-align: top; } .searchGrid .objTile img { max-height: 180px; } +/****** + * Pagination bars + */ + +.paginationBar { margin: 0 0 2em 0; background: #F2F2F2; border: 1px solid #D6D6D6; text-align: center; } +.paginationBar a { display: inline-block; padding: .3em .8em; transition: background .4s, color .4s; } +.paginationBar a.current:hover, +.paginationBar a:hover { background: #646464; color: #FFF; } +.paginationBar a.current, +a.navicurrent { background: #D6D6D6; } + /********** * Simple tiles for displaying an object. */