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-56
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>', $.extend({log: false}, options), true); |
33 |
}, |
33 |
}, |
34 |
|
34 |
|
35 |
displayMsg: function(msg, options, is_alert) { |
35 |
displayMsg: function(msg, options) { |
36 |
if (msg == '') |
36 |
if (msg == '') |
37 |
return; |
37 |
return; |
38 |
|
38 |
|
39 |
if (options != undefined) { |
39 |
options = $.extend({ |
40 |
delay = 'delay' in options ? parseInt(options.delay) * 1000 : 1000 |
40 |
delay: 1000, |
41 |
life = 'life' in options ? parseInt(options.life) * 1000 : Infinity |
41 |
life: Infinity, |
42 |
} else { |
42 |
log: true, |
43 |
delay = 1000 |
43 |
className: '', |
44 |
life = Infinity |
44 |
}, options); |
45 |
} |
|
|
46 |
|
45 |
|
|
|
46 |
clearTimeout(humanMsg.t1); |
47 |
clearTimeout(humanMsg.t2); |
47 |
clearTimeout(humanMsg.t2); |
48 |
|
48 |
|
49 |
// Inject message |
49 |
// Inject message |
50 |
jQuery('#'+humanMsg.msgID+'-contents').html(is_alert ? ('<p>' + msg + '</p>') : msg) |
50 |
jQuery('#'+humanMsg.msgID+'-contents').html(msg); |
51 |
|
51 |
|
52 |
// Show message |
52 |
// Show message |
53 |
jQuery('#'+humanMsg.msgID).show().animate({ opacity: humanMsg.msgOpacity}, 200, function() { |
53 |
jQuery('#'+humanMsg.msgID).attr('class', 'humanMsg ' + options.className).show().animate({ opacity: humanMsg.msgOpacity}, 200, function() { |
|
|
54 |
if ( !options.log ) return true; |
54 |
jQuery('#'+humanMsg.logID) |
55 |
jQuery('#'+humanMsg.logID) |
55 |
.show().children('ul').prepend('<li>'+msg+'</li>') // Prepend message to log |
56 |
.show().children('ul').prepend('<li>'+msg+'</li>') // Prepend message to log |
56 |
.children('li:first').slideDown(200) // Slide it down |
57 |
.children('li:first').slideDown(200) // Slide it down |
Lines 64-72
var humanMsg = {
Link Here
|
64 |
}) |
65 |
}) |
65 |
|
66 |
|
66 |
// Watch for mouse & keyboard in `delay` |
67 |
// Watch for mouse & keyboard in `delay` |
67 |
humanMsg.t1 = setTimeout("humanMsg.bindEvents()", delay) |
68 |
humanMsg.t1 = setTimeout("humanMsg.bindEvents()", options.delay) |
68 |
// Remove message after `life` |
69 |
// Remove message after `life` |
69 |
humanMsg.t2 = setTimeout("humanMsg.removeMsg()", life) |
70 |
humanMsg.t2 = setTimeout("humanMsg.removeMsg()", options.life) |
70 |
}, |
71 |
}, |
71 |
|
72 |
|
72 |
bindEvents: function() { |
73 |
bindEvents: function() { |