mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2026-02-10 09:06:21 +01:00
Add notifications auto refresh
This commit is contained in:
27
allianceauth/static/js/base.js
Normal file
27
allianceauth/static/js/base.js
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
Javascript for the base template
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
var elem = document.getElementById("dataExport");
|
||||
var notificationsRenderUrl = elem.getAttribute("data-notificationsRenderUrl");
|
||||
|
||||
// render the notifications item in the top menu
|
||||
function render_notifications(){
|
||||
$("#menu_item_notifications").load(
|
||||
notificationsRenderUrl,
|
||||
function(responseTxt, statusTxt, xhr){
|
||||
if(statusTxt == "error")
|
||||
console.log(
|
||||
"Failed to load HTMl to render notifications item. Error: "
|
||||
+ xhr.status
|
||||
+ ": "
|
||||
+ xhr.statusText
|
||||
);
|
||||
});
|
||||
}
|
||||
render_notifications()
|
||||
|
||||
// re-render notifications every x seconds
|
||||
setInterval(render_notifications, 5000);
|
||||
});
|
||||
Reference in New Issue
Block a user