init
This commit is contained in:
commit
72a26edcff
22092 changed files with 2101903 additions and 0 deletions
45
lib/js/Notify.js
Normal file
45
lib/js/Notify.js
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
Notify = function(text, callback, close_callback, style) {
|
||||
|
||||
var time = '10000';
|
||||
var $container = $('#notifications');
|
||||
var icon = '<i class="fa fa-info-circle "></i>';
|
||||
|
||||
if (typeof style == 'undefined' ) style = 'warning'
|
||||
|
||||
var html = $('<div class="alert alert-' + style + ' hide">' + icon + " " + text + '</div>');
|
||||
|
||||
$('<a>',{
|
||||
text: '×',
|
||||
class: 'button close',
|
||||
style: 'padding-left: 10px;',
|
||||
href: '#',
|
||||
click: function(e){
|
||||
e.preventDefault()
|
||||
close_callback && close_callback()
|
||||
remove_notice()
|
||||
}
|
||||
}).prependTo(html)
|
||||
|
||||
$container.prepend(html)
|
||||
html.removeClass('hide').hide().fadeIn('slow')
|
||||
|
||||
function remove_notice() {
|
||||
html.stop().fadeOut('slow').remove()
|
||||
}
|
||||
|
||||
var timer = setInterval(remove_notice, time);
|
||||
|
||||
$(html).hover(function(){
|
||||
clearInterval(timer);
|
||||
}, function(){
|
||||
timer = setInterval(remove_notice, time);
|
||||
});
|
||||
|
||||
html.on('click', function () {
|
||||
clearInterval(timer)
|
||||
callback && callback()
|
||||
remove_notice()
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue