Text fragment links

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.
ncdave4life

Text fragment links

Post by ncdave4life » 2021-03-10, 04:16

Chrome and the two leading Chromium-based browsers, Opera and Edge, all support the new and very useful "text fragment links" feature, but Palemoon still doesn't. I wish it did!

Here's a test link:

https://sealevel.info/papers.html#:~:text=He%20or%20she%20formulates

Here's a similar test link, which uses a hack on the web page to make it also mostly work in Mozilla Firefox (but not in Palemoon):

https://sealevel.info/papers.html#:~:text=He%20or%20she

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

Re: Text fragment links

Post by Moonchild » 2021-03-10, 05:10

So a proprietary extension to the URL standard that is sugar for doing an in-page search. I bet an extension can be made to do just that without too much trouble.
ncdave4life wrote:
2021-03-10, 04:16
Chrome and the two leading Chromium-based browsers, Opera and Edge, all support the new and very useful "text fragment links" feature, but Palemoon still doesn't.
You make it sound as if this is something masses of people have been waiting for to be implemented in Pale Moon (2 words, capitalized, please) but this is the first time I've even heard of it. I also find it typically presumptuous that Google has proposed it to the W3C to be standardized while it looks more like a hack and UI consideration than something to include in the long-standing URL standard.
"There is no point in arguing with an idiot, because then you're both idiots." - Anonymous
"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
jobbautista9
Board Warrior
Board Warrior
Posts: 1024
Joined: 2020-11-03, 06:47
Location: Philippines

Re: Text fragment links

Post by jobbautista9 » 2021-03-10, 05:54

OP, how is this any better than say, using the browser's find feature and typing out exactly the text you're looking for?
Image

"Destroying things, smartly!" - IJN Samidare, probably

Avatar artwork by ebifurya: https://www.pixiv.net/artworks/85379109

XUL add-ons developer. You can find a list of add-ons I manage at http://rw.rs/~job/software.html.

User avatar
RealityRipple
Keeps coming back
Keeps coming back
Posts: 891
Joined: 2018-05-17, 02:34
Location: Los Berros Canyon, California

Re: Text fragment links

Post by RealityRipple » 2021-03-10, 07:54

https://realityripple.com/Software/Mozilla-Extensions/sttf/

Couldn't implement Prefix, Suffix, or textEnd because that's not how fastFind works, and I didn't want to iterate through a bunch of DOM nodes to do the searching myself. I might figure a way to get it done later.

User avatar
jobbautista9
Board Warrior
Board Warrior
Posts: 1024
Joined: 2020-11-03, 06:47
Location: Philippines

Re: Text fragment links

Post by jobbautista9 » 2021-03-10, 10:21

Thanks for the nice extension, RealityRipple. It works fine here. Btw, I sent you a PR at your github repo, which adds the ability to copy the link to selected text, like what the Chrome extension does.
Image

"Destroying things, smartly!" - IJN Samidare, probably

Avatar artwork by ebifurya: https://www.pixiv.net/artworks/85379109

XUL add-ons developer. You can find a list of add-ons I manage at http://rw.rs/~job/software.html.

User avatar
RealityRipple
Keeps coming back
Keeps coming back
Posts: 891
Joined: 2018-05-17, 02:34
Location: Los Berros Canyon, California

Re: Text fragment links

Post by RealityRipple » 2021-03-10, 11:06

Updated to v1.1. I'll add a pref to turn that menu item off in the future.

Edit: Updated to v1.2 to include that pref and to hide the menu item if no text is selected.

Edit Again: Updated to v1.2.1 to url-encode copied fragments and correctly decode fragments (to get commas-in-search working).