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

messagebar

v0.2.1

Published

A top bar for notification messages. Dismiss it by clicking the x. Works with Django, but that's optional.

Downloads

6

Readme

jQuery MessageBar Build Status devDependencies

A top bar for notification messages. Dismiss it by clicking the x. Works with Django, but that's optional.

  • Free software: MIT License (http://audreyr.mit-license.org/)

Screenshot and Demo

Here is a screenshot of MessageBar being used on https://www.djangopackages.com:

Screenshot of MessageBar

To see a live demo of several MessageBars in action, see http://audreyr.github.io/messagebar/demo/.

  • They correspond to Bootstrap's default, primary, success, info, warning, and danger styles.
  • The default MessageBars are purposely plain. It's your job to change the CSS colors and font to match your site, of course.

To run the demo locally:

npm install
grunt

Usage

  1. Include jQuery:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
  1. Include plugin's code:
<link href="dist/jquery.messagebar.min.css" rel="stylesheet">
<script src="dist/jquery.messagebar.min.js"></script>
  1. Put your plugin HTML on your web page:
<div class="messagebar">
    <div class="container">
      This is a notification. You can click it away if you want.
      <button type="button" class="close" data-dismiss="message">&times;</button>
    </div>
</div>
  1. Call the plugin:
$(".messagebar").messageBar({
  slide: false
});

(Note: slide: true hasn't been implemented yet. See https://github.com/audreyr/messagebar/issues/1 for more info. If you feel like implementing that feature, go for it and send a pull request!)

Setting Up jQuery MessageBar with Django Messages

jQuery MessageBar can easily be connected to Django's messages framework, allowing your web application to display notifications as top bars that can be clicked away.

This is similar to the notification bars used in many popular web applications, such as StackOverflow.

  1. Add this to your base template:
{% for message in messages %}
  <div class="messagebar messagebar-default{% if message.tags %} {{ message.tags }}{% endif %}" id="message_{{ forloop.counter }}">
    <div class="container">
      {{ message }}
      <button type="button" class="close" data-dismiss="message">&times;</button>
    </div>
  </div>
{% endfor %}
  1. Change the names of the classes in messagebar.css to match Django's built-in message levels of:
  • debug
  • info
  • success
  • warning
  • error

See https://docs.djangoproject.com/en/dev/ref/contrib/messages/#message-tags for more info.