From 1d5fff9f58b486a519b74b12a907dd1acd32ba3c Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 13 May 2019 10:53:10 +0200 Subject: upgrade jgrowl --- library/jgrowl/.gitignore | 5 + library/jgrowl/Gruntfile.js | 61 +++++ library/jgrowl/LICENSE | 7 + library/jgrowl/README | 3 - library/jgrowl/README.md | 75 ++++++ library/jgrowl/bower.json | 32 +++ library/jgrowl/examples/appendTo.html | 103 ++++++++ library/jgrowl/examples/bootstrap.html | 91 +++++++ library/jgrowl/examples/jgrowl.html | 171 +++++++++++++ library/jgrowl/jgrowl.jquery.json | 40 +++ library/jgrowl/jquery.jgrowl.css | 101 +++++++- library/jgrowl/jquery.jgrowl.js | 399 ++++++++++++++++++++++++++++++ library/jgrowl/jquery.jgrowl.map | 1 + library/jgrowl/jquery.jgrowl.min.css | 1 + library/jgrowl/jquery.jgrowl.min.js | 2 + library/jgrowl/jquery.jgrowl_minimized.js | 2 - library/jgrowl/less/jgrowl.core.less | 101 ++++++++ library/jgrowl/less/jgrowl.less | 2 + library/jgrowl/less/jgrowl.variables.less | 8 + library/jgrowl/package.json | 23 ++ 20 files changed, 1222 insertions(+), 6 deletions(-) create mode 100644 library/jgrowl/.gitignore create mode 100644 library/jgrowl/Gruntfile.js create mode 100644 library/jgrowl/LICENSE delete mode 100644 library/jgrowl/README create mode 100644 library/jgrowl/README.md create mode 100644 library/jgrowl/bower.json create mode 100644 library/jgrowl/examples/appendTo.html create mode 100644 library/jgrowl/examples/bootstrap.html create mode 100755 library/jgrowl/examples/jgrowl.html create mode 100644 library/jgrowl/jgrowl.jquery.json create mode 100755 library/jgrowl/jquery.jgrowl.js create mode 100644 library/jgrowl/jquery.jgrowl.min.css create mode 100644 library/jgrowl/jquery.jgrowl.min.js delete mode 100644 library/jgrowl/jquery.jgrowl_minimized.js create mode 100755 library/jgrowl/less/jgrowl.core.less create mode 100644 library/jgrowl/less/jgrowl.less create mode 100644 library/jgrowl/less/jgrowl.variables.less create mode 100644 library/jgrowl/package.json (limited to 'library') diff --git a/library/jgrowl/.gitignore b/library/jgrowl/.gitignore new file mode 100644 index 000000000..385e49ef1 --- /dev/null +++ b/library/jgrowl/.gitignore @@ -0,0 +1,5 @@ +.DS_Store +node_modules/ +jGrowl.iml +jGrowl.ipr +jGrowl.iws diff --git a/library/jgrowl/Gruntfile.js b/library/jgrowl/Gruntfile.js new file mode 100644 index 000000000..fed0fceee --- /dev/null +++ b/library/jgrowl/Gruntfile.js @@ -0,0 +1,61 @@ +module.exports = function(grunt) { + + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + uglify: { + options: { + sourceMap: true, + sourceMapName: 'jquery.jgrowl.map' + }, + jgrowl: { + files: { + 'jquery.jgrowl.min.js': ['jquery.jgrowl.js'] + } + } + }, + less: { + jgrowl: { + files: { + "jquery.jgrowl.css": "less/jgrowl.less" + } + } + }, + cssmin: { + jgrowl: { + expand: true, + src: 'jquery.jgrowl.css', + ext: '.jgrowl.min.css' + } + }, + jshint: { + files: ['Gruntfile.js', 'jquery.jgrowl.js'], + options: { + // options here to override JSHint defaults + globals: { + jQuery: true, + console: true, + module: true, + document: true + } + } + }, + watch: { + scripts: { + files: ['jquery.jgrowl.js', 'less/*'], + tasks: ['jshint', 'less', 'cssmin', 'uglify'], + options: { + spawn: false + } + } + } + }); + + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-cssmin'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-contrib-less'); + + grunt.registerTask('test', ['jshint']); + grunt.registerTask('default', ['jshint', 'uglify', 'less', 'cssmin']); +}; diff --git a/library/jgrowl/LICENSE b/library/jgrowl/LICENSE new file mode 100644 index 000000000..e70a54a58 --- /dev/null +++ b/library/jgrowl/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2012 Stan Lemon + +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. diff --git a/library/jgrowl/README b/library/jgrowl/README deleted file mode 100644 index d0f1a62ad..000000000 --- a/library/jgrowl/README +++ /dev/null @@ -1,3 +0,0 @@ -https://github.com/stanlemon/jGrowl - -jGrowl is free and open source, it's distributed under the MIT and GPL licenses diff --git a/library/jgrowl/README.md b/library/jgrowl/README.md new file mode 100644 index 000000000..7dfd85637 --- /dev/null +++ b/library/jgrowl/README.md @@ -0,0 +1,75 @@ +# jGrowl +jGrowl is a jQuery plugin that raises unobtrusive messages within the browser, similar to the way that OS X's Growl Framework works. The idea is simple, deliver notifications to the end user in a noticeable way that doesn't obstruct the work flow and yet keeps the user informed. + +## Installation +jGrowl can be added to your project using package managers like bower and npm or directly into your html using cdnjs, as well as the good old fashioned copy-paste into your project directory. + +Use cdnjs: + +```html + + +``` + +Install with bower + +``` +bower install jgrowl +``` + +Install with npm + +``` +npm install jgrowl +``` + +```js +// Sample 1 +$.jGrowl("Hello world!"); +// Sample 2 +$.jGrowl("Stick this!", { sticky: true }); +// Sample 3 +$.jGrowl("A message with a header", { header: 'Important' }); +// Sample 4 +$.jGrowl("A message that will live a little longer.", { life: 10000 }); +// Sample 5 +$.jGrowl("A message with a beforeOpen callback and a different opening animation.", { + beforeClose: function(e,m) { + alert('About to close this notification!'); + }, + animateOpen: { + height: 'show' + } +}); +``` + +## Configuration Options +| Option | Default | Description | +|------------------|--------------------------------------|------------------------------------------------------------| +| pool | 0 | Limit the number of messages appearing at a given time to the number in the pool. | +| header | empty | Optional header to prefix the message, this is often helpful for associating messages to each other. | +| group | empty | A css class to be applied to notifications when they are created, useful for 'grouping' notifications by a css selector. | +| sticky | false | When set to true a message will stick to the screen until it is intentionally closed by the user. | +| position | top-right | Designates a class which is applied to the jGrowl container and controls its position on the screen. By Default there are five options available, top-left, top-right, bottom-left, bottom-right, center. This must be changed in the defaults before the startup method is called. | +| appendTo | body | The element where our jGrowl messages are appended to. The default is `body` but feel free to define another one. | +| glue | after | Designates whether a jGrowl notification should be appended to the container after all notifications, or whether it should be prepended to the container before all notifications. Options are after or before. | +| theme | default | A CSS class designating custom styling for this particular message, intended for use with jQuery UI. | +| themeState | highlight | A CSS class designating custom styling for this particular message and its state, intended for use with jQuery UI. | +| corners | 10px | If the corners jQuery plugin is include this option specifies the curvature radius to be used for the notifications as they are created. | +| check | 250 | The frequency that jGrowl should check for messages to be scrubbed from the screen.This must be changed in the defaults before the startup method is called. | +| life | 3000 | The lifespan of a non-sticky message on the screen. | +| closeDuration | normal | The animation speed used to close a notification. | +| openDuration | normal | The animation speed used to open a notification. | +| easing | swing | The easing method to be used with the animation for opening and closing a notification. | +| closer | true | Whether or not the close-all button should be used when more then one notification appears on the screen. Optionally this property can be set to a function which will be used as a callback when the close all button is clicked. This must be changed in the defaults before the startup method is called. | +| closeTemplate | × | This content is used for the individual notification close links that are added to the corner of a notification. This must be changed in the defaults before the startup method is called. | +| closerTemplate | <div>[ close all ]</div> | This content is used for the close-all link that is added to the bottom of a jGrowl container when it contains more than one notification. This must be changed in the defaults before the startup method is called. | +| log | function(e,m,o) {} | Callback to be used before anything is done with the notification. This is intended to be used if the user would like to have some type of logging mechanism for all notifications passed to jGrowl. This callback receives the notification's DOM context, the notification's message and its option object. | +| beforeOpen | function(e,m,o) {} | Callback to be used before a new notification is opened. This callback receives the notification's DOM context, the notification's message and its option object. | +| afterOpen | function(e,m,o) {} | Callback to be used after a new notification is opened. This callback receives the notification's DOM context, the notification's message and its option object. | +| open | function(e,m,o) {} | Callback to be used when a new notification is opened. This callback receives the notification's DOM context, the notifications message and its option object. | +| beforeClose | function(e,m,o) {} | Callback to be used before a new notification is closed. This callback receives the notification's DOM context, the notification's message and its option object. | +| close | function(e,m,o) {} | Callback to be used when a new notification is closed. This callback receives the notification's DOM context, the notification's message and its option object. | +| click | function(e,m,o) {} | Callback to be used when a notification is clicked. This callback receives the notification's DOM context, the notification's message and its option object. | +| animateOpen | { opacity: 'show' } | The animation properties to use when opening a new notification (default to fadeOut). | +| animateClose | { opacity: 'hide' } | The animation properties to use when closing a new notification (defaults to fadeIn). | diff --git a/library/jgrowl/bower.json b/library/jgrowl/bower.json new file mode 100644 index 000000000..15cfc754b --- /dev/null +++ b/library/jgrowl/bower.json @@ -0,0 +1,32 @@ +{ + "name": "jGrowl", + "version": "1.4.5", + "homepage": "https://github.com/stanlemon/jGrowl", + "authors": [ + "Stan Lemon " + ], + "description": "jGrowl is an unobtrusive notification system for web applications.", + "main": [ + "jquery.jgrowl.css", + "jquery.jgrowl.js" + ], + "keywords": [ + "growl", + "jgrowl", + "jquery", + "toaster", + "notification", + "message" + ], + "license": "MIT", + "dependencies": { + "jquery": ">=1.4" + }, + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/library/jgrowl/examples/appendTo.html b/library/jgrowl/examples/appendTo.html new file mode 100644 index 000000000..3eb0f4d27 --- /dev/null +++ b/library/jgrowl/examples/appendTo.html @@ -0,0 +1,103 @@ + + + + jGrowl Examples + + + + + + + +
I'm the dummy navigation
+ +

Append To Another DOM-Object

+ + diff --git a/library/jgrowl/examples/bootstrap.html b/library/jgrowl/examples/bootstrap.html new file mode 100644 index 000000000..6e069a3b9 --- /dev/null +++ b/library/jgrowl/examples/bootstrap.html @@ -0,0 +1,91 @@ + + + + + + + + + + jGrowl and Bootstrap + + + + + + + + + + + +
+ + + +
+ +
+

jGrowl and Bootstrap

+

This is a Bootstrap starter template with jGrowl integrated. As you can see it's extremely easy to make jGrowl look and feel like part of Bootstrap.

+
+
+
+ + + + + + + + + + diff --git a/library/jgrowl/examples/jgrowl.html b/library/jgrowl/examples/jgrowl.html new file mode 100755 index 000000000..e10fdd6cb --- /dev/null +++ b/library/jgrowl/examples/jgrowl.html @@ -0,0 +1,171 @@ + + + + jGrowl Examples + + + + + + + +

jGrowl Tests

+ +

Create a new message.

+ +

Shutdown bottom-left container.

+ +
An extra wide node, watch as the jGrowl containers stay put in the corners of the screen..
+ +

Log:

+ +
+ + diff --git a/library/jgrowl/jgrowl.jquery.json b/library/jgrowl/jgrowl.jquery.json new file mode 100644 index 000000000..c5f0756c9 --- /dev/null +++ b/library/jgrowl/jgrowl.jquery.json @@ -0,0 +1,40 @@ +{ + "name": "jgrowl", + "filename": "jquery.jgrowl.min.js", + "title": "jGrowl", + "description": "jGrowl is a jQuery plugin that raises unobtrusive messages within the browser, similar to the way that OS X's Growl Framework works. The idea is simple, deliver notifications to the end user in a noticeable way that doesn't obstruct the work flow and yet keeps the user informed.", + "keywords": [ + "growl", + "jgrowl", + "jquery", + "toaster", + "notification", + "message" + ], + "version": "1.4.3", + "author": { + "name": "Stan Lemon", + "email": "stosh1985@gmail.com", + "url": "http://stanlemon.net" + }, + "maintainers": [ + { + "name": "Stan Lemon", + "email": "stosh1985@gmail.com", + "url": "http://stanlemon.net" + } + ], + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/stanlemon/jGrowl/blob/master/LICENSE" + } + ], + "bugs": "https://github.com/stanlemon/jGrowl/issues", + "homepage": "https://github.com/stanlemon/jGrowl", + "docs": "https://github.com/stanlemon/jGrowl", + "download": "https://github.com/stanlemon/jGrowl/archive/master.zip", + "dependencies": { + "jquery": ">=1.4" + } +} diff --git a/library/jgrowl/jquery.jgrowl.css b/library/jgrowl/jquery.jgrowl.css index ea3948415..4a00b60f7 100644 --- a/library/jgrowl/jquery.jgrowl.css +++ b/library/jgrowl/jquery.jgrowl.css @@ -1 +1,100 @@ -.jGrowl{z-index:9999;color:#fff;font-size:12px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;position:fixed}.jGrowl.top-left{left:0;top:0}.jGrowl.top-right{right:0;top:0}.jGrowl.bottom-left{left:0;bottom:0}.jGrowl.bottom-right{right:0;bottom:0}.jGrowl.center{top:0;width:50%;left:25%}.jGrowl.center .jGrowl-closer,.jGrowl.center .jGrowl-notification{margin-left:auto;margin-right:auto}.jGrowl-notification{background-color:#000;opacity:.9;-ms-filter:alpha(90);filter:alpha(90);zoom:1;width:250px;padding:10px;margin:10px;text-align:left;display:none;border-radius:5px;min-height:40px}.jGrowl-notification .ui-state-highlight,.jGrowl-notification .ui-widget-content .ui-state-highlight,.jGrowl-notification .ui-widget-header .ui-state-highlight{border:1px solid #000;background:#000;color:#fff}.jGrowl-notification .jGrowl-header{font-weight:700;font-size:.85em}.jGrowl-notification .jGrowl-close{background-color:transparent;color:inherit;border:none;z-index:99;float:right;font-weight:700;font-size:1em;cursor:pointer}.jGrowl-closer{background-color:#000;opacity:.9;-ms-filter:alpha(90);filter:alpha(90);zoom:1;width:250px;padding:10px;margin:10px;display:none;border-radius:5px;padding-top:4px;padding-bottom:4px;cursor:pointer;font-size:.9em;font-weight:700;text-align:center}.jGrowl-closer .ui-state-highlight,.jGrowl-closer .ui-widget-content .ui-state-highlight,.jGrowl-closer .ui-widget-header .ui-state-highlight{border:1px solid #000;background:#000;color:#fff}@media print{.jGrowl{display:none}} \ No newline at end of file +.jGrowl { + z-index: 9999; + color: #ffffff; + font-size: 12px; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + position: fixed; +} +.jGrowl.top-left { + left: 0px; + top: 0px; +} +.jGrowl.top-right { + right: 0px; + top: 0px; +} +.jGrowl.bottom-left { + left: 0px; + bottom: 0px; +} +.jGrowl.bottom-right { + right: 0px; + bottom: 0px; +} +.jGrowl.center { + top: 0px; + width: 50%; + left: 25%; +} +.jGrowl.center .jGrowl-notification, +.jGrowl.center .jGrowl-closer { + margin-left: auto; + margin-right: auto; +} +.jGrowl-notification { + background-color: #000000; + opacity: 0.9; + filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=(0.9*100)); + -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=(0.9*100)); + zoom: 1; + width: 250px; + padding: 10px; + margin: 10px; + text-align: left; + display: none; + border-radius: 5px; + min-height: 40px; +} +.jGrowl-notification .ui-state-highlight, +.jGrowl-notification .ui-widget-content .ui-state-highlight, +.jGrowl-notification .ui-widget-header .ui-state-highlight { + border: 1px solid #000; + background: #000; + color: #fff; +} +.jGrowl-notification .jGrowl-header { + font-weight: bold; + font-size: .85em; +} +.jGrowl-notification .jGrowl-close { + background-color: transparent; + color: inherit; + border: none; + z-index: 99; + float: right; + font-weight: bold; + font-size: 1em; + cursor: pointer; +} +.jGrowl-closer { + background-color: #000000; + opacity: 0.9; + filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=(0.9*100)); + -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=(0.9*100)); + zoom: 1; + width: 250px; + padding: 10px; + margin: 10px; + text-align: left; + display: none; + border-radius: 5px; + padding-top: 4px; + padding-bottom: 4px; + cursor: pointer; + font-size: .9em; + font-weight: bold; + text-align: center; +} +.jGrowl-closer .ui-state-highlight, +.jGrowl-closer .ui-widget-content .ui-state-highlight, +.jGrowl-closer .ui-widget-header .ui-state-highlight { + border: 1px solid #000; + background: #000; + color: #fff; +} +/** Hide jGrowl when printing **/ +@media print { + .jGrowl { + display: none; + } +} diff --git a/library/jgrowl/jquery.jgrowl.js b/library/jgrowl/jquery.jgrowl.js new file mode 100755 index 000000000..d5444d438 --- /dev/null +++ b/library/jgrowl/jquery.jgrowl.js @@ -0,0 +1,399 @@ +/** + * jGrowl 1.4.5 + * + * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) + * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. + * + * Written by Stan Lemon + * Last updated: 2015.02.01 + * + * jGrowl is a jQuery plugin implementing unobtrusive userland notifications. These + * notifications function similarly to the Growl Framework available for + * Mac OS X (http://growl.info). + * + * To Do: + * - Move library settings to containers and allow them to be changed per container + * + * Changes in 1.4.5 + * - Fixed arguement list for click callback, thanks @timotheeg + * + * Changes in 1.4.4 + * - Revert word-break changes, thanks @curtisgibby + * + * Changes in 1.4.3 + * - Fixed opactiy in LESS for older version of IE + * + * Changes in 1.4.2 + * - Added word-break to less/css + * + * Changes in 1.4.1 + * - Added appendTo option + * - jQuery compatibility updates + * - Add check for closing a notification before it opens + * + * Changes in 1.4.0 + * - Removed IE6 support + * - Added LESS support + * + * Changes in 1.3.0 + * - Added non-vendor border-radius to stylesheet + * - Added grunt for generating minified js and css + * - Added npm package info + * - Added bower package info + * - Updates for jshint + * + * Changes in 1.2.13 + * - Fixed clearing interval when the container shuts down + * + * Changes in 1.2.12 + * - Added compressed versions using UglifyJS and Sqwish + * - Improved README with configuration options explanation + * - Added a source map + * + * Changes in 1.2.11 + * - Fix artifacts left behind by the shutdown method and text-cleanup + * + * Changes in 1.2.10 + * - Fix beforeClose to be called in click event + * + * Changes in 1.2.9 + * - Fixed BC break in jQuery 2.0 beta + * + * Changes in 1.2.8 + * - Fixes for jQuery 1.9 and the MSIE6 check, note that with jQuery 2.0 support + * jGrowl intends to drop support for IE6 altogether + * + * Changes in 1.2.6 + * - Fixed js error when a notification is opening and closing at the same time + * + * Changes in 1.2.5 + * - Changed wrapper jGrowl's options usage to "o" instead of $.jGrowl.defaults + * - Added themeState option to control 'highlight' or 'error' for jQuery UI + * - Ammended some CSS to provide default positioning for nested usage. + * - Changed some CSS to be prefixed with jGrowl- to prevent namespacing issues + * - Added two new options - openDuration and closeDuration to allow + * better control of notification open and close speeds, respectively + * Patch contributed by Jesse Vincet. + * - Added afterOpen callback. Patch contributed by Russel Branca. + * + * Changes in 1.2.4 + * - Fixed IE bug with the close-all button + * - Fixed IE bug with the filter CSS attribute (special thanks to gotwic) + * - Update IE opacity CSS + * - Changed font sizes to use "em", and only set the base style + * + * Changes in 1.2.3 + * - The callbacks no longer use the container as context, instead they use the actual notification + * - The callbacks now receive the container as a parameter after the options parameter + * - beforeOpen and beforeClose now check the return value, if it's false - the notification does + * not continue. The open callback will also halt execution if it returns false. + * - Fixed bug where containers would get confused + * - Expanded the pause functionality to pause an entire container. + * + * Changes in 1.2.2 + * - Notification can now be theme rolled for jQuery UI, special thanks to Jeff Chan! + * + * Changes in 1.2.1 + * - Fixed instance where the interval would fire the close method multiple times. + * - Added CSS to hide from print media + * - Fixed issue with closer button when div { position: relative } is set + * - Fixed leaking issue with multiple containers. Special thanks to Matthew Hanlon! + * + * Changes in 1.2.0 + * - Added message pooling to limit the number of messages appearing at a given time. + * - Closing a notification is now bound to the notification object and triggered by the close button. + * + * Changes in 1.1.2 + * - Added iPhone styled example + * - Fixed possible IE7 bug when determining if the ie6 class shoudl be applied. + * - Added template for the close button, so that it's content could be customized. + * + * Changes in 1.1.1 + * - Fixed CSS styling bug for ie6 caused by a mispelling + * - Changes height restriction on default notifications to min-height + * - Added skinned examples using a variety of images + * - Added the ability to customize the content of the [close all] box + * - Added jTweet, an example of using jGrowl + Twitter + * + * Changes in 1.1.0 + * - Multiple container and instances. + * - Standard $.jGrowl() now wraps $.fn.jGrowl() by first establishing a generic jGrowl container. + * - Instance methods of a jGrowl container can be called by $.fn.jGrowl(methodName) + * - Added glue preferenced, which allows notifications to be inserted before or after nodes in the container + * - Added new log callback which is called before anything is done for the notification + * - Corner's attribute are now applied on an individual notification basis. + * + * Changes in 1.0.4 + * - Various CSS fixes so that jGrowl renders correctly in IE6. + * + * Changes in 1.0.3 + * - Fixed bug with options persisting across notifications + * - Fixed theme application bug + * - Simplified some selectors and manipulations. + * - Added beforeOpen and beforeClose callbacks + * - Reorganized some lines of code to be more readable + * - Removed unnecessary this.defaults context + * - If corners plugin is present, it's now customizable. + * - Customizable open animation. + * - Customizable close animation. + * - Customizable animation easing. + * - Added customizable positioning (top-left, top-right, bottom-left, bottom-right, center) + * + * Changes in 1.0.2 + * - All CSS styling is now external. + * - Added a theme parameter which specifies a secondary class for styling, such + * that notifications can be customized in appearance on a per message basis. + * - Notification life span is now customizable on a per message basis. + * - Added the ability to disable the global closer, enabled by default. + * - Added callbacks for when a notification is opened or closed. + * - Added callback for the global closer. + * - Customizable animation speed. + * - jGrowl now set itself up and tears itself down. + * + * Changes in 1.0.1: + * - Removed dependency on metadata plugin in favor of .data() + * - Namespaced all events + */ +(function($) { + /** jGrowl Wrapper - Establish a base jGrowl Container for compatibility with older releases. **/ + $.jGrowl = function( m , o ) { + // To maintain compatibility with older version that only supported one instance we'll create the base container. + if ( $('#jGrowl').length === 0 ) + $('
').addClass( (o && o.position) ? o.position : $.jGrowl.defaults.position ).appendTo( (o && o.appendTo) ? o.appendTo : $.jGrowl.defaults.appendTo ); + + // Create a notification on the container. + $('#jGrowl').jGrowl(m,o); + }; + + + /** Raise jGrowl Notification on a jGrowl Container **/ + $.fn.jGrowl = function( m , o ) { + // Short hand for passing in just an object to this method + if ( o === undefined && $.isPlainObject(m) ) { + o = m; + m = o.message; + } + + if ( $.isFunction(this.each) ) { + var args = arguments; + + return this.each(function() { + /** Create a jGrowl Instance on the Container if it does not exist **/ + if ( $(this).data('jGrowl.instance') === undefined ) { + $(this).data('jGrowl.instance', $.extend( new $.fn.jGrowl(), { notifications: [], element: null, interval: null } )); + $(this).data('jGrowl.instance').startup( this ); + } + + /** Optionally call jGrowl instance methods, or just raise a normal notification **/ + if ( $.isFunction($(this).data('jGrowl.instance')[m]) ) { + $(this).data('jGrowl.instance')[m].apply( $(this).data('jGrowl.instance') , $.makeArray(args).slice(1) ); + } else { + $(this).data('jGrowl.instance').create( m , o ); + } + }); + } + }; + + $.extend( $.fn.jGrowl.prototype , { + + /** Default JGrowl Settings **/ + defaults: { + pool: 0, + header: '', + group: '', + sticky: false, + position: 'top-right', + appendTo: 'body', + glue: 'after', + theme: 'default', + themeState: 'highlight', + corners: '10px', + check: 250, + life: 3000, + closeDuration: 'normal', + openDuration: 'normal', + easing: 'swing', + closer: true, + closeTemplate: '×', + closerTemplate: '
[ close all ]
', + log: function() {}, + beforeOpen: function() {}, + afterOpen: function() {}, + open: function() {}, + beforeClose: function() {}, + close: function() {}, + click: function() {}, + animateOpen: { + opacity: 'show' + }, + animateClose: { + opacity: 'hide' + } + }, + + notifications: [], + + /** jGrowl Container Node **/ + element: null, + + /** Interval Function **/ + interval: null, + + /** Create a Notification **/ + create: function( message , options ) { + var o = $.extend({}, this.defaults, options); + + /* To keep backward compatibility with 1.24 and earlier, honor 'speed' if the user has set it */ + if (typeof o.speed !== 'undefined') { + o.openDuration = o.speed; + o.closeDuration = o.speed; + } + + this.notifications.push({ message: message , options: o }); + + o.log.apply( this.element , [this.element,message,o] ); + }, + + render: function( n ) { + var self = this; + var message = n.message; + var o = n.options; + + // Support for jQuery theme-states, if this is not used it displays a widget header + o.themeState = (o.themeState === '') ? '' : 'ui-state-' + o.themeState; + + var notification = $('
') + .addClass('jGrowl-notification alert ' + o.themeState + ' ui-corner-all' + ((o.group !== undefined && o.group !== '') ? ' ' + o.group : '')) + .append($('