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

frontrow

v1.0.1

Published

Customizable modals for the humanity

Downloads

19

Readme

Code Climate Version 1.0.1

frontrow.js

Customizable modals for the humanity. No jQuery required and no dependencies.

Demo

See a simple live demo here!

Install

From npm

npm install --save frontrow

or manually (from the dist folder)

<link rel="stylesheet" href="frontrow.min.css">
<script src="frontrow.min.js"></script>

Usage

frontrow(elem, [options])

This (only) method allows you to launch a modal window when the elem is clicked. The options object (optional) can have the following properties, which will help you customize the modal's behaviours:

Option | Description --------------------|-------------------------------------------------------------------------------------------------- title | The title of the modal which appears in its header confirmBtnText | The text of the confirm button. Defaults to 'Confirm' cancelBtnText | The text inside the cancel link. Defaults to 'cancel' overlayColor | The CSS color property of the overlay behind the modal. Defaults to 'white' overlayOpacity | The CSS opacity property of the overlay behind the modal. Defaults to 0.8 content | The selector of the DOM element (inner) that will be rendered in the modal's body width | The width of the modal. If set to 'none', it will take the entire page's width. If set to 'auto', the modal will take the width of the content. Defaults to '300px' height | The height of the modal. If none is specified, it will automatically set itself to fit the content of the modal. If specified, a vertical scrollbar will appear only if there is not enough room for the content confirmCallback | The callback function that executes when the confirm button is clicked. Defaults to frontrow.dispose() thus, closes the modal openCallback | The callback function that executes when the modal appears and fully renders its content

More options will be added soon.

API

When you create a modal using frontrow(elem, options), an instance of modal is returned. This instance exposes a few methods which you can use to manipulate the actual modal before/after is rendered.

.show()

This allows you to render and show a modal without clicking on the associated button:

<button id="myModal">Launch Modal</button>

var modal = frontrow('myModal');
modal.show(); // Shows the modal

.set(option, value)

This sets the value of one of the options to the instance. If the modal is showing already, the options are set on the fly. You can use any of the options in the table above.

<button id="myModal">Launch Modal</button>

var modal = frontrow('myModal', {title: 'Hello World!'});
modal.set('title', 'Another Title!');
modal.show(); // Shows the modal with the new title
modal.set('title', 'Changed again'); // switches the title on the fly
modal.set('overlayColor', 'red'); // Switches the overlay color on the fly

Other functions

frontrow.dispose()

This method will remove the current modal from the DOM. This will not need an instance because

Roadmap

Soon:

  • Load content from a remote HTML file (AJAX)
  • Add styling API
  • Suggest new stuff

Development

Installing any dependencies

npm install

Then run Gulp

gulp

Lastly open the page and any changes you make just need a browser refresh.

open index.html

License

MIT