Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gromnitsky/pepe-the-text-fragment
A solution for all site owners, who don't like 'Copy link to highlight' feature
https://github.com/gromnitsky/pepe-the-text-fragment
Last synced: about 6 hours ago
JSON representation
A solution for all site owners, who don't like 'Copy link to highlight' feature
- Host: GitHub
- URL: https://github.com/gromnitsky/pepe-the-text-fragment
- Owner: gromnitsky
- Created: 2021-11-21T18:29:17.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-04-22T00:09:06.000Z (over 2 years ago)
- Last Synced: 2023-04-10T15:02:56.111Z (over 1 year ago)
- Language: HTML
- Homepage: http://gromnitsky.users.sourceforge.net/js/examples/pepe-the-text-fragment/#:~:text=Pellentesque%20dapibus
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pepe the Text Fragment
A solution for all site owners, who don't like 'Copy link to
highlight' feature.[Check](http://gromnitsky.users.sourceforge.net/js/examples/pepe-the-text-fragment/#:~:text=Pellentesque%20dapibus)
## What?
There's a spec called [Text Fragments][]. If *a user agent* supports
it, & a user provides a URL in the form of[Text Fragments]: https://wicg.github.io/scroll-to-text-fragment/
https://example.com/hello/#:~:text=world
then the user agent looks for the string 'world' on the page &
highlights it.You, as site owner, you have no control over this. You cannot disable
such a feature, for example. If you try to look at `location.hash`,
you discover that even when the text fragment was provided, there's no
remnants of in `location.hash`.## So?
As a joke, you can use a module form this repo to display an image of
Pepe the Frog when somebody has a nerve to link to your site with
*text fragments*.The module is veri smol:
```
$ terser pepe-the-text-fragment.js --module -mc | gzip -c | wc -c
626
```## Usage
~~~
import pepe from './pepe-the-text-fragment.js'
pepe()
~~~The function displays a modal frog & returns an injected dom node,
hence you can bind an `onclick` event to it, for example. See
`index.html`.## Loicense
MIT.