From bdc196da1dcbc3c5526d74f0b1bf4c3cab0d679a Mon Sep 17 00:00:00 2001 From: CupCakeArmy <nicco.borgioli@gmail.com> Date: Wed, 27 Apr 2016 12:27:21 +0200 Subject: [PATCH] Fixed Alert Bux --- admin/lib/cust/main.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/admin/lib/cust/main.js b/admin/lib/cust/main.js index f5d7193..022173e 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); }, -- GitLab