Is there a way to programmatically bookmark a page highlight, as an annotation?

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4942
Joined: 2015-12-09, 15:45
Contact:

Is there a way to programmatically bookmark a page highlight, as an annotation?

Unread post by moonbat » 2020-10-01, 09:47

I want to make an extension that lets you highlight text on a webpage and add your own comments to it (which will be displayed in a sidebar) for future reference whenever you revisit the page. How does one 'bookmark' a DOM node so that the highlight can be applied again on visiting the page?
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35476
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Is there a way to programmatically bookmark a page highlight, as an annotation?

Unread post by Moonchild » 2020-10-01, 10:08

You'll probably have to come up with your own storage format for that.
I do recommend if you want to do something like this that you store the data in an sqlite database for fast lookups.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
adesh
Board Warrior
Board Warrior
Posts: 1277
Joined: 2017-06-06, 07:38

Re: Is there a way to programmatically bookmark a page highlight, as an annotation?

Unread post by adesh » 2020-10-01, 10:29

You may need to use the combination of xpath and actual text to reach the correct node.

Locked