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 🙏

© 2026 – Pkg Stats / Ryan Hefner

tube-fu.js

v0.0.2

Published

A lightweight, mobile-friendly, performance-oriented alternative to embed YouTube videos.

Downloads

24

Readme

TubeFu.js

TubeFu.js on NPM

A lightweight, mobile-friendly, performance-oriented alternative to embed YouTube videos.

About

Embed YouTube videos without the performance hit from all those Iframes. TubeFu.js makes smart, pagespeed-optimized video embedding completely automatic. TubeFu.js also automagically makes your embedded videos completely fluid & responsive...no more fighting those YouTube Iframes that overflow their containers. If you're using YouTube videos on your site, give TubeFu.js a shot...you'll be shocked at the performance boost, especially on mobile devices!

Usage

To use TubeFu.js, you'll need a modern JavaScript workflow and build system with ES6 module bundling and transpiling capabilities. Here's a great example.

Install

Install TubeFu.js via NPM and add to your dependencies:

$ npm install tube-fu.js --save

Initialize

Import the TubeFu.js module, then instantiate it. The constructor takes several optional arguments, but you should find the defaults work great for everything but edge cases.

// import TubeFu.js
import TubeFu from 'tube-fu.js'

// create an instance
const Tube = new TubeFu()

You're only one step away from lightning-fast embedded videos. You'll need to make a simple edit to the standard YouTube embed code in your HTML. Simply change the YouTube element's tag type from 'iframe' to 'div' and add the class 'tube-fu', like so:

// change the standard YouTube embed code from this:
<iframe width="420" height="315" src="https://www.youtube.com/embed/notKtAgfwDA" frameborder="0" allowfullscreen></iframe>

// to this
<div class="tube-fu" width="420" height="315" src="https://www.youtube.com/embed/notKtAgfwDA" frameborder="0" allowfullscreen></div>

That's it, you're now equipped with a lightning-fast, completely responsive, bandwidth-sipping video embedding system. Please note that you may encounter issues if you have any additional options or query-strings referenced in the YouTube element's URL. Just stick with the standard copy/paste YouTube embed code, TubeFu.js can take care of optional stuff for you at the constructor.

Selector

To change the embedded video element selector from the default 'tube-fu', pass a selector or element to the constructor as the first argument:

// Pass a selector
const Tube = new TubeFu({
  selector: '.css-selector',
  // options...
})

// Or element
const videoEl = document.querySelector('.sweet-vid');
const Tube = new TubeFu({
  selector: videoEl,
  // options...
})

Note that each embedded video on your page needs to have its own TubeFu.js instance, so make sure that you pass a unique selector or element to the constructor; not a NodeList. If you have several videos with a common selector, you can iterate through the videos to create individual TubeFu.js instances:

const videos = document.querySelectorAll('.video-class');

for (let i = 0; i < videos.length; ++i) {
  new TubeFu({
    selector: videos[i],
    // options...
  })
}

Options

TubeFu.js was designed to "just work" with its default options, so no options are required. If you need to tweak the way that TubeFu.js does its thing, read on!

Here is each available option, along with their defaults:

new TubeFu({
  selector: '.tube-fu',
  injectStyles: true, /* use false to completely disable automatic CSS injection */
  iframeClass: '.tube-fu-active', /* the class applied to the active video and thumbnails */
  playButtonClass: '.tube-fu-play-button', /* initial class of the play button */
  ytModestbranding: 1, /* youtube's "modest branding" option, accepts 1 or 0 */
  ytShowinfo: 0, /* youtube's "show info" option, accepts 1 or 0 */
  ytControls: 0, /* youtube's "show controls" option, accepts 1 or 0 */
  ytVq: 'hd720' /* youtube's "vq" option, accepts a youtube video quality parameter */
});

License

MIT. © 2016 Donny West

Makes People Smile