A simple, modern, browser notification system

Overview

humane.js

This project was heavily inspired by humanmsg project for jQuery. I really liked the project but I wanted to remove the jQuery dependency, add support for CSS transitions, and have more control over the timing. I consider the project complete and don't plan on adding any new features except for any bug fixes.

About

humane.js tries to be as unobtrusive as possible to the user experience while providing helpful information that is clear and grabs the users attention. It is framework independent. Customizable.

Setup

Setup is simple:

  • Download tar/zip
  • Select a theme from themes dir.
  • Include the theme CSS in your page
  • Include humane.min.js in your page

Demo/Usage

You can see a demo and usage here

Custom Themes

Got a neat theme/animation, love to see it. View theme-src/bigbox.styl for an template to get started (uses Stylus w/ Nib and Canvas).

To get setup with Stylus use npm:

npm install --development

With Stylus installed you can watch for changes and compile into CSS by running:

npm run watch

Desktop and Mobile Browser Support

humane.js has been tested for the following browsers.

  • Internet Explorer 7+
  • Firefox 3+
  • Chrome 9+
  • Safari 3+
  • Opera 10+
  • iOS 4+
  • Android 2+

AMD and Node.js Support

humane.js works for AMD systems like require.js and within Node.js CommonJS module system like browserify.

Contributers

Many thanks to the JS/Browser wizards that helped make this better, community rocks!

  • @bga_ (Alexander)
  • @joseanpg (Jose)
  • @OiNutter (Will McKenzie)
  • @ianmassey (Ian Massey)

License

(The MIT License)

Copyright (c) 2018 Marc Harter <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Comments
  • Very cool but no Stacking

    Very cool but no Stacking

    I love the styling and effects, but there's a problem. What if a notification is being displayed and just after a second a new notification is fired?

    You need to add stacking.

    discussion 
    opened by divineslight 12
  • Not compatible with requirejs

    Not compatible with requirejs

    The current amd / node friendly definition format doesn't play well with the loading functionality of requirejs. I needed to stripe the module.exports code and directly assign window.humane = new Humane in a single closure structure.

    Here is a gist of the simplified code, sans all node js support, that works with requirejs. https://gist.github.com/gregory80/b451035746ad8479bf04

    opened by gtzilla 11
  • page contents disapear on android

    page contents disapear on android

    I'm using Android 2.3.x phone with its bultin webkit based browser. On the demo page, after a notification disapears, all the content on the page disapears too. But as soon I scroll the page everything reapears again. It's very strange, maybe even a bug in the browser?

    bug mobile webkit confirmed 
    opened by gdamjan 11
  • Feature: Per-notification options

    Feature: Per-notification options

    Not all notifications, even within one 'type' are created equal. Some I know I would like to appear very briefly; others, not.

    E.g.:

    • “Sending…” ← Want to appear briefly, even shorter than any other info/generic notification
    • “Offline – will retry” ← Go away on its own after 2 or 3 sec
    • An error message from the server or form validation ← I don’t want this to go away on its own

    Seems kind of odd not to have this option, actually. I’d rather see a config object than a post-display function as the second argument of humane[.<type>]() calls.

    opened by alanhogan 10
  • Added support for callbacks

    Added support for callbacks

    humane-js now supports passing functions to be called once a notification has animated out. I've used the prefix matching for the transition events from Zepto.js and tweaked it so the right event should be watched for each engine. Also added the event for the js animation as well. And finally I've added an example to the index page and built a minified version with the amends included.

    Let me know if you want anything done differently to fit in better.

    opened by OiNutter 10
  • Demo page doesn't work in IE8

    Demo page doesn't work in IE8

    Hi there!

    Was just checking out the online demo's and noticed that support for IE8 on the demo page is limited. When I change the theme to something (ie. Jacked up), it results in a javascript error.

    bug confirmed 
    opened by stringbeans 9
  • IE8 error on line 124

    IE8 error on line 124

    I have been using humane and its awesome, however I have a call to humane:

    <div id="notify"></div>
    <!-- rest of the html -->
    <script>
      var notify = humane.create({container: document.getElementById('notify')});
      notify.log("<h2>Order successfully submitted for 435645 of the Test Brochure</h2><p>You will be contacted shortly with confirmation of your order</p>", { timeout: 5000, clickToClose: false, addnCls: "success"});
    </script>
    </body>
    

    I am including the style sheet and humane.js in the top and when I try and run the above notify.log call i get an error in IE8 reported on line 124 which is:

    this.el.filters.item('DXImageTransform.Microsoft.Alpha').Opacity = opacity*100
    

    As far as I can see I have my document matching that of http://wavded.github.com/humane-js/ in terms of where I run the notify.log call and where I include the js and css files. Is it possible that the issue with me setting a container?

    opened by LRotherfield 8
  • Using multiple themes in single implementation

    Using multiple themes in single implementation

    Hey... so I am currently using humanejs in development and am going with the original theme so far and it's been great for errors and bold notifications.

    However, I have a situation where I've been using it to indicate when a user has saved a draft and now I'm implementing an autosave feature to save drafts every 10 seconds. Where the original theme notification was perfect to indicate when they (un)successfully saved a draft on user action, it's way too obtrusive to pop-up in the middle of editing to indicate a successful autosave.

    What I would like to do is use one of the less obtrusive themes for the autosave (jackedup or libnotify) while keeping the bolder notifications for intentional user actions. I was thinking that if there was an option to specify a class for the dialog you could include two of the theme css' which were modified to style descending from those classes. However, there doesn't seem to be a way to do this with any of the available options or hooks. Is there any ways to do something like this?

    feature 
    opened by Gooseus 8
  • Timeout=0 doesn't work second time around

    Timeout=0 doesn't work second time around

    Hello.

    I have the following snippet of code: https://gist.github.com/9e8913c73bc7347c2c74

    Everything works fine after first click on "a1" span, but on every second click after that, the notification is removed and is showed back again but stays only for 2,5 seconds.

    opened by nowotny 7
  • "Stacking" notifications.

    This is adapted from the email I sent to @wavded, as I figured that this would be an all-around better forum for the issue than either twitter or email, especially since you indicated in a tweet that you'd been thinking of this for the next version, anyhow.


    I'm working on a site and humane.js is going a long way to making one of its central features /possible/, so many thanks and kudos to you for your fabulous work on it. However, one showstopper that I've realized is that I'm not able to "stack" the notifications concurrently and that there can only be one concurrently visible notification on the screen at a time, while any others that get logged before it times out get a slot in a backlog queue. So I guess I'm looking to hack on humane. But I'm not the best JS dev in the world, so I suppose I'm in need of some minor guidance. Which are the relevant sections of code? Would you be able to tell me what needs to happen in either English or pseudocode? If you could, I'm sure I could implement the patch with no problems.

    Here are some examples of what I'm trying to achieve: webkit <-- webkit already has this, coming up from the bottom.

    growl? <-- though I've never used it and so can't say for sure, this appears to be growl and is more or less exactly what I'm looking for.

    Thanks again,

    @adlwalrus

    opened by aawwawa 6
  •  json_encode issue?

    json_encode issue?

    Well humane.log("Test") works, but not the below, missing something? :man:

    <? php
         $str = json_encode($my_array);
         print $str;
         echo "<script>humane.log('$str');</script>";
    ?>
    
    opened by hemanth 6
  • how do you

    how do you "stack" the notifications? getting overlapped one over the other

    how do you "stack" the notifications? I have different processes that generated different notifications, and some of them are overlapping one over another instead of stacking on the side one below the other. Am I doing something wrong? What is the correct use for generating notifications that can stack?

    Thanks

    opened by gadget00 5
  • Bump canvas from 1.0.2 to 2.6.0

    Bump canvas from 1.0.2 to 2.6.0

    Bumps canvas from 1.0.2 to 2.6.0.

    Changelog

    Sourced from canvas's changelog.

    2.6.0

    Changed

    • Allow larger buffers to be returned from toBuffer('raw').

    Added

    • Support for various BMP headers and color depths (#1435)

    Fixed

    • Fix crash when changing canvas width/height while fillStyle or strokeStyle was set to a CanvasPattern or CanvasGradient (#1357).
    • Fix crash when changing width/height of SVG canvases (#1380).
    • Fix crash when using toBuffer('raw') with large canvases (#1158).
    • Clarified meaning of byte ordering for toBuffer('raw') in readme. (#1416)
    • Fix package.json Typings field to point to Declaration file (#1432)
    • Properly check return value from Set and Call. (#1415)
    • Use Get version from Nan instead of v8. (#1415)

    2.5.0

    Added

    • Support redirects when fetching images (using simple-get) (#1398)
    • Support Node.js v12

    Fixed

    • Fix object literal & arrow function syntax usage for IE.

    2.4.1

    Fixed

    • Guard JPEG width/height against maximum supported (#1385)
    • Fix electron 5 and node 12 compatibility
    • Fix encoding options (quality) parameter in canvas.toDataURL()

    2.4.0

    Added

    • (Actually) added resolution option for canvas.toBuffer("image/png") and canvas.createPNGStream(). This was documented since 2.0.0 but not working.
    • Add typescript definitions.

    Fixed

    • PDF metadata (added in 2.3.0) wasn't being set with canvas.createPDFStream()
    • Fix custom "inspect" function deprecation warnings (#1326)

    2.3.1

    Fixed

    • Fix canvas.toBuffer() for JPEGs (#1350)

    2.3.0

    Added

    • Add support for multiple PDF page sizes
    ... (truncated)
    Commits
    • f5b9814 2.6.0
    • ccecad2 history: 2.6.0
    • 8dcd0da Merge pull request #1415 from Automattic/nan-fixes
    • e03bb84 Properly check return value from Set and Call
    • 876f93d Add support for various BMP headers and color depths (#1435)
    • dd0c7c2 Update package.json typings field (#1432)
    • 126760a Clarify toBuffer('raw') byte ordering
    • c1cc378 Fix assertion error with large canvases and toBuffer('raw')
    • 9d71cfd Fix crash when resurfacing SVG canvases
    • 4d485aa Fix crash when resurfacing while fill/strokeStyle set to pattern or gradient
    • Additional commits viewable in compare view
    Maintainer changes

    This version was pushed to npm by linusu, a new releaser for canvas since your current version.


    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot ignore this [patch|minor|major] version will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Use new syntax of linear-gradient

    Use new syntax of linear-gradient

    I use autoprefixer and see next warnings:

    34:3	⚠  Gradient has outdated direction syntax. New syntax is like `to left` instead of `right`. [autoprefixer]
    66:3	⚠  Gradient has outdated direction syntax. New syntax is like `to left` instead of `right`. [autoprefixer]
    79:3	⚠  Gradient has outdated direction syntax. New syntax is like `to left` instead of `right`. [autoprefixer]
    92:3	⚠  Gradient has outdated direction syntax. New syntax is like `to left` instead of `right`. [autoprefixer]
    

    Description of new syntax: https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient

    opened by vtaits 5
  • Text doesnt feed to notification

    Text doesnt feed to notification

    How to feed "not very", but still long text to notification? It is very strange that, say, error notification is cuted on unpredictable point. I think if application needs to send some notication, its content is important and cant be shortened anyway (maybe it can be shortened only if it is filling all "document" area, so have to get scrollbars - and this is obviously not desired behaviour).

    opened by DRVTiny 0
Owner
Marc Harter
Co-author of Node.js in Action and Node.js in Practice. Writes for @strongloop. Full-stack engineer for @applieddataconsultants.
Marc Harter
Elegant, responsive, flexible and lightweight notification plugin with no dependencies.

iziToast Elegant, responsive, flexible and lightweight notification plugin with no dependencies. izitoast.marcelodolza.com Fast Responsive Animated Li

Marcelo Dolza 2.5k Jan 2, 2023
⛔️ DEPRECATED - Dependency-free notification library that makes it easy to create alert - success - error - warning - information - confirmation messages as an alternative the standard alert dialog.

DEPRECATED This repository is no longer supported, please consider using alternatives. Dependency-free notification library. Documentation » Hi NOTY i

Nedim Arabacı 6.7k Dec 21, 2022
Pure JavaScript library for better notification messages

Toastify Toastify is a lightweight, vanilla JS toast notification library. Demo Click here Features Multiple stacked notifications Customizable No blo

Varun A P 1.3k Dec 30, 2022
framework-agnostic styled alert system for javascript

SMOKE.JS - 0.1.3 Notify or get approval from your users quickly and with style. This alert system uses css animations and background (so there are no

j youngblood 934 Dec 25, 2022
Simple javascript toast notifications

toastr toastr is a Javascript library for non-blocking notifications. jQuery is required. The goal is to create a simple core library that can be cust

null 11.5k Jan 6, 2023
The Frontend of Escobar's Inventory Management System, Employee Management System, Ordering System, and Income & Expense System

Usage Create an App # with npx $ npx create-nextron-app my-app --example with-javascript # with yarn $ yarn create nextron-app my-app --example with-

Viver Bungag 4 Jan 2, 2023
JavaScript Alert/Notification System

alertify.js - browser dialogs never looked so good The end of maintenance... at least for now Unfortunately, I will no longer be maintaining alertify.

Fabien Doiron 4.3k Dec 22, 2022
🔔 a clean and simple notification, input, and selection suite for javascript, with no dependencies

notie notie is a clean and simple notification, input, and selection suite for javascript, with no dependencies Live demo: https://jaredreich.com/noti

Jared Reich 6.3k Dec 26, 2022
Simple, cli-first, mobile push notification across systems.

Notify.sh Simple, cli-first, mobile push notification across systems. Install In each folder, run npm install. The expected node version is 14. (Highe

David Alen 7 May 20, 2022
Lightweight and simple notification library in Vanilla JavaScript.

SimpleNotification SimpleNotification is a library to display simple yet customizable notifications. You can stylize text with a simple syntax, add bu

null 14 Dec 11, 2022
A simple and light jquery library for toast notification!

What is notify message? Notify message it's a simple jquery library for create a simple and light push notification in your website! How does this wor

Ivan Persiani 3 Feb 23, 2022
Elegant, responsive, flexible and lightweight notification plugin with no dependencies.

iziToast Elegant, responsive, flexible and lightweight notification plugin with no dependencies. izitoast.marcelodolza.com Fast Responsive Animated Li

Marcelo Dolza 2.5k Jan 2, 2023
⛔️ DEPRECATED - Dependency-free notification library that makes it easy to create alert - success - error - warning - information - confirmation messages as an alternative the standard alert dialog.

DEPRECATED This repository is no longer supported, please consider using alternatives. Dependency-free notification library. Documentation » Hi NOTY i

Nedim Arabacı 6.7k Dec 21, 2022
⚡️ Look for Covid-19 Resources, Get Vaccine Availability Notification, Complete source code for covidrescue.co.in website.

covidrescue.co.in ⚡️ Get real-time, verified leads on Oxygen, Remdesivir, ICU, Beds, Food and more based on your location. Get notifications on Vaccin

Placeholder Tech 15 Jul 10, 2022
GitHub action to get notification whenever vaccine slot is availble in cowin portal :tada:

Covid Vaccine availability notifier Setup Fork this repo Update the config at src/config.js Delete the db file src/db.json module.exports = { // opt

Ameer Jhan 32 Jul 27, 2022
Mosha-vue-toastify - A light weight and fun Vue 3 toast or notification or snack bar or however you wanna call it library.

Mosha Vue Toastify A lightweight and fun Vue 3 toast or notification or snack bar or however you wanna call it library. English | 简体中文 Talk is cheap,

Baidi Liu 187 Jan 2, 2023
Pure JavaScript library for better notification messages

Toastify Toastify is a lightweight, vanilla JS toast notification library. Demo Click here Features Multiple stacked notifications Customizable No blo

Varun A P 1.3k Dec 30, 2022
A useful nodejs program to send notification on discord when new result

A useful nodejs program to send notification on discord when new result

Alwyn974 5 Mar 23, 2022
Send slack notification with BQ results

bq2slack-github-action Send slack notification with BQ results. How to use Sample github actions workflow yaml name: Run SQL against BQ and notify sla

Data-i Consulting 4 Dec 16, 2022
Manage and monitorize your notification using only your terminal :3

Notifications Monitor Monitor your notifications and get a temporary list of the notifications. Dependencies Node.js (to run the program; by default,

Gabriel Guerra 3 Apr 12, 2022