diff --git a/admin/lib/cust/main.js b/admin/lib/cust/main.js index f5d71937bf6cb5c48cf864849b5e579044785847..022173e031fc6c52a8e47ec71e4197187957ac39 100644 --- a/admin/lib/cust/main.js +++ b/admin/lib/cust/main.js @@ -4,6 +4,7 @@ var tools = { //Log Function & Utility Vars + alertElems: [], alertNum: 0, alertType: { 's': 'alert-success', @@ -14,9 +15,11 @@ var tools = { log: function(msg, type, timeout) { timeout = timeout || 5000; tools.alertNum++; - $('.alertCont').append('<div id="alertBox' + tools.alertNum + '" class="alert ' + tools.alertType[type] + ' alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>' + msg + '</div>'); + $('.alertCont').append('<div id="alertBox-' + tools.alertNum + '" class="alert ' + tools.alertType[type] + ' alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>' + msg + '</div>'); + tools.alertElems.push(tools.alertNum); setTimeout(function() { - $('#alertBox' + tools.alertNum).alert('close'); + $('#alertBox-' + tools.alertElems[0]).alert('close'); + tools.alertElems.shift(); }, timeout); console.log(msg); },