forked from asklyphe-public/asklyphe
add calculator to nojs (nojs seems to always 504 when I use it, see if I can fix that)
This commit is contained in:
parent
f955d63937
commit
a8c86790fc
2 changed files with 12 additions and 0 deletions
|
@ -301,6 +301,11 @@ pub async fn search_nojs(
|
|||
if let Some(redirect) = bang_redirect {
|
||||
return Redirect::to(&redirect).into_response();
|
||||
}
|
||||
|
||||
let mut calc_query = query.clone().to_lowercase();
|
||||
calc_query = calc_query.replace("calculate", "").replace("what is", "");
|
||||
let math = math::calculate(&calc_query);
|
||||
complications.math = math;
|
||||
} else {
|
||||
complications.disabled = true;
|
||||
query = query.replace("-complications", "");
|
||||
|
|
|
@ -75,6 +75,13 @@
|
|||
</div>
|
||||
{% when None %}
|
||||
{% endmatch %}
|
||||
{% match complications.math %}
|
||||
{% when Some with (math) %}
|
||||
<div class="calculator-complication">
|
||||
<h1>{{ math.equation }} = {{ math.result }}</h1>
|
||||
</div>
|
||||
{% when None %}
|
||||
{% endmatch %}
|
||||
</div>
|
||||
<ol class="search-result-list">
|
||||
{% for result in search_results %}
|
||||
|
|
Loading…
Add table
Reference in a new issue