npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@embetty/component

v2.3.1

Published

Embetty displays remote content like tweets or videos without compromising your privacy.

Downloads

11

Readme

embetty · Build Status Dependency Status JavaScript Style Guide

Embetty displays remote content like tweets or videos without compromising your privacy.

See it in action on our demo pages.

Quick Start

  1. Setup your embetty-server.
  2. Include the embetty lib into your HTML document.
  3. Insert an embed by using a custom tag (see embeds section below).

Example:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta data-embetty-server="/path/to/embetty-server" />
    <script async src="embetty.js"></script>
  </head>
  <body>
    <embetty-tweet status="1166685910030790662"></embetty-tweet>
  </body>
</html>

Documentation

Configure the Embetty server

Embetty needs a server component that you need to run on your infrastructure. Configure the server URL for embetty using a <meta data-embetty-server> tag:

<head>
  <meta data-embetty-server="/path/to/embetty-server" />
</head>

Including embetty.js

There are three options.

  1. Download an Embetty archive from the releases page. Make embetty.js available on your site.
  2. Use Embetty in your npm project: yarn add @embetty/component or npm install @embetty/component --save. Then import embetty into your main script (i.e. import '@embetty/component').
  3. Clone this repository and build ./dist/embetty.js:
    $ git clone https://github.com/heiseonline/embetty
    $ cd embetty
    $ yarn
    $ yarn build

Supported embed types

Currently, tweets and various video platforms are supported.

Tweet

Use the status attribute to embed a tweet with its tweet ID. Example:

<embetty-tweet status="950371792874557440"></embetty-tweet>

Use the include-thread attribute to include the thread above the tweet (i.e. the conversation so far, for context). Example:

<embetty-tweet status="950371792874557440" include-thread></embetty-tweet>

Video

Use the type attribute with a value of facebook, vimeo or youtube. Set the video-id attribute to the video ID.

<embetty-video type="facebook" video-id="10156049485672318"></embetty-video>

Use the poster-image attribute with an URL. This overwrites the preview image of the video.

<embetty-video
  type="facebook"
  video-id="10156049485672318"
  poster-image="www.test.com/image.jpg"
></embetty-video>

For videos of type vimeo or youtube, it's also possible to set a start-at attribute with a value of time in seconds to start the video at a specific timecode.

<embetty-video
  type="youtube"
  start-at="96"
  video-id="3L4fHrIJ3A4"
></embetty-video>
<embetty-video type="vimeo" start-at="96" video-id="223099532"></embetty-video>

Mastodon Status

Use the status attribute with the link of the corresponding status. Embetty will retrieve the data from the corresponding Mastodon instance.

<embetty-mastodon
  status="https://social.heise.de/@heiseonline/110372412617177781"
></embetty-mastodon>

Events

Embetty triggers the following events:

| Name | Description | | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | | initialized | The Embetty embed will enter the viewport after this has been triggered. | | activated | The Embetty video embed has been replaced with an iframe containing the original video player. The content of the iframe may still be loading. |

Example code:

document.querySelector('embetty-tweet').addEventListener('initialized', function(e) { ... })

Testing

  1. Clone this repository.
  2. yarn
  3. export the TWITTER_ tokens mentioned in https://github.com/heiseonline/embetty-server
  4. yarn test

Caveats

The Embetty server component does not proxy video data. This means that the tracking protection becomes ineffective after the play button has been clicked.

License

Embetty is MIT licensed.