Merge pull request #2069 from llmII/feat-pagination-numbered

Feature: Support numbered pagination.
This commit is contained in:
Paul Braeuning 2023-01-23 23:06:24 +01:00 committed by GitHub
commit 522ba9a14b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 56 additions and 2 deletions

View File

@ -167,3 +167,4 @@ features or generally made searx better:
- @XavierHorwood - @XavierHorwood
- Ahmad Alkadri `<https://github.com/ahmad-alkadri>`_ - Ahmad Alkadri `<https://github.com/ahmad-alkadri>`_
- Milad Laly @Milad-Laly - Milad Laly @Milad-Laly
- @llmII

Binary file not shown.

View File

@ -362,7 +362,7 @@ article[data-vim-selected].category-social {
.category-files, .category-files,
.category-social { .category-social {
border: 1px solid var(--color-result-border); border: 1px solid var(--color-result-border);
margin: 1rem @results-tablet-offset 0 @results-tablet-offset !important; margin: 0 @results-tablet-offset 1rem @results-tablet-offset !important;
.rounded-corners; .rounded-corners;
} }
@ -734,6 +734,26 @@ article[data-vim-selected].category-social {
} }
} }
.numbered_pagination {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
overflow: hidden;
}
.page_number {
background: transparent !important;
color: var(--color-result-link-font) !important;
text-decoration: underline;
}
.page_number_current {
background: transparent;
color: var(--color-result-link-visited-font);
border: none;
}
#apis { #apis {
margin-top: 8px; margin-top: 8px;
clear: both; clear: both;
@ -1009,6 +1029,10 @@ article[data-vim-selected].category-social {
background-color: var(--color-sidebar-background); background-color: var(--color-sidebar-background);
} }
.numbered_pagination {
display: none;
}
.result-paper { .result-paper {
.attributes { .attributes {
display: block; display: block;

View File

@ -187,6 +187,35 @@
<button role="link" type="submit">{{ _('Next page') }} {{ icon_small('chevron-right') }}</button> <button role="link" type="submit">{{ _('Next page') }} {{ icon_small('chevron-right') }}</button>
</div> </div>
</form> </form>
{% set pstart = 1 %}
{% set pend = 11 %}
{% if pageno > 5 %}
{% set pstart = pageno - 4 %}
{% set pend = pageno + 6 %}
{% endif %}
<div class="numbered_pagination">
{% for x in range(pstart, pend) %}
<form method="{{ method or 'POST' }}" action="{{ url_for('search') }}" class="page_number">
<input type="hidden" name="q" value="{{ q|e }}" >
{% for category in selected_categories %}
<input type="hidden" name="category_{{ category }}" value="1" >
{% endfor %}
<input type="hidden" name="pageno" value="{{ x }}" >
<input type="hidden" name="language" value="{{ current_language }}" >
<input type="hidden" name="time_range" value="{{ time_range }}" >
<input type="hidden" name="safesearch" value="{{ safesearch }}" >
<input type="hidden" name="theme" value="{{ theme }}" >
{% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit|e }}" >{% endif %}
{{- engine_data_form(engine_data) -}}
{% if pageno == x %}
<input role="link" class="page_number_current" type="button" value="{{ x }}">
{% else %}
<input role="link" class="page_number" type="submit" value="{{ x }}">
{% endif %}
</form>
{% endfor %}
</div>
</nav> </nav>
{% endif %} {% endif %}
</div> </div>