ChopOMatic / anywhereindb

Automatically exported from code.google.com/p/anywhereindb
0 stars 0 forks source link

No Search output [solved] #16

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The search doesn't output anything.

Using: anywhereindb_0_33 on Windows 7 with any Chrome and Mozilla.

Please provide any additional information below.

Firebug shows:
TypeError: text is null
text = text.replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(search_text_d, 
"<s...

Solution:
surround line 590 (in the text_processing function) a check for a valid text, 
i.e.:
if ( text && 0 < text.length ) {
   text = text.replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(search_text_d, "<span class=hg>\$1</span>");
}

There's also another typo at line 463, with consequences:
   <form id=search action="<?php echo $_SERVER['PHP_SELF'];?>" method=POST>
should read:
   <form id=search action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">

Cheers,
Marcello

I've attached the full working code. Thanks a lot for your work.

Original issue reported on code.google.com by marcello...@gmail.com on 4 Nov 2014 at 2:13

Attachments:

GoogleCodeExporter commented 8 years ago
Well.. the test should have simply been:
if ( text ) {
   text = text.replace(/>/g,">").replace(/</g,"<").replace(search_text_d, "<span class=hg>\$1</span>");
}

the " && 0 < text.length " part is redundant.
I only learned javascript yesterday :)

Original comment by marcello...@gmail.com on 4 Nov 2014 at 3:10