Discussions » Creation Requests

Word highlighter

§
Posted: 2014-07-20

Word highlighter

Looking for a script that would highlight specific words and even regex on pages. The real issue us it would be nice if it autoloads.

An issue would be that it needs to be autoloaded even on pages that are not part of the CSS html. A few sites loads the page and then loads following pages that I think are called dynamic. So no real page refresh just content.

§
Posted: 2014-07-21
Edited: 2014-07-21
§
Posted: 2014-07-28

OK. Tried it and while it does work on static CSS backgrounds it does not work on dynamically displayed information. So when I go to another page the background stays the information changes and that is what I need to highlight.

Thanks for the link.

§
Posted: 2014-07-28

To make a script watch for changes in a page, you need to add a MutationObserver to the script. I don't know whether erosman has registered on this site and can add that, or whether someone else will need to do it.

§
Posted: 2014-07-29
Edited: 2014-07-29

Oh, heck, I can't just leave it like that, can I...

On userscripts.org, I think erosman once wrote: "I dont even put my own copyright & license on my own scripts and keep them open to public." So I think I can post a revised version.

You can test it here: https://greasyfork.org/scripts/3719-text-highlighter-dynamic

§
Posted: 2014-07-29
Edited: 2014-07-29

Perfect! To a degree. Is it possible to get it to run regex in search of something as well. I am looking for a size to be highlighted.

^([2-9][0-9]|1[5-9])\.\d{3}

-edit
It is possible to hardcode some of the search patterns? Would hate to loose them if a reinstall happens. Or more to the point some things it would be nice to have a personal universal words to always highlight and then some on the fly with the way you have it now.

§
Posted: 2014-07-29

I'm sure those changes are possible, but they would require a lot closer study of the script than I have made so far. Here are some general thoughts:

Regarding your default search terms, perhaps you could define one or more sets of terms in the script, and then call those up using the keywords box (e.g., --1 to use keywords[1], --2 to use keywords[2], etc.), or use a separate menu item for each of your standard sets.

I think a separate menu item also might be a good idea for a RegEx, since you do not want it processed and parsed like other keywords, but I'm not handy with XPath so I'm not sure exactly how to pass it, maybe without all the pre-processing the script does now?

§
Posted: 2014-07-29

OK. Figured out how to hard code the words. Thanks for bringing this to me. If I figure out how to get it to parse out the regex I'll be back.

§
Posted: 2014-11-24
Edited: 2014-11-24

I just left feedback for this script on Greasy Fork: Text Highlighter - Dynamic https://greasyfork.org/en/scripts/3719-text-highlighter-dynamic :

I love this script! The "dynamic" nature makes it work on pages that are created for me when I load them, like tv schedules and e-mail inboxes. so I'm using it to mark episodes of tv shows seen--when i used a regular highlighter script, the found text would only be highlighted when it was in the same location on the page. I had to highlight the show title when it was 4 hours away, 3 hours away, 2 hours away, &c.

I even cloned this script twice, changing all the ??mo-named variables from THmo to TVmo and then to FFmo, so I could highlight different things in different colors. (I cloned it a 3rd time but i must have done something wrong, the page would never finish loading and I'd have to end-task Firefox. Too bad I dont really know anything about javascript.)

I worried the list of tv episodes keywords would get too long, but hasn't yet, at 1,800 characters! So if the author would like to develop a fork of this script along these lines, I would love it! As it is, I'm a big fan, making it work!

The author erosman or jscher2000 or anybody else!

§
Posted: 2014-11-24

I posted some thoughts in that thread: https://greasyfork.org/en/forum/discussion/2264/great-script

§
Posted: 2015-09-07

Hi nickodemos, you asked:

Is it possible to get it to run regex in search of something as well. I am looking for a size to be highlighted.

^([2-9][0-9]|1[5-9])\.\d{3}

-edit
It is possible to hardcode some of the search patterns? Would hate to loose them if a reinstall happens. Or more to the point some things it would be nice to have a personal universal words to always highlight and then some on the fly with the way you have it now.

I haven't tested that pattern, but the next release will support regular expressions. Also, it allows multiple sets you can individually enable/disable/edit depending on what you want to see on the current page.

If you want to test, PLEASE back up your current modified version first, then check out: https://greasyfork.org/en/forum/discussion/6045/new-beta-version-available-for-testing

Post reply

Sign in to post a reply.