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 🙏

© 2025 – Pkg Stats / Ryan Hefner

context-cards

v2.1.3

Published

Get Wikipedia page previews on any page!

Downloads

89

Readme

Wikipedia Context Cards

Get Wikipedia page previews on any page!

See some live examples at https://joakin.github.io/context-cards, or check our UI tests for examples of many previews.

How to use

Include the library in your page:

https://unpkg.com/context-cards/dist/context-cards.js

Mark some links with data-wiki-title and data-wiki-lang.

<ul>
  <li>
    <a href="#" data-wiki-lang="en" data-wiki-title="Cake">Cake</a>
  </li>
  <li>
    <a href="#" data-wiki-lang="ca" data-wiki-title="Pastís">Pastís</a>
  </li>
</ul>

Those links should show the previews now on hover and focus!

Right to left languages: previews and content

If you add a link with a language that is right to left, the preview content will automatically show up appropriately (example).

If the content of your page is right to left, and you have the dir attribute set on any of the parent elements of the link, or the link itself, then things should work fine by default, by positioning the card anchored to the bottom right of your link.

If you are doing something strange with your content and don't have those attributes, you can manually add dir="rtl" to the link and the card will work as intended.

Dynamic content

Sometimes you have content that loads later on the page, and is not there on DOMContentLoaded. If that is the case, you will need to tell context cards to refresh the links so that it can bind its interactions as needed.

When including the script in the page, context cards binds itself to window.ContextCards. If you need to tell it to refresh the links and search for new ones, you can call ContextCards.bindLinks(). That should appropriately bind the event handlers for the new links marked with the data attributes mentioned above.

Self hosting the script file

If you don't want to use a npm CDN like unpkg, you can always get the script file for the popups from the npm package after installing it, in the dist/context-cards.js file.

Another alternative is getting it from this git repo. The file you can include is always in dist/context-cards.js, and you can get it from the master branch, or from the git tags which match the npm versions.

Credits

Based on the original work on Extension:Popups.