Alerts now work in Nox.

This commit is contained in:
Azareal 2018-09-20 20:45:33 +10:00
parent eb6db07c30
commit 7de911d78c
6 changed files with 66 additions and 3 deletions

View File

@ -188,7 +188,6 @@ function runWebSockets() {
}
conn.onmessage = (event) => {
//console.log("WSMessage:", event.data);
if(event.data[0] == "{") {
console.log("json message");
let data = "";

View File

@ -9,6 +9,8 @@ var hooks = {
"pre_init": [],
"start_init": [],
"end_init": [],
"after_add_alert":[],
"after_update_alert_list":[],
};
var ranInitHooks = {}

View File

@ -1,7 +1,7 @@
{
"Name": "cosora",
"FriendlyName": "Cosora",
"Version": "0.0.1",
"Version": "0.1.0",
"Creator": "Azareal",
"URL": "github.com/Azareal/Gosora",
"Tag": "WIP",

View File

@ -55,9 +55,44 @@ li a {
padding-bottom: 21px;
color: #dddddd;
}
.menu_alerts {
.menu_alerts .alert_bell, .menu_alerts .alert_counter, .menu_alerts:not(.selectedAlert) .alertList {
display: none;
}
.alertList {
display: flex;
flex-direction: column;
background-color: #444444;
position: absolute;
border: 1px solid #333333;
top: 82px;
border-top: none;
right: 0px;
padding-left: 16px;
padding-right: 16px;
}
.alertItem.withAvatar {
background: none !important;
height: 66px;
padding-top: 4px;
display: flex;
padding: 16px;
padding-left: 0px;
padding-right: 0px;
}
.alertItem.withAvatar:not(:last-child) {
border-bottom: 1px solid #555555;
}
.alertItem.withAvatar .bgsub {
height: 36px;
width: 36px;
border-radius: 32px;
}
.alertItem.withAvatar .text {
margin-left: 12px;
padding-top: 5px;
font-size: 16px;
}
.right_of_nav {
float: left;
width: 200px;

22
themes/nox/public/misc.js Normal file
View File

@ -0,0 +1,22 @@
"use strict";
(() => {
addInitHook("after_update_alert_list", () => {
if(alertCount==0) {
$(".alerts").html("No new alerts")
} else {
$(".alerts").html(alertCount + " new alerts")
}
})
})();
$(document).ready(() => {
$(".alerts").click((event) => {
event.stopPropagation();
var alerts = $(".menu_alerts")[0];
if($(alerts).hasClass("selectedAlert")) return;
if(!conn) loadAlerts(alerts);
alerts.className += " selectedAlert";
document.getElementById("back").className += " alertActive"
});
});

View File

@ -27,6 +27,11 @@
"Name":"trumbowyg/ui/trumbowyg.custom.css",
"Location":"global",
"Loggedin":true
},
{
"Name":"nox/misc.js",
"Location":"global",
"Loggedin":true
}
]
}