j_growl_rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +34 -0
- data/app/assets/javascripts/j_growl_rails/Gruntfile.js +50 -0
- data/app/assets/javascripts/j_growl_rails/application.js +13 -0
- data/app/assets/javascripts/j_growl_rails/jgrowl.jquery.json +38 -0
- data/app/assets/javascripts/j_growl_rails/jquery.jgrowl.js +372 -0
- data/app/assets/javascripts/j_growl_rails/jquery.jgrowl.min.js +2 -0
- data/app/assets/stylesheets/j_growl_rails/application.css +15 -0
- data/app/assets/stylesheets/j_growl_rails/jquery.jgrowl.css +129 -0
- data/app/assets/stylesheets/j_growl_rails/jquery.jgrowl.min.css +1 -0
- data/app/controllers/j_growl_rails/application_controller.rb +4 -0
- data/app/helpers/j_growl_rails/application_helper.rb +4 -0
- data/app/views/layouts/j_growl_rails/application.html.erb +14 -0
- data/config/routes.rb +2 -0
- data/lib/j_growl_rails.rb +4 -0
- data/lib/j_growl_rails/engine.rb +5 -0
- data/lib/j_growl_rails/version.rb +3 -0
- data/lib/tasks/j_growl_rails_tasks.rake +4 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +83 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/j_growl_rails_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- metadata +164 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 12fb665584979f2df0e61637aaa1874cea60f65c
|
4
|
+
data.tar.gz: ccf38dd4acb6781ef912f46303be100420c03968
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7581cf854cc8782bac0fd89067c3be7d34c68a3b72725dcd41aecafd1b83e4ba6cd486f07bba7b57630c8e36121086cbc51f2d12e697b8333bf662f90c7bda8b
|
7
|
+
data.tar.gz: 5e450fd0dab446be4bc32de540d66b79203d67bd0adf91b5b655812e2050c4cd54c556b5bb041a8629fdf468c3f816b2012b905332c119303131dacdfcd0c08d
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'JGrowlRails'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
Bundler::GemHelper.install_tasks
|
23
|
+
|
24
|
+
require 'rake/testtask'
|
25
|
+
|
26
|
+
Rake::TestTask.new(:test) do |t|
|
27
|
+
t.libs << 'lib'
|
28
|
+
t.libs << 'test'
|
29
|
+
t.pattern = 'test/**/*_test.rb'
|
30
|
+
t.verbose = false
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
task default: :test
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module.exports = function(grunt) {
|
2
|
+
|
3
|
+
grunt.initConfig({
|
4
|
+
pkg: grunt.file.readJSON('package.json'),
|
5
|
+
uglify: {
|
6
|
+
options: {
|
7
|
+
sourceMap: true,
|
8
|
+
sourceMapName: 'jquery.jgrowl.map'
|
9
|
+
},
|
10
|
+
jgrowl: {
|
11
|
+
files: {
|
12
|
+
'jquery.jgrowl.min.js': ['jquery.jgrowl.js']
|
13
|
+
}
|
14
|
+
},
|
15
|
+
},
|
16
|
+
cssmin: {
|
17
|
+
minify: {
|
18
|
+
expand: true,
|
19
|
+
src: 'jquery.jgrowl.css',
|
20
|
+
ext: '.jgrowl.min.css'
|
21
|
+
}
|
22
|
+
},
|
23
|
+
jshint: {
|
24
|
+
files: ['Gruntfile.js', 'jquery.jgrowl.js'],
|
25
|
+
options: {
|
26
|
+
// options here to override JSHint defaults
|
27
|
+
globals: {
|
28
|
+
jQuery: true,
|
29
|
+
console: true,
|
30
|
+
module: true,
|
31
|
+
document: true
|
32
|
+
}
|
33
|
+
}
|
34
|
+
},
|
35
|
+
watch: {
|
36
|
+
files: ['<%= jshint.files %>'],
|
37
|
+
tasks: ['jshint', 'qunit']
|
38
|
+
}
|
39
|
+
});
|
40
|
+
|
41
|
+
grunt.loadNpmTasks('grunt-contrib-uglify');
|
42
|
+
grunt.loadNpmTasks('grunt-contrib-cssmin');
|
43
|
+
grunt.loadNpmTasks('grunt-contrib-jshint');
|
44
|
+
grunt.loadNpmTasks('grunt-contrib-watch');
|
45
|
+
|
46
|
+
grunt.registerTask('test', ['jshint']);
|
47
|
+
|
48
|
+
grunt.registerTask('default', ['jshint', 'uglify', 'cssmin']);
|
49
|
+
|
50
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,38 @@
|
|
1
|
+
{
|
2
|
+
"name": "jgrowl",
|
3
|
+
"filename": "jquery.jgrowl.min.js",
|
4
|
+
"title": "jQuery jGrowl",
|
5
|
+
"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.",
|
6
|
+
"keywords": [
|
7
|
+
"message",
|
8
|
+
"toaster",
|
9
|
+
"notification",
|
10
|
+
"growl"
|
11
|
+
],
|
12
|
+
"version": "1.3.0",
|
13
|
+
"author": {
|
14
|
+
"name": "Stan Lemon",
|
15
|
+
"email": "stosh1985@gmail.com",
|
16
|
+
"url": "http://stanlemon.net"
|
17
|
+
},
|
18
|
+
"maintainers": [
|
19
|
+
{
|
20
|
+
"name": "Stan Lemon",
|
21
|
+
"email": "stosh1985@gmail.com",
|
22
|
+
"url": "http://stanlemon.net"
|
23
|
+
}
|
24
|
+
],
|
25
|
+
"licenses": [
|
26
|
+
{
|
27
|
+
"type": "MIT",
|
28
|
+
"url": "https://github.com/stanlemon/jGrowl/blob/master/LICENSE"
|
29
|
+
}
|
30
|
+
],
|
31
|
+
"bugs": "https://github.com/stanlemon/jGrowl/issues",
|
32
|
+
"homepage": "https://github.com/stanlemon/jGrowl",
|
33
|
+
"docs": "https://github.com/stanlemon/jGrowl",
|
34
|
+
"download": "https://github.com/stanlemon/jGrowl/archive/master.zip",
|
35
|
+
"dependencies": {
|
36
|
+
"jquery": ">=1.4"
|
37
|
+
}
|
38
|
+
}
|
@@ -0,0 +1,372 @@
|
|
1
|
+
/**
|
2
|
+
* jGrowl 1.3.0
|
3
|
+
*
|
4
|
+
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
5
|
+
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
6
|
+
*
|
7
|
+
* Written by Stan Lemon <stosh1985@gmail.com>
|
8
|
+
* Last updated: 2014.04.18
|
9
|
+
*
|
10
|
+
* jGrowl is a jQuery plugin implementing unobtrusive userland notifications. These
|
11
|
+
* notifications function similarly to the Growl Framework available for
|
12
|
+
* Mac OS X (http://growl.info).
|
13
|
+
*
|
14
|
+
* To Do:
|
15
|
+
* - Move library settings to containers and allow them to be changed per container
|
16
|
+
*
|
17
|
+
* Changes in 1.3.0
|
18
|
+
* - Added non-vendor border-radius to stylesheet
|
19
|
+
* - Added grunt for generating minified js and css
|
20
|
+
* - Added npm package info
|
21
|
+
* - Added bower package info
|
22
|
+
* - Updates for jshint
|
23
|
+
*
|
24
|
+
* Changes in 1.2.13
|
25
|
+
* - Fixed clearing interval when the container shuts down
|
26
|
+
*
|
27
|
+
* Changes in 1.2.12
|
28
|
+
* - Added compressed versions using UglifyJS and Sqwish
|
29
|
+
* - Improved README with configuration options explanation
|
30
|
+
* - Added a source map
|
31
|
+
*
|
32
|
+
* Changes in 1.2.11
|
33
|
+
* - Fix artifacts left behind by the shutdown method and text-cleanup
|
34
|
+
*
|
35
|
+
* Changes in 1.2.10
|
36
|
+
* - Fix beforeClose to be called in click event
|
37
|
+
*
|
38
|
+
* Changes in 1.2.9
|
39
|
+
* - Fixed BC break in jQuery 2.0 beta
|
40
|
+
*
|
41
|
+
* Changes in 1.2.8
|
42
|
+
* - Fixes for jQuery 1.9 and the MSIE6 check, note that with jQuery 2.0 support
|
43
|
+
* jGrowl intends to drop support for IE6 altogether
|
44
|
+
*
|
45
|
+
* Changes in 1.2.6
|
46
|
+
* - Fixed js error when a notification is opening and closing at the same time
|
47
|
+
*
|
48
|
+
* Changes in 1.2.5
|
49
|
+
* - Changed wrapper jGrowl's options usage to "o" instead of $.jGrowl.defaults
|
50
|
+
* - Added themeState option to control 'highlight' or 'error' for jQuery UI
|
51
|
+
* - Ammended some CSS to provide default positioning for nested usage.
|
52
|
+
* - Changed some CSS to be prefixed with jGrowl- to prevent namespacing issues
|
53
|
+
* - Added two new options - openDuration and closeDuration to allow
|
54
|
+
* better control of notification open and close speeds, respectively
|
55
|
+
* Patch contributed by Jesse Vincet.
|
56
|
+
* - Added afterOpen callback. Patch contributed by Russel Branca.
|
57
|
+
*
|
58
|
+
* Changes in 1.2.4
|
59
|
+
* - Fixed IE bug with the close-all button
|
60
|
+
* - Fixed IE bug with the filter CSS attribute (special thanks to gotwic)
|
61
|
+
* - Update IE opacity CSS
|
62
|
+
* - Changed font sizes to use "em", and only set the base style
|
63
|
+
*
|
64
|
+
* Changes in 1.2.3
|
65
|
+
* - The callbacks no longer use the container as context, instead they use the actual notification
|
66
|
+
* - The callbacks now receive the container as a parameter after the options parameter
|
67
|
+
* - beforeOpen and beforeClose now check the return value, if it's false - the notification does
|
68
|
+
* not continue. The open callback will also halt execution if it returns false.
|
69
|
+
* - Fixed bug where containers would get confused
|
70
|
+
* - Expanded the pause functionality to pause an entire container.
|
71
|
+
*
|
72
|
+
* Changes in 1.2.2
|
73
|
+
* - Notification can now be theme rolled for jQuery UI, special thanks to Jeff Chan!
|
74
|
+
*
|
75
|
+
* Changes in 1.2.1
|
76
|
+
* - Fixed instance where the interval would fire the close method multiple times.
|
77
|
+
* - Added CSS to hide from print media
|
78
|
+
* - Fixed issue with closer button when div { position: relative } is set
|
79
|
+
* - Fixed leaking issue with multiple containers. Special thanks to Matthew Hanlon!
|
80
|
+
*
|
81
|
+
* Changes in 1.2.0
|
82
|
+
* - Added message pooling to limit the number of messages appearing at a given time.
|
83
|
+
* - Closing a notification is now bound to the notification object and triggered by the close button.
|
84
|
+
*
|
85
|
+
* Changes in 1.1.2
|
86
|
+
* - Added iPhone styled example
|
87
|
+
* - Fixed possible IE7 bug when determining if the ie6 class shoudl be applied.
|
88
|
+
* - Added template for the close button, so that it's content could be customized.
|
89
|
+
*
|
90
|
+
* Changes in 1.1.1
|
91
|
+
* - Fixed CSS styling bug for ie6 caused by a mispelling
|
92
|
+
* - Changes height restriction on default notifications to min-height
|
93
|
+
* - Added skinned examples using a variety of images
|
94
|
+
* - Added the ability to customize the content of the [close all] box
|
95
|
+
* - Added jTweet, an example of using jGrowl + Twitter
|
96
|
+
*
|
97
|
+
* Changes in 1.1.0
|
98
|
+
* - Multiple container and instances.
|
99
|
+
* - Standard $.jGrowl() now wraps $.fn.jGrowl() by first establishing a generic jGrowl container.
|
100
|
+
* - Instance methods of a jGrowl container can be called by $.fn.jGrowl(methodName)
|
101
|
+
* - Added glue preferenced, which allows notifications to be inserted before or after nodes in the container
|
102
|
+
* - Added new log callback which is called before anything is done for the notification
|
103
|
+
* - Corner's attribute are now applied on an individual notification basis.
|
104
|
+
*
|
105
|
+
* Changes in 1.0.4
|
106
|
+
* - Various CSS fixes so that jGrowl renders correctly in IE6.
|
107
|
+
*
|
108
|
+
* Changes in 1.0.3
|
109
|
+
* - Fixed bug with options persisting across notifications
|
110
|
+
* - Fixed theme application bug
|
111
|
+
* - Simplified some selectors and manipulations.
|
112
|
+
* - Added beforeOpen and beforeClose callbacks
|
113
|
+
* - Reorganized some lines of code to be more readable
|
114
|
+
* - Removed unnecessary this.defaults context
|
115
|
+
* - If corners plugin is present, it's now customizable.
|
116
|
+
* - Customizable open animation.
|
117
|
+
* - Customizable close animation.
|
118
|
+
* - Customizable animation easing.
|
119
|
+
* - Added customizable positioning (top-left, top-right, bottom-left, bottom-right, center)
|
120
|
+
*
|
121
|
+
* Changes in 1.0.2
|
122
|
+
* - All CSS styling is now external.
|
123
|
+
* - Added a theme parameter which specifies a secondary class for styling, such
|
124
|
+
* that notifications can be customized in appearance on a per message basis.
|
125
|
+
* - Notification life span is now customizable on a per message basis.
|
126
|
+
* - Added the ability to disable the global closer, enabled by default.
|
127
|
+
* - Added callbacks for when a notification is opened or closed.
|
128
|
+
* - Added callback for the global closer.
|
129
|
+
* - Customizable animation speed.
|
130
|
+
* - jGrowl now set itself up and tears itself down.
|
131
|
+
*
|
132
|
+
* Changes in 1.0.1:
|
133
|
+
* - Removed dependency on metadata plugin in favor of .data()
|
134
|
+
* - Namespaced all events
|
135
|
+
*/
|
136
|
+
(function($) {
|
137
|
+
/** Compatibility holdover for 1.9 to check IE6 **/
|
138
|
+
var $ie6 = (function(){
|
139
|
+
return false === $.support.boxModel && $.support.objectAll && $.support.leadingWhitespace;
|
140
|
+
})();
|
141
|
+
|
142
|
+
/** jGrowl Wrapper - Establish a base jGrowl Container for compatibility with older releases. **/
|
143
|
+
$.jGrowl = function( m , o ) {
|
144
|
+
// To maintain compatibility with older version that only supported one instance we'll create the base container.
|
145
|
+
if ( $('#jGrowl').size() === 0 )
|
146
|
+
$('<div id="jGrowl"></div>').addClass( (o && o.position) ? o.position : $.jGrowl.defaults.position ).appendTo('body');
|
147
|
+
|
148
|
+
// Create a notification on the container.
|
149
|
+
$('#jGrowl').jGrowl(m,o);
|
150
|
+
};
|
151
|
+
|
152
|
+
|
153
|
+
/** Raise jGrowl Notification on a jGrowl Container **/
|
154
|
+
$.fn.jGrowl = function( m , o ) {
|
155
|
+
if ( $.isFunction(this.each) ) {
|
156
|
+
var args = arguments;
|
157
|
+
|
158
|
+
return this.each(function() {
|
159
|
+
/** Create a jGrowl Instance on the Container if it does not exist **/
|
160
|
+
if ( $(this).data('jGrowl.instance') === undefined ) {
|
161
|
+
$(this).data('jGrowl.instance', $.extend( new $.fn.jGrowl(), { notifications: [], element: null, interval: null } ));
|
162
|
+
$(this).data('jGrowl.instance').startup( this );
|
163
|
+
}
|
164
|
+
|
165
|
+
/** Optionally call jGrowl instance methods, or just raise a normal notification **/
|
166
|
+
if ( $.isFunction($(this).data('jGrowl.instance')[m]) ) {
|
167
|
+
$(this).data('jGrowl.instance')[m].apply( $(this).data('jGrowl.instance') , $.makeArray(args).slice(1) );
|
168
|
+
} else {
|
169
|
+
$(this).data('jGrowl.instance').create( m , o );
|
170
|
+
}
|
171
|
+
});
|
172
|
+
}
|
173
|
+
};
|
174
|
+
|
175
|
+
$.extend( $.fn.jGrowl.prototype , {
|
176
|
+
|
177
|
+
/** Default JGrowl Settings **/
|
178
|
+
defaults: {
|
179
|
+
pool: 0,
|
180
|
+
header: '',
|
181
|
+
group: '',
|
182
|
+
sticky: false,
|
183
|
+
position: 'top-right',
|
184
|
+
glue: 'after',
|
185
|
+
theme: 'default',
|
186
|
+
themeState: 'highlight',
|
187
|
+
corners: '10px',
|
188
|
+
check: 250,
|
189
|
+
life: 3000,
|
190
|
+
closeDuration: 'normal',
|
191
|
+
openDuration: 'normal',
|
192
|
+
easing: 'swing',
|
193
|
+
closer: true,
|
194
|
+
closeTemplate: '×',
|
195
|
+
closerTemplate: '<div>[ close all ]</div>',
|
196
|
+
log: function() {},
|
197
|
+
beforeOpen: function() {},
|
198
|
+
afterOpen: function() {},
|
199
|
+
open: function() {},
|
200
|
+
beforeClose: function() {},
|
201
|
+
close: function() {},
|
202
|
+
animateOpen: {
|
203
|
+
opacity: 'show'
|
204
|
+
},
|
205
|
+
animateClose: {
|
206
|
+
opacity: 'hide'
|
207
|
+
}
|
208
|
+
},
|
209
|
+
|
210
|
+
notifications: [],
|
211
|
+
|
212
|
+
/** jGrowl Container Node **/
|
213
|
+
element: null,
|
214
|
+
|
215
|
+
/** Interval Function **/
|
216
|
+
interval: null,
|
217
|
+
|
218
|
+
/** Create a Notification **/
|
219
|
+
create: function( message , options ) {
|
220
|
+
var o = $.extend({}, this.defaults, options);
|
221
|
+
|
222
|
+
/* To keep backward compatibility with 1.24 and earlier, honor 'speed' if the user has set it */
|
223
|
+
if (typeof o.speed !== 'undefined') {
|
224
|
+
o.openDuration = o.speed;
|
225
|
+
o.closeDuration = o.speed;
|
226
|
+
}
|
227
|
+
|
228
|
+
this.notifications.push({ message: message , options: o });
|
229
|
+
|
230
|
+
o.log.apply( this.element , [this.element,message,o] );
|
231
|
+
},
|
232
|
+
|
233
|
+
render: function( n ) {
|
234
|
+
var self = this;
|
235
|
+
var message = n.message;
|
236
|
+
var o = n.options;
|
237
|
+
|
238
|
+
// Support for jQuery theme-states, if this is not used it displays a widget header
|
239
|
+
o.themeState = (o.themeState === '') ? '' : 'ui-state-' + o.themeState;
|
240
|
+
|
241
|
+
var notification = $('<div/>')
|
242
|
+
.addClass('jGrowl-notification ' + o.themeState + ' ui-corner-all' + ((o.group !== undefined && o.group !== '') ? ' ' + o.group : ''))
|
243
|
+
.append($('<div/>').addClass('jGrowl-close').html(o.closeTemplate))
|
244
|
+
.append($('<div/>').addClass('jGrowl-header').html(o.header))
|
245
|
+
.append($('<div/>').addClass('jGrowl-message').html(message))
|
246
|
+
.data("jGrowl", o).addClass(o.theme).children('div.jGrowl-close').bind("click.jGrowl", function() {
|
247
|
+
$(this).parent().trigger('jGrowl.beforeClose');
|
248
|
+
})
|
249
|
+
.parent();
|
250
|
+
|
251
|
+
|
252
|
+
/** Notification Actions **/
|
253
|
+
$(notification).bind("mouseover.jGrowl", function() {
|
254
|
+
$('div.jGrowl-notification', self.element).data("jGrowl.pause", true);
|
255
|
+
}).bind("mouseout.jGrowl", function() {
|
256
|
+
$('div.jGrowl-notification', self.element).data("jGrowl.pause", false);
|
257
|
+
}).bind('jGrowl.beforeOpen', function() {
|
258
|
+
if ( o.beforeOpen.apply( notification , [notification,message,o,self.element] ) !== false ) {
|
259
|
+
$(this).trigger('jGrowl.open');
|
260
|
+
}
|
261
|
+
}).bind('jGrowl.open', function() {
|
262
|
+
if ( o.open.apply( notification , [notification,message,o,self.element] ) !== false ) {
|
263
|
+
if ( o.glue == 'after' ) {
|
264
|
+
$('div.jGrowl-notification:last', self.element).after(notification);
|
265
|
+
} else {
|
266
|
+
$('div.jGrowl-notification:first', self.element).before(notification);
|
267
|
+
}
|
268
|
+
|
269
|
+
$(this).animate(o.animateOpen, o.openDuration, o.easing, function() {
|
270
|
+
// Fixes some anti-aliasing issues with IE filters.
|
271
|
+
if ($.support.opacity === false)
|
272
|
+
this.style.removeAttribute('filter');
|
273
|
+
|
274
|
+
if ( $(this).data("jGrowl") !== null ) // Happens when a notification is closing before it's open.
|
275
|
+
$(this).data("jGrowl").created = new Date();
|
276
|
+
|
277
|
+
$(this).trigger('jGrowl.afterOpen');
|
278
|
+
});
|
279
|
+
}
|
280
|
+
}).bind('jGrowl.afterOpen', function() {
|
281
|
+
o.afterOpen.apply( notification , [notification,message,o,self.element] );
|
282
|
+
}).bind('jGrowl.beforeClose', function() {
|
283
|
+
if ( o.beforeClose.apply( notification , [notification,message,o,self.element] ) !== false )
|
284
|
+
$(this).trigger('jGrowl.close');
|
285
|
+
}).bind('jGrowl.close', function() {
|
286
|
+
// Pause the notification, lest during the course of animation another close event gets called.
|
287
|
+
$(this).data('jGrowl.pause', true);
|
288
|
+
$(this).animate(o.animateClose, o.closeDuration, o.easing, function() {
|
289
|
+
if ( $.isFunction(o.close) ) {
|
290
|
+
if ( o.close.apply( notification , [notification,message,o,self.element] ) !== false )
|
291
|
+
$(this).remove();
|
292
|
+
} else {
|
293
|
+
$(this).remove();
|
294
|
+
}
|
295
|
+
});
|
296
|
+
}).trigger('jGrowl.beforeOpen');
|
297
|
+
|
298
|
+
/** Optional Corners Plugin **/
|
299
|
+
if ( o.corners !== '' && $.fn.corner !== undefined ) $(notification).corner( o.corners );
|
300
|
+
|
301
|
+
/** Add a Global Closer if more than one notification exists **/
|
302
|
+
if ($('div.jGrowl-notification:parent', self.element).size() > 1 &&
|
303
|
+
$('div.jGrowl-closer', self.element).size() === 0 && this.defaults.closer !== false ) {
|
304
|
+
$(this.defaults.closerTemplate).addClass('jGrowl-closer ' + this.defaults.themeState + ' ui-corner-all').addClass(this.defaults.theme)
|
305
|
+
.appendTo(self.element).animate(this.defaults.animateOpen, this.defaults.speed, this.defaults.easing)
|
306
|
+
.bind("click.jGrowl", function() {
|
307
|
+
$(this).siblings().trigger("jGrowl.beforeClose");
|
308
|
+
|
309
|
+
if ( $.isFunction( self.defaults.closer ) ) {
|
310
|
+
self.defaults.closer.apply( $(this).parent()[0] , [$(this).parent()[0]] );
|
311
|
+
}
|
312
|
+
});
|
313
|
+
}
|
314
|
+
},
|
315
|
+
|
316
|
+
/** Update the jGrowl Container, removing old jGrowl notifications **/
|
317
|
+
update: function() {
|
318
|
+
$(this.element).find('div.jGrowl-notification:parent').each( function() {
|
319
|
+
if ($(this).data("jGrowl") !== undefined && $(this).data("jGrowl").created !== undefined &&
|
320
|
+
($(this).data("jGrowl").created.getTime() + parseInt($(this).data("jGrowl").life, 10)) < (new Date()).getTime() &&
|
321
|
+
$(this).data("jGrowl").sticky !== true &&
|
322
|
+
($(this).data("jGrowl.pause") === undefined || $(this).data("jGrowl.pause") !== true) ) {
|
323
|
+
|
324
|
+
// Pause the notification, lest during the course of animation another close event gets called.
|
325
|
+
$(this).trigger('jGrowl.beforeClose');
|
326
|
+
}
|
327
|
+
});
|
328
|
+
|
329
|
+
if (this.notifications.length > 0 &&
|
330
|
+
(this.defaults.pool === 0 || $(this.element).find('div.jGrowl-notification:parent').size() < this.defaults.pool) )
|
331
|
+
this.render( this.notifications.shift() );
|
332
|
+
|
333
|
+
if ($(this.element).find('div.jGrowl-notification:parent').size() < 2 ) {
|
334
|
+
$(this.element).find('div.jGrowl-closer').animate(this.defaults.animateClose, this.defaults.speed, this.defaults.easing, function() {
|
335
|
+
$(this).remove();
|
336
|
+
});
|
337
|
+
}
|
338
|
+
},
|
339
|
+
|
340
|
+
/** Setup the jGrowl Notification Container **/
|
341
|
+
startup: function(e) {
|
342
|
+
this.element = $(e).addClass('jGrowl').append('<div class="jGrowl-notification"></div>');
|
343
|
+
this.interval = setInterval( function() {
|
344
|
+
$(e).data('jGrowl.instance').update();
|
345
|
+
}, parseInt(this.defaults.check, 10));
|
346
|
+
|
347
|
+
if ($ie6) {
|
348
|
+
$(this.element).addClass('ie6');
|
349
|
+
}
|
350
|
+
},
|
351
|
+
|
352
|
+
/** Shutdown jGrowl, removing it and clearing the interval **/
|
353
|
+
shutdown: function() {
|
354
|
+
$(this.element).removeClass('jGrowl')
|
355
|
+
.find('div.jGrowl-notification').trigger('jGrowl.close')
|
356
|
+
.parent().empty()
|
357
|
+
;
|
358
|
+
|
359
|
+
clearInterval(this.interval);
|
360
|
+
},
|
361
|
+
|
362
|
+
close: function() {
|
363
|
+
$(this.element).find('div.jGrowl-notification').each(function(){
|
364
|
+
$(this).trigger('jGrowl.beforeClose');
|
365
|
+
});
|
366
|
+
}
|
367
|
+
});
|
368
|
+
|
369
|
+
/** Reference the Defaults Object for compatibility with older versions of jGrowl **/
|
370
|
+
$.jGrowl.defaults = $.fn.jGrowl.prototype.defaults;
|
371
|
+
|
372
|
+
})(jQuery);
|