messengerjs-rails 1.4.1 → 1.5.0
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.
- checksums.yaml +5 -5
- data/lib/messengerjs-rails/version.rb +1 -1
- data/vendor/assets/javascripts/messenger-theme-flat.js +5 -5
- data/vendor/assets/javascripts/messenger-theme-future.js +5 -5
- data/vendor/assets/javascripts/messenger.js +336 -327
- data/vendor/assets/javascripts/messenger.min.js +2 -2
- data/vendor/assets/stylesheets/messenger-spinner.css +21 -91
- data/vendor/assets/stylesheets/messenger-theme-air.css +49 -129
- data/vendor/assets/stylesheets/messenger-theme-block.css +2 -2
- data/vendor/assets/stylesheets/messenger-theme-flat.css +45 -133
- data/vendor/assets/stylesheets/messenger-theme-future.css +69 -153
- data/vendor/assets/stylesheets/messenger-theme-ice.css +19 -23
- data/vendor/assets/stylesheets/messenger.css +5 -1
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d918a00e803028c04bc87cd08c88e1ea6342235af12f161ae974bf90eaabc0a0
|
4
|
+
data.tar.gz: cce229915232c3cd11594d4ab8948ee23723b9f35557ce76437748740660fc09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e7ba7f4e2e05c2ea8dadf3c46f25f5702e3dfeea355537d5a5cb876c7fb541e8e6edac1f423b6a6f16cdfb36956029918fd0883d6005a899ec9dde817ef2870
|
7
|
+
data.tar.gz: 601042460a367690629bbcc63d655d9f8bd4a0a6aa02b56f8ba6e0a27a213297ea3b83226c552a634bd90fe33c24e3b4a6dd348c7e6313cc1cac7b8208cd40a6
|
@@ -1,13 +1,13 @@
|
|
1
|
-
(function() {
|
1
|
+
(function () {
|
2
2
|
var $, FlatMessage, spinner_template,
|
3
3
|
__hasProp = {}.hasOwnProperty,
|
4
|
-
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
4
|
+
__extends = function (child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
5
5
|
|
6
6
|
$ = jQuery;
|
7
7
|
|
8
8
|
spinner_template = '<div class="messenger-spinner">\n <span class="messenger-spinner-side messenger-spinner-side-left">\n <span class="messenger-spinner-fill"></span>\n </span>\n <span class="messenger-spinner-side messenger-spinner-side-right">\n <span class="messenger-spinner-fill"></span>\n </span>\n</div>';
|
9
9
|
|
10
|
-
FlatMessage = (function(_super) {
|
10
|
+
FlatMessage = (function (_super) {
|
11
11
|
|
12
12
|
__extends(FlatMessage, _super);
|
13
13
|
|
@@ -15,7 +15,7 @@
|
|
15
15
|
return FlatMessage.__super__.constructor.apply(this, arguments);
|
16
16
|
}
|
17
17
|
|
18
|
-
FlatMessage.prototype.template = function(opts) {
|
18
|
+
FlatMessage.prototype.template = function (opts) {
|
19
19
|
var $message;
|
20
20
|
$message = FlatMessage.__super__.template.apply(this, arguments);
|
21
21
|
$message.append($(spinner_template));
|
@@ -30,4 +30,4 @@
|
|
30
30
|
Message: FlatMessage
|
31
31
|
};
|
32
32
|
|
33
|
-
}).call(this);
|
33
|
+
}).call(this);
|
@@ -1,13 +1,13 @@
|
|
1
|
-
(function() {
|
1
|
+
(function () {
|
2
2
|
var $, FutureMessage, spinner_template,
|
3
3
|
__hasProp = {}.hasOwnProperty,
|
4
|
-
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
4
|
+
__extends = function (child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
5
5
|
|
6
6
|
$ = jQuery;
|
7
7
|
|
8
8
|
spinner_template = '<div class="messenger-spinner">\n <span class="messenger-spinner-side messenger-spinner-side-left">\n <span class="messenger-spinner-fill"></span>\n </span>\n <span class="messenger-spinner-side messenger-spinner-side-right">\n <span class="messenger-spinner-fill"></span>\n </span>\n</div>';
|
9
9
|
|
10
|
-
FutureMessage = (function(_super) {
|
10
|
+
FutureMessage = (function (_super) {
|
11
11
|
|
12
12
|
__extends(FutureMessage, _super);
|
13
13
|
|
@@ -15,7 +15,7 @@
|
|
15
15
|
return FutureMessage.__super__.constructor.apply(this, arguments);
|
16
16
|
}
|
17
17
|
|
18
|
-
FutureMessage.prototype.template = function(opts) {
|
18
|
+
FutureMessage.prototype.template = function (opts) {
|
19
19
|
var $message;
|
20
20
|
$message = FutureMessage.__super__.template.apply(this, arguments);
|
21
21
|
$message.append($(spinner_template));
|
@@ -30,4 +30,4 @@
|
|
30
30
|
Message: FutureMessage
|
31
31
|
};
|
32
32
|
|
33
|
-
}).call(this);
|
33
|
+
}).call(this);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! messenger 1.
|
1
|
+
/*! messenger 1.5.0 */
|
2
2
|
/*
|
3
3
|
* This file begins the output concatenated into messenger.js
|
4
4
|
*
|
@@ -6,19 +6,19 @@
|
|
6
6
|
* (for noConflict), and making it a callable function.
|
7
7
|
*/
|
8
8
|
|
9
|
-
(function(){
|
10
|
-
|
11
|
-
|
9
|
+
(function () {
|
10
|
+
var _prevMessenger = window.Messenger;
|
11
|
+
var localMessenger;
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
localMessenger = window.Messenger = function () {
|
14
|
+
return localMessenger._call.apply(this, arguments);
|
15
|
+
}
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
window.Messenger.noConflict = function () {
|
18
|
+
window.Messenger = _prevMessenger;
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
return localMessenger;
|
21
|
+
}
|
22
22
|
})();
|
23
23
|
|
24
24
|
/*
|
@@ -28,282 +28,282 @@
|
|
28
28
|
* Portions taken from Underscore.js and Backbone.js
|
29
29
|
* Both of which are Copyright (c) 2009-2013 Jeremy Ashkenas, DocumentCloud
|
30
30
|
*/
|
31
|
-
window.Messenger._ = (function() {
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
}
|
79
|
-
}
|
31
|
+
window.Messenger._ = (function () {
|
32
|
+
if (window._)
|
33
|
+
return window._
|
34
|
+
|
35
|
+
var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
|
36
|
+
|
37
|
+
// Create quick reference variables for speed access to core prototypes.
|
38
|
+
var push = ArrayProto.push,
|
39
|
+
slice = ArrayProto.slice,
|
40
|
+
concat = ArrayProto.concat,
|
41
|
+
toString = ObjProto.toString,
|
42
|
+
hasOwnProperty = ObjProto.hasOwnProperty;
|
43
|
+
|
44
|
+
// All **ECMAScript 5** native function implementations that we hope to use
|
45
|
+
// are declared here.
|
46
|
+
var
|
47
|
+
nativeForEach = ArrayProto.forEach,
|
48
|
+
nativeMap = ArrayProto.map,
|
49
|
+
nativeReduce = ArrayProto.reduce,
|
50
|
+
nativeReduceRight = ArrayProto.reduceRight,
|
51
|
+
nativeFilter = ArrayProto.filter,
|
52
|
+
nativeEvery = ArrayProto.every,
|
53
|
+
nativeSome = ArrayProto.some,
|
54
|
+
nativeIndexOf = ArrayProto.indexOf,
|
55
|
+
nativeLastIndexOf = ArrayProto.lastIndexOf,
|
56
|
+
nativeIsArray = Array.isArray,
|
57
|
+
nativeKeys = Object.keys,
|
58
|
+
nativeBind = FuncProto.bind;
|
59
|
+
|
60
|
+
// Create a safe reference to the Underscore object for use below.
|
61
|
+
var _ = {};
|
62
|
+
|
63
|
+
// Establish the object that gets returned to break out of a loop iteration.
|
64
|
+
var breaker = {};
|
65
|
+
|
66
|
+
var each = _.each = _.forEach = function (obj, iterator, context) {
|
67
|
+
if (obj == null) return;
|
68
|
+
if (nativeForEach && obj.forEach === nativeForEach) {
|
69
|
+
obj.forEach(iterator, context);
|
70
|
+
} else if (obj.length === +obj.length) {
|
71
|
+
for (var i = 0, l = obj.length; i < l; i++) {
|
72
|
+
if (iterator.call(context, obj[i], i, obj) === breaker) return;
|
73
|
+
}
|
74
|
+
} else {
|
75
|
+
for (var key in obj) {
|
76
|
+
if (_.has(obj, key)) {
|
77
|
+
if (iterator.call(context, obj[key], key, obj) === breaker) return;
|
80
78
|
}
|
81
|
-
|
79
|
+
}
|
80
|
+
}
|
81
|
+
};
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
83
|
+
_.result = function (object, property) {
|
84
|
+
if (object == null) return null;
|
85
|
+
var value = object[property];
|
86
|
+
return _.isFunction(value) ? value.call(object) : value;
|
87
|
+
};
|
88
88
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
};
|
89
|
+
_.once = function (func) {
|
90
|
+
var ran = false, memo;
|
91
|
+
return function () {
|
92
|
+
if (ran) return memo;
|
93
|
+
ran = true;
|
94
|
+
memo = func.apply(this, arguments);
|
95
|
+
func = null;
|
96
|
+
return memo;
|
98
97
|
};
|
98
|
+
};
|
99
99
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
100
|
+
var idCounter = 0;
|
101
|
+
_.uniqueId = function (prefix) {
|
102
|
+
var id = ++idCounter + '';
|
103
|
+
return prefix ? prefix + id : id;
|
104
|
+
};
|
105
105
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
106
|
+
_.filter = _.select = function (obj, iterator, context) {
|
107
|
+
var results = [];
|
108
|
+
if (obj == null) return results;
|
109
|
+
if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context);
|
110
|
+
each(obj, function (value, index, list) {
|
111
|
+
if (iterator.call(context, value, index, list)) results[results.length] = value;
|
112
|
+
});
|
113
|
+
return results;
|
114
|
+
};
|
115
|
+
|
116
|
+
// Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp.
|
117
|
+
each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function (name) {
|
118
|
+
_['is' + name] = function (obj) {
|
119
|
+
return toString.call(obj) == '[object ' + name + ']';
|
114
120
|
};
|
121
|
+
});
|
115
122
|
|
116
|
-
|
117
|
-
each(
|
118
|
-
|
119
|
-
|
120
|
-
|
123
|
+
_.defaults = function (obj) {
|
124
|
+
each(slice.call(arguments, 1), function (source) {
|
125
|
+
if (source) {
|
126
|
+
for (var prop in source) {
|
127
|
+
if (obj[prop] == null) obj[prop] = source[prop];
|
128
|
+
}
|
129
|
+
}
|
121
130
|
});
|
131
|
+
return obj;
|
132
|
+
};
|
122
133
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
134
|
+
_.extend = function (obj) {
|
135
|
+
each(slice.call(arguments, 1), function (source) {
|
136
|
+
if (source) {
|
137
|
+
for (var prop in source) {
|
138
|
+
obj[prop] = source[prop];
|
139
|
+
}
|
140
|
+
}
|
141
|
+
});
|
142
|
+
return obj;
|
143
|
+
};
|
133
144
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
}
|
141
|
-
});
|
142
|
-
return obj;
|
143
|
-
};
|
145
|
+
_.keys = nativeKeys || function (obj) {
|
146
|
+
if (obj !== Object(obj)) throw new TypeError('Invalid object');
|
147
|
+
var keys = [];
|
148
|
+
for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key;
|
149
|
+
return keys;
|
150
|
+
};
|
144
151
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
152
|
+
_.bind = function (func, context) {
|
153
|
+
if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
|
154
|
+
var args = slice.call(arguments, 2);
|
155
|
+
return function () {
|
156
|
+
return func.apply(context, args.concat(slice.call(arguments)));
|
150
157
|
};
|
158
|
+
};
|
151
159
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
160
|
+
_.isObject = function (obj) {
|
161
|
+
return obj === Object(obj);
|
162
|
+
};
|
163
|
+
|
164
|
+
return _;
|
165
|
+
})();
|
166
|
+
|
167
|
+
window.Messenger.Events = (function () {
|
168
|
+
if (window.Backbone && Backbone.Events) {
|
169
|
+
return Backbone.Events;
|
170
|
+
}
|
171
|
+
|
172
|
+
var eventsShim = function () {
|
173
|
+
var eventSplitter = /\s+/;
|
174
|
+
|
175
|
+
var eventsApi = function (obj, action, name, rest) {
|
176
|
+
if (!name) return true;
|
177
|
+
if (typeof name === 'object') {
|
178
|
+
for (var key in name) {
|
179
|
+
obj[action].apply(obj, [key, name[key]].concat(rest));
|
180
|
+
}
|
181
|
+
} else if (eventSplitter.test(name)) {
|
182
|
+
var names = name.split(eventSplitter);
|
183
|
+
for (var i = 0, l = names.length; i < l; i++) {
|
184
|
+
obj[action].apply(obj, [names[i]].concat(rest));
|
185
|
+
}
|
186
|
+
} else {
|
187
|
+
return true;
|
188
|
+
}
|
158
189
|
};
|
159
190
|
|
160
|
-
|
161
|
-
|
191
|
+
var triggerEvents = function (events, args) {
|
192
|
+
var ev, i = -1, l = events.length;
|
193
|
+
switch (args.length) {
|
194
|
+
case 0: while (++i < l) (ev = events[i]).callback.call(ev.ctx);
|
195
|
+
return;
|
196
|
+
case 1: while (++i < l) (ev = events[i]).callback.call(ev.ctx, args[0]);
|
197
|
+
return;
|
198
|
+
case 2: while (++i < l) (ev = events[i]).callback.call(ev.ctx, args[0], args[1]);
|
199
|
+
return;
|
200
|
+
case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, args[0], args[1], args[2]);
|
201
|
+
return;
|
202
|
+
default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args);
|
203
|
+
}
|
162
204
|
};
|
163
205
|
|
164
|
-
|
165
|
-
})();
|
206
|
+
var Events = {
|
166
207
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
208
|
+
on: function (name, callback, context) {
|
209
|
+
if (!(eventsApi(this, 'on', name, [callback, context]) && callback)) return this;
|
210
|
+
this._events || (this._events = {});
|
211
|
+
var list = this._events[name] || (this._events[name] = []);
|
212
|
+
list.push({ callback: callback, context: context, ctx: context || this });
|
213
|
+
return this;
|
214
|
+
},
|
171
215
|
|
172
|
-
|
173
|
-
|
216
|
+
once: function (name, callback, context) {
|
217
|
+
if (!(eventsApi(this, 'once', name, [callback, context]) && callback)) return this;
|
218
|
+
var self = this;
|
219
|
+
var once = _.once(function () {
|
220
|
+
self.off(name, once);
|
221
|
+
callback.apply(this, arguments);
|
222
|
+
});
|
223
|
+
once._callback = callback;
|
224
|
+
this.on(name, once, context);
|
225
|
+
return this;
|
226
|
+
},
|
174
227
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
var names = name.split(eventSplitter);
|
183
|
-
for (var i = 0, l = names.length; i < l; i++) {
|
184
|
-
obj[action].apply(obj, [names[i]].concat(rest));
|
185
|
-
}
|
186
|
-
} else {
|
187
|
-
return true;
|
188
|
-
}
|
189
|
-
};
|
228
|
+
off: function (name, callback, context) {
|
229
|
+
var list, ev, events, names, i, l, j, k;
|
230
|
+
if (!this._events || !eventsApi(this, 'off', name, [callback, context])) return this;
|
231
|
+
if (!name && !callback && !context) {
|
232
|
+
this._events = {};
|
233
|
+
return this;
|
234
|
+
}
|
190
235
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
236
|
+
names = name ? [name] : _.keys(this._events);
|
237
|
+
for (i = 0, l = names.length; i < l; i++) {
|
238
|
+
name = names[i];
|
239
|
+
if (list = this._events[name]) {
|
240
|
+
events = [];
|
241
|
+
if (callback || context) {
|
242
|
+
for (j = 0, k = list.length; j < k; j++) {
|
243
|
+
ev = list[j];
|
244
|
+
if ((callback && callback !== ev.callback &&
|
245
|
+
callback !== ev.callback._callback) ||
|
246
|
+
(context && context !== ev.context)) {
|
247
|
+
events.push(ev);
|
248
|
+
}
|
249
|
+
}
|
203
250
|
}
|
204
|
-
|
251
|
+
this._events[name] = events;
|
252
|
+
}
|
253
|
+
}
|
205
254
|
|
206
|
-
|
207
|
-
|
208
|
-
on: function(name, callback, context) {
|
209
|
-
if (!(eventsApi(this, 'on', name, [callback, context]) && callback)) return this;
|
210
|
-
this._events || (this._events = {});
|
211
|
-
var list = this._events[name] || (this._events[name] = []);
|
212
|
-
list.push({callback: callback, context: context, ctx: context || this});
|
213
|
-
return this;
|
214
|
-
},
|
215
|
-
|
216
|
-
once: function(name, callback, context) {
|
217
|
-
if (!(eventsApi(this, 'once', name, [callback, context]) && callback)) return this;
|
218
|
-
var self = this;
|
219
|
-
var once = _.once(function() {
|
220
|
-
self.off(name, once);
|
221
|
-
callback.apply(this, arguments);
|
222
|
-
});
|
223
|
-
once._callback = callback;
|
224
|
-
this.on(name, once, context);
|
225
|
-
return this;
|
226
|
-
},
|
227
|
-
|
228
|
-
off: function(name, callback, context) {
|
229
|
-
var list, ev, events, names, i, l, j, k;
|
230
|
-
if (!this._events || !eventsApi(this, 'off', name, [callback, context])) return this;
|
231
|
-
if (!name && !callback && !context) {
|
232
|
-
this._events = {};
|
233
|
-
return this;
|
234
|
-
}
|
255
|
+
return this;
|
256
|
+
},
|
235
257
|
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
(context && context !== ev.context)) {
|
247
|
-
events.push(ev);
|
248
|
-
}
|
249
|
-
}
|
250
|
-
}
|
251
|
-
this._events[name] = events;
|
252
|
-
}
|
253
|
-
}
|
258
|
+
trigger: function (name) {
|
259
|
+
if (!this._events) return this;
|
260
|
+
var args = Array.prototype.slice.call(arguments, 1);
|
261
|
+
if (!eventsApi(this, 'trigger', name, args)) return this;
|
262
|
+
var events = this._events[name];
|
263
|
+
var allEvents = this._events.all;
|
264
|
+
if (events) triggerEvents(events, args);
|
265
|
+
if (allEvents) triggerEvents(allEvents, arguments);
|
266
|
+
return this;
|
267
|
+
},
|
254
268
|
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
var events = this._events[name];
|
263
|
-
var allEvents = this._events.all;
|
264
|
-
if (events) triggerEvents(events, args);
|
265
|
-
if (allEvents) triggerEvents(allEvents, arguments);
|
266
|
-
return this;
|
267
|
-
},
|
268
|
-
|
269
|
-
listenTo: function(obj, name, callback) {
|
270
|
-
var listeners = this._listeners || (this._listeners = {});
|
271
|
-
var id = obj._listenerId || (obj._listenerId = _.uniqueId('l'));
|
272
|
-
listeners[id] = obj;
|
273
|
-
obj.on(name, typeof name === 'object' ? this : callback, this);
|
274
|
-
return this;
|
275
|
-
},
|
276
|
-
|
277
|
-
stopListening: function(obj, name, callback) {
|
278
|
-
var listeners = this._listeners;
|
279
|
-
if (!listeners) return;
|
280
|
-
if (obj) {
|
281
|
-
obj.off(name, typeof name === 'object' ? this : callback, this);
|
282
|
-
if (!name && !callback) delete listeners[obj._listenerId];
|
283
|
-
} else {
|
284
|
-
if (typeof name === 'object') callback = this;
|
285
|
-
for (var id in listeners) {
|
286
|
-
listeners[id].off(name, callback, this);
|
287
|
-
}
|
288
|
-
this._listeners = {};
|
289
|
-
}
|
290
|
-
return this;
|
291
|
-
}
|
292
|
-
};
|
269
|
+
listenTo: function (obj, name, callback) {
|
270
|
+
var listeners = this._listeners || (this._listeners = {});
|
271
|
+
var id = obj._listenerId || (obj._listenerId = _.uniqueId('l'));
|
272
|
+
listeners[id] = obj;
|
273
|
+
obj.on(name, typeof name === 'object' ? this : callback, this);
|
274
|
+
return this;
|
275
|
+
},
|
293
276
|
|
294
|
-
|
295
|
-
|
296
|
-
return
|
277
|
+
stopListening: function (obj, name, callback) {
|
278
|
+
var listeners = this._listeners;
|
279
|
+
if (!listeners) return;
|
280
|
+
if (obj) {
|
281
|
+
obj.off(name, typeof name === 'object' ? this : callback, this);
|
282
|
+
if (!name && !callback) delete listeners[obj._listenerId];
|
283
|
+
} else {
|
284
|
+
if (typeof name === 'object') callback = this;
|
285
|
+
for (var id in listeners) {
|
286
|
+
listeners[id].off(name, callback, this);
|
287
|
+
}
|
288
|
+
this._listeners = {};
|
289
|
+
}
|
290
|
+
return this;
|
291
|
+
}
|
297
292
|
};
|
298
|
-
|
293
|
+
|
294
|
+
Events.bind = Events.on;
|
295
|
+
Events.unbind = Events.off;
|
296
|
+
return Events;
|
297
|
+
};
|
298
|
+
return eventsShim();
|
299
299
|
})();
|
300
300
|
|
301
|
-
(function() {
|
301
|
+
(function () {
|
302
302
|
var $, ActionMessenger, BaseView, Events, RetryingMessage, _, _Message, _Messenger, _ref, _ref1, _ref2,
|
303
303
|
__hasProp = {}.hasOwnProperty,
|
304
|
-
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
304
|
+
__extends = function (child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
305
305
|
__slice = [].slice,
|
306
|
-
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
306
|
+
__indexOf = [].indexOf || function (item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
307
307
|
|
308
308
|
$ = jQuery;
|
309
309
|
|
@@ -311,7 +311,7 @@ window.Messenger.Events = (function() {
|
|
311
311
|
|
312
312
|
Events = (_ref1 = typeof Backbone !== "undefined" && Backbone !== null ? Backbone.Events : void 0) != null ? _ref1 : window.Messenger.Events;
|
313
313
|
|
314
|
-
BaseView = (function() {
|
314
|
+
BaseView = (function () {
|
315
315
|
|
316
316
|
function BaseView(options) {
|
317
317
|
$.extend(this, Events);
|
@@ -324,12 +324,12 @@ window.Messenger.Events = (function() {
|
|
324
324
|
this.initialize.apply(this, arguments);
|
325
325
|
}
|
326
326
|
|
327
|
-
BaseView.prototype.setElement = function(el) {
|
327
|
+
BaseView.prototype.setElement = function (el) {
|
328
328
|
this.$el = $(el);
|
329
329
|
return this.el = this.$el[0];
|
330
330
|
};
|
331
331
|
|
332
|
-
BaseView.prototype.delegateEvents = function(events) {
|
332
|
+
BaseView.prototype.delegateEvents = function (events) {
|
333
333
|
var delegateEventSplitter, eventName, key, match, method, selector, _results;
|
334
334
|
if (!(events || (events = _.result(this, "events")))) {
|
335
335
|
return;
|
@@ -359,7 +359,7 @@ window.Messenger.Events = (function() {
|
|
359
359
|
return _results;
|
360
360
|
};
|
361
361
|
|
362
|
-
BaseView.prototype.jqon = function(eventName, selector, method) {
|
362
|
+
BaseView.prototype.jqon = function (eventName, selector, method) {
|
363
363
|
var _ref2;
|
364
364
|
if (this.$el.on != null) {
|
365
365
|
return (_ref2 = this.$el).on.apply(_ref2, arguments);
|
@@ -376,7 +376,7 @@ window.Messenger.Events = (function() {
|
|
376
376
|
}
|
377
377
|
};
|
378
378
|
|
379
|
-
BaseView.prototype.jqoff = function(eventName) {
|
379
|
+
BaseView.prototype.jqoff = function (eventName) {
|
380
380
|
var _ref2;
|
381
381
|
if (this.$el.off != null) {
|
382
382
|
return (_ref2 = this.$el).off.apply(_ref2, arguments);
|
@@ -386,11 +386,11 @@ window.Messenger.Events = (function() {
|
|
386
386
|
}
|
387
387
|
};
|
388
388
|
|
389
|
-
BaseView.prototype.undelegateEvents = function() {
|
389
|
+
BaseView.prototype.undelegateEvents = function () {
|
390
390
|
return this.jqoff(".delegateEvents" + this.cid);
|
391
391
|
};
|
392
392
|
|
393
|
-
BaseView.prototype.remove = function() {
|
393
|
+
BaseView.prototype.remove = function () {
|
394
394
|
this.undelegateEvents();
|
395
395
|
return this.$el.remove();
|
396
396
|
};
|
@@ -399,7 +399,7 @@ window.Messenger.Events = (function() {
|
|
399
399
|
|
400
400
|
})();
|
401
401
|
|
402
|
-
_Message = (function(_super) {
|
402
|
+
_Message = (function (_super) {
|
403
403
|
|
404
404
|
__extends(_Message, _super);
|
405
405
|
|
@@ -410,10 +410,11 @@ window.Messenger.Events = (function() {
|
|
410
410
|
_Message.prototype.defaults = {
|
411
411
|
hideAfter: 10,
|
412
412
|
scroll: true,
|
413
|
-
closeButtonText: "×"
|
413
|
+
closeButtonText: "×",
|
414
|
+
escapeText: false
|
414
415
|
};
|
415
416
|
|
416
|
-
_Message.prototype.initialize = function(opts) {
|
417
|
+
_Message.prototype.initialize = function (opts) {
|
417
418
|
if (opts == null) {
|
418
419
|
opts = {};
|
419
420
|
}
|
@@ -423,7 +424,7 @@ window.Messenger.Events = (function() {
|
|
423
424
|
return this.options = $.extend({}, this.options, opts, this.defaults);
|
424
425
|
};
|
425
426
|
|
426
|
-
_Message.prototype.show = function() {
|
427
|
+
_Message.prototype.show = function () {
|
427
428
|
var wasShown;
|
428
429
|
if (!this.rendered) {
|
429
430
|
this.render();
|
@@ -436,7 +437,7 @@ window.Messenger.Events = (function() {
|
|
436
437
|
}
|
437
438
|
};
|
438
439
|
|
439
|
-
_Message.prototype.hide = function() {
|
440
|
+
_Message.prototype.hide = function () {
|
440
441
|
var wasShown;
|
441
442
|
if (!this.rendered) {
|
442
443
|
return;
|
@@ -449,11 +450,11 @@ window.Messenger.Events = (function() {
|
|
449
450
|
}
|
450
451
|
};
|
451
452
|
|
452
|
-
_Message.prototype.cancel = function() {
|
453
|
+
_Message.prototype.cancel = function () {
|
453
454
|
return this.hide();
|
454
455
|
};
|
455
456
|
|
456
|
-
_Message.prototype.update = function(opts) {
|
457
|
+
_Message.prototype.update = function (opts) {
|
457
458
|
var _ref2,
|
458
459
|
_this = this;
|
459
460
|
if (_.isString(opts)) {
|
@@ -474,7 +475,7 @@ window.Messenger.Events = (function() {
|
|
474
475
|
if (this._hideTimeout != null) {
|
475
476
|
clearTimeout(this._hideTimeout);
|
476
477
|
}
|
477
|
-
this._hideTimeout = setTimeout(function() {
|
478
|
+
this._hideTimeout = setTimeout(function () {
|
478
479
|
return _this.hide();
|
479
480
|
}, this.options.hideAfter * 1000);
|
480
481
|
} else {
|
@@ -483,7 +484,7 @@ window.Messenger.Events = (function() {
|
|
483
484
|
if (this.options.hideOnNavigate) {
|
484
485
|
this.$message.addClass('messenger-will-hide-on-navigate');
|
485
486
|
if ((typeof Backbone !== "undefined" && Backbone !== null ? Backbone.history : void 0) != null) {
|
486
|
-
Backbone.history.on('route', function() {
|
487
|
+
Backbone.history.on('route', function () {
|
487
488
|
return _this.hide();
|
488
489
|
});
|
489
490
|
}
|
@@ -493,7 +494,7 @@ window.Messenger.Events = (function() {
|
|
493
494
|
return this.trigger('update', this);
|
494
495
|
};
|
495
496
|
|
496
|
-
_Message.prototype.scrollTo = function() {
|
497
|
+
_Message.prototype.scrollTo = function () {
|
497
498
|
if (!this.options.scroll) {
|
498
499
|
return;
|
499
500
|
}
|
@@ -506,7 +507,7 @@ window.Messenger.Events = (function() {
|
|
506
507
|
});
|
507
508
|
};
|
508
509
|
|
509
|
-
_Message.prototype.timeSinceUpdate = function() {
|
510
|
+
_Message.prototype.timeSinceUpdate = function () {
|
510
511
|
if (this.lastUpdate) {
|
511
512
|
return (new Date) - this.lastUpdate;
|
512
513
|
} else {
|
@@ -514,15 +515,15 @@ window.Messenger.Events = (function() {
|
|
514
515
|
}
|
515
516
|
};
|
516
517
|
|
517
|
-
_Message.prototype.actionsToEvents = function() {
|
518
|
+
_Message.prototype.actionsToEvents = function () {
|
518
519
|
var act, name, _ref2, _results,
|
519
520
|
_this = this;
|
520
521
|
_ref2 = this.options.actions;
|
521
522
|
_results = [];
|
522
523
|
for (name in _ref2) {
|
523
524
|
act = _ref2[name];
|
524
|
-
_results.push(this.events["click [data-action=\"" + name + "\"] a"] = (function(act) {
|
525
|
-
return function(e) {
|
525
|
+
_results.push(this.events["click [data-action=\"" + name + "\"] a"] = (function (act) {
|
526
|
+
return function (e) {
|
526
527
|
e.preventDefault();
|
527
528
|
e.stopPropagation();
|
528
529
|
_this.trigger("action:" + name, act, e);
|
@@ -533,7 +534,7 @@ window.Messenger.Events = (function() {
|
|
533
534
|
return _results;
|
534
535
|
};
|
535
536
|
|
536
|
-
_Message.prototype.checkClickable = function() {
|
537
|
+
_Message.prototype.checkClickable = function () {
|
537
538
|
var evt, name, _ref2, _results;
|
538
539
|
_ref2 = this.events;
|
539
540
|
_results = [];
|
@@ -548,13 +549,13 @@ window.Messenger.Events = (function() {
|
|
548
549
|
return _results;
|
549
550
|
};
|
550
551
|
|
551
|
-
_Message.prototype.undelegateEvents = function() {
|
552
|
+
_Message.prototype.undelegateEvents = function () {
|
552
553
|
var _ref2;
|
553
554
|
_Message.__super__.undelegateEvents.apply(this, arguments);
|
554
555
|
return (_ref2 = this.$message) != null ? _ref2.removeClass('messenger-clickable') : void 0;
|
555
556
|
};
|
556
557
|
|
557
|
-
_Message.prototype.parseActions = function() {
|
558
|
+
_Message.prototype.parseActions = function () {
|
558
559
|
var act, actions, n_act, name, _ref2, _ref3;
|
559
560
|
actions = [];
|
560
561
|
_ref2 = this.options.actions;
|
@@ -570,20 +571,28 @@ window.Messenger.Events = (function() {
|
|
570
571
|
return actions;
|
571
572
|
};
|
572
573
|
|
573
|
-
_Message.prototype.template = function(opts) {
|
574
|
+
_Message.prototype.template = function (opts) {
|
574
575
|
var $action, $actions, $cancel, $link, $message, $text, action, _i, _len, _ref2,
|
575
576
|
_this = this;
|
576
577
|
$message = $("<div class='messenger-message message alert " + opts.type + " message-" + opts.type + " alert-" + opts.type + "'>");
|
577
578
|
if (opts.showCloseButton) {
|
578
579
|
$cancel = $('<button type="button" class="messenger-close" data-dismiss="alert">');
|
579
580
|
$cancel.html(opts.closeButtonText);
|
580
|
-
$cancel.click(function() {
|
581
|
+
$cancel.click(function () {
|
582
|
+
var _base;
|
581
583
|
_this.cancel();
|
584
|
+
if (typeof (_base = _this.options).onClickClose === "function") {
|
585
|
+
_base.onClickClose();
|
586
|
+
}
|
582
587
|
return true;
|
583
588
|
});
|
584
589
|
$message.append($cancel);
|
585
590
|
}
|
586
|
-
|
591
|
+
if (opts.escapeText) {
|
592
|
+
$text = $('<div class="messenger-message-inner"></div>').text(opts.message);
|
593
|
+
} else {
|
594
|
+
$text = $("<div class=\"messenger-message-inner\">" + opts.message + "</div>");
|
595
|
+
}
|
587
596
|
$message.append($text);
|
588
597
|
if (opts.actions.length) {
|
589
598
|
$actions = $('<div class="messenger-actions">');
|
@@ -603,7 +612,7 @@ window.Messenger.Events = (function() {
|
|
603
612
|
return $message;
|
604
613
|
};
|
605
614
|
|
606
|
-
_Message.prototype.render = function() {
|
615
|
+
_Message.prototype.render = function () {
|
607
616
|
var opts;
|
608
617
|
if (this.rendered) {
|
609
618
|
return;
|
@@ -626,7 +635,7 @@ window.Messenger.Events = (function() {
|
|
626
635
|
|
627
636
|
})(BaseView);
|
628
637
|
|
629
|
-
RetryingMessage = (function(_super) {
|
638
|
+
RetryingMessage = (function (_super) {
|
630
639
|
|
631
640
|
__extends(RetryingMessage, _super);
|
632
641
|
|
@@ -634,12 +643,12 @@ window.Messenger.Events = (function() {
|
|
634
643
|
return RetryingMessage.__super__.constructor.apply(this, arguments);
|
635
644
|
}
|
636
645
|
|
637
|
-
RetryingMessage.prototype.initialize = function() {
|
646
|
+
RetryingMessage.prototype.initialize = function () {
|
638
647
|
RetryingMessage.__super__.initialize.apply(this, arguments);
|
639
648
|
return this._timers = {};
|
640
649
|
};
|
641
650
|
|
642
|
-
RetryingMessage.prototype.cancel = function() {
|
651
|
+
RetryingMessage.prototype.cancel = function () {
|
643
652
|
this.clearTimers();
|
644
653
|
this.hide();
|
645
654
|
if ((this._actionInstance != null) && (this._actionInstance.abort != null)) {
|
@@ -647,7 +656,7 @@ window.Messenger.Events = (function() {
|
|
647
656
|
}
|
648
657
|
};
|
649
658
|
|
650
|
-
RetryingMessage.prototype.clearTimers = function() {
|
659
|
+
RetryingMessage.prototype.clearTimers = function () {
|
651
660
|
var name, timer, _ref2, _ref3;
|
652
661
|
_ref2 = this._timers;
|
653
662
|
for (name in _ref2) {
|
@@ -658,7 +667,7 @@ window.Messenger.Events = (function() {
|
|
658
667
|
return (_ref3 = this.$message) != null ? _ref3.removeClass('messenger-retry-soon messenger-retry-later') : void 0;
|
659
668
|
};
|
660
669
|
|
661
|
-
RetryingMessage.prototype.render = function() {
|
670
|
+
RetryingMessage.prototype.render = function () {
|
662
671
|
var action, name, _ref2, _results;
|
663
672
|
RetryingMessage.__super__.render.apply(this, arguments);
|
664
673
|
this.clearTimers();
|
@@ -675,15 +684,15 @@ window.Messenger.Events = (function() {
|
|
675
684
|
return _results;
|
676
685
|
};
|
677
686
|
|
678
|
-
RetryingMessage.prototype.renderPhrase = function(action, time) {
|
687
|
+
RetryingMessage.prototype.renderPhrase = function (action, time) {
|
679
688
|
var phrase;
|
680
689
|
phrase = action.phrase.replace('TIME', this.formatTime(time));
|
681
690
|
return phrase;
|
682
691
|
};
|
683
692
|
|
684
|
-
RetryingMessage.prototype.formatTime = function(time) {
|
693
|
+
RetryingMessage.prototype.formatTime = function (time) {
|
685
694
|
var pluralize;
|
686
|
-
pluralize = function(num, str) {
|
695
|
+
pluralize = function (num, str) {
|
687
696
|
num = Math.floor(num);
|
688
697
|
if (num !== 1) {
|
689
698
|
str = str + 's';
|
@@ -704,7 +713,7 @@ window.Messenger.Events = (function() {
|
|
704
713
|
return pluralize(time, 'hour');
|
705
714
|
};
|
706
715
|
|
707
|
-
RetryingMessage.prototype.startCountdown = function(name, action) {
|
716
|
+
RetryingMessage.prototype.startCountdown = function (name, action) {
|
708
717
|
var $phrase, remaining, tick, _ref2,
|
709
718
|
_this = this;
|
710
719
|
if (this._timers[name] != null) {
|
@@ -719,7 +728,7 @@ window.Messenger.Events = (function() {
|
|
719
728
|
this.$message.removeClass('messenger-retry-soon');
|
720
729
|
this.$message.addClass('messenger-retry-later');
|
721
730
|
}
|
722
|
-
tick = function() {
|
731
|
+
tick = function () {
|
723
732
|
var delta;
|
724
733
|
$phrase.text(_this.renderPhrase(action, remaining));
|
725
734
|
if (remaining > 0) {
|
@@ -739,7 +748,7 @@ window.Messenger.Events = (function() {
|
|
739
748
|
|
740
749
|
})(_Message);
|
741
750
|
|
742
|
-
_Messenger = (function(_super) {
|
751
|
+
_Messenger = (function (_super) {
|
743
752
|
|
744
753
|
__extends(_Messenger, _super);
|
745
754
|
|
@@ -755,23 +764,23 @@ window.Messenger.Events = (function() {
|
|
755
764
|
type: 'info'
|
756
765
|
};
|
757
766
|
|
758
|
-
_Messenger.prototype.initialize = function(options) {
|
767
|
+
_Messenger.prototype.initialize = function (options) {
|
759
768
|
this.options = options != null ? options : {};
|
760
769
|
this.history = [];
|
761
770
|
return this.messageDefaults = $.extend({}, this.messageDefaults, this.options.messageDefaults);
|
762
771
|
};
|
763
772
|
|
764
|
-
_Messenger.prototype.render = function() {
|
773
|
+
_Messenger.prototype.render = function () {
|
765
774
|
return this.updateMessageSlotClasses();
|
766
775
|
};
|
767
776
|
|
768
|
-
_Messenger.prototype.findById = function(id) {
|
769
|
-
return _.filter(this.history, function(rec) {
|
777
|
+
_Messenger.prototype.findById = function (id) {
|
778
|
+
return _.filter(this.history, function (rec) {
|
770
779
|
return rec.msg.options.id === id;
|
771
780
|
});
|
772
781
|
};
|
773
782
|
|
774
|
-
_Messenger.prototype._reserveMessageSlot = function(msg) {
|
783
|
+
_Messenger.prototype._reserveMessageSlot = function (msg) {
|
775
784
|
var $slot, dmsg,
|
776
785
|
_this = this;
|
777
786
|
$slot = $('<li>');
|
@@ -782,7 +791,7 @@ window.Messenger.Events = (function() {
|
|
782
791
|
$slot: $slot
|
783
792
|
});
|
784
793
|
this._enforceIdConstraint(msg);
|
785
|
-
msg.on('update', function() {
|
794
|
+
msg.on('update', function () {
|
786
795
|
return _this._enforceIdConstraint(msg);
|
787
796
|
});
|
788
797
|
while (this.options.maxMessages && this.history.length > this.options.maxMessages) {
|
@@ -793,7 +802,7 @@ window.Messenger.Events = (function() {
|
|
793
802
|
return $slot;
|
794
803
|
};
|
795
804
|
|
796
|
-
_Messenger.prototype._enforceIdConstraint = function(msg) {
|
805
|
+
_Messenger.prototype._enforceIdConstraint = function (msg) {
|
797
806
|
var entry, _i, _len, _msg, _ref2;
|
798
807
|
if (msg.options.id == null) {
|
799
808
|
return;
|
@@ -813,7 +822,7 @@ window.Messenger.Events = (function() {
|
|
813
822
|
}
|
814
823
|
};
|
815
824
|
|
816
|
-
_Messenger.prototype.newMessage = function(opts) {
|
825
|
+
_Messenger.prototype.newMessage = function (opts) {
|
817
826
|
var msg, _ref2, _ref3, _ref4,
|
818
827
|
_this = this;
|
819
828
|
if (opts == null) {
|
@@ -822,7 +831,7 @@ window.Messenger.Events = (function() {
|
|
822
831
|
opts.messenger = this;
|
823
832
|
_Message = (_ref2 = (_ref3 = Messenger.themes[(_ref4 = opts.theme) != null ? _ref4 : this.options.theme]) != null ? _ref3.Message : void 0) != null ? _ref2 : RetryingMessage;
|
824
833
|
msg = new _Message(opts);
|
825
|
-
msg.on('show', function() {
|
834
|
+
msg.on('show', function () {
|
826
835
|
if (opts.scrollTo && _this.$el.css('position') !== 'fixed') {
|
827
836
|
return msg.scrollTo();
|
828
837
|
}
|
@@ -831,7 +840,7 @@ window.Messenger.Events = (function() {
|
|
831
840
|
return msg;
|
832
841
|
};
|
833
842
|
|
834
|
-
_Messenger.prototype.updateMessageSlotClasses = function() {
|
843
|
+
_Messenger.prototype.updateMessageSlotClasses = function () {
|
835
844
|
var anyShown, last, rec, willBeFirst, _i, _len, _ref2;
|
836
845
|
willBeFirst = true;
|
837
846
|
last = null;
|
@@ -856,7 +865,7 @@ window.Messenger.Events = (function() {
|
|
856
865
|
return this.$el["" + (anyShown ? 'remove' : 'add') + "Class"]('messenger-empty');
|
857
866
|
};
|
858
867
|
|
859
|
-
_Messenger.prototype.hideAll = function() {
|
868
|
+
_Messenger.prototype.hideAll = function () {
|
860
869
|
var rec, _i, _len, _ref2, _results;
|
861
870
|
_ref2 = this.history;
|
862
871
|
_results = [];
|
@@ -867,7 +876,7 @@ window.Messenger.Events = (function() {
|
|
867
876
|
return _results;
|
868
877
|
};
|
869
878
|
|
870
|
-
_Messenger.prototype.post = function(opts) {
|
879
|
+
_Messenger.prototype.post = function (opts) {
|
871
880
|
var msg;
|
872
881
|
if (_.isString(opts)) {
|
873
882
|
opts = {
|
@@ -884,7 +893,7 @@ window.Messenger.Events = (function() {
|
|
884
893
|
|
885
894
|
})(BaseView);
|
886
895
|
|
887
|
-
ActionMessenger = (function(_super) {
|
896
|
+
ActionMessenger = (function (_super) {
|
888
897
|
|
889
898
|
__extends(ActionMessenger, _super);
|
890
899
|
|
@@ -904,7 +913,7 @@ window.Messenger.Events = (function() {
|
|
904
913
|
action: $.ajax
|
905
914
|
};
|
906
915
|
|
907
|
-
ActionMessenger.prototype.hookBackboneAjax = function(msgr_opts) {
|
916
|
+
ActionMessenger.prototype.hookBackboneAjax = function (msgr_opts) {
|
908
917
|
var _ajax,
|
909
918
|
_this = this;
|
910
919
|
if (msgr_opts == null) {
|
@@ -919,7 +928,7 @@ window.Messenger.Events = (function() {
|
|
919
928
|
successMessage: "Request completed successfully.",
|
920
929
|
showSuccessWithoutError: false
|
921
930
|
});
|
922
|
-
_ajax = function(options) {
|
931
|
+
_ajax = function (options) {
|
923
932
|
var sync_msgr_opts;
|
924
933
|
sync_msgr_opts = _.extend({}, msgr_opts, options.messenger);
|
925
934
|
return _this["do"](sync_msgr_opts, options);
|
@@ -934,7 +943,7 @@ window.Messenger.Events = (function() {
|
|
934
943
|
_ajax._withoutMessenger = Backbone.ajax;
|
935
944
|
return Backbone.ajax = _ajax;
|
936
945
|
} else {
|
937
|
-
return Backbone.sync = _.wrap(Backbone.sync, function() {
|
946
|
+
return Backbone.sync = _.wrap(Backbone.sync, function () {
|
938
947
|
var args, _old_ajax, _old_sync;
|
939
948
|
_old_sync = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
940
949
|
_old_ajax = $.ajax;
|
@@ -945,7 +954,7 @@ window.Messenger.Events = (function() {
|
|
945
954
|
}
|
946
955
|
};
|
947
956
|
|
948
|
-
ActionMessenger.prototype._getHandlerResponse = function(returnVal) {
|
957
|
+
ActionMessenger.prototype._getHandlerResponse = function (returnVal) {
|
949
958
|
if (returnVal === false) {
|
950
959
|
return false;
|
951
960
|
}
|
@@ -955,7 +964,7 @@ window.Messenger.Events = (function() {
|
|
955
964
|
return returnVal;
|
956
965
|
};
|
957
966
|
|
958
|
-
ActionMessenger.prototype._parseEvents = function(events) {
|
967
|
+
ActionMessenger.prototype._parseEvents = function (events) {
|
959
968
|
var desc, firstSpace, func, label, out, type, _ref2;
|
960
969
|
if (events == null) {
|
961
970
|
events = {};
|
@@ -974,7 +983,7 @@ window.Messenger.Events = (function() {
|
|
974
983
|
return out;
|
975
984
|
};
|
976
985
|
|
977
|
-
ActionMessenger.prototype._normalizeResponse = function() {
|
986
|
+
ActionMessenger.prototype._normalizeResponse = function () {
|
978
987
|
var data, elem, resp, type, xhr, _i, _len;
|
979
988
|
resp = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
980
989
|
type = null;
|
@@ -993,7 +1002,7 @@ window.Messenger.Events = (function() {
|
|
993
1002
|
return [type, data, xhr];
|
994
1003
|
};
|
995
1004
|
|
996
|
-
ActionMessenger.prototype.run = function() {
|
1005
|
+
ActionMessenger.prototype.run = function () {
|
997
1006
|
var args, events, getMessageText, handler, handlers, m_opts, msg, old, opts, type, _ref2,
|
998
1007
|
_this = this;
|
999
1008
|
m_opts = arguments[0], opts = arguments[1], args = 3 <= arguments.length ? __slice.call(arguments, 2) : [];
|
@@ -1002,7 +1011,7 @@ window.Messenger.Events = (function() {
|
|
1002
1011
|
}
|
1003
1012
|
m_opts = $.extend(true, {}, this.messageDefaults, this.doDefaults, m_opts != null ? m_opts : {});
|
1004
1013
|
events = this._parseEvents(m_opts.events);
|
1005
|
-
getMessageText = function(type, xhr) {
|
1014
|
+
getMessageText = function (type, xhr) {
|
1006
1015
|
var message;
|
1007
1016
|
message = m_opts[type + 'Message'];
|
1008
1017
|
if (_.isFunction(message)) {
|
@@ -1021,10 +1030,10 @@ window.Messenger.Events = (function() {
|
|
1021
1030
|
}));
|
1022
1031
|
}
|
1023
1032
|
handlers = {};
|
1024
|
-
_.each(['error', 'success'], function(type) {
|
1033
|
+
_.each(['error', 'success'], function (type) {
|
1025
1034
|
var originalHandler;
|
1026
1035
|
originalHandler = opts[type];
|
1027
|
-
return handlers[type] = function() {
|
1036
|
+
return handlers[type] = function () {
|
1028
1037
|
var data, defaultOpts, handlerResp, msgOpts, reason, resp, responseOpts, xhr, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9;
|
1029
1038
|
resp = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
1030
1039
|
_ref3 = _this._normalizeResponse.apply(_this, resp), reason = _ref3[0], data = _ref3[1], xhr = _ref3[2];
|
@@ -1083,15 +1092,15 @@ window.Messenger.Events = (function() {
|
|
1083
1092
|
phrase: 'Retrying TIME',
|
1084
1093
|
auto: msgOpts.retry.auto,
|
1085
1094
|
delay: msgOpts.retry.delay,
|
1086
|
-
action: function() {
|
1095
|
+
action: function () {
|
1087
1096
|
msgOpts.messageInstance = msg;
|
1088
|
-
return setTimeout(function() {
|
1097
|
+
return setTimeout(function () {
|
1089
1098
|
return _this["do"].apply(_this, [msgOpts, opts].concat(__slice.call(args)));
|
1090
1099
|
}, 0);
|
1091
1100
|
}
|
1092
1101
|
},
|
1093
1102
|
cancel: {
|
1094
|
-
action: function() {
|
1103
|
+
action: function () {
|
1095
1104
|
return msg.cancel();
|
1096
1105
|
}
|
1097
1106
|
}
|
@@ -1128,14 +1137,14 @@ window.Messenger.Events = (function() {
|
|
1128
1137
|
|
1129
1138
|
ActionMessenger.prototype["do"] = ActionMessenger.prototype.run;
|
1130
1139
|
|
1131
|
-
ActionMessenger.prototype.ajax = function() {
|
1140
|
+
ActionMessenger.prototype.ajax = function () {
|
1132
1141
|
var args, m_opts;
|
1133
1142
|
m_opts = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
1134
1143
|
m_opts.action = $.ajax;
|
1135
1144
|
return this.run.apply(this, [m_opts].concat(__slice.call(args)));
|
1136
1145
|
};
|
1137
1146
|
|
1138
|
-
ActionMessenger.prototype.expectPromise = function(action, m_opts) {
|
1147
|
+
ActionMessenger.prototype.expectPromise = function (action, m_opts) {
|
1139
1148
|
m_opts = _.extend({}, m_opts, {
|
1140
1149
|
action: action,
|
1141
1150
|
returnsPromise: true
|
@@ -1143,7 +1152,7 @@ window.Messenger.Events = (function() {
|
|
1143
1152
|
return this.run(m_opts);
|
1144
1153
|
};
|
1145
1154
|
|
1146
|
-
ActionMessenger.prototype.error = function(m_opts) {
|
1155
|
+
ActionMessenger.prototype.error = function (m_opts) {
|
1147
1156
|
if (m_opts == null) {
|
1148
1157
|
m_opts = {};
|
1149
1158
|
}
|
@@ -1156,7 +1165,7 @@ window.Messenger.Events = (function() {
|
|
1156
1165
|
return this.post(m_opts);
|
1157
1166
|
};
|
1158
1167
|
|
1159
|
-
ActionMessenger.prototype.info = function(m_opts) {
|
1168
|
+
ActionMessenger.prototype.info = function (m_opts) {
|
1160
1169
|
if (m_opts == null) {
|
1161
1170
|
m_opts = {};
|
1162
1171
|
}
|
@@ -1169,7 +1178,7 @@ window.Messenger.Events = (function() {
|
|
1169
1178
|
return this.post(m_opts);
|
1170
1179
|
};
|
1171
1180
|
|
1172
|
-
ActionMessenger.prototype.success = function(m_opts) {
|
1181
|
+
ActionMessenger.prototype.success = function (m_opts) {
|
1173
1182
|
if (m_opts == null) {
|
1174
1183
|
m_opts = {};
|
1175
1184
|
}
|
@@ -1186,7 +1195,7 @@ window.Messenger.Events = (function() {
|
|
1186
1195
|
|
1187
1196
|
})(_Messenger);
|
1188
1197
|
|
1189
|
-
$.fn.messenger = function() {
|
1198
|
+
$.fn.messenger = function () {
|
1190
1199
|
var $el, args, func, instance, opts, _ref2, _ref3, _ref4;
|
1191
1200
|
func = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
1192
1201
|
if (func == null) {
|
@@ -1208,7 +1217,7 @@ window.Messenger.Events = (function() {
|
|
1208
1217
|
}
|
1209
1218
|
};
|
1210
1219
|
|
1211
|
-
window.Messenger._call = function(opts) {
|
1220
|
+
window.Messenger._call = function (opts) {
|
1212
1221
|
var $el, $parent, choosen_loc, chosen_loc, classes, defaultOpts, inst, loc, locations, _i, _len;
|
1213
1222
|
defaultOpts = {
|
1214
1223
|
extraClasses: 'messenger-fixed messenger-on-bottom messenger-on-right',
|
@@ -1260,4 +1269,4 @@ window.Messenger.Events = (function() {
|
|
1260
1269
|
|
1261
1270
|
$.globalMessenger = window.Messenger = Messenger;
|
1262
1271
|
|
1263
|
-
}).call(this);
|
1272
|
+
}).call(this);
|