Last Comment Bug 158773 - pages loaded from search results should highlight the search term
: pages loaded from search results should highlight the search term
Status: RESOLVED FIXED
: fixed-seamonkey2.0.6
Product: SeaMonkey
Classification: Client Software
Component: Help Documentation (show other bugs)
: Trunk
: All All
: -- enhancement (vote)
: seamonkey2.1a2
Assigned To: Jens Hatlak (:InvisibleSmiley)
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2002-07-22 23:25 PDT by timeless
Modified: 2010-05-17 03:17 PDT (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
document Help findbar (1.96 KB, patch)
2010-05-15 09:06 PDT, Jens Hatlak (:InvisibleSmiley)
iann_bugzilla: review+
Details | Diff | Splinter Review
patch v2 (2.11 KB, patch)
2010-05-15 10:43 PDT, Jens Hatlak (:InvisibleSmiley)
iann_bugzilla: review+
Details | Diff | Splinter Review
patch v2a, r=IanN [Checkin: comments 19+20] (2.11 KB, patch)
2010-05-16 05:09 PDT, Jens Hatlak (:InvisibleSmiley)
jh: review+
kairo: approval‑seamonkey2.0.6+
Details | Diff | Splinter Review

Description timeless 2002-07-22 23:25:15 PDT
someone decided to make mozilla help pages extremely long.
this is a big problem, because you can search for a topic (print preview) get a
very long page and see *no* evidence of print preview on the page.

this bug is asking for the search term to be highlighted (ala google).
for multiple terms (print preview) it might be beneficial to color each word and
also color multiword spans.  i think coloring multiword spans won't be necessary
because the natural adjacency of multiple colored words will draw the reader to
them.
Comment 1 Brant Gurganus 2003-02-05 17:27:44 PST

*** This bug has been marked as a duplicate of 158772 ***
Comment 2 timeless 2003-02-05 17:31:21 PST
no.
Comment 3 Brant Gurganus 2003-02-05 17:40:50 PST
Now that I understand timeless, I would agree with this as well.
Comment 4 Ian Oeschger (gone) 2003-08-14 11:58:55 PDT
moving stuff over to an outside-the-firewall email for the time being, looking
for people to pick these Help and doc bugs up for me.
Comment 5 R.J. Keller 2003-08-24 14:35:41 PDT
--> me

We'll see if we can get this for 1.6a.
Comment 6 R.J. Keller 2003-08-24 18:09:21 PDT
Brant, do you think that we could get this in for 1.6a?
Comment 7 Brant Gurganus 2003-08-25 06:26:20 PDT
I'm not exactly sure how to go about doing this.  The best I can come up with is
to do something like:
[search item clicked]
Search for search term in article.
Replace with <span class="searched">search term</span>

That's the most straight forward algorithm I can think of if it can be done.
Comment 8 R.J. Keller 2003-10-11 08:41:27 PDT
-> Future

Not sure when I'm going to get to this. Probably not before 1.7.
Comment 9 R.J. Keller 2004-08-31 16:42:51 PDT
Moving to new Help component owner.
Comment 10 neil@parkwaycc.co.uk 2004-09-01 06:24:29 PDT
The finder component is this:
var finder = Components.classes["@mozilla.org/embedcomp/rangefind;1"]
                       .createInstance(Components.interfaces.nsIFind);
Its Find method returns a range that contains the found string.
var range = finder.Find(string, searchRange, startRange, endRange);
startRange and endRange are usually points. They may not look useful but
depending on which way you're searching it's easier to update the start/end
range for the find again than to change the search range.
You then need to modify the document to highlight the string. Unfortunately
there are at least two bugs that are stopping this from working :-(
Comment 11 neil@parkwaycc.co.uk 2004-09-01 09:34:40 PDT
OK, so now surroundContents is fixed, here's a starter code snippet:

var searchRange = content.document.createRange();
searchRange.selectNodeContents(content.document.body);
var endRange = searchRange.cloneRange();
endRange.collapse(false);
var range = searchRange.cloneRange();
range.collapse(true);
var finder = Components.classes["@mozilla.org/embedcomp/rangefind;1"]
                       .createInstance(Components.interfaces.nsIFind);
while ((range = finder.Find(findText, searchRange, range, endRange)) != null) {
  var span = content.document.createElement("span");
  span.className = "searchHighlight";
  range.surroundContents(span);
  range.collapse(false);
}
Comment 12 Jens Hatlak (:InvisibleSmiley) 2008-12-21 13:06:13 PST
Now that SM2 uses the Toolkit-based help browser with the find bar at the bottom there is "Highlight all" which qualifies as a workaround. Could that functionality be adapted to fix this bug?
Comment 13 Ian Neal 2010-05-04 05:39:16 PDT
(In reply to comment #12)
> Now that SM2 uses the Toolkit-based help browser with the find bar at the
> bottom there is "Highlight all" which qualifies as a workaround. Could that
> functionality be adapted to fix this bug?

Yes, but we need to document how to do that on the "Using the Help Window" page.
Feel free to take this bug.
Comment 14 Jens Hatlak (:InvisibleSmiley) 2010-05-15 09:06:58 PDT
Created attachment 445549 [details] [diff] [review]
document Help findbar
Comment 15 Ian Neal 2010-05-15 09:28:52 PDT
Comment on attachment 445549 [details] [diff] [review]
document Help findbar

>+++ b/suite/locales/en-US/chrome/common/help/help_help.xhtml
> <ul>
>   <li>Main topics are listed in the left sidebar. Click a topic to read about
>     it. To see its subtopics, double-click or click the <span class="noMac">
>     plus-sign</span><span class="mac">triangle</span> at the left.</li>
Whilst you are here can you correct the error with it only being a "triangle" on macs, it is a "triangle" on linux (at least Fedora) as well. Probably using class="win" and class="unix" as well as class="mac".

>+  <li>To search inside a page, use the <kbd class="mac">Cmd</kbd><kbd
>+    class="noMac">Ctrl</kbd>+<kbd>F</kbd> shortcut. Enter the word or phrase
>+    you would like to find into the text field of the bar that will open at the
>+    bottom and press Return, or use the <q>Next</q> and <q>Previous</q> buttons
You should not use "Return" but use:
<kbd class="mac">Return</kbd><kbd class="noMac">Enter</kbd>

>+    to find the next match in the chosen direction. Use <q>Highlight all</q> to
>+    highlight your search phrase within the whole page. If you want to do a
>+    case-sensitive search, tick the <q>Match case</q> checkbox.</li>
We have to use an Americanism here, so not "tick" but "check". In this case:
"check the <q>Match case</q> box." so as not to repeat check in the word checkbox.
r=me with those changes.
Comment 16 Jens Hatlak (:InvisibleSmiley) 2010-05-15 10:43:49 PDT
Created attachment 445557 [details] [diff] [review]
patch v2

(In reply to comment #15)
> (From update of attachment 445549 [details] [diff] [review])
> >+++ b/suite/locales/en-US/chrome/common/help/help_help.xhtml
> > <ul>
> >   <li>Main topics are listed in the left sidebar. Click a topic to read about
> >     it. To see its subtopics, double-click or click the <span class="noMac">
> >     plus-sign</span><span class="mac">triangle</span> at the left.</li>
> Whilst you are here can you correct the error with it only being a "triangle"
> on macs, it is a "triangle" on linux (at least Fedora) as well. Probably using
> class="win" and class="unix" as well as class="mac".

Actually with Modern it's always a triangle so I changed the text to be platform-independent (all-encompassing). Re-requesting review solely for that, fixed your other nits.
Comment 17 Ian Neal 2010-05-15 13:28:11 PDT
Comment on attachment 445557 [details] [diff] [review]
patch v2

>   <li>Main topics are listed in the left sidebar. Click a topic to read about
>+    it. To see its subtopics, double-click or click the plus-sign/triangle at
>+    the left.</li>
"at the left" doesn't sound right, "to the left" is probably better.
r=me with that addressed.
Comment 18 Jens Hatlak (:InvisibleSmiley) 2010-05-16 05:09:30 PDT
Created attachment 445589 [details] [diff] [review]
patch v2a, r=IanN [Checkin: comments 19+20]
Comment 19 Jens Hatlak (:InvisibleSmiley) 2010-05-16 05:17:19 PDT
Comment on attachment 445589 [details] [diff] [review]
patch v2a, r=IanN [Checkin: comments 19+20]

http://hg.mozilla.org/comm-central/rev/2a5aeaa7f616
Comment 20 Jens Hatlak (:InvisibleSmiley) 2010-05-16 05:57:25 PDT
Comment on attachment 445589 [details] [diff] [review]
patch v2a, r=IanN [Checkin: comments 19+20]

http://hg.mozilla.org/releases/comm-1.9.1/rev/7d6981344b11
Comment 21 neil@parkwaycc.co.uk 2010-05-17 03:17:40 PDT
(In reply to comment #15)
>(From update of attachment 445549 [details] [diff] [review])
>>+    case-sensitive search, tick the <q>Match case</q> checkbox.</li>
>We have to use an Americanism here, so not "tick" but "check".
Our localiser will then restore "tick" to the en-GB locale ;-)

Note You need to log in before you can comment on or make changes to this bug.