|
204 | 204 | zIndex: @settings.z_index + 1 |
205 | 205 | return |
206 | 206 |
|
| 207 | + isFunction = (element) -> |
| 208 | + return typeof element === 'function'; |
| 209 | + |
207 | 210 | placement: -> |
208 | 211 | self = this |
209 | 212 | offsetAmt = @settings.offset.y |
|
235 | 238 | if @settings.newest_on_top == true |
236 | 239 | offsetAmt = parseInt(offsetAmt) + parseInt(@settings.spacing) + @$ele.outerHeight() |
237 | 240 | @reposition offsetAmt |
238 | | - if $.isFunction(self.settings.onShow) |
| 241 | + if self.isFunction(self.settings.onShow) |
239 | 242 | self.settings.onShow.call @$ele |
240 | 243 | @$ele.one(@animations.start, -> |
241 | 244 | hasAnimation = true |
242 | 245 | return |
243 | 246 | ).one @animations.end, -> |
244 | 247 | self.$ele.removeClass self.settings.animate.enter |
245 | | - if $.isFunction(self.settings.onShown) |
| 248 | + if self.isFunction(self.settings.onShown) |
246 | 249 | self.settings.onShown.call this |
247 | 250 | return |
248 | 251 | setTimeout (-> |
249 | 252 | if !hasAnimation |
250 | | - if $.isFunction(self.settings.onShown) |
| 253 | + if self.isFunction(self.settings.onShown) |
251 | 254 | self.settings.onShown.call this |
252 | 255 | return |
253 | 256 | ), 600 |
|
258 | 261 | @$ele.find('[data-notify="dismiss"]').on 'click', -> |
259 | 262 | self.close() |
260 | 263 | return |
261 | | - if $.isFunction(self.settings.onClick) |
| 264 | + if self.isFunction(self.settings.onClick) |
262 | 265 | @$ele.on 'click', (event) -> |
263 | 266 | if event.target != self.$ele.find('[data-notify="dismiss"]')[0] |
264 | 267 | self.settings.onClick.call this, event |
|
291 | 294 | hasAnimation = false |
292 | 295 | @$ele.attr('data-closing', 'true').addClass @settings.animate.exit |
293 | 296 | self.reposition posX |
294 | | - if $.isFunction(self.settings.onClose) |
| 297 | + if self.isFunction(self.settings.onClose) |
295 | 298 | self.settings.onClose.call @$ele |
296 | 299 | @$ele.one(@animations.start, -> |
297 | 300 | hasAnimation = true |
298 | 301 | return |
299 | 302 | ).one @animations.end, -> |
300 | 303 | $(this).remove() |
301 | | - if $.isFunction(self.settings.onClosed) |
| 304 | + if self.isFunction(self.settings.onClosed) |
302 | 305 | self.settings.onClosed.call this |
303 | 306 | return |
304 | 307 | setTimeout (-> |
305 | 308 | if !hasAnimation |
306 | 309 | self.$ele.remove() |
307 | | - if $.isFunction(self.settings.onClosed) |
| 310 | + if self.isFunction(self.settings.onClosed) |
308 | 311 | self.settings.onClosed.call this |
309 | 312 | return |
310 | 313 | ), 600 |
|
0 commit comments