add solve trigger to calculator
parent
6c89f5e9f9
commit
8c2bbdbed6
|
@ -19,7 +19,7 @@ attribution web => [ 'https://www.duckduckgo.com', 'DuckDuckGo' ],
|
||||||
|
|
||||||
triggers query_nowhitespace => qr<
|
triggers query_nowhitespace => qr<
|
||||||
^
|
^
|
||||||
( what is | calculate | math )? !?
|
( what is | calculate | solve | math )? !?
|
||||||
|
|
||||||
[\( \) x X * % + / \^ \$ -]*
|
[\( \) x X * % + / \^ \$ -]*
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ handle query_nowhitespace => sub {
|
||||||
my $results_no_html;
|
my $results_no_html;
|
||||||
my $query = $_;
|
my $query = $_;
|
||||||
|
|
||||||
$query =~ s/^(?:whatis|calculate|math)//;
|
$query =~ s/^(?:whatis|calculate|solve|math)//;
|
||||||
|
|
||||||
if($query !~ /[xX]\s*[\*\%\+\-\/\^]/ && $query !~ /^-?[\d]{2,3}\.\d+,\s?-?[\d]{2,3}\.\d+$/) {
|
if($query !~ /[xX]\s*[\*\%\+\-\/\^]/ && $query !~ /^-?[\d]{2,3}\.\d+,\s?-?[\d]{2,3}\.\d+$/) {
|
||||||
my $tmp_result = '';
|
my $tmp_result = '';
|
||||||
|
|
|
@ -15,7 +15,7 @@ ddg_goodie_test(
|
||||||
heading => 'Calculator',
|
heading => 'Calculator',
|
||||||
html => qq(<div>2 - 2 = <a href="javascript:;" onClick="document.x.q.value='0';document.x.q.focus();">0</a></div>)
|
html => qq(<div>2 - 2 = <a href="javascript:;" onClick="document.x.q.value='0';document.x.q.focus();">0</a></div>)
|
||||||
),
|
),
|
||||||
'2+2' => test_zci(
|
'solve 2+2' => test_zci(
|
||||||
"2 + 2 = 4",
|
"2 + 2 = 4",
|
||||||
heading => 'Calculator',
|
heading => 'Calculator',
|
||||||
html => qq(<div>2 + 2 = <a href="javascript:;" onClick="document.x.q.value='4';document.x.q.focus();">4</a></div>)
|
html => qq(<div>2 + 2 = <a href="javascript:;" onClick="document.x.q.value='4';document.x.q.focus();">4</a></div>)
|
||||||
|
|
Loading…
Reference in New Issue