Greasy Fork is available in English.

Text Highlight and Seek

Automatically highlight user-defined text with Seek function (2019-09-22)

< Feedback on Text Highlight and Seek

Review: Good - script works

§
Posted: 25-02-2020

Still being used after all this time

Yet I ran into something that I can't get it to highlight.

On the page I am trying to find a text but the script can't "see" it.

EG I am trying to find [goose]. The page shows it as [goose]. The page source shows it as >goose<.

So I was wondering if it would be possible to add an option to search the page source for something given.

§
Posted: 26-02-2020

@nickodemos said: EG I am trying to find [goose]. The page shows it as [goose]. The page source shows it as >goose<.

Hmm, why does the character rendered in the page look like [ when it is really > -- is that a trick of styling? font issue? Is there an example you could reference for testing?

So I was wondering if it would be possible to add an option to search the page source for something given.

In a sense, it is searching the source. The script looks within the individual text nodes of the various elements. That approach has its limitations: for example, if you were to search for a word that bolded a few letters in the middle -- embargo -- the script wouldn't match that to embargo because there are three different text nodes making up the word (em, bar, go).

That is different from Firefox's Find feature, which is able to find and highlight the whole word. The script's code would need to be updated to search text the way Firefox's Find feature does. And the method used for highlighting is limited in its ability to cross tag boundaries so I'm not sure how I would deal with that.

Not sure any of that is relevant.

§
Posted: 26-02-2020

[720p]

As you can see the square brackets are there just that the markup language is in between.

§
Posted: 26-02-2020

Yes, this is the problem that the brackets are in a different text node from the contents. It's difficult to think of a good approach for this.

§
Posted: 26-02-2020

Yeah. No worries. Figured it might be a bit much as you would have no way to counter each variation.

Either way the script has helped me a great deal over the years. Thanks for taking the time in the forums to help out when I asked that first time.

§
Posted: 26-02-2020
Edited: 26-02-2020

Just when I was hoping to fall asleep...

I realize now when you wrote >goose< that you meant you want to highlight only when the entire text node matches. So for the case of >720p< (or <b>720p</b>, for example), try this:

Pattern: ^720p$

Match type: Regular Expression

(^ means the beginning of the text node and $ means the end of the text node)

§
Posted: 26-02-2020

Thanks and sorry for keeping you awake on this. That pretty much did what a general search would have done as I need to capture the square brackets as well otherwise the entire page populates with the search.

You can call it a day. Instead of running this search all the time I will only use it when I am hunting down what I need.

Post reply

Sign in to post a reply.