link-to-media
v0.0.3
Published
Link to img, video, or audio elements
Downloads
3
Readme
Link to Media Extension and Polyfill
Extension
A browser extension that allows you to link to arbitrary <img>
s, <video>
s,
or <audio>
s on webpages, according to the
Alternative Content Types
proposal.
Polyfill
A polyfill for the proposal to extend the concept of Text Fragments to include media.
Installation of the polyfill
npm install --save link-to-media
Usage
To create a link based on an element:
import { createLink, scrollTo } from 'link-to-media';
const img = document.querySelector('img');
const link = createLink(img);
To scroll the page to an element based on a link:
import { scrollTo } from 'link-to-media';
// This waits for `onload` internally.
scrollTo();
Developing
Scripts
npm run fix
# Beautifies the code.
npm run build
# Builds the polyfill.
npm start
# Runs a local server with test cases.
License
Apache 2.0.