creative-dashpaper-gem 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +41 -0
  3. data/lib/creative/dash_papergem/version.rb +8 -0
  4. data/lib/creative/dash_papergem.rb +10 -0
  5. data/vendor/assets/fonts/themify.eot +0 -0
  6. data/vendor/assets/fonts/themify.svg +362 -0
  7. data/vendor/assets/fonts/themify.ttf +0 -0
  8. data/vendor/assets/fonts/themify.woff +0 -0
  9. data/vendor/assets/images/apple-icon.png +0 -0
  10. data/vendor/assets/images/background.jpg +0 -0
  11. data/vendor/assets/images/faces/face-0.jpg +0 -0
  12. data/vendor/assets/images/faces/face-1.jpg +0 -0
  13. data/vendor/assets/images/faces/face-2.jpg +0 -0
  14. data/vendor/assets/images/faces/face-3.jpg +0 -0
  15. data/vendor/assets/images/favicon.png +0 -0
  16. data/vendor/assets/images/new_logo.png +0 -0
  17. data/vendor/assets/images/tim_80x80.png +0 -0
  18. data/vendor/assets/javascripts/bootstrap-checkbox-radio.js +248 -0
  19. data/vendor/assets/javascripts/bootstrap-notify.js +404 -0
  20. data/vendor/assets/javascripts/bootstrap.min.js +7 -0
  21. data/vendor/assets/javascripts/chartist.min.js +9 -0
  22. data/vendor/assets/javascripts/demo.js +151 -0
  23. data/vendor/assets/javascripts/jquery-1.10.2.js +9789 -0
  24. data/vendor/assets/javascripts/paper-dashboard.js +126 -0
  25. data/vendor/assets/stylesheets/animate.min.css +6 -0
  26. data/vendor/assets/stylesheets/bootstrap.min.css +5 -0
  27. data/vendor/assets/stylesheets/demo.css +70 -0
  28. data/vendor/assets/stylesheets/paper/_alerts.scss +64 -0
  29. data/vendor/assets/stylesheets/paper/_buttons.scss +114 -0
  30. data/vendor/assets/stylesheets/paper/_cards.scss +243 -0
  31. data/vendor/assets/stylesheets/paper/_chartist.scss +230 -0
  32. data/vendor/assets/stylesheets/paper/_checkbox-radio.scss +132 -0
  33. data/vendor/assets/stylesheets/paper/_dropdown.scss +115 -0
  34. data/vendor/assets/stylesheets/paper/_footers.scss +43 -0
  35. data/vendor/assets/stylesheets/paper/_inputs.scss +171 -0
  36. data/vendor/assets/stylesheets/paper/_misc.scss +69 -0
  37. data/vendor/assets/stylesheets/paper/_mixins.scss +17 -0
  38. data/vendor/assets/stylesheets/paper/_navbars.scss +167 -0
  39. data/vendor/assets/stylesheets/paper/_responsive.scss +447 -0
  40. data/vendor/assets/stylesheets/paper/_sidebar-and-main-panel.scss +195 -0
  41. data/vendor/assets/stylesheets/paper/_tables.scss +77 -0
  42. data/vendor/assets/stylesheets/paper/_typography.scss +117 -0
  43. data/vendor/assets/stylesheets/paper/_variables.scss +262 -0
  44. data/vendor/assets/stylesheets/paper/mixins/_buttons.scss +85 -0
  45. data/vendor/assets/stylesheets/paper/mixins/_cards.scss +8 -0
  46. data/vendor/assets/stylesheets/paper/mixins/_chartist.scss +104 -0
  47. data/vendor/assets/stylesheets/paper/mixins/_icons.scss +13 -0
  48. data/vendor/assets/stylesheets/paper/mixins/_inputs.scss +17 -0
  49. data/vendor/assets/stylesheets/paper/mixins/_labels.scss +21 -0
  50. data/vendor/assets/stylesheets/paper/mixins/_navbars.scss +11 -0
  51. data/vendor/assets/stylesheets/paper/mixins/_sidebar.scss +42 -0
  52. data/vendor/assets/stylesheets/paper/mixins/_tabs.scss +4 -0
  53. data/vendor/assets/stylesheets/paper/mixins/_transparency.scss +20 -0
  54. data/vendor/assets/stylesheets/paper/mixins/_vendor-prefixes.scss +197 -0
  55. data/vendor/assets/stylesheets/paper-dashboard.css +3315 -0
  56. data/vendor/assets/stylesheets/paper-dashboard.scss +28 -0
  57. data/vendor/assets/stylesheets/themify-icons.css +1081 -0
  58. metadata +148 -0
Binary file
Binary file
Binary file
@@ -0,0 +1,248 @@
1
+ !function ($) {
2
+
3
+ /* CHECKBOX PUBLIC CLASS DEFINITION
4
+ * ============================== */
5
+
6
+ var Checkbox = function (element, options) {
7
+ this.init(element, options);
8
+ }
9
+
10
+ Checkbox.prototype = {
11
+
12
+ constructor: Checkbox
13
+
14
+ , init: function (element, options) {
15
+ var $el = this.$element = $(element)
16
+
17
+ this.options = $.extend({}, $.fn.checkbox.defaults, options);
18
+ $el.before(this.options.template);
19
+ this.setState();
20
+ }
21
+
22
+ , setState: function () {
23
+ var $el = this.$element
24
+ , $parent = $el.closest('.checkbox');
25
+
26
+ $el.prop('disabled') && $parent.addClass('disabled');
27
+ $el.prop('checked') && $parent.addClass('checked');
28
+ }
29
+
30
+ , toggle: function () {
31
+ var ch = 'checked'
32
+ , $el = this.$element
33
+ , $parent = $el.closest('.checkbox')
34
+ , checked = $el.prop(ch)
35
+ , e = $.Event('toggle')
36
+
37
+ if ($el.prop('disabled') == false) {
38
+ $parent.toggleClass(ch) && checked ? $el.removeAttr(ch) : $el.prop(ch, ch);
39
+ $el.trigger(e).trigger('change');
40
+ }
41
+ }
42
+
43
+ , setCheck: function (option) {
44
+ var d = 'disabled'
45
+ , ch = 'checked'
46
+ , $el = this.$element
47
+ , $parent = $el.closest('.checkbox')
48
+ , checkAction = option == 'check' ? true : false
49
+ , e = $.Event(option)
50
+
51
+ $parent[checkAction ? 'addClass' : 'removeClass' ](ch) && checkAction ? $el.prop(ch, ch) : $el.removeAttr(ch);
52
+ $el.trigger(e).trigger('change');
53
+ }
54
+
55
+ }
56
+
57
+
58
+ /* CHECKBOX PLUGIN DEFINITION
59
+ * ======================== */
60
+
61
+ var old = $.fn.checkbox
62
+
63
+ $.fn.checkbox = function (option) {
64
+ return this.each(function () {
65
+ var $this = $(this)
66
+ , data = $this.data('checkbox')
67
+ , options = $.extend({}, $.fn.checkbox.defaults, $this.data(), typeof option == 'object' && option);
68
+ if (!data) $this.data('checkbox', (data = new Checkbox(this, options)));
69
+ if (option == 'toggle') data.toggle()
70
+ if (option == 'check' || option == 'uncheck') data.setCheck(option)
71
+ else if (option) data.setState();
72
+ });
73
+ }
74
+
75
+ $.fn.checkbox.defaults = {
76
+ template: '<span class="icons"><span class="first-icon fa fa-square fa-base"></span><span class="second-icon fa fa-check-square fa-base"></span></span>'
77
+ }
78
+
79
+
80
+ /* CHECKBOX NO CONFLICT
81
+ * ================== */
82
+
83
+ $.fn.checkbox.noConflict = function () {
84
+ $.fn.checkbox = old;
85
+ return this;
86
+ }
87
+
88
+
89
+ /* CHECKBOX DATA-API
90
+ * =============== */
91
+
92
+ $(document).on('click.checkbox.data-api', '[data-toggle^=checkbox], .checkbox', function (e) {
93
+ var $checkbox = $(e.target);
94
+ if (e.target.tagName != "A") {
95
+ e && e.preventDefault() && e.stopPropagation();
96
+ if (!$checkbox.hasClass('checkbox')) $checkbox = $checkbox.closest('.checkbox');
97
+ $checkbox.find(':checkbox').checkbox('toggle');
98
+ }
99
+ });
100
+
101
+ $(function () {
102
+ $('input[type="checkbox"]').each(function () {
103
+ var $checkbox = $(this);
104
+ $checkbox.checkbox();
105
+ });
106
+ });
107
+
108
+ }(window.jQuery);
109
+
110
+ /* =============================================================
111
+ * flatui-radio v0.0.3
112
+ * ============================================================ */
113
+
114
+ !function ($) {
115
+
116
+ /* RADIO PUBLIC CLASS DEFINITION
117
+ * ============================== */
118
+
119
+ var Radio = function (element, options) {
120
+ this.init(element, options);
121
+ }
122
+
123
+ Radio.prototype = {
124
+
125
+ constructor: Radio
126
+
127
+ , init: function (element, options) {
128
+ var $el = this.$element = $(element)
129
+
130
+ this.options = $.extend({}, $.fn.radio.defaults, options);
131
+ $el.before(this.options.template);
132
+ this.setState();
133
+ }
134
+
135
+ , setState: function () {
136
+ var $el = this.$element
137
+ , $parent = $el.closest('.radio');
138
+
139
+ $el.prop('disabled') && $parent.addClass('disabled');
140
+ $el.prop('checked') && $parent.addClass('checked');
141
+ }
142
+
143
+ , toggle: function () {
144
+ var d = 'disabled'
145
+ , ch = 'checked'
146
+ , $el = this.$element
147
+ , checked = $el.prop(ch)
148
+ , $parent = $el.closest('.radio')
149
+ , $parentWrap = $el.closest('form').length ? $el.closest('form') : $el.closest('body')
150
+ , $elemGroup = $parentWrap.find(':radio[name="' + $el.attr('name') + '"]')
151
+ , e = $.Event('toggle')
152
+
153
+ if ($el.prop(d) == false) {
154
+ $elemGroup.not($el).each(function () {
155
+ var $el = $(this)
156
+ , $parent = $(this).closest('.radio');
157
+
158
+ if ($el.prop(d) == false) {
159
+ $parent.removeClass(ch) && $el.removeAttr(ch).trigger('change');
160
+ }
161
+ });
162
+
163
+ if (checked == false) $parent.addClass(ch) && $el.prop(ch, true);
164
+ $el.trigger(e);
165
+
166
+ if (checked !== $el.prop(ch)) {
167
+ $el.trigger('change');
168
+ }
169
+ }
170
+ }
171
+
172
+ , setCheck: function (option) {
173
+ var ch = 'checked'
174
+ , $el = this.$element
175
+ , $parent = $el.closest('.radio')
176
+ , checkAction = option == 'check' ? true : false
177
+ , checked = $el.prop(ch)
178
+ , $parentWrap = $el.closest('form').length ? $el.closest('form') : $el.closest('body')
179
+ , $elemGroup = $parentWrap.find(':radio[name="' + $el['attr']('name') + '"]')
180
+ , e = $.Event(option)
181
+
182
+ $elemGroup.not($el).each(function () {
183
+ var $el = $(this)
184
+ , $parent = $(this).closest('.radio');
185
+
186
+ $parent.removeClass(ch) && $el.removeAttr(ch);
187
+ });
188
+
189
+ $parent[checkAction ? 'addClass' : 'removeClass'](ch) && checkAction ? $el.prop(ch, ch) : $el.removeAttr(ch);
190
+ $el.trigger(e);
191
+
192
+ if (checked !== $el.prop(ch)) {
193
+ $el.trigger('change');
194
+ }
195
+ }
196
+
197
+ }
198
+
199
+
200
+ /* RADIO PLUGIN DEFINITION
201
+ * ======================== */
202
+
203
+ var old = $.fn.radio
204
+
205
+ $.fn.radio = function (option) {
206
+ return this.each(function () {
207
+ var $this = $(this)
208
+ , data = $this.data('radio')
209
+ , options = $.extend({}, $.fn.radio.defaults, $this.data(), typeof option == 'object' && option);
210
+ if (!data) $this.data('radio', (data = new Radio(this, options)));
211
+ if (option == 'toggle') data.toggle()
212
+ if (option == 'check' || option == 'uncheck') data.setCheck(option)
213
+ else if (option) data.setState();
214
+ });
215
+ }
216
+
217
+ $.fn.radio.defaults = {
218
+ template: '<span class="icons"><span class="first-icon fa fa-circle-o fa-base"></span><span class="second-icon fa fa-dot-circle-o fa-base"></span></span>'
219
+ }
220
+
221
+
222
+ /* RADIO NO CONFLICT
223
+ * ================== */
224
+
225
+ $.fn.radio.noConflict = function () {
226
+ $.fn.radio = old;
227
+ return this;
228
+ }
229
+
230
+
231
+ /* RADIO DATA-API
232
+ * =============== */
233
+
234
+ $(document).on('click.radio.data-api', '[data-toggle^=radio], .radio', function (e) {
235
+ var $radio = $(e.target);
236
+ e && e.preventDefault() && e.stopPropagation();
237
+ if (!$radio.hasClass('radio')) $radio = $radio.closest('.radio');
238
+ $radio.find(':radio').radio('toggle');
239
+ });
240
+
241
+ $(function () {
242
+ $('input[type="radio"]').each(function () {
243
+ var $radio = $(this);
244
+ $radio.radio();
245
+ });
246
+ });
247
+
248
+ }(window.jQuery);
@@ -0,0 +1,404 @@
1
+ /*
2
+
3
+
4
+
5
+ Creative Tim Modifications
6
+
7
+ Lines: 239, 240 was changed from top: 5px to top: 50% and we added margin-top: -13px. In this way the close button will be aligned vertically
8
+ Line:242 - modified when the icon is set, we add the class "alert-with-icon", so there will be enough space for the icon.
9
+
10
+
11
+
12
+
13
+ */
14
+
15
+
16
+ /*
17
+ * Project: Bootstrap Notify = v3.1.5
18
+ * Description: Turns standard Bootstrap alerts into "Growl-like" notifications.
19
+ * Author: Mouse0270 aka Robert McIntosh
20
+ * License: MIT License
21
+ * Website: https://github.com/mouse0270/bootstrap-growl
22
+ */
23
+
24
+ /* global define:false, require: false, jQuery:false */
25
+
26
+ (function (factory) {
27
+ if (typeof define === 'function' && define.amd) {
28
+ // AMD. Register as an anonymous module.
29
+ define(['jquery'], factory);
30
+ } else if (typeof exports === 'object') {
31
+ // Node/CommonJS
32
+ factory(require('jquery'));
33
+ } else {
34
+ // Browser globals
35
+ factory(jQuery);
36
+ }
37
+ }(function ($) {
38
+ // Create the defaults once
39
+ var defaults = {
40
+ element: 'body',
41
+ position: null,
42
+ type: "info",
43
+ allow_dismiss: true,
44
+ allow_duplicates: true,
45
+ newest_on_top: false,
46
+ showProgressbar: false,
47
+ placement: {
48
+ from: "top",
49
+ align: "right"
50
+ },
51
+ offset: 20,
52
+ spacing: 10,
53
+ z_index: 1031,
54
+ delay: 5000,
55
+ timer: 1000,
56
+ url_target: '_blank',
57
+ mouse_over: null,
58
+ animate: {
59
+ enter: 'animated fadeInDown',
60
+ exit: 'animated fadeOutUp'
61
+ },
62
+ onShow: null,
63
+ onShown: null,
64
+ onClose: null,
65
+ onClosed: null,
66
+ icon_type: 'class',
67
+ template: '<div data-notify="container" class="col-xs-11 col-sm-4 alert alert-{0}" role="alert"><button type="button" aria-hidden="true" class="close" data-notify="dismiss">&times;</button><span data-notify="icon"></span> <span data-notify="title">{1}</span> <span data-notify="message">{2}</span><div class="progress" data-notify="progressbar"><div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div></div><a href="{3}" target="{4}" data-notify="url"></a></div>'
68
+ };
69
+
70
+ String.format = function () {
71
+ var str = arguments[0];
72
+ for (var i = 1; i < arguments.length; i++) {
73
+ str = str.replace(RegExp("\\{" + (i - 1) + "\\}", "gm"), arguments[i]);
74
+ }
75
+ return str;
76
+ };
77
+
78
+ function isDuplicateNotification(notification) {
79
+ var isDupe = false;
80
+
81
+ $('[data-notify="container"]').each(function (i, el) {
82
+ var $el = $(el);
83
+ var title = $el.find('[data-notify="title"]').text().trim();
84
+ var message = $el.find('[data-notify="message"]').html().trim();
85
+
86
+ // The input string might be different than the actual parsed HTML string!
87
+ // (<br> vs <br /> for example)
88
+ // So we have to force-parse this as HTML here!
89
+ var isSameTitle = title === $("<div>" + notification.settings.content.title + "</div>").html().trim();
90
+ var isSameMsg = message === $("<div>" + notification.settings.content.message + "</div>").html().trim();
91
+ var isSameType = $el.hasClass('alert-' + notification.settings.type);
92
+
93
+ if (isSameTitle && isSameMsg && isSameType) {
94
+ //we found the dupe. Set the var and stop checking.
95
+ isDupe = true;
96
+ }
97
+ return !isDupe;
98
+ });
99
+
100
+ return isDupe;
101
+ }
102
+
103
+ function Notify(element, content, options) {
104
+ // Setup Content of Notify
105
+ var contentObj = {
106
+ content: {
107
+ message: typeof content === 'object' ? content.message : content,
108
+ title: content.title ? content.title : '',
109
+ icon: content.icon ? content.icon : '',
110
+ url: content.url ? content.url : '#',
111
+ target: content.target ? content.target : '-'
112
+ }
113
+ };
114
+
115
+ options = $.extend(true, {}, contentObj, options);
116
+ this.settings = $.extend(true, {}, defaults, options);
117
+ this._defaults = defaults;
118
+ if (this.settings.content.target === "-") {
119
+ this.settings.content.target = this.settings.url_target;
120
+ }
121
+ this.animations = {
122
+ start: 'webkitAnimationStart oanimationstart MSAnimationStart animationstart',
123
+ end: 'webkitAnimationEnd oanimationend MSAnimationEnd animationend'
124
+ };
125
+
126
+ if (typeof this.settings.offset === 'number') {
127
+ this.settings.offset = {
128
+ x: this.settings.offset,
129
+ y: this.settings.offset
130
+ };
131
+ }
132
+
133
+ //if duplicate messages are not allowed, then only continue if this new message is not a duplicate of one that it already showing
134
+ if (this.settings.allow_duplicates || (!this.settings.allow_duplicates && !isDuplicateNotification(this))) {
135
+ this.init();
136
+ }
137
+ }
138
+
139
+ $.extend(Notify.prototype, {
140
+ init: function () {
141
+ var self = this;
142
+
143
+ this.buildNotify();
144
+ if (this.settings.content.icon) {
145
+ this.setIcon();
146
+ }
147
+ if (this.settings.content.url != "#") {
148
+ this.styleURL();
149
+ }
150
+ this.styleDismiss();
151
+ this.placement();
152
+ this.bind();
153
+
154
+ this.notify = {
155
+ $ele: this.$ele,
156
+ update: function (command, update) {
157
+ var commands = {};
158
+ if (typeof command === "string") {
159
+ commands[command] = update;
160
+ } else {
161
+ commands = command;
162
+ }
163
+ for (var cmd in commands) {
164
+ switch (cmd) {
165
+ case "type":
166
+ this.$ele.removeClass('alert-' + self.settings.type);
167
+ this.$ele.find('[data-notify="progressbar"] > .progress-bar').removeClass('progress-bar-' + self.settings.type);
168
+ self.settings.type = commands[cmd];
169
+ this.$ele.addClass('alert-' + commands[cmd]).find('[data-notify="progressbar"] > .progress-bar').addClass('progress-bar-' + commands[cmd]);
170
+ break;
171
+ case "icon":
172
+ var $icon = this.$ele.find('[data-notify="icon"]');
173
+ if (self.settings.icon_type.toLowerCase() === 'class') {
174
+ $icon.removeClass(self.settings.content.icon).addClass(commands[cmd]);
175
+ } else {
176
+ if (!$icon.is('img')) {
177
+ $icon.find('img');
178
+ }
179
+ $icon.attr('src', commands[cmd]);
180
+ }
181
+ break;
182
+ case "progress":
183
+ var newDelay = self.settings.delay - (self.settings.delay * (commands[cmd] / 100));
184
+ this.$ele.data('notify-delay', newDelay);
185
+ this.$ele.find('[data-notify="progressbar"] > div').attr('aria-valuenow', commands[cmd]).css('width', commands[cmd] + '%');
186
+ break;
187
+ case "url":
188
+ this.$ele.find('[data-notify="url"]').attr('href', commands[cmd]);
189
+ break;
190
+ case "target":
191
+ this.$ele.find('[data-notify="url"]').attr('target', commands[cmd]);
192
+ break;
193
+ default:
194
+ this.$ele.find('[data-notify="' + cmd + '"]').html(commands[cmd]);
195
+ }
196
+ }
197
+ var posX = this.$ele.outerHeight() + parseInt(self.settings.spacing) + parseInt(self.settings.offset.y);
198
+ self.reposition(posX);
199
+ },
200
+ close: function () {
201
+ self.close();
202
+ }
203
+ };
204
+
205
+ },
206
+ buildNotify: function () {
207
+ var content = this.settings.content;
208
+ this.$ele = $(String.format(this.settings.template, this.settings.type, content.title, content.message, content.url, content.target));
209
+ this.$ele.attr('data-notify-position', this.settings.placement.from + '-' + this.settings.placement.align);
210
+ if (!this.settings.allow_dismiss) {
211
+ this.$ele.find('[data-notify="dismiss"]').css('display', 'none');
212
+ }
213
+ if ((this.settings.delay <= 0 && !this.settings.showProgressbar) || !this.settings.showProgressbar) {
214
+ this.$ele.find('[data-notify="progressbar"]').remove();
215
+ }
216
+ },
217
+ setIcon: function () {
218
+
219
+ this.$ele.addClass('alert-with-icon');
220
+
221
+ if (this.settings.icon_type.toLowerCase() === 'class') {
222
+ this.$ele.find('[data-notify="icon"]').addClass(this.settings.content.icon);
223
+ } else {
224
+ if (this.$ele.find('[data-notify="icon"]').is('img')) {
225
+ this.$ele.find('[data-notify="icon"]').attr('src', this.settings.content.icon);
226
+ } else {
227
+ this.$ele.find('[data-notify="icon"]').append('<img src="' + this.settings.content.icon + '" alt="Notify Icon" />');
228
+ }
229
+ }
230
+ },
231
+ styleDismiss: function () {
232
+ this.$ele.find('[data-notify="dismiss"]').css({
233
+ position: 'absolute',
234
+ right: '10px',
235
+ top: '50%',
236
+ marginTop: '-13px',
237
+ zIndex: this.settings.z_index + 2
238
+ });
239
+ },
240
+ styleURL: function () {
241
+ this.$ele.find('[data-notify="url"]').css({
242
+ backgroundImage: 'url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)',
243
+ height: '100%',
244
+ left: 0,
245
+ position: 'absolute',
246
+ top: 0,
247
+ width: '100%',
248
+ zIndex: this.settings.z_index + 1
249
+ });
250
+ },
251
+ placement: function () {
252
+ var self = this,
253
+ offsetAmt = this.settings.offset.y,
254
+ css = {
255
+ display: 'inline-block',
256
+ margin: '0px auto',
257
+ position: this.settings.position ? this.settings.position : (this.settings.element === 'body' ? 'fixed' : 'absolute'),
258
+ transition: 'all .5s ease-in-out',
259
+ zIndex: this.settings.z_index
260
+ },
261
+ hasAnimation = false,
262
+ settings = this.settings;
263
+
264
+ $('[data-notify-position="' + this.settings.placement.from + '-' + this.settings.placement.align + '"]:not([data-closing="true"])').each(function () {
265
+ offsetAmt = Math.max(offsetAmt, parseInt($(this).css(settings.placement.from)) + parseInt($(this).outerHeight()) + parseInt(settings.spacing));
266
+ });
267
+ if (this.settings.newest_on_top === true) {
268
+ offsetAmt = this.settings.offset.y;
269
+ }
270
+ css[this.settings.placement.from] = offsetAmt + 'px';
271
+
272
+ switch (this.settings.placement.align) {
273
+ case "left":
274
+ case "right":
275
+ css[this.settings.placement.align] = this.settings.offset.x + 'px';
276
+ break;
277
+ case "center":
278
+ css.left = 0;
279
+ css.right = 0;
280
+ break;
281
+ }
282
+ this.$ele.css(css).addClass(this.settings.animate.enter);
283
+ $.each(Array('webkit-', 'moz-', 'o-', 'ms-', ''), function (index, prefix) {
284
+ self.$ele[0].style[prefix + 'AnimationIterationCount'] = 1;
285
+ });
286
+
287
+ $(this.settings.element).append(this.$ele);
288
+
289
+ if (this.settings.newest_on_top === true) {
290
+ offsetAmt = (parseInt(offsetAmt) + parseInt(this.settings.spacing)) + this.$ele.outerHeight();
291
+ this.reposition(offsetAmt);
292
+ }
293
+
294
+ if ($.isFunction(self.settings.onShow)) {
295
+ self.settings.onShow.call(this.$ele);
296
+ }
297
+
298
+ this.$ele.one(this.animations.start, function () {
299
+ hasAnimation = true;
300
+ }).one(this.animations.end, function () {
301
+ if ($.isFunction(self.settings.onShown)) {
302
+ self.settings.onShown.call(this);
303
+ }
304
+ });
305
+
306
+ setTimeout(function () {
307
+ if (!hasAnimation) {
308
+ if ($.isFunction(self.settings.onShown)) {
309
+ self.settings.onShown.call(this);
310
+ }
311
+ }
312
+ }, 600);
313
+ },
314
+ bind: function () {
315
+ var self = this;
316
+
317
+ this.$ele.find('[data-notify="dismiss"]').on('click', function () {
318
+ self.close();
319
+ });
320
+
321
+ this.$ele.mouseover(function () {
322
+ $(this).data('data-hover', "true");
323
+ }).mouseout(function () {
324
+ $(this).data('data-hover', "false");
325
+ });
326
+ this.$ele.data('data-hover', "false");
327
+
328
+ if (this.settings.delay > 0) {
329
+ self.$ele.data('notify-delay', self.settings.delay);
330
+ var timer = setInterval(function () {
331
+ var delay = parseInt(self.$ele.data('notify-delay')) - self.settings.timer;
332
+ if ((self.$ele.data('data-hover') === 'false' && self.settings.mouse_over === "pause") || self.settings.mouse_over != "pause") {
333
+ var percent = ((self.settings.delay - delay) / self.settings.delay) * 100;
334
+ self.$ele.data('notify-delay', delay);
335
+ self.$ele.find('[data-notify="progressbar"] > div').attr('aria-valuenow', percent).css('width', percent + '%');
336
+ }
337
+ if (delay <= -(self.settings.timer)) {
338
+ clearInterval(timer);
339
+ self.close();
340
+ }
341
+ }, self.settings.timer);
342
+ }
343
+ },
344
+ close: function () {
345
+ var self = this,
346
+ posX = parseInt(this.$ele.css(this.settings.placement.from)),
347
+ hasAnimation = false;
348
+
349
+ this.$ele.data('closing', 'true').addClass(this.settings.animate.exit);
350
+ self.reposition(posX);
351
+
352
+ if ($.isFunction(self.settings.onClose)) {
353
+ self.settings.onClose.call(this.$ele);
354
+ }
355
+
356
+ this.$ele.one(this.animations.start, function () {
357
+ hasAnimation = true;
358
+ }).one(this.animations.end, function () {
359
+ $(this).remove();
360
+ if ($.isFunction(self.settings.onClosed)) {
361
+ self.settings.onClosed.call(this);
362
+ }
363
+ });
364
+
365
+ setTimeout(function () {
366
+ if (!hasAnimation) {
367
+ self.$ele.remove();
368
+ if (self.settings.onClosed) {
369
+ self.settings.onClosed(self.$ele);
370
+ }
371
+ }
372
+ }, 600);
373
+ },
374
+ reposition: function (posX) {
375
+ var self = this,
376
+ notifies = '[data-notify-position="' + this.settings.placement.from + '-' + this.settings.placement.align + '"]:not([data-closing="true"])',
377
+ $elements = this.$ele.nextAll(notifies);
378
+ if (this.settings.newest_on_top === true) {
379
+ $elements = this.$ele.prevAll(notifies);
380
+ }
381
+ $elements.each(function () {
382
+ $(this).css(self.settings.placement.from, posX);
383
+ posX = (parseInt(posX) + parseInt(self.settings.spacing)) + $(this).outerHeight();
384
+ });
385
+ }
386
+ });
387
+
388
+ $.notify = function (content, options) {
389
+ var plugin = new Notify(this, content, options);
390
+ return plugin.notify;
391
+ };
392
+ $.notifyDefaults = function (options) {
393
+ defaults = $.extend(true, {}, defaults, options);
394
+ return defaults;
395
+ };
396
+ $.notifyClose = function (command) {
397
+ if (typeof command === "undefined" || command === "all") {
398
+ $('[data-notify]').find('[data-notify="dismiss"]').trigger('click');
399
+ } else {
400
+ $('[data-notify-position="' + command + '"]').find('[data-notify="dismiss"]').trigger('click');
401
+ }
402
+ };
403
+
404
+ }));