pnotify-rails 1.2.2 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,132 @@
1
+ // Reference
2
+ // This file is for referencing while you are making a notify module.
3
+ // Uses AMD or browser globals for jQuery.
4
+ (function (factory) {
5
+ if (typeof define === 'function' && define.amd) {
6
+ // AMD. Register as a module.
7
+ define('pnotify.reference', ['jquery', 'pnotify'], factory);
8
+ } else {
9
+ // Browser globals
10
+ factory(jQuery, PNotify);
11
+ }
12
+ }(function($, PNotify){
13
+ // This if the default values of your options.
14
+ PNotify.prototype.options.reference = {
15
+ // Provide a thing for stuff. Turned off by default.
16
+ putThing: false,
17
+ // If you are displaying any text, you should use a labels options to
18
+ // support internationalization.
19
+ labels: {
20
+ text: "Spin Around"
21
+ }
22
+ };
23
+ PNotify.prototype.modules.reference = {
24
+ // You can put variables here that are specific to a notice instance.
25
+ thingElem: null,
26
+
27
+ // This function is called when the notice is being created, after the
28
+ // core has done all of its work.
29
+ init: function(notice /* the notice object */, options /* this module's options */){
30
+ var that = this; // This line will allow you to access instance variables
31
+ // like "this.thingElem" from within closures.
32
+
33
+ // Note that options only contains the options specific to our modules.
34
+ // To access global options, we would use notice.options.
35
+
36
+ // We want to check to make sure the notice should include our thing.
37
+ if (!options.putThing)
38
+ return;
39
+
40
+ // We're going to create a button that will be appended to the notice.
41
+ // It will be disabled by default, so we can enable it on mouseover.
42
+ // You should try to keep elements inside the notice container.
43
+ this.thingElem = $('<button style="float:right;" class="btn btn-default" type="button" disabled><i class="'+notice.styles.athing+'" />&nbsp;'+options.labels.text+'</button>').appendTo(notice.container);
44
+ // Since our button is floated, we have to add a clearing div.
45
+ notice.container.append('<div style="clear: right; line-height: 0;" />')
46
+
47
+ // Now we're going to enable the button on mouseenter.
48
+ notice.elem.on({
49
+ "mouseenter": function(e){
50
+ // Enable the button.
51
+ // Notice that we have to use "that" to access thingElem, because
52
+ // we are in a different scope inside this function.
53
+ that.thingElem.prop("disabled", false);
54
+ },
55
+ "mouseleave": function(e){
56
+ // Disable the button.
57
+ that.thingElem.prop("disabled", true);
58
+ }
59
+ });
60
+
61
+ // Now we're going to make our button do something.
62
+ this.thingElem.on("click", function(){
63
+ // Spin the notice around.
64
+ var cur_angle = 0;
65
+ var timer = setInterval(function(){
66
+ cur_angle += 10;
67
+ if (cur_angle == 360) {
68
+ cur_angle = 0;
69
+ clearInterval(timer);
70
+ }
71
+ notice.elem.css({
72
+ '-moz-transform': ('rotate('+cur_angle+'deg)'),
73
+ '-webkit-transform': ('rotate('+cur_angle+'deg)'),
74
+ '-o-transform': ('rotate('+cur_angle+'deg)'),
75
+ '-ms-transform': ('rotate('+cur_angle+'deg)'),
76
+ 'filter': ('progid:DXImageTransform.Microsoft.BasicImage(rotation='+(cur_angle / 360 * 4)+')')
77
+ });
78
+ }, 20);
79
+ });
80
+ },
81
+
82
+ // This is called when the notice is updating its options.
83
+ update: function(notice, options /* the new options for our module */, oldOpts /* the old options for our module */){
84
+ // We need to remove the button if it's now disabled, and show it again if it's enabled.
85
+ if (options.putThing && this.thingElem)
86
+ this.thingElem.show();
87
+ else if (!options.putThing && this.thingElem)
88
+ this.thingElem.hide();
89
+ // You may notice that if the user creates a notice without our button,
90
+ // then updates it to enable our button, they will be out of luck.
91
+ // Whatever, I don't want to write that much code.
92
+
93
+ // Now we update the icon, which may have changed.
94
+ // Note that as of right now, PNotify doesn't support updating styling.
95
+ if (this.thingElem)
96
+ this.thingElem.find('i').attr("class", notice.styles.athing);
97
+ },
98
+ // I have nothing to put in these, just showing you that they exist. You
99
+ // won't need to include them if you aren't using them.
100
+ beforeOpen: function(notice, options){
101
+ // Called before the notice is opened.
102
+ },
103
+ afterOpen: function(notice, options){
104
+ // Called after the notice is opened.
105
+ },
106
+ beforeClose: function(notice, options){
107
+ // Called before the notice is closed.
108
+ },
109
+ afterClose: function(notice, options){
110
+ // Called after the notice is closed.
111
+ },
112
+ beforeDestroy: function(notice, options){
113
+ // Called before the notice is destroyed.
114
+ },
115
+ afterDestroy: function(notice, options){
116
+ // Called after the notice is destroyed.
117
+ }
118
+ };
119
+ // This is where you would add any styling options you are using in your code.
120
+ $.extend(PNotify.styling.jqueryui, {
121
+ athing: "ui-icon ui-icon-refresh"
122
+ });
123
+ $.extend(PNotify.styling.bootstrap2, {
124
+ athing: "icon-refresh"
125
+ });
126
+ $.extend(PNotify.styling.bootstrap3, {
127
+ athing: "glyphicon glyphicon-refresh"
128
+ });
129
+ $.extend(PNotify.styling.fontawesome, {
130
+ athing: "fa fa-refresh"
131
+ });
132
+ }));
@@ -0,0 +1,6 @@
1
+ /*
2
+ *= include pnotify/pnotify.core
3
+ *= include pnotify/pnotify.buttons
4
+ *= include pnotify/pnotify.history
5
+ *= include pnotify/pnotify.picon
6
+ */
@@ -0,0 +1,4 @@
1
+ .ui-pnotify-closer, .ui-pnotify-sticker {
2
+ float: right;
3
+ margin-left: .2em;
4
+ }
@@ -0,0 +1,56 @@
1
+ /*
2
+ Author : Hunter Perrin
3
+ Version : 2.0.1
4
+ Link : http://sciactive.com/pnotify/
5
+ */
6
+ /* -- Notice */
7
+ .ui-pnotify {
8
+ top: 25px;
9
+ right: 25px;
10
+ position: absolute;
11
+ height: auto;
12
+ /* Ensures notices are above everything */
13
+ z-index: 9999;
14
+ }
15
+ /* Hides position: fixed from IE6 */
16
+ html > body > .ui-pnotify {
17
+ position: fixed;
18
+ }
19
+ .ui-pnotify .ui-pnotify-shadow {
20
+ -webkit-box-shadow: 0px 2px 10px rgba(50, 50, 50, 0.5);
21
+ -moz-box-shadow: 0px 2px 10px rgba(50, 50, 50, 0.5);
22
+ box-shadow: 0px 2px 10px rgba(50, 50, 50, 0.5);
23
+ }
24
+ .ui-pnotify-container {
25
+ background-position: 0 0;
26
+ padding: .8em;
27
+ height: 100%;
28
+ margin: 0;
29
+ }
30
+ .ui-pnotify-sharp {
31
+ -webkit-border-radius: 0;
32
+ -moz-border-radius: 0;
33
+ border-radius: 0;
34
+ }
35
+ .ui-pnotify-title {
36
+ display: block;
37
+ margin-bottom: .4em;
38
+ margin-top: 0;
39
+ }
40
+ .ui-pnotify-text {
41
+ display: block;
42
+ }
43
+ .ui-pnotify-icon, .ui-pnotify-icon span {
44
+ display: block;
45
+ float: left;
46
+ margin-right: .2em;
47
+ }
48
+ /* Alternate stack initial positioning. */
49
+ .ui-pnotify.stack-topleft, .ui-pnotify.stack-bottomleft {
50
+ left: 25px;
51
+ right: auto;
52
+ }
53
+ .ui-pnotify.stack-bottomright, .ui-pnotify.stack-bottomleft {
54
+ bottom: 25px;
55
+ top: auto;
56
+ }
@@ -0,0 +1,33 @@
1
+ /* -- Pulldown */
2
+ .ui-pnotify-history-container {
3
+ position: absolute;
4
+ top: 0;
5
+ right: 18px;
6
+ width: 70px;
7
+ border-top: none;
8
+ padding: 0;
9
+ -webkit-border-top-left-radius: 0;
10
+ -moz-border-top-left-radius: 0;
11
+ border-top-left-radius: 0;
12
+ -webkit-border-top-right-radius: 0;
13
+ -moz-border-top-right-radius: 0;
14
+ border-top-right-radius: 0;
15
+ /* Ensures history container is above notices. */
16
+ z-index: 10000;
17
+ }
18
+ .ui-pnotify-history-container.ui-pnotify-history-fixed {
19
+ position: fixed;
20
+ }
21
+ .ui-pnotify-history-container .ui-pnotify-history-header {
22
+ padding: 2px;
23
+ text-align: center;
24
+ }
25
+ .ui-pnotify-history-container button {
26
+ cursor: pointer;
27
+ display: block;
28
+ width: 100%;
29
+ }
30
+ .ui-pnotify-history-container .ui-pnotify-history-pulldown {
31
+ display: block;
32
+ margin: 0 auto;
33
+ }
@@ -0,0 +1,11 @@
1
+ .ui-pnotify .picon {
2
+ background-color: transparent;
3
+ background-repeat: no-repeat;
4
+ background-position: center center;
5
+ width: 17px;
6
+ height: 17px;
7
+ }
8
+ .ui-pnotify-title {
9
+ line-height: 17px;
10
+ min-height: 17px;
11
+ }
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pnotify-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Navin Peiris
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-11 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2014-06-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '10.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '10.3'
13
27
  description: Pines Notify for Rails 3.1 Asset Pipeline
14
28
  email:
15
29
  - navin.peiris@gmail.com
@@ -17,20 +31,26 @@ executables: []
17
31
  extensions: []
18
32
  extra_rdoc_files: []
19
33
  files:
20
- - .gitignore
21
- - Gemfile
22
34
  - LICENSE.txt
23
35
  - README.md
24
- - Rakefile
25
36
  - lib/pnotify-rails.rb
26
37
  - lib/pnotify-rails/engine.rb
27
38
  - lib/pnotify-rails/railtie.rb
28
39
  - lib/pnotify-rails/version.rb
29
- - pnotify-rails.gemspec
30
40
  - vendor/assets/javascripts/pnotify/index.js
31
- - vendor/assets/javascripts/pnotify/jquery.pnotify.js
32
- - vendor/assets/stylesheets/jquery.pnotify.default.css
33
- - vendor/assets/stylesheets/jquery.pnotify.default.icons.css
41
+ - vendor/assets/javascripts/pnotify/pnotify.buttons.js
42
+ - vendor/assets/javascripts/pnotify/pnotify.callbacks.js
43
+ - vendor/assets/javascripts/pnotify/pnotify.confirm.js
44
+ - vendor/assets/javascripts/pnotify/pnotify.core.js
45
+ - vendor/assets/javascripts/pnotify/pnotify.desktop.js
46
+ - vendor/assets/javascripts/pnotify/pnotify.history.js
47
+ - vendor/assets/javascripts/pnotify/pnotify.nonblock.js
48
+ - vendor/assets/javascripts/pnotify/pnotify.reference.js
49
+ - vendor/assets/stylesheets/pnotify/index.css
50
+ - vendor/assets/stylesheets/pnotify/pnotify.buttons.css
51
+ - vendor/assets/stylesheets/pnotify/pnotify.core.css
52
+ - vendor/assets/stylesheets/pnotify/pnotify.history.css
53
+ - vendor/assets/stylesheets/pnotify/pnotify.picon.css
34
54
  homepage: https://github.com/navinpeiris/pnotify-rails
35
55
  licenses: []
36
56
  metadata: {}
@@ -40,17 +60,17 @@ require_paths:
40
60
  - lib
41
61
  required_ruby_version: !ruby/object:Gem::Requirement
42
62
  requirements:
43
- - - '>='
63
+ - - ">="
44
64
  - !ruby/object:Gem::Version
45
65
  version: '0'
46
66
  required_rubygems_version: !ruby/object:Gem::Requirement
47
67
  requirements:
48
- - - '>='
68
+ - - ">="
49
69
  - !ruby/object:Gem::Version
50
70
  version: '0'
51
71
  requirements: []
52
72
  rubyforge_project:
53
- rubygems_version: 2.0.5
73
+ rubygems_version: 2.2.2
54
74
  signing_key:
55
75
  specification_version: 4
56
76
  summary: Pines Notify is a JavaScript notification plugin developed by Hunter Perrin
data/.gitignore DELETED
@@ -1,19 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- .ruby-version
19
- .idea
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in pnotify-rails.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env rake
2
- require 'bundler'
3
- Bundler::GemHelper.install_tasks
4
-
5
- desc "Bundle the gem"
6
- task :bundle do
7
- sh('bundle install')
8
- sh 'gem build *.gemspec'
9
- sh 'gem install *.gem'
10
- sh 'rm *.gem'
11
- end
12
-
13
- task(:default).clear
14
- task :default => :bundle
@@ -1,19 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'pnotify-rails/version'
5
-
6
- Gem::Specification.new do |gem|
7
- gem.name = 'pnotify-rails'
8
- gem.version = PNotify::Rails::VERSION
9
- gem.authors = ['Navin Peiris']
10
- gem.email = ['navin.peiris@gmail.com']
11
- gem.description = %q{Pines Notify for Rails 3.1 Asset Pipeline}
12
- gem.summary = %q{Pines Notify is a JavaScript notification plugin developed by Hunter Perrin integrated for Rails 3.1 Asset Pipeline}
13
- gem.homepage = 'https://github.com/navinpeiris/pnotify-rails'
14
-
15
- gem.files = `git ls-files`.split($/)
16
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
- gem.require_paths = ['lib']
19
- end
@@ -1,937 +0,0 @@
1
- /*
2
- * jQuery Pines Notify (pnotify) Plugin 1.2.2
3
- *
4
- * http://pinesframework.org/pnotify/
5
- * Copyright (c) 2009-2012 Hunter Perrin
6
- *
7
- * Triple license under the GPL, LGPL, and MPL:
8
- * http://www.gnu.org/licenses/gpl.html
9
- * http://www.gnu.org/licenses/lgpl.html
10
- * http://www.mozilla.org/MPL/MPL-1.1.html
11
- */
12
-
13
- (function($) {
14
- var history_handle_top,
15
- timer,
16
- body,
17
- jwindow = $(window),
18
- styling = {
19
- jqueryui: {
20
- container: "ui-widget ui-widget-content ui-corner-all",
21
- notice: "ui-state-highlight",
22
- // (The actual jQUI notice icon looks terrible.)
23
- notice_icon: "ui-icon ui-icon-info",
24
- info: "",
25
- info_icon: "ui-icon ui-icon-info",
26
- success: "ui-state-default",
27
- success_icon: "ui-icon ui-icon-circle-check",
28
- error: "ui-state-error",
29
- error_icon: "ui-icon ui-icon-alert",
30
- closer: "ui-icon ui-icon-close",
31
- pin_up: "ui-icon ui-icon-pin-w",
32
- pin_down: "ui-icon ui-icon-pin-s",
33
- hi_menu: "ui-state-default ui-corner-bottom",
34
- hi_btn: "ui-state-default ui-corner-all",
35
- hi_btnhov: "ui-state-hover",
36
- hi_hnd: "ui-icon ui-icon-grip-dotted-horizontal"
37
- },
38
- bootstrap: {
39
- container: "alert",
40
- notice: "",
41
- notice_icon: "icon-exclamation-sign",
42
- info: "alert-info",
43
- info_icon: "icon-info-sign",
44
- success: "alert-success",
45
- success_icon: "icon-ok-sign",
46
- error: "alert-error",
47
- error_icon: "icon-warning-sign",
48
- closer: "icon-remove",
49
- pin_up: "icon-pause",
50
- pin_down: "icon-play",
51
- hi_menu: "well",
52
- hi_btn: "btn",
53
- hi_btnhov: "",
54
- hi_hnd: "icon-chevron-down"
55
- }
56
- };
57
- // Set global variables.
58
- var do_when_ready = function(){
59
- body = $("body");
60
- jwindow = $(window);
61
- // Reposition the notices when the window resizes.
62
- jwindow.bind('resize', function(){
63
- if (timer)
64
- clearTimeout(timer);
65
- timer = setTimeout($.pnotify_position_all, 10);
66
- });
67
- };
68
- if (document.body)
69
- do_when_ready();
70
- else
71
- $(do_when_ready);
72
- $.extend({
73
- pnotify_remove_all: function () {
74
- var notices_data = jwindow.data("pnotify");
75
- /* POA: Added null-check */
76
- if (notices_data && notices_data.length) {
77
- $.each(notices_data, function(){
78
- if (this.pnotify_remove)
79
- this.pnotify_remove();
80
- });
81
- }
82
- },
83
- pnotify_position_all: function () {
84
- // This timer is used for queueing this function so it doesn't run
85
- // repeatedly.
86
- if (timer)
87
- clearTimeout(timer);
88
- timer = null;
89
- // Get all the notices.
90
- var notices_data = jwindow.data("pnotify");
91
- if (!notices_data || !notices_data.length)
92
- return;
93
- // Reset the next position data.
94
- $.each(notices_data, function(){
95
- var s = this.opts.stack;
96
- if (!s) return;
97
- s.nextpos1 = s.firstpos1;
98
- s.nextpos2 = s.firstpos2;
99
- s.addpos2 = 0;
100
- s.animation = true;
101
- });
102
- $.each(notices_data, function(){
103
- this.pnotify_position();
104
- });
105
- },
106
- pnotify: function(options) {
107
- // Stores what is currently being animated (in or out).
108
- var animating;
109
-
110
- // Build main options.
111
- var opts;
112
- if (typeof options != "object") {
113
- opts = $.extend({}, $.pnotify.defaults);
114
- opts.text = options;
115
- } else {
116
- opts = $.extend({}, $.pnotify.defaults, options);
117
- }
118
- // Translate old pnotify_ style options.
119
- for (var i in opts) {
120
- if (typeof i == "string" && i.match(/^pnotify_/))
121
- opts[i.replace(/^pnotify_/, "")] = opts[i];
122
- }
123
-
124
- if (opts.before_init) {
125
- if (opts.before_init(opts) === false)
126
- return null;
127
- }
128
-
129
- // This keeps track of the last element the mouse was over, so
130
- // mouseleave, mouseenter, etc can be called.
131
- var nonblock_last_elem;
132
- // This is used to pass events through the notice if it is non-blocking.
133
- var nonblock_pass = function(e, e_name){
134
- pnotify.css("display", "none");
135
- var element_below = document.elementFromPoint(e.clientX, e.clientY);
136
- pnotify.css("display", "block");
137
- var jelement_below = $(element_below);
138
- var cursor_style = jelement_below.css("cursor");
139
- pnotify.css("cursor", cursor_style != "auto" ? cursor_style : "default");
140
- // If the element changed, call mouseenter, mouseleave, etc.
141
- if (!nonblock_last_elem || nonblock_last_elem.get(0) != element_below) {
142
- if (nonblock_last_elem) {
143
- dom_event.call(nonblock_last_elem.get(0), "mouseleave", e.originalEvent);
144
- dom_event.call(nonblock_last_elem.get(0), "mouseout", e.originalEvent);
145
- }
146
- dom_event.call(element_below, "mouseenter", e.originalEvent);
147
- dom_event.call(element_below, "mouseover", e.originalEvent);
148
- }
149
- dom_event.call(element_below, e_name, e.originalEvent);
150
- // Remember the latest element the mouse was over.
151
- nonblock_last_elem = jelement_below;
152
- };
153
-
154
- // Get our styling object.
155
- var styles = styling[opts.styling];
156
-
157
- // Create our widget.
158
- // Stop animation, reset the removal timer, and show the close
159
- // button when the user mouses over.
160
- var pnotify = $("<div />", {
161
- "class": "ui-pnotify "+opts.addclass,
162
- "css": {"display": "none"},
163
- "mouseenter": function(e){
164
- if (opts.nonblock) e.stopPropagation();
165
- if (opts.mouse_reset && animating == "out") {
166
- // If it's animating out, animate back in really quickly.
167
- pnotify.stop(true);
168
- animating = "in";
169
- pnotify.css("height", "auto").animate({"width": opts.width, "opacity": opts.nonblock ? opts.nonblock_opacity : opts.opacity}, "fast");
170
- }
171
- if (opts.nonblock) {
172
- // If it's non-blocking, animate to the other opacity.
173
- pnotify.stop().animate({"opacity": opts.nonblock_opacity}, "fast");
174
- }
175
- // Stop the close timer.
176
- if (opts.hide && opts.mouse_reset) pnotify.pnotify_cancel_remove();
177
- // Show the buttons.
178
- if (opts.sticker && !opts.nonblock) pnotify.sticker.trigger("pnotify_icon").css("visibility", "visible");
179
- if (opts.closer && !opts.nonblock) pnotify.closer.css("visibility", "visible");
180
- },
181
- "mouseleave": function(e){
182
- if (opts.nonblock) e.stopPropagation();
183
- nonblock_last_elem = null;
184
- pnotify.css("cursor", "auto");
185
- // Animate back to the normal opacity.
186
- if (opts.nonblock && animating != "out")
187
- pnotify.stop().animate({"opacity": opts.opacity}, "fast");
188
- // Start the close timer.
189
- if (opts.hide && opts.mouse_reset) pnotify.pnotify_queue_remove();
190
- // Hide the buttons.
191
- if (opts.sticker_hover)
192
- pnotify.sticker.css("visibility", "hidden");
193
- if (opts.closer_hover)
194
- pnotify.closer.css("visibility", "hidden");
195
- $.pnotify_position_all();
196
- },
197
- "mouseover": function(e){
198
- if (opts.nonblock) e.stopPropagation();
199
- },
200
- "mouseout": function(e){
201
- if (opts.nonblock) e.stopPropagation();
202
- },
203
- "mousemove": function(e){
204
- if (opts.nonblock) {
205
- e.stopPropagation();
206
- nonblock_pass(e, "onmousemove");
207
- }
208
- },
209
- "mousedown": function(e){
210
- if (opts.nonblock) {
211
- e.stopPropagation();
212
- e.preventDefault();
213
- nonblock_pass(e, "onmousedown");
214
- }
215
- },
216
- "mouseup": function(e){
217
- if (opts.nonblock) {
218
- e.stopPropagation();
219
- e.preventDefault();
220
- nonblock_pass(e, "onmouseup");
221
- }
222
- },
223
- "click": function(e){
224
- if (opts.nonblock) {
225
- e.stopPropagation();
226
- nonblock_pass(e, "onclick");
227
- }
228
- },
229
- "dblclick": function(e){
230
- if (opts.nonblock) {
231
- e.stopPropagation();
232
- nonblock_pass(e, "ondblclick");
233
- }
234
- }
235
- });
236
- pnotify.opts = opts;
237
- // Create a container for the notice contents.
238
- pnotify.container = $("<div />", {"class": styles.container+" ui-pnotify-container "+(opts.type == "error" ? styles.error : (opts.type == "info" ? styles.info : (opts.type == "success" ? styles.success : styles.notice)))})
239
- .appendTo(pnotify);
240
- if (opts.cornerclass != "")
241
- pnotify.container.removeClass("ui-corner-all").addClass(opts.cornerclass);
242
- // Create a drop shadow.
243
- if (opts.shadow)
244
- pnotify.container.addClass("ui-pnotify-shadow");
245
-
246
- // The current version of Pines Notify.
247
- pnotify.pnotify_version = "1.2.2";
248
-
249
- // This function is for updating the notice.
250
- pnotify.pnotify = function(options) {
251
- // Update the notice.
252
- var old_opts = opts;
253
- if (typeof options == "string")
254
- opts.text = options;
255
- else
256
- opts = $.extend({}, opts, options);
257
- // Translate old pnotify_ style options.
258
- for (var i in opts) {
259
- if (typeof i == "string" && i.match(/^pnotify_/))
260
- opts[i.replace(/^pnotify_/, "")] = opts[i];
261
- }
262
- pnotify.opts = opts;
263
- // Update the corner class.
264
- if (opts.cornerclass != old_opts.cornerclass)
265
- pnotify.container.removeClass("ui-corner-all").addClass(opts.cornerclass);
266
- // Update the shadow.
267
- if (opts.shadow != old_opts.shadow) {
268
- if (opts.shadow)
269
- pnotify.container.addClass("ui-pnotify-shadow");
270
- else
271
- pnotify.container.removeClass("ui-pnotify-shadow");
272
- }
273
- // Update the additional classes.
274
- if (opts.addclass === false)
275
- pnotify.removeClass(old_opts.addclass);
276
- else if (opts.addclass !== old_opts.addclass)
277
- pnotify.removeClass(old_opts.addclass).addClass(opts.addclass);
278
- // Update the title.
279
- if (opts.title === false)
280
- pnotify.title_container.slideUp("fast");
281
- else if (opts.title !== old_opts.title) {
282
- if (opts.title_escape)
283
- pnotify.title_container.text(opts.title).slideDown(200);
284
- else
285
- pnotify.title_container.html(opts.title).slideDown(200);
286
- }
287
- // Update the text.
288
- if (opts.text === false) {
289
- pnotify.text_container.slideUp("fast");
290
- } else if (opts.text !== old_opts.text) {
291
- if (opts.text_escape)
292
- pnotify.text_container.text(opts.text).slideDown(200);
293
- else
294
- pnotify.text_container.html(opts.insert_brs ? String(opts.text).replace(/\n/g, "<br />") : opts.text).slideDown(200);
295
- }
296
- // Update values for history menu access.
297
- pnotify.pnotify_history = opts.history;
298
- pnotify.pnotify_hide = opts.hide;
299
- // Change the notice type.
300
- if (opts.type != old_opts.type)
301
- pnotify.container.removeClass(styles.error+" "+styles.notice+" "+styles.success+" "+styles.info).addClass(opts.type == "error" ? styles.error : (opts.type == "info" ? styles.info : (opts.type == "success" ? styles.success : styles.notice)));
302
- if (opts.icon !== old_opts.icon || (opts.icon === true && opts.type != old_opts.type)) {
303
- // Remove any old icon.
304
- pnotify.container.find("div.ui-pnotify-icon").remove();
305
- if (opts.icon !== false) {
306
- // Build the new icon.
307
- $("<div />", {"class": "ui-pnotify-icon"})
308
- .append($("<span />", {"class": opts.icon === true ? (opts.type == "error" ? styles.error_icon : (opts.type == "info" ? styles.info_icon : (opts.type == "success" ? styles.success_icon : styles.notice_icon))) : opts.icon}))
309
- .prependTo(pnotify.container);
310
- }
311
- }
312
- // Update the width.
313
- if (opts.width !== old_opts.width)
314
- pnotify.animate({width: opts.width});
315
- // Update the minimum height.
316
- if (opts.min_height !== old_opts.min_height)
317
- pnotify.container.animate({minHeight: opts.min_height});
318
- // Update the opacity.
319
- if (opts.opacity !== old_opts.opacity)
320
- pnotify.fadeTo(opts.animate_speed, opts.opacity);
321
- // Update the sticker and closer buttons.
322
- if (!opts.closer || opts.nonblock)
323
- pnotify.closer.css("display", "none");
324
- else
325
- pnotify.closer.css("display", "block");
326
- if (!opts.sticker || opts.nonblock)
327
- pnotify.sticker.css("display", "none");
328
- else
329
- pnotify.sticker.css("display", "block");
330
- // Update the sticker icon.
331
- pnotify.sticker.trigger("pnotify_icon");
332
- // Update the hover status of the buttons.
333
- if (opts.sticker_hover)
334
- pnotify.sticker.css("visibility", "hidden");
335
- else if (!opts.nonblock)
336
- pnotify.sticker.css("visibility", "visible");
337
- if (opts.closer_hover)
338
- pnotify.closer.css("visibility", "hidden");
339
- else if (!opts.nonblock)
340
- pnotify.closer.css("visibility", "visible");
341
- // Update the timed hiding.
342
- if (!opts.hide)
343
- pnotify.pnotify_cancel_remove();
344
- else if (!old_opts.hide)
345
- pnotify.pnotify_queue_remove();
346
- pnotify.pnotify_queue_position();
347
- return pnotify;
348
- };
349
-
350
- // Position the notice. dont_skip_hidden causes the notice to
351
- // position even if it's not visible.
352
- pnotify.pnotify_position = function(dont_skip_hidden){
353
- // Get the notice's stack.
354
- var s = pnotify.opts.stack;
355
- if (!s) return;
356
- if (!s.nextpos1)
357
- s.nextpos1 = s.firstpos1;
358
- if (!s.nextpos2)
359
- s.nextpos2 = s.firstpos2;
360
- if (!s.addpos2)
361
- s.addpos2 = 0;
362
- var hidden = pnotify.css("display") == "none";
363
- // Skip this notice if it's not shown.
364
- if (!hidden || dont_skip_hidden) {
365
- var curpos1, curpos2;
366
- // Store what will need to be animated.
367
- var animate = {};
368
- // Calculate the current pos1 value.
369
- var csspos1;
370
- switch (s.dir1) {
371
- case "down":
372
- csspos1 = "top";
373
- break;
374
- case "up":
375
- csspos1 = "bottom";
376
- break;
377
- case "left":
378
- csspos1 = "right";
379
- break;
380
- case "right":
381
- csspos1 = "left";
382
- break;
383
- }
384
- curpos1 = parseInt(pnotify.css(csspos1));
385
- if (isNaN(curpos1))
386
- curpos1 = 0;
387
- // Remember the first pos1, so the first visible notice goes there.
388
- if (typeof s.firstpos1 == "undefined" && !hidden) {
389
- s.firstpos1 = curpos1;
390
- s.nextpos1 = s.firstpos1;
391
- }
392
- // Calculate the current pos2 value.
393
- var csspos2;
394
- switch (s.dir2) {
395
- case "down":
396
- csspos2 = "top";
397
- break;
398
- case "up":
399
- csspos2 = "bottom";
400
- break;
401
- case "left":
402
- csspos2 = "right";
403
- break;
404
- case "right":
405
- csspos2 = "left";
406
- break;
407
- }
408
- curpos2 = parseInt(pnotify.css(csspos2));
409
- if (isNaN(curpos2))
410
- curpos2 = 0;
411
- // Remember the first pos2, so the first visible notice goes there.
412
- if (typeof s.firstpos2 == "undefined" && !hidden) {
413
- s.firstpos2 = curpos2;
414
- s.nextpos2 = s.firstpos2;
415
- }
416
- // Check that it's not beyond the viewport edge.
417
- if ((s.dir1 == "down" && s.nextpos1 + pnotify.height() > jwindow.height()) ||
418
- (s.dir1 == "up" && s.nextpos1 + pnotify.height() > jwindow.height()) ||
419
- (s.dir1 == "left" && s.nextpos1 + pnotify.width() > jwindow.width()) ||
420
- (s.dir1 == "right" && s.nextpos1 + pnotify.width() > jwindow.width()) ) {
421
- // If it is, it needs to go back to the first pos1, and over on pos2.
422
- s.nextpos1 = s.firstpos1;
423
- s.nextpos2 += s.addpos2 + (typeof s.spacing2 == "undefined" ? 25 : s.spacing2);
424
- s.addpos2 = 0;
425
- }
426
- // Animate if we're moving on dir2.
427
- if (s.animation && s.nextpos2 < curpos2) {
428
- switch (s.dir2) {
429
- case "down":
430
- animate.top = s.nextpos2+"px";
431
- break;
432
- case "up":
433
- animate.bottom = s.nextpos2+"px";
434
- break;
435
- case "left":
436
- animate.right = s.nextpos2+"px";
437
- break;
438
- case "right":
439
- animate.left = s.nextpos2+"px";
440
- break;
441
- }
442
- } else {
443
- if(s.nextpos2)
444
- pnotify.css(csspos2, s.nextpos2+"px");
445
- }
446
- // Keep track of the widest/tallest notice in the column/row, so we can push the next column/row.
447
- switch (s.dir2) {
448
- case "down":
449
- case "up":
450
- if (pnotify.outerHeight(true) > s.addpos2)
451
- s.addpos2 = pnotify.height();
452
- break;
453
- case "left":
454
- case "right":
455
- if (pnotify.outerWidth(true) > s.addpos2)
456
- s.addpos2 = pnotify.width();
457
- break;
458
- }
459
- // Move the notice on dir1.
460
- if (s.nextpos1) {
461
- // Animate if we're moving toward the first pos.
462
- if (s.animation && (curpos1 > s.nextpos1 || animate.top || animate.bottom || animate.right || animate.left)) {
463
- switch (s.dir1) {
464
- case "down":
465
- animate.top = s.nextpos1+"px";
466
- break;
467
- case "up":
468
- animate.bottom = s.nextpos1+"px";
469
- break;
470
- case "left":
471
- animate.right = s.nextpos1+"px";
472
- break;
473
- case "right":
474
- animate.left = s.nextpos1+"px";
475
- break;
476
- }
477
- } else
478
- pnotify.css(csspos1, s.nextpos1+"px");
479
- }
480
- // Run the animation.
481
- if (animate.top || animate.bottom || animate.right || animate.left)
482
- pnotify.animate(animate, {duration: this.opts.position_animate_speed, queue: false});
483
- // Calculate the next dir1 position.
484
- switch (s.dir1) {
485
- case "down":
486
- case "up":
487
- s.nextpos1 += pnotify.height() + (typeof s.spacing1 == "undefined" ? 25 : s.spacing1);
488
- break;
489
- case "left":
490
- case "right":
491
- s.nextpos1 += pnotify.width() + (typeof s.spacing1 == "undefined" ? 25 : s.spacing1);
492
- break;
493
- }
494
- }
495
- };
496
-
497
- // Queue the positiona all function so it doesn't run repeatedly and
498
- // use up resources.
499
- pnotify.pnotify_queue_position = function(milliseconds){
500
- if (timer)
501
- clearTimeout(timer);
502
- if (!milliseconds)
503
- milliseconds = 10;
504
- timer = setTimeout($.pnotify_position_all, milliseconds);
505
- };
506
-
507
- // Display the notice.
508
- pnotify.pnotify_display = function() {
509
- // Remove oldest notifications leaving only opts.maxonscreen on screen
510
- notices_data = jwindow.data("pnotify");
511
- if (notices_data && (notices_data.length > opts.maxonscreen)) {
512
- $.each(notices_data.slice(0, notices_data.length - opts.maxonscreen), function(){
513
- if (this.pnotify_remove)
514
- this.pnotify_remove();
515
- });
516
- };
517
- // If the notice is not in the DOM, append it.
518
- if (!pnotify.parent().length)
519
- pnotify.appendTo(body);
520
- // Run callback.
521
- if (opts.before_open) {
522
- if (opts.before_open(pnotify) === false)
523
- return;
524
- }
525
- // Try to put it in the right position.
526
- if (opts.stack.push != "top")
527
- pnotify.pnotify_position(true);
528
- // First show it, then set its opacity, then hide it.
529
- if (opts.animation == "fade" || opts.animation.effect_in == "fade") {
530
- // If it's fading in, it should start at 0.
531
- pnotify.show().fadeTo(0, 0).hide();
532
- } else {
533
- // Or else it should be set to the opacity.
534
- if (opts.opacity != 1)
535
- pnotify.show().fadeTo(0, opts.opacity).hide();
536
- }
537
- pnotify.animate_in(function(){
538
- if (opts.after_open)
539
- opts.after_open(pnotify);
540
-
541
- pnotify.pnotify_queue_position();
542
-
543
- // Now set it to hide.
544
- if (opts.hide)
545
- pnotify.pnotify_queue_remove();
546
- });
547
- };
548
-
549
- // Remove the notice.
550
- pnotify.pnotify_remove = function() {
551
- if (pnotify.timer) {
552
- window.clearTimeout(pnotify.timer);
553
- pnotify.timer = null;
554
- }
555
- // Run callback.
556
- if (opts.before_close) {
557
- if (opts.before_close(pnotify) === false)
558
- return;
559
- }
560
- pnotify.animate_out(function(){
561
- if (opts.after_close) {
562
- if (opts.after_close(pnotify) === false)
563
- return;
564
- }
565
- pnotify.pnotify_queue_position();
566
- // If we're supposed to remove the notice from the DOM, do it.
567
- if (opts.remove)
568
- pnotify.detach();
569
- });
570
- };
571
-
572
- // Animate the notice in.
573
- pnotify.animate_in = function(callback){
574
- // Declare that the notice is animating in. (Or has completed animating in.)
575
- animating = "in";
576
- var animation;
577
- if (typeof opts.animation.effect_in != "undefined")
578
- animation = opts.animation.effect_in;
579
- else
580
- animation = opts.animation;
581
- if (animation == "none") {
582
- pnotify.show();
583
- callback();
584
- } else if (animation == "show")
585
- pnotify.show(opts.animate_speed, callback);
586
- else if (animation == "fade")
587
- pnotify.show().fadeTo(opts.animate_speed, opts.opacity, callback);
588
- else if (animation == "slide")
589
- pnotify.slideDown(opts.animate_speed, callback);
590
- else if (typeof animation == "function")
591
- animation("in", callback, pnotify);
592
- else
593
- pnotify.show(animation, (typeof opts.animation.options_in == "object" ? opts.animation.options_in : {}), opts.animate_speed, callback);
594
- };
595
-
596
- // Animate the notice out.
597
- pnotify.animate_out = function(callback){
598
- // Declare that the notice is animating out. (Or has completed animating out.)
599
- animating = "out";
600
- var animation;
601
- if (typeof opts.animation.effect_out != "undefined")
602
- animation = opts.animation.effect_out;
603
- else
604
- animation = opts.animation;
605
- if (animation == "none") {
606
- pnotify.hide();
607
- callback();
608
- } else if (animation == "show")
609
- pnotify.hide(opts.animate_speed, callback);
610
- else if (animation == "fade")
611
- pnotify.fadeOut(opts.animate_speed, callback);
612
- else if (animation == "slide")
613
- pnotify.slideUp(opts.animate_speed, callback);
614
- else if (typeof animation == "function")
615
- animation("out", callback, pnotify);
616
- else
617
- pnotify.hide(animation, (typeof opts.animation.options_out == "object" ? opts.animation.options_out : {}), opts.animate_speed, callback);
618
- };
619
-
620
- // Cancel any pending removal timer.
621
- pnotify.pnotify_cancel_remove = function() {
622
- if (pnotify.timer)
623
- window.clearTimeout(pnotify.timer);
624
- };
625
-
626
- // Queue a removal timer.
627
- pnotify.pnotify_queue_remove = function() {
628
- // Cancel any current removal timer.
629
- pnotify.pnotify_cancel_remove();
630
- pnotify.timer = window.setTimeout(function(){
631
- pnotify.pnotify_remove();
632
- }, (isNaN(opts.delay) ? 0 : opts.delay));
633
- };
634
-
635
- // Provide a button to close the notice.
636
- pnotify.closer = $("<div />", {
637
- "class": "ui-pnotify-closer",
638
- "css": {"cursor": "pointer", "visibility": opts.closer_hover ? "hidden" : "visible"},
639
- "click": function(){
640
- pnotify.pnotify_remove();
641
- pnotify.sticker.css("visibility", "hidden");
642
- pnotify.closer.css("visibility", "hidden");
643
- }
644
- })
645
- .append($("<span />", {"class": styles.closer, "title": opts.labels.close}))
646
- .appendTo(pnotify.container);
647
- if (!opts.closer || opts.nonblock)
648
- pnotify.closer.css("display", "none");
649
-
650
- // Provide a button to stick the notice.
651
- pnotify.sticker = $("<div />", {
652
- "class": "ui-pnotify-sticker",
653
- "css": {"cursor": "pointer", "visibility": opts.sticker_hover ? "hidden" : "visible"},
654
- "click": function(){
655
- opts.hide = !opts.hide;
656
- if (opts.hide)
657
- pnotify.pnotify_queue_remove();
658
- else
659
- pnotify.pnotify_cancel_remove();
660
- $(this).trigger("pnotify_icon");
661
- }
662
- })
663
- .bind("pnotify_icon", function(){
664
- $(this).children().removeClass(styles.pin_up+" "+styles.pin_down).addClass(opts.hide ? styles.pin_up : styles.pin_down);
665
- })
666
- .append($("<span />", {"class": styles.pin_up, "title": opts.labels.stick}))
667
- .appendTo(pnotify.container);
668
- if (!opts.sticker || opts.nonblock)
669
- pnotify.sticker.css("display", "none");
670
-
671
- // Add the appropriate icon.
672
- if (opts.icon !== false) {
673
- $("<div />", {"class": "ui-pnotify-icon"})
674
- .append($("<span />", {"class": opts.icon === true ? (opts.type == "error" ? styles.error_icon : (opts.type == "info" ? styles.info_icon : (opts.type == "success" ? styles.success_icon : styles.notice_icon))) : opts.icon}))
675
- .prependTo(pnotify.container);
676
- }
677
-
678
- // Add a title.
679
- pnotify.title_container = $("<h4 />", {
680
- "class": "ui-pnotify-title"
681
- })
682
- .appendTo(pnotify.container);
683
- if (opts.title === false)
684
- pnotify.title_container.hide();
685
- else if (opts.title_escape)
686
- pnotify.title_container.text(opts.title);
687
- else
688
- pnotify.title_container.html(opts.title);
689
-
690
- // Add text.
691
- pnotify.text_container = $("<div />", {
692
- "class": "ui-pnotify-text"
693
- })
694
- .appendTo(pnotify.container);
695
- if (opts.text === false)
696
- pnotify.text_container.hide();
697
- else if (opts.text_escape)
698
- pnotify.text_container.text(opts.text);
699
- else
700
- pnotify.text_container.html(opts.insert_brs ? String(opts.text).replace(/\n/g, "<br />") : opts.text);
701
-
702
- // Set width and min height.
703
- if (typeof opts.width == "string")
704
- pnotify.css("width", opts.width);
705
- if (typeof opts.min_height == "string")
706
- pnotify.container.css("min-height", opts.min_height);
707
-
708
- // The history variable controls whether the notice gets redisplayed
709
- // by the history pull down.
710
- pnotify.pnotify_history = opts.history;
711
- // The hide variable controls whether the history pull down should
712
- // queue a removal timer.
713
- pnotify.pnotify_hide = opts.hide;
714
-
715
- // Add the notice to the notice array.
716
- var notices_data = jwindow.data("pnotify");
717
- if (notices_data == null || typeof notices_data != "object")
718
- notices_data = [];
719
- if (opts.stack.push == "top")
720
- notices_data = $.merge([pnotify], notices_data);
721
- else
722
- notices_data = $.merge(notices_data, [pnotify]);
723
- jwindow.data("pnotify", notices_data);
724
- // Now position all the notices if they are to push to the top.
725
- if (opts.stack.push == "top")
726
- pnotify.pnotify_queue_position(1);
727
-
728
- // Run callback.
729
- if (opts.after_init)
730
- opts.after_init(pnotify);
731
-
732
- if (opts.history) {
733
- // If there isn't a history pull down, create one.
734
- var history_menu = jwindow.data("pnotify_history");
735
- if (typeof history_menu == "undefined") {
736
- history_menu = $("<div />", {
737
- "class": "ui-pnotify-history-container "+styles.hi_menu,
738
- "mouseleave": function(){
739
- history_menu.animate({top: "-"+history_handle_top+"px"}, {duration: 100, queue: false});
740
- }
741
- })
742
- .append($("<div />", {"class": "ui-pnotify-history-header", "text": opts.labels.redisplay}))
743
- .append($("<button />", {
744
- "class": "ui-pnotify-history-all "+styles.hi_btn,
745
- "text": opts.labels.all,
746
- "mouseenter": function(){
747
- $(this).addClass(styles.hi_btnhov);
748
- },
749
- "mouseleave": function(){
750
- $(this).removeClass(styles.hi_btnhov);
751
- },
752
- "click": function(){
753
- // Display all notices. (Disregarding non-history notices.)
754
- $.each(notices_data, function(){
755
- if (this.pnotify_history) {
756
- if (this.is(":visible")) {
757
- if (this.pnotify_hide)
758
- this.pnotify_queue_remove();
759
- } else if (this.pnotify_display)
760
- this.pnotify_display();
761
- }
762
- });
763
- return false;
764
- }
765
- }))
766
- .append($("<button />", {
767
- "class": "ui-pnotify-history-last "+styles.hi_btn,
768
- "text": opts.labels.last,
769
- "mouseenter": function(){
770
- $(this).addClass(styles.hi_btnhov);
771
- },
772
- "mouseleave": function(){
773
- $(this).removeClass(styles.hi_btnhov);
774
- },
775
- "click": function(){
776
- // Look up the last history notice, and display it.
777
- var i = -1;
778
- var notice;
779
- do {
780
- if (i == -1)
781
- notice = notices_data.slice(i);
782
- else
783
- notice = notices_data.slice(i, i+1);
784
- if (!notice[0])
785
- break;
786
- i--;
787
- } while (!notice[0].pnotify_history || notice[0].is(":visible"));
788
- if (!notice[0])
789
- return false;
790
- if (notice[0].pnotify_display)
791
- notice[0].pnotify_display();
792
- return false;
793
- }
794
- }))
795
- .appendTo(body);
796
-
797
- // Make a handle so the user can pull down the history tab.
798
- var handle = $("<span />", {
799
- "class": "ui-pnotify-history-pulldown "+styles.hi_hnd,
800
- "mouseenter": function(){
801
- history_menu.animate({top: "0"}, {duration: 100, queue: false});
802
- }
803
- })
804
- .appendTo(history_menu);
805
-
806
- // Get the top of the handle.
807
- history_handle_top = handle.offset().top + 2;
808
- // Hide the history pull down up to the top of the handle.
809
- history_menu.css({top: "-"+history_handle_top+"px"});
810
- // Save the history pull down.
811
- jwindow.data("pnotify_history", history_menu);
812
- }
813
- }
814
-
815
- // Mark the stack so it won't animate the new notice.
816
- opts.stack.animation = false;
817
-
818
- // Display the notice.
819
- if (opts.auto_display)
820
- pnotify.pnotify_display();
821
-
822
- return pnotify;
823
- }
824
- });
825
-
826
- // Some useful regexes.
827
- var re_on = /^on/,
828
- re_mouse_events = /^(dbl)?click$|^mouse(move|down|up|over|out|enter|leave)$|^contextmenu$/,
829
- re_ui_events = /^(focus|blur|select|change|reset)$|^key(press|down|up)$/,
830
- re_html_events = /^(scroll|resize|(un)?load|abort|error)$/;
831
- // Fire a DOM event.
832
- var dom_event = function(e, orig_e){
833
- var event_object;
834
- e = e.toLowerCase();
835
- if (document.createEvent && this.dispatchEvent) {
836
- // FireFox, Opera, Safari, Chrome
837
- e = e.replace(re_on, '');
838
- if (e.match(re_mouse_events)) {
839
- // This allows the click event to fire on the notice. There is
840
- // probably a much better way to do it.
841
- $(this).offset();
842
- event_object = document.createEvent("MouseEvents");
843
- event_object.initMouseEvent(
844
- e, orig_e.bubbles, orig_e.cancelable, orig_e.view, orig_e.detail,
845
- orig_e.screenX, orig_e.screenY, orig_e.clientX, orig_e.clientY,
846
- orig_e.ctrlKey, orig_e.altKey, orig_e.shiftKey, orig_e.metaKey, orig_e.button, orig_e.relatedTarget
847
- );
848
- } else if (e.match(re_ui_events)) {
849
- event_object = document.createEvent("UIEvents");
850
- event_object.initUIEvent(e, orig_e.bubbles, orig_e.cancelable, orig_e.view, orig_e.detail);
851
- } else if (e.match(re_html_events)) {
852
- event_object = document.createEvent("HTMLEvents");
853
- event_object.initEvent(e, orig_e.bubbles, orig_e.cancelable);
854
- }
855
- if (!event_object) return;
856
- this.dispatchEvent(event_object);
857
- } else {
858
- // Internet Explorer
859
- if (!e.match(re_on)) e = "on"+e;
860
- event_object = document.createEventObject(orig_e);
861
- this.fireEvent(e, event_object);
862
- }
863
- };
864
-
865
- $.pnotify.defaults = {
866
- // The notice's title.
867
- title: false,
868
- // Whether to escape the content of the title. (Not allow HTML.)
869
- title_escape: false,
870
- // The notice's text.
871
- text: false,
872
- // Whether to escape the content of the text. (Not allow HTML.)
873
- text_escape: false,
874
- // What styling classes to use. (Can be either jqueryui or bootstrap.)
875
- styling: "bootstrap",
876
- // Additional classes to be added to the notice. (For custom styling.)
877
- addclass: "",
878
- // Class to be added to the notice for corner styling.
879
- cornerclass: "",
880
- // Create a non-blocking notice. It lets the user click elements underneath it.
881
- nonblock: false,
882
- // The opacity of the notice (if it's non-blocking) when the mouse is over it.
883
- nonblock_opacity: .2,
884
- // Display a pull down menu to redisplay previous notices, and place the notice in the history.
885
- history: true,
886
- // Maximum number of notifications to have onscreen
887
- maxonscreen: Infinity,
888
- // Display the notice when it is created. Turn this off to add notifications to the history without displaying them.
889
- auto_display: true,
890
- // Width of the notice.
891
- width: "300px",
892
- // Minimum height of the notice. It will expand to fit content.
893
- min_height: "16px",
894
- // Type of the notice. "notice", "info", "success", or "error".
895
- type: "notice",
896
- // Set icon to true to use the default icon for the selected style/type, false for no icon, or a string for your own icon class.
897
- icon: true,
898
- // The animation to use when displaying and hiding the notice. "none", "show", "fade", and "slide" are built in to jQuery. Others require jQuery UI. Use an object with effect_in and effect_out to use different effects.
899
- animation: "fade",
900
- // Speed at which the notice animates in and out. "slow", "def" or "normal", "fast" or number of milliseconds.
901
- animate_speed: "slow",
902
- // Specify a specific duration of position animation
903
- position_animate_speed: 500,
904
- // Opacity of the notice.
905
- opacity: 1,
906
- // Display a drop shadow.
907
- shadow: true,
908
- // Provide a button for the user to manually close the notice.
909
- closer: true,
910
- // Only show the closer button on hover.
911
- closer_hover: true,
912
- // Provide a button for the user to manually stick the notice.
913
- sticker: true,
914
- // Only show the sticker button on hover.
915
- sticker_hover: true,
916
- // After a delay, remove the notice.
917
- hide: true,
918
- // Delay in milliseconds before the notice is removed.
919
- delay: 8000,
920
- // Reset the hide timer if the mouse moves over the notice.
921
- mouse_reset: true,
922
- // Remove the notice's elements from the DOM after it is removed.
923
- remove: true,
924
- // Change new lines to br tags.
925
- insert_brs: true,
926
- // The stack on which the notices will be placed. Also controls the direction the notices stack.
927
- stack: {"dir1": "down", "dir2": "left", "push": "bottom", "spacing1": 25, "spacing2": 25},
928
- //Lets you change the displayed text, facilitating the internationalization.
929
- labels: {
930
- redisplay: "Redisplay",
931
- all: "All",
932
- last: "Last",
933
- close: "Close",
934
- stick: "Stick"
935
- }
936
- };
937
- })(jQuery);