You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
705 B
36 lines
705 B
7 years ago
|
window.Notify = (function () {
|
||
|
let nt = {}
|
||
|
const sel = '#notif'
|
||
7 years ago
|
|
||
7 years ago
|
let hideTmeo1 // timeout to start hiding (transition)
|
||
|
let hideTmeo2 // timeout to add the hidden class
|
||
7 years ago
|
|
||
7 years ago
|
nt.show = function (message, timeout) {
|
||
7 years ago
|
$(sel).html(message)
|
||
|
Modal.show(sel)
|
||
7 years ago
|
|
||
7 years ago
|
clearTimeout(hideTmeo1)
|
||
|
clearTimeout(hideTmeo2)
|
||
7 years ago
|
|
||
7 years ago
|
if (undef(timeout)) timeout = 2500
|
||
7 years ago
|
|
||
7 years ago
|
hideTmeo1 = setTimeout(nt.hide, timeout)
|
||
|
}
|
||
7 years ago
|
|
||
7 years ago
|
nt.hide = function () {
|
||
7 years ago
|
let $m = $(sel)
|
||
|
$m.removeClass('visible')
|
||
7 years ago
|
hideTmeo2 = setTimeout(function () {
|
||
7 years ago
|
$m.addClass('hidden')
|
||
|
}, 250) // transition time
|
||
|
}
|
||
7 years ago
|
|
||
7 years ago
|
nt.init = function () {
|
||
|
$(sel).on('click', function () {
|
||
7 years ago
|
nt.hide(this)
|
||
|
})
|
||
|
}
|
||
|
|
||
|
return nt
|
||
|
})()
|