diff --git a/pywb/static/query.js b/pywb/static/query.js index fd0a0450..ec69033e 100644 --- a/pywb/static/query.js +++ b/pywb/static/query.js @@ -956,11 +956,11 @@ RenderCalendar.prototype.niceDateRange = function() { var from = this.queryInfo.searchParams.from; var to = this.queryInfo.searchParams.to; if (from && to) { - return 'From ' + from + ' to ' + to; + return [text.from, from, text.until, to].join(' '); } else if (from) { - return 'From ' + from + ' until ' + 'present'; + return [text.from, from, text.until, text.present].join(' '); } - return 'From earliest until ' + to; + return [text.from, text.earliest, text.until, to].join(' '); }; /** diff --git a/pywb/static/search.js b/pywb/static/search.js index eafa0023..d9ca082b 100644 --- a/pywb/static/search.js +++ b/pywb/static/search.js @@ -14,17 +14,33 @@ var elemIds = { }, dateTime: { from: 'dt-from', + fromTime: 'ts-from', fromBad: 'dt-from-bad', to: 'dt-to', + toTime: 'ts-to', toBad: 'dt-to-bad' }, match: 'match-type-select', url: 'search-url', form: 'search-form', resultsNewWindow: 'open-results-new-window', - advancedOptions: 'advanced-options' + advancedOptions: 'advanced-options', + clearOptions: 'clear-options', }; +function clearOptions(event) { + for (const field of [ + elemIds.match, + elemIds.dateTime.from, + elemIds.dateTime.fromTime, + elemIds.dateTime.to, + elemIds.dateTime.toTime, + ]) { + document.getElementById(field).value = ''; + } + clearFilters(event); +} + function makeCheckDateRangeChecker(dtInputId, dtBadNotice) { var dtInput = document.getElementById(dtInputId); dtInput.onblur = function() { @@ -138,11 +154,13 @@ function performQuery(url) { } var fromT = document.getElementById(elemIds.dateTime.from).value; if (fromT) { - query.push('from=' + fromT.trim()); + fromT += document.getElementById(elemIds.dateTime.fromTime).value; + query.push('from=' + fromT.replace(/[^0-9]/g, '')); } var toT = document.getElementById(elemIds.dateTime.to).value; if (toT) { - query.push('to=' + toT.trim()); + toT += document.getElementById(elemIds.dateTime.toTime).value; + query.push('to=' + toT.replace(/[^0-9]/g, '')); } var builtQuery = query.join('&'); if (document.getElementById(elemIds.resultsNewWindow).checked) { @@ -188,6 +206,7 @@ $(document).ready(function() { elemIds.dateTime.to, document.getElementById(elemIds.dateTime.toBad) ); + document.getElementById(elemIds.clearOptions).onclick = clearOptions; document.getElementById(elemIds.filtering.add).onclick = addFilter; document.getElementById(elemIds.filtering.clear).onclick = clearFilters; var searchURLInput = document.getElementById(elemIds.url); @@ -195,9 +214,6 @@ $(document).ready(function() { form.addEventListener('submit', function(event) { submitForm(event, form, searchURLInput); }); - document.getElementById(elemIds.advancedOptions).onclick = function() { - validateFields(form); - } var filteringExpression = document.getElementById(elemIds.filtering.expression); filteringExpression.addEventListener("keypress", function(event) { if (event.key === "Enter") { diff --git a/pywb/templates/instructions.html b/pywb/templates/instructions.html new file mode 100644 index 00000000..211df2d1 --- /dev/null +++ b/pywb/templates/instructions.html @@ -0,0 +1,216 @@ + + + diff --git a/pywb/templates/query.html b/pywb/templates/query.html index ae01e87f..f1e5c58b 100644 --- a/pywb/templates/query.html +++ b/pywb/templates/query.html @@ -69,6 +69,10 @@ 'host': "{{ _('host') }}", 'domain': "{{ _('domain') }}", }, + from: "{{ _('From') }}", + until: "{{ _('until') }}", + present: "{{ _('present') }}", + earliest: "{{ _('earliest') }}", }; var filterMods = { diff --git a/pywb/templates/search.html b/pywb/templates/search.html index a781fb00..91271706 100644 --- a/pywb/templates/search.html +++ b/pywb/templates/search.html @@ -31,15 +31,20 @@
-
+
+
+
+ + title="{{ _('Enter a URL to search for') }}" type="search" required autofocus />
{% trans %}Please enter a URL{% endtrans %}
@@ -53,23 +58,26 @@
- +
-
- +
{% trans %}To:{% endtrans %}
- -
- {% trans %}Please enter a valid To timestamp. Timestamps may be 4 <= ts <=14 digits{% endtrans %} -
+ +
-
+

{% trans %}Filtering{% endtrans %}

-
- - -
-
+
+ +
  • {% trans %}No Filter{% endtrans %}
+
@@ -192,4 +193,5 @@
{% endif %} +{% include "instructions.html" %} {% endblock %}