tomayac / link-to-media

Home Page:https://tomayac.github.io/link-to-media/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

Link to media extension activated on an image.

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.

About

https://tomayac.github.io/link-to-media/

License:Apache License 2.0


Languages

Language:JavaScript 100.0%