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

minigram

v0.1.1

Published

A simple plugin to display your latest Instagram photos with Vanilla JS

Downloads

16

Readme

Minigram

A simple plugin to display your latest Instagram photos with Vanilla JS

Demo

View demo here

Install

With npm

npm install minigram --save

Download

You can download the latest version or checkout all the releases here.

How to use?

Require the package or use the global Minigram namespace:

AMD

<script>
require(["path/to/minigram.js"], function(Minigram) {
    // Code here
});
</script>

commonJS

var Minigram = require('Minigram');

ES6

import Minigram from 'Minigram';

Browser

<script src="path/to/minigram.js"></script>

Basic Usage

See how easy it is to obtain images of a profile:

<script>
    new Minigram(target, {
        counter: 8,
        resolution: 'low',
        token: 'YOUR_TOKEN_HERE',
        html: '<li class="instagram-thumbnail"><a class="instagram-placeholder" href="{url}" target="_blank"><img src="{image}" alt="{caption}"></a></li>'
    });
</script>

Requirements

The only thing you'll need to get going is a valid access token from Instagram's API. You can easily register for one on Instagram's website.

Options

  • target - Either the ID name, CLASS name or the DOM element itself where you want to add the images to.
  • counter - Maximum number of images to display. Default is 10. Max of 20
  • resolution - Size of the images to get. Available options are:
    • thumb (default) - 150x150
    • low - 306x306
    • standard - 612x612
  • token - A valid oAuth token. See the wiki how to get your token
  • html - Custom HTML template to use for images. See templating.
  • before (function) - A callback function called before fetching images from Instagram.
  • after (function) - A callback function called when Instagram returns valid data.
  • error (function) - A callback function called if the API Instagram return error (argument -> json object).
  • success (function) - A callback function called when images have been added to the page.

Templating

The easiest way to control the way minigram.js looks on your website is to use the template option. You can write your own HTML markup and it will be used for every image that minigram.js fetches.

Here's a quick example:

<script>
    new Minigram(target, {
        counter: 8,
        resolution: 'low',
        token: 'YOUR_TOKEN_HERE',
        html: '<a href="{url}"><img src="{image}" alt="{caption}"></a>'
    });
</script>

Notice the {url}, {image} and {caption}? The templating option provides several tags for you to use to control where variables are inserted into your HTML markup. Available keywors are:

  • {caption} - Image's caption text. Defaults to empty string if there isn't one.
  • {url} - URL to view the image on Instagram's website.
  • {type} - the image's type. Can be image or video.
  • {likes} - Number of likes the image has.
  • {filter} - Filter name used in photo.
  • {image} - URL of the image source. The size is inherited from the resolution option.

Browser Support

IE | Chrome | Firefox | Opera | Safari --- | --- | --- | --- | --- | IE 9+ ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |

Contributing

Check CONTRIBUTING.md for more information.

History

Check Releases for detailed changelog.

License

MIT