| 1 |
const wdk_log_notify = (text, type, popup_place) => { |
| 2 |
var $ = jQuery; |
| 3 |
if (!$('.wdk_log_notify-box').length) $('body').append('<div class="wdk_log_notify-box"></div>') |
| 4 |
if (typeof text == "undefined") var text = 'Undefined text'; |
| 5 |
if (typeof type == "undefined") var type = 'success'; |
| 6 |
if (typeof popup_place == "undefined") var popup_place = $('.wdk_log_notify-box'); |
| 7 |
var el_class = ''; |
| 8 |
var el_timer = 5000; |
| 9 |
switch (type) { |
| 10 |
case "success": |
| 11 |
el_class = "success"; |
| 12 |
break |
| 13 |
case "error": |
| 14 |
el_class = "error"; |
| 15 |
break |
| 16 |
case "loading": |
| 17 |
el_class = "loading"; |
| 18 |
el_timer = 2000; |
| 19 |
break |
| 20 |
default: |
| 21 |
el_class = "success"; |
| 22 |
break |
| 23 |
} |
| 24 |
|
| 25 |
/* notify */ |
| 26 |
var html = ''; |
| 27 |
html = '<div class="wdk_log_notify ' + el_class + '">\n\ |
| 28 |
' + text + '\n\ |
| 29 |
</div>'; |
| 30 |
var notification = $(html).appendTo(popup_place).delay(100).queue(function() { |
| 31 |
$(this).addClass('show') |
| 32 |
setTimeout(function() { |
| 33 |
notification.removeClass('show') |
| 34 |
setTimeout(function() { |
| 35 |
notification.remove(); |
| 36 |
}, 1000); |
| 37 |
}, el_timer); |
| 38 |
}) |
| 39 |
/* end notify */ |
| 40 |
} |
| 41 |
|