tjadmin 0.0.3 → 0.0.4

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 (108) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tjadmin/version.rb +1 -1
  3. data/vendor/assets/font/DXI1ORHCpsQm3Vp6mXoaTXhCUOGz7vYGh680lGh-uXM.woff +0 -0
  4. data/vendor/assets/font/FontAwesome.otf +0 -0
  5. data/vendor/assets/font/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff +0 -0
  6. data/vendor/assets/font/fontawesome-webfont.eot +0 -0
  7. data/vendor/assets/font/fontawesome-webfont.svg +399 -0
  8. data/vendor/assets/font/fontawesome-webfont.ttf +0 -0
  9. data/vendor/assets/font/fontawesome-webfont.woff +0 -0
  10. data/vendor/assets/javascripts/tjadmin/ace-elements.js +866 -0
  11. data/vendor/assets/javascripts/tjadmin/ace-extra.js +374 -0
  12. data/vendor/assets/javascripts/tjadmin/ace.js +310 -0
  13. data/vendor/assets/javascripts/tjadmin/additional-methods.js +617 -0
  14. data/vendor/assets/javascripts/tjadmin/bootbox.js +660 -0
  15. data/vendor/assets/javascripts/tjadmin/bootstrap-colorpicker.js +540 -0
  16. data/vendor/assets/javascripts/tjadmin/bootstrap-tag.js +206 -0
  17. data/vendor/assets/javascripts/tjadmin/bootstrap-wysiwyg.js +206 -0
  18. data/vendor/assets/javascripts/tjadmin/bootstrap.js +2280 -0
  19. data/vendor/assets/javascripts/tjadmin/chosen.jquery.js +1166 -0
  20. data/vendor/assets/javascripts/tjadmin/date-time/bootstrap-datepicker.js +1016 -0
  21. data/vendor/assets/javascripts/tjadmin/date-time/bootstrap-timepicker.js +888 -0
  22. data/vendor/assets/javascripts/tjadmin/date-time/daterangepicker.js +854 -0
  23. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.bg.js +14 -0
  24. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ca.js +14 -0
  25. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.cs.js +15 -0
  26. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.da.js +14 -0
  27. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.de.js +16 -0
  28. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.el.js +13 -0
  29. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.es.js +14 -0
  30. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.fi.js +14 -0
  31. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.fr.js +16 -0
  32. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.he.js +15 -0
  33. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.hr.js +13 -0
  34. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.hu.js +16 -0
  35. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.id.js +13 -0
  36. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.is.js +14 -0
  37. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.it.js +16 -0
  38. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ja.js +15 -0
  39. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.kr.js +13 -0
  40. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.lt.js +16 -0
  41. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.lv.js +16 -0
  42. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ms.js +14 -0
  43. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.nb.js +14 -0
  44. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.nl.js +14 -0
  45. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.pl.js +15 -0
  46. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.pt-BR.js +14 -0
  47. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.pt.js +14 -0
  48. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ro.js +15 -0
  49. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.rs-latin.js +14 -0
  50. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.rs.js +14 -0
  51. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.ru.js +14 -0
  52. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.sk.js +15 -0
  53. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.sl.js +14 -0
  54. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.sv.js +14 -0
  55. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.sw.js +15 -0
  56. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.th.js +14 -0
  57. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.tr.js +15 -0
  58. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.uk.js +14 -0
  59. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.zh-CN.js +14 -0
  60. data/vendor/assets/javascripts/tjadmin/date-time/locales/bootstrap-datepicker.zh-TW.js +13 -0
  61. data/vendor/assets/javascripts/tjadmin/date-time/moment.js +1400 -0
  62. data/vendor/assets/javascripts/tjadmin/excanvas.js +1428 -0
  63. data/vendor/assets/javascripts/tjadmin/flot/jquery.flot.js +3061 -0
  64. data/vendor/assets/javascripts/tjadmin/flot/jquery.flot.pie.js +817 -0
  65. data/vendor/assets/javascripts/tjadmin/flot/jquery.flot.resize.js +60 -0
  66. data/vendor/assets/javascripts/tjadmin/fuelux/data/fuelux.tree-sampledata.js +174 -0
  67. data/vendor/assets/javascripts/tjadmin/fuelux/fuelux.spinner.js +201 -0
  68. data/vendor/assets/javascripts/tjadmin/fuelux/fuelux.tree.js +173 -0
  69. data/vendor/assets/javascripts/tjadmin/fuelux/fuelux.wizard.js +172 -0
  70. data/vendor/assets/javascripts/tjadmin/fullcalendar.js +5973 -0
  71. data/vendor/assets/javascripts/tjadmin/jquery-1.10.2.js +9789 -0
  72. data/vendor/assets/javascripts/tjadmin/jquery-2.0.3.js +8829 -0
  73. data/vendor/assets/javascripts/tjadmin/jquery-ui-1.10.3.custom.js +5423 -0
  74. data/vendor/assets/javascripts/tjadmin/jquery.autosize.js +242 -0
  75. data/vendor/assets/javascripts/tjadmin/jquery.colorbox.js +1063 -0
  76. data/vendor/assets/javascripts/tjadmin/jquery.dataTables.js +12099 -0
  77. data/vendor/assets/javascripts/tjadmin/jquery.easy-pie-chart.js +200 -0
  78. data/vendor/assets/javascripts/tjadmin/jquery.gritter.js +418 -0
  79. data/vendor/assets/javascripts/tjadmin/jquery.hotkeys.js +113 -0
  80. data/vendor/assets/javascripts/tjadmin/jquery.inputlimiter.1.3.1.js +172 -0
  81. data/vendor/assets/javascripts/tjadmin/jquery.knob.js +656 -0
  82. data/vendor/assets/javascripts/tjadmin/jquery.maskedinput.js +338 -0
  83. data/vendor/assets/javascripts/tjadmin/jquery.mobile.custom.js +1081 -0
  84. data/vendor/assets/javascripts/tjadmin/jquery.slimscroll.js +448 -0
  85. data/vendor/assets/javascripts/tjadmin/jquery.sparkline.js +3054 -0
  86. data/vendor/assets/javascripts/tjadmin/jquery.ui.touch-punch.js +160 -0
  87. data/vendor/assets/javascripts/tjadmin/jquery.validate.js +1231 -0
  88. data/vendor/assets/javascripts/tjadmin/markdown/bootstrap-markdown.js +993 -0
  89. data/vendor/assets/javascripts/tjadmin/markdown/markdown.js +1616 -0
  90. data/vendor/assets/javascripts/tjadmin/markdown/to-markdown.js +184 -0
  91. data/vendor/assets/javascripts/tjadmin/select2.js +3168 -0
  92. data/vendor/assets/javascripts/tjadmin/spin.js +349 -0
  93. data/vendor/assets/javascripts/tjadmin/x-editable/ace-editable.js +368 -0
  94. data/vendor/assets/javascripts/tjadmin/x-editable/bootstrap-editable.js +6827 -0
  95. data/vendor/assets/javascripts/tjadmin.js +5 -0
  96. data/vendor/assets/stylesheets/tjadmin/ace-fonts.css.scss +13 -0
  97. data/vendor/assets/stylesheets/tjadmin/ace-ie.css +293 -0
  98. data/vendor/assets/stylesheets/tjadmin/ace-responsive.css +1113 -0
  99. data/vendor/assets/stylesheets/tjadmin/ace-skins.css +1301 -0
  100. data/vendor/assets/stylesheets/tjadmin/ace.css +14701 -0
  101. data/vendor/assets/stylesheets/tjadmin/bootstrap-responsive.css +1109 -0
  102. data/vendor/assets/stylesheets/tjadmin/bootstrap.css +6167 -0
  103. data/vendor/assets/stylesheets/tjadmin/chosen.css +430 -0
  104. data/vendor/assets/stylesheets/tjadmin/font-awesome-ie7.css +1203 -0
  105. data/vendor/assets/stylesheets/tjadmin/font-awesome.css +1479 -0
  106. data/vendor/assets/stylesheets/tjadmin/jquery-ui-1.10.3.custom.css +223 -0
  107. data/vendor/assets/stylesheets/tjadmin.css +9 -0
  108. metadata +106 -1
@@ -0,0 +1,200 @@
1
+ // Generated by CoffeeScript 1.6.3
2
+ /*
3
+ Easy pie chart is a jquery plugin to display simple animated pie charts for only one value
4
+
5
+ Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
6
+ and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
7
+
8
+ Built on top of the jQuery library (http://jquery.com)
9
+
10
+ @source: http://github.com/rendro/easy-pie-chart/
11
+ @autor: Robert Fleischmann
12
+ @version: 1.2.5
13
+
14
+ Inspired by: http://dribbble.com/shots/631074-Simple-Pie-Charts-II?list=popular&offset=210
15
+ Thanks to Philip Thrasher for the jquery plugin boilerplate for coffee script
16
+ */
17
+
18
+ (function($) {
19
+ $.easyPieChart = function(el, options) {
20
+ var addScaleLine, animateLine, drawLine, easeInOutQuad, rAF, renderBackground, renderScale, renderTrack,
21
+ _this = this;
22
+ this.el = el;
23
+ this.$el = $(el);
24
+ this.$el.data("easyPieChart", this);
25
+ this.init = function() {
26
+ var percent, scaleBy;
27
+ _this.options = $.extend({}, $.easyPieChart.defaultOptions, options);
28
+ percent = parseInt(_this.$el.data('percent'), 10);
29
+ _this.percentage = 0;
30
+ _this.canvas = $("<canvas width='" + _this.options.size + "' height='" + _this.options.size + "'></canvas>").get(0);
31
+ _this.$el.append(_this.canvas);
32
+ if (typeof G_vmlCanvasManager !== "undefined" && G_vmlCanvasManager !== null) {
33
+ G_vmlCanvasManager.initElement(_this.canvas);
34
+ }
35
+ _this.ctx = _this.canvas.getContext('2d');
36
+ if (window.devicePixelRatio > 1) {
37
+ scaleBy = window.devicePixelRatio;
38
+ $(_this.canvas).css({
39
+ width: _this.options.size,
40
+ height: _this.options.size
41
+ });
42
+ _this.canvas.width *= scaleBy;
43
+ _this.canvas.height *= scaleBy;
44
+ _this.ctx.scale(scaleBy, scaleBy);
45
+ }
46
+ _this.ctx.translate(_this.options.size / 2, _this.options.size / 2);
47
+ _this.ctx.rotate(_this.options.rotate * Math.PI / 180);
48
+ _this.$el.addClass('easyPieChart');
49
+ _this.$el.css({
50
+ width: _this.options.size,
51
+ height: _this.options.size,
52
+ lineHeight: "" + _this.options.size + "px"
53
+ });
54
+ _this.update(percent);
55
+ return _this;
56
+ };
57
+ this.update = function(percent) {
58
+ percent = parseFloat(percent) || 0;
59
+ if (_this.options.animate === false) {
60
+ drawLine(percent);
61
+ } else {
62
+ if (_this.options.delay) {
63
+ animateLine(_this.percentage, 0);
64
+ setTimeout(function() {
65
+ return animateLine(_this.percentage, percent);
66
+ }, _this.options.delay);
67
+ } else {
68
+ animateLine(_this.percentage, percent);
69
+ }
70
+ }
71
+ return _this;
72
+ };
73
+ renderScale = function() {
74
+ var i, _i, _results;
75
+ _this.ctx.fillStyle = _this.options.scaleColor;
76
+ _this.ctx.lineWidth = 1;
77
+ _results = [];
78
+ for (i = _i = 0; _i <= 24; i = ++_i) {
79
+ _results.push(addScaleLine(i));
80
+ }
81
+ return _results;
82
+ };
83
+ addScaleLine = function(i) {
84
+ var offset;
85
+ offset = i % 6 === 0 ? 0 : _this.options.size * 0.017;
86
+ _this.ctx.save();
87
+ _this.ctx.rotate(i * Math.PI / 12);
88
+ _this.ctx.fillRect(_this.options.size / 2 - offset, 0, -_this.options.size * 0.05 + offset, 1);
89
+ _this.ctx.restore();
90
+ };
91
+ renderTrack = function() {
92
+ var offset;
93
+ offset = _this.options.size / 2 - _this.options.lineWidth / 2;
94
+ if (_this.options.scaleColor !== false) {
95
+ offset -= _this.options.size * 0.08;
96
+ }
97
+ _this.ctx.beginPath();
98
+ _this.ctx.arc(0, 0, offset, 0, Math.PI * 2, true);
99
+ _this.ctx.closePath();
100
+ _this.ctx.strokeStyle = _this.options.trackColor;
101
+ _this.ctx.lineWidth = _this.options.lineWidth;
102
+ _this.ctx.stroke();
103
+ };
104
+ renderBackground = function() {
105
+ if (_this.options.scaleColor !== false) {
106
+ renderScale();
107
+ }
108
+ if (_this.options.trackColor !== false) {
109
+ renderTrack();
110
+ }
111
+ };
112
+ drawLine = function(percent) {
113
+ var offset;
114
+ renderBackground();
115
+ _this.ctx.strokeStyle = $.isFunction(_this.options.barColor) ? _this.options.barColor(percent) : _this.options.barColor;
116
+ _this.ctx.lineCap = _this.options.lineCap;
117
+ _this.ctx.lineWidth = _this.options.lineWidth;
118
+ offset = _this.options.size / 2 - _this.options.lineWidth / 2;
119
+ if (_this.options.scaleColor !== false) {
120
+ offset -= _this.options.size * 0.08;
121
+ }
122
+ _this.ctx.save();
123
+ _this.ctx.rotate(-Math.PI / 2);
124
+ _this.ctx.beginPath();
125
+ _this.ctx.arc(0, 0, offset, 0, Math.PI * 2 * percent / 100, false);
126
+ _this.ctx.stroke();
127
+ _this.ctx.restore();
128
+ };
129
+ rAF = (function() {
130
+ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) {
131
+ return window.setTimeout(callback, 1000 / 60);
132
+ };
133
+ })();
134
+ animateLine = function(from, to) {
135
+ var anim, startTime;
136
+ _this.options.onStart.call(_this);
137
+ _this.percentage = to;
138
+ Date.now || (Date.now = function() {
139
+ return +(new Date);
140
+ });
141
+ startTime = Date.now();
142
+ anim = function() {
143
+ var currentValue, process;
144
+ process = Math.min(Date.now() - startTime, _this.options.animate);
145
+ _this.ctx.clearRect(-_this.options.size / 2, -_this.options.size / 2, _this.options.size, _this.options.size);
146
+ renderBackground.call(_this);
147
+ currentValue = [easeInOutQuad(process, from, to - from, _this.options.animate)];
148
+ _this.options.onStep.call(_this, currentValue);
149
+ drawLine.call(_this, currentValue);
150
+ if (process >= _this.options.animate) {
151
+ return _this.options.onStop.call(_this, currentValue, to);
152
+ } else {
153
+ return rAF(anim);
154
+ }
155
+ };
156
+ rAF(anim);
157
+ };
158
+ easeInOutQuad = function(t, b, c, d) {
159
+ var easeIn, easing;
160
+ easeIn = function(t) {
161
+ return Math.pow(t, 2);
162
+ };
163
+ easing = function(t) {
164
+ if (t < 1) {
165
+ return easeIn(t);
166
+ } else {
167
+ return 2 - easeIn((t / 2) * -2 + 2);
168
+ }
169
+ };
170
+ t /= d / 2;
171
+ return c / 2 * easing(t) + b;
172
+ };
173
+ return this.init();
174
+ };
175
+ $.easyPieChart.defaultOptions = {
176
+ barColor: '#ef1e25',
177
+ trackColor: '#f2f2f2',
178
+ scaleColor: '#dfe0e0',
179
+ lineCap: 'round',
180
+ rotate: 0,
181
+ size: 110,
182
+ lineWidth: 3,
183
+ animate: false,
184
+ delay: false,
185
+ onStart: $.noop,
186
+ onStop: $.noop,
187
+ onStep: $.noop
188
+ };
189
+ $.fn.easyPieChart = function(options) {
190
+ return $.each(this, function(i, el) {
191
+ var $el, instanceOptions;
192
+ $el = $(el);
193
+ if (!$el.data('easyPieChart')) {
194
+ instanceOptions = $.extend({}, options, $el.data());
195
+ return $el.data('easyPieChart', new $.easyPieChart(el, instanceOptions));
196
+ }
197
+ });
198
+ };
199
+ return void 0;
200
+ })(jQuery);
@@ -0,0 +1,418 @@
1
+ /*
2
+ * Gritter for jQuery
3
+ * http://www.boedesign.com/
4
+ *
5
+ * Copyright (c) 2012 Jordan Boesch
6
+ * Dual licensed under the MIT and GPL licenses.
7
+ *
8
+ * Date: February 24, 2012
9
+ * Version: 1.7.4
10
+ */
11
+
12
+ (function($){
13
+
14
+ /**
15
+ * Set it up as an object under the jQuery namespace
16
+ */
17
+ $.gritter = {};
18
+
19
+ /**
20
+ * Set up global options that the user can over-ride
21
+ */
22
+ $.gritter.options = {
23
+ position: '',
24
+ class_name: '', // could be set to 'gritter-light' to use white notifications
25
+ fade_in_speed: 'medium', // how fast notifications fade in
26
+ fade_out_speed: 1000, // how fast the notices fade out
27
+ time: 6000 // hang on the screen for...
28
+ }
29
+
30
+ /**
31
+ * Add a gritter notification to the screen
32
+ * @see Gritter#add();
33
+ */
34
+ $.gritter.add = function(params){
35
+
36
+ try {
37
+ return Gritter.add(params || {});
38
+ } catch(e) {
39
+
40
+ var err = 'Gritter Error: ' + e;
41
+ (typeof(console) != 'undefined' && console.error) ?
42
+ console.error(err, params) :
43
+ alert(err);
44
+
45
+ }
46
+
47
+ }
48
+
49
+ /**
50
+ * Remove a gritter notification from the screen
51
+ * @see Gritter#removeSpecific();
52
+ */
53
+ $.gritter.remove = function(id, params){
54
+ Gritter.removeSpecific(id, params || {});
55
+ }
56
+
57
+ /**
58
+ * Remove all notifications
59
+ * @see Gritter#stop();
60
+ */
61
+ $.gritter.removeAll = function(params){
62
+ Gritter.stop(params || {});
63
+ }
64
+
65
+ /**
66
+ * Big fat Gritter object
67
+ * @constructor (not really since its object literal)
68
+ */
69
+ var Gritter = {
70
+
71
+ // Public - options to over-ride with $.gritter.options in "add"
72
+ position: '',
73
+ fade_in_speed: '',
74
+ fade_out_speed: '',
75
+ time: '',
76
+
77
+ // Private - no touchy the private parts
78
+ _custom_timer: 0,
79
+ _item_count: 0,
80
+ _is_setup: 0,
81
+ _tpl_close: '<div class="gritter-close"></div>',
82
+ _tpl_title: '<span class="gritter-title">[[title]]</span>',
83
+ _tpl_item: '<div id="gritter-item-[[number]]" class="gritter-item-wrapper [[item_class]]" style="display:none"><div class="gritter-top"></div><div class="gritter-item">[[close]][[image]]<div class="[[class_name]]">[[title]]<p>[[text]]</p></div><div style="clear:both"></div></div><div class="gritter-bottom"></div></div>',
84
+ _tpl_wrap: '<div id="gritter-notice-wrapper"></div>',
85
+
86
+ /**
87
+ * Add a gritter notification to the screen
88
+ * @param {Object} params The object that contains all the options for drawing the notification
89
+ * @return {Integer} The specific numeric id to that gritter notification
90
+ */
91
+ add: function(params){
92
+ // Handle straight text
93
+ if(typeof(params) == 'string'){
94
+ params = {text:params};
95
+ }
96
+
97
+ // We might have some issues if we don't have a title or text!
98
+ if(params.text === null){
99
+ throw 'You must supply "text" parameter.';
100
+ }
101
+
102
+ // Check the options and set them once
103
+ if(!this._is_setup){
104
+ this._runSetup();
105
+ }
106
+
107
+ // Basics
108
+ var title = params.title,
109
+ text = params.text,
110
+ image = params.image || '',
111
+ sticky = params.sticky || false,
112
+ item_class = params.class_name || $.gritter.options.class_name,
113
+ position = $.gritter.options.position,
114
+ time_alive = params.time || '';
115
+
116
+ this._verifyWrapper();
117
+
118
+ this._item_count++;
119
+ var number = this._item_count,
120
+ tmp = this._tpl_item;
121
+
122
+ // Assign callbacks
123
+ $(['before_open', 'after_open', 'before_close', 'after_close']).each(function(i, val){
124
+ Gritter['_' + val + '_' + number] = ($.isFunction(params[val])) ? params[val] : function(){}
125
+ });
126
+
127
+ // Reset
128
+ this._custom_timer = 0;
129
+
130
+ // A custom fade time set
131
+ if(time_alive){
132
+ this._custom_timer = time_alive;
133
+ }
134
+
135
+ var image_str = (image != '') ? '<img src="' + image + '" class="gritter-image" />' : '',
136
+ class_name = (image != '') ? 'gritter-with-image' : 'gritter-without-image';
137
+
138
+ // String replacements on the template
139
+ if(title){
140
+ title = this._str_replace('[[title]]',title,this._tpl_title);
141
+ }else{
142
+ title = '';
143
+ }
144
+
145
+ tmp = this._str_replace(
146
+ ['[[title]]', '[[text]]', '[[close]]', '[[image]]', '[[number]]', '[[class_name]]', '[[item_class]]'],
147
+ [title, text, this._tpl_close, image_str, this._item_count, class_name, item_class], tmp
148
+ );
149
+
150
+ // If it's false, don't show another gritter message
151
+ if(this['_before_open_' + number]() === false){
152
+ return false;
153
+ }
154
+
155
+ $('#gritter-notice-wrapper').addClass(position).append(tmp);
156
+
157
+ var item = $('#gritter-item-' + this._item_count);
158
+
159
+ item.fadeIn(this.fade_in_speed, function(){
160
+ Gritter['_after_open_' + number]($(this));
161
+ });
162
+
163
+ if(!sticky){
164
+ this._setFadeTimer(item, number);
165
+ }
166
+
167
+ // Bind the hover/unhover states
168
+ $(item).bind('mouseenter mouseleave', function(event){
169
+ if(event.type == 'mouseenter'){
170
+ if(!sticky){
171
+ Gritter._restoreItemIfFading($(this), number);
172
+ }
173
+ }
174
+ else {
175
+ if(!sticky){
176
+ Gritter._setFadeTimer($(this), number);
177
+ }
178
+ }
179
+ Gritter._hoverState($(this), event.type);
180
+ });
181
+
182
+ // Clicking (X) makes the perdy thing close
183
+ $(item).find('.gritter-close').click(function(){
184
+ Gritter.removeSpecific(number, {}, null, true);
185
+ });
186
+
187
+ return number;
188
+
189
+ },
190
+
191
+ /**
192
+ * If we don't have any more gritter notifications, get rid of the wrapper using this check
193
+ * @private
194
+ * @param {Integer} unique_id The ID of the element that was just deleted, use it for a callback
195
+ * @param {Object} e The jQuery element that we're going to perform the remove() action on
196
+ * @param {Boolean} manual_close Did we close the gritter dialog with the (X) button
197
+ */
198
+ _countRemoveWrapper: function(unique_id, e, manual_close){
199
+
200
+ // Remove it then run the callback function
201
+ e.remove();
202
+ this['_after_close_' + unique_id](e, manual_close);
203
+
204
+ // Check if the wrapper is empty, if it is.. remove the wrapper
205
+ if($('.gritter-item-wrapper').length == 0){
206
+ $('#gritter-notice-wrapper').remove();
207
+ }
208
+
209
+ },
210
+
211
+ /**
212
+ * Fade out an element after it's been on the screen for x amount of time
213
+ * @private
214
+ * @param {Object} e The jQuery element to get rid of
215
+ * @param {Integer} unique_id The id of the element to remove
216
+ * @param {Object} params An optional list of params to set fade speeds etc.
217
+ * @param {Boolean} unbind_events Unbind the mouseenter/mouseleave events if they click (X)
218
+ */
219
+ _fade: function(e, unique_id, params, unbind_events){
220
+
221
+ var params = params || {},
222
+ fade = (typeof(params.fade) != 'undefined') ? params.fade : true,
223
+ fade_out_speed = params.speed || this.fade_out_speed,
224
+ manual_close = unbind_events;
225
+
226
+ this['_before_close_' + unique_id](e, manual_close);
227
+
228
+ // If this is true, then we are coming from clicking the (X)
229
+ if(unbind_events){
230
+ e.unbind('mouseenter mouseleave');
231
+ }
232
+
233
+ // Fade it out or remove it
234
+ if(fade){
235
+
236
+ e.animate({
237
+ opacity: 0
238
+ }, fade_out_speed, function(){
239
+ e.animate({ height: 0 }, 300, function(){
240
+ Gritter._countRemoveWrapper(unique_id, e, manual_close);
241
+ })
242
+ })
243
+
244
+ }
245
+ else {
246
+
247
+ this._countRemoveWrapper(unique_id, e);
248
+
249
+ }
250
+
251
+ },
252
+
253
+ /**
254
+ * Perform actions based on the type of bind (mouseenter, mouseleave)
255
+ * @private
256
+ * @param {Object} e The jQuery element
257
+ * @param {String} type The type of action we're performing: mouseenter or mouseleave
258
+ */
259
+ _hoverState: function(e, type){
260
+
261
+ // Change the border styles and add the (X) close button when you hover
262
+ if(type == 'mouseenter'){
263
+
264
+ e.addClass('hover');
265
+
266
+ // Show close button
267
+ e.find('.gritter-close').show();
268
+
269
+ }
270
+ // Remove the border styles and hide (X) close button when you mouse out
271
+ else {
272
+
273
+ e.removeClass('hover');
274
+
275
+ // Hide close button
276
+ e.find('.gritter-close').hide();
277
+
278
+ }
279
+
280
+ },
281
+
282
+ /**
283
+ * Remove a specific notification based on an ID
284
+ * @param {Integer} unique_id The ID used to delete a specific notification
285
+ * @param {Object} params A set of options passed in to determine how to get rid of it
286
+ * @param {Object} e The jQuery element that we're "fading" then removing
287
+ * @param {Boolean} unbind_events If we clicked on the (X) we set this to true to unbind mouseenter/mouseleave
288
+ */
289
+ removeSpecific: function(unique_id, params, e, unbind_events){
290
+
291
+ if(!e){
292
+ var e = $('#gritter-item-' + unique_id);
293
+ }
294
+
295
+ // We set the fourth param to let the _fade function know to
296
+ // unbind the "mouseleave" event. Once you click (X) there's no going back!
297
+ this._fade(e, unique_id, params || {}, unbind_events);
298
+
299
+ },
300
+
301
+ /**
302
+ * If the item is fading out and we hover over it, restore it!
303
+ * @private
304
+ * @param {Object} e The HTML element to remove
305
+ * @param {Integer} unique_id The ID of the element
306
+ */
307
+ _restoreItemIfFading: function(e, unique_id){
308
+
309
+ clearTimeout(this['_int_id_' + unique_id]);
310
+ e.stop().css({ opacity: '', height: '' });
311
+
312
+ },
313
+
314
+ /**
315
+ * Setup the global options - only once
316
+ * @private
317
+ */
318
+ _runSetup: function(){
319
+
320
+ for(opt in $.gritter.options){
321
+ this[opt] = $.gritter.options[opt];
322
+ }
323
+ this._is_setup = 1;
324
+
325
+ },
326
+
327
+ /**
328
+ * Set the notification to fade out after a certain amount of time
329
+ * @private
330
+ * @param {Object} item The HTML element we're dealing with
331
+ * @param {Integer} unique_id The ID of the element
332
+ */
333
+ _setFadeTimer: function(e, unique_id){
334
+
335
+ var timer_str = (this._custom_timer) ? this._custom_timer : this.time;
336
+ this['_int_id_' + unique_id] = setTimeout(function(){
337
+ Gritter._fade(e, unique_id);
338
+ }, timer_str);
339
+
340
+ },
341
+
342
+ /**
343
+ * Bring everything to a halt
344
+ * @param {Object} params A list of callback functions to pass when all notifications are removed
345
+ */
346
+ stop: function(params){
347
+
348
+ // callbacks (if passed)
349
+ var before_close = ($.isFunction(params.before_close)) ? params.before_close : function(){};
350
+ var after_close = ($.isFunction(params.after_close)) ? params.after_close : function(){};
351
+
352
+ var wrap = $('#gritter-notice-wrapper');
353
+ before_close(wrap);
354
+ wrap.fadeOut(function(){
355
+ $(this).remove();
356
+ after_close();
357
+ });
358
+
359
+ },
360
+
361
+ /**
362
+ * An extremely handy PHP function ported to JS, works well for templating
363
+ * @private
364
+ * @param {String/Array} search A list of things to search for
365
+ * @param {String/Array} replace A list of things to replace the searches with
366
+ * @return {String} sa The output
367
+ */
368
+ _str_replace: function(search, replace, subject, count){
369
+
370
+ var i = 0, j = 0, temp = '', repl = '', sl = 0, fl = 0,
371
+ f = [].concat(search),
372
+ r = [].concat(replace),
373
+ s = subject,
374
+ ra = r instanceof Array, sa = s instanceof Array;
375
+ s = [].concat(s);
376
+
377
+ if(count){
378
+ this.window[count] = 0;
379
+ }
380
+
381
+ for(i = 0, sl = s.length; i < sl; i++){
382
+
383
+ if(s[i] === ''){
384
+ continue;
385
+ }
386
+
387
+ for (j = 0, fl = f.length; j < fl; j++){
388
+
389
+ temp = s[i] + '';
390
+ repl = ra ? (r[j] !== undefined ? r[j] : '') : r[0];
391
+ s[i] = (temp).split(f[j]).join(repl);
392
+
393
+ if(count && s[i] !== temp){
394
+ this.window[count] += (temp.length-s[i].length) / f[j].length;
395
+ }
396
+
397
+ }
398
+ }
399
+
400
+ return sa ? s : s[0];
401
+
402
+ },
403
+
404
+ /**
405
+ * A check to make sure we have something to wrap our notices with
406
+ * @private
407
+ */
408
+ _verifyWrapper: function(){
409
+
410
+ if($('#gritter-notice-wrapper').length == 0){
411
+ $('body').append(this._tpl_wrap);
412
+ }
413
+
414
+ }
415
+
416
+ }
417
+
418
+ })(jQuery);