Lines 21-27
var humanMsg = {
Link Here
|
21 |
if (msgOpacity != undefined) humanMsg.msgOpacity = parseFloat(msgOpacity); |
21 |
if (msgOpacity != undefined) humanMsg.msgOpacity = parseFloat(msgOpacity); |
22 |
|
22 |
|
23 |
// Inject the message structure |
23 |
// Inject the message structure |
24 |
jQuery(appendTo).append('<div id="'+humanMsg.msgID+'" class="humanMsg"><div class="round"></div><div id="'+humanMsg.msgID+'-contents"></div><div class="round"></div></div> <div id="'+humanMsg.logID+'"><p class="launcher">'+logName+'</p><ul></ul></div>') |
24 |
jQuery(appendTo).append('<div id="'+humanMsg.msgID+'" class="humanMsg"><div id="'+humanMsg.msgID+'-contents"></div></div> <div id="'+humanMsg.logID+'"><p class="launcher">'+logName+'</p><ul></ul></div>'); |
25 |
|
25 |
|
26 |
jQuery('#'+humanMsg.logID+' p').click( |
26 |
jQuery('#'+humanMsg.logID+' p').click( |
27 |
function() { jQuery(this).siblings('ul').slideToggle() } |
27 |
function() { jQuery(this).siblings('ul').slideToggle() } |
Lines 29-72
var humanMsg = {
Link Here
|
29 |
}, |
29 |
}, |
30 |
|
30 |
|
31 |
displayAlert: function(msg, options) { |
31 |
displayAlert: function(msg, options) { |
32 |
humanMsg.displayMsg(msg, options, true); |
32 |
humanMsg.displayMsg('<p>' + msg + '</p>', options); |
33 |
}, |
33 |
}, |
34 |
|
34 |
|
35 |
displayMsg: function(msg, options, is_alert) { |
35 |
logMsg: function(msg) { |
|
|
36 |
jQuery('#'+humanMsg.logID) |
37 |
.show().children('ul').prepend('<li>'+msg+'</li>') // Prepend message to log |
38 |
.children('li:first').slideDown(200) // Slide it down |
39 |
|
40 |
if ( jQuery('#'+humanMsg.logID+' ul').css('display') == 'none') { |
41 |
jQuery('#'+humanMsg.logID+' p').animate({ bottom: 40 }, 200, 'linear', function() { |
42 |
jQuery(this).animate({ bottom: 0 }, 300, 'swing', function() { jQuery(this).css({ bottom: 0 }) }) |
43 |
}) |
44 |
} |
45 |
}, |
46 |
|
47 |
displayMsg: function(msg, options) { |
36 |
if (msg == '') |
48 |
if (msg == '') |
37 |
return; |
49 |
return; |
38 |
|
50 |
|
39 |
if (options != undefined) { |
51 |
options = $.extend({ |
40 |
delay = 'delay' in options ? parseInt(options.delay) * 1000 : 1000 |
52 |
delay: 1000, |
41 |
life = 'life' in options ? parseInt(options.life) * 1000 : Infinity |
53 |
life: Infinity, |
42 |
} else { |
54 |
log: true, |
43 |
delay = 1000 |
55 |
className: '', |
44 |
life = Infinity |
56 |
}, options); |
45 |
} |
|
|
46 |
|
57 |
|
|
|
58 |
clearTimeout(humanMsg.t1); |
47 |
clearTimeout(humanMsg.t2); |
59 |
clearTimeout(humanMsg.t2); |
48 |
|
60 |
|
49 |
// Inject message |
61 |
// Inject message |
50 |
jQuery('#'+humanMsg.msgID+'-contents').html(is_alert ? ('<p>' + msg + '</p>') : msg) |
62 |
jQuery('#'+humanMsg.msgID+'-contents').html(msg); |
51 |
|
63 |
|
52 |
// Show message |
64 |
// Show message |
53 |
jQuery('#'+humanMsg.msgID).show().animate({ opacity: humanMsg.msgOpacity}, 200, function() { |
65 |
jQuery('#'+humanMsg.msgID).attr('class', 'humanMsg ' + options.className).show().animate({ opacity: humanMsg.msgOpacity}, 200, function() { |
54 |
jQuery('#'+humanMsg.logID) |
66 |
humanMsg.logMsg(msg, options); |
55 |
.show().children('ul').prepend('<li>'+msg+'</li>') // Prepend message to log |
|
|
56 |
.children('li:first').slideDown(200) // Slide it down |
57 |
|
58 |
if ( jQuery('#'+humanMsg.logID+' ul').css('display') == 'none') { |
59 |
jQuery('#'+humanMsg.logID+' p').animate({ bottom: 40 }, 200, 'linear', function() { |
60 |
jQuery(this).animate({ bottom: 0 }, 300, 'swing', function() { jQuery(this).css({ bottom: 0 }) }) |
61 |
}) |
62 |
} |
63 |
|
64 |
}) |
67 |
}) |
65 |
|
68 |
|
66 |
// Watch for mouse & keyboard in `delay` |
69 |
// Watch for mouse & keyboard in `delay` |
67 |
humanMsg.t1 = setTimeout("humanMsg.bindEvents()", delay) |
70 |
humanMsg.t1 = setTimeout("humanMsg.bindEvents()", options.delay) |
68 |
// Remove message after `life` |
71 |
// Remove message after `life` |
69 |
humanMsg.t2 = setTimeout("humanMsg.removeMsg()", life) |
72 |
humanMsg.t2 = setTimeout("humanMsg.removeMsg()", options.life) |
70 |
}, |
73 |
}, |
71 |
|
74 |
|
72 |
bindEvents: function() { |
75 |
bindEvents: function() { |