lemonldap-ng/lemonldap-ng-portal/site/htdocs/static/common/js/notifications.min.js
2020-02-09 17:47:25 +01:00

1 line
1.0 KiB
JavaScript

(function(){var a,t;a=function(t,e){return $("#msg").html(window.translate(t)),$("#color").removeClass("message-positive message-warning alert-success alert-warning"),$("#color").addClass("message-"+e),"positive"===e&&(e="success"),$("#color").addClass("alert-"+e)},t=function(o,n){return console.log("Ref:",o,"epoch:",n),o&&n?(console.log("Send AJAX request"),$.ajax({type:"GET",url:portal+"mynotifs/"+o,data:{epoch:n},dataType:"json",success:function(t){var e;return t.result?(console.log("Notification:",t.notification),$("#displayNotif").html(t.notification),$("#myNotification").removeAttr("hidden"),$("#notifRef").text(o),e=new Date(1e3*n),$("#notifEpoch").text(e.toLocaleString())):a("notifNotFound","warning")}})):a("retreiveNotifFailed","warning")},$(document).ready(function(){return $("body").on("click",".btn-success",function(){return t($(this).attr("notif"),$(this).attr("epoch"))}),$("#goback").attr("href",portal),$(".data-epoch").each(function(){var t;return t=new Date(1e3*$(this).text()),$(this).text(t.toLocaleString())})})}).call(this);