Ajout du système de popup sur reception d'un SMS

This commit is contained in:
Pierre-Lin Bonnemaison 2015-08-16 03:25:41 +02:00
parent 0b2fe3c989
commit 90e761e152
9 changed files with 91 additions and 3 deletions

View file

@ -17,5 +17,24 @@ function showMessage(message, type)
}
var alerthtml = '<div class="col-xs-10 col-xs-offset-1 col-md-6 col-md-offset-3 popup-alert alert ' + type + '"><button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>' + message + '</div>';
jQuery('body').prepend(alerthtml);
jQuery('body .popup-alerts-container').prepend(alerthtml);
}
/**
* Cette fonction vérifie si un message a été reçu
*/
function verifReceived()
{
jQuery('.popup-alert').fadeOut('slow');
jQuery.getJSON(HTTP_PWD + "/receiveds/popup", function( data ) {
$.each(data, function(key, val) {
showMessage('SMS reçu du ' + val.send_by.replace(/</g, "&lt;").replace(/>/g, "&gt;") + ' : ' + val.content.replace(/</g, "&lt;").replace(/>/g, "&gt;"), 1);
});
});
}
jQuery(document).ready(function()
{
var verifReceivedInterval = setInterval(verifReceived, 10000);
});