Closed Bug 158773 Opened 22 years ago Closed 14 years ago

pages loaded from search results should highlight the search term

Categories

(SeaMonkey :: Help Documentation, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
seamonkey2.1a2

People

(Reporter: timeless, Assigned: InvisibleSmiley)

Details

(Keywords: fixed-seamonkey2.0.6)

Attachments

(1 file, 2 obsolete files)

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.

*** This bug has been marked as a duplicate of 158772 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
no.
Status: RESOLVED → REOPENED
Resolution: DUPLICATE → ---
Now that I understand timeless, I would agree with this as well.
Severity: major → enhancement
OS: Windows 2000 → All
Hardware: PC → All
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.
Assignee: oeschger → oeschger
Status: REOPENED → NEW
--> me

We'll see if we can get this for 1.6a.
Assignee: oeschger → rlk
Target Milestone: --- → mozilla1.6alpha
Brant, do you think that we could get this in for 1.6a?
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.
QA Contact: tpreston → stolenclover
-> Future

Not sure when I'm going to get to this. Probably not before 1.7.
Target Milestone: mozilla1.6alpha → Future
Moving to new Help component owner.
Assignee: rlk → neil.parkwaycc.co.uk
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 :-(
Keywords: helpwanted
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);
}
Product: Browser → Seamonkey
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?
(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.
Assignee: neil → nobody
QA Contact: danielwang → help
Attached patch document Help findbar (obsolete) — Splinter Review
Assignee: nobody → jh
Status: NEW → ASSIGNED
Attachment #445549 - Flags: review?(iann_bugzilla)
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.
Attachment #445549 - Flags: review?(iann_bugzilla) → review+
Attached patch patch v2 (obsolete) — Splinter Review
(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.
Attachment #445549 - Attachment is obsolete: true
Attachment #445557 - Flags: review?(iann_bugzilla)
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.
Attachment #445557 - Flags: review?(iann_bugzilla) → review+
Attachment #445557 - Attachment is obsolete: true
Attachment #445589 - Flags: review+
Comment on attachment 445589 [details] [diff] [review]
patch v2a, r=IanN [Checkin: comments 19+20]

http://hg.mozilla.org/comm-central/rev/2a5aeaa7f616
Attachment #445589 - Attachment description: patch v2a, r=IanN → patch v2a, r=IanN [Checkin: comment 19]
Attachment #445589 - Flags: approval-seamonkey2.0.6?
Status: ASSIGNED → RESOLVED
Closed: 22 years ago14 years ago
Keywords: helpwanted
Resolution: --- → FIXED
Target Milestone: Future → seamonkey2.1a2
Attachment #445589 - Flags: approval-seamonkey2.0.6? → approval-seamonkey2.0.6+
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
Attachment #445589 - Attachment description: patch v2a, r=IanN [Checkin: comment 19] → patch v2a, r=IanN [Checkin: comments 19+20]
(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 ;-)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: