2018-09-20 10:45:33 +00:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
(() => {
|
2018-11-30 03:02:20 +00:00
|
|
|
addInitHook("after_update_alert_list", (alertCount) => {
|
|
|
|
console.log("misc.js");
|
|
|
|
console.log("alertCount:",alertCount);
|
2018-09-20 10:45:33 +00:00
|
|
|
if(alertCount==0) {
|
2018-11-30 03:02:20 +00:00
|
|
|
$(".alerts").html(phraseBox["alerts"]["alerts.no_alerts_short"]);
|
2018-10-06 06:35:53 +00:00
|
|
|
$(".user_box").removeClass("has_alerts");
|
2018-09-20 10:45:33 +00:00
|
|
|
} else {
|
2018-11-30 03:02:20 +00:00
|
|
|
// TODO: Localise this
|
2018-10-06 06:35:53 +00:00
|
|
|
$(".alerts").html(alertCount + " new alerts");
|
|
|
|
$(".user_box").addClass("has_alerts");
|
2018-09-20 10:45:33 +00:00
|
|
|
}
|
2018-12-27 05:42:41 +00:00
|
|
|
});
|
|
|
|
addHook("open_edit", () => $('.topic_block').addClass("edithead"));
|
|
|
|
addHook("close_edit", () => $('.topic_block').removeClass("edithead"));
|
2018-09-20 10:45:33 +00:00
|
|
|
})();
|
|
|
|
|
|
|
|
$(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"
|
|
|
|
});
|
2019-02-24 08:02:00 +00:00
|
|
|
|
|
|
|
// Move the alerts above the first header
|
|
|
|
let colSel = $(".colstack_right .colstack_head:first");
|
|
|
|
let colSelAlt = $(".colstack_right .colstack_item:first");
|
|
|
|
let colSelAltAlt = $(".colstack_right .coldyn_block:first");
|
|
|
|
if(colSel.length > 0) {
|
|
|
|
$('.alert').insertBefore(colSel);
|
|
|
|
} else if (colSelAlt.length > 0) {
|
|
|
|
$('.alert').insertBefore(colSelAlt);
|
|
|
|
} else if (colSelAltAlt.length > 0) {
|
|
|
|
$('.alert').insertBefore(colSelAltAlt);
|
|
|
|
} else {
|
|
|
|
$('.alert').insertAfter(".rowhead:first");
|
|
|
|
}
|
2018-09-20 10:45:33 +00:00
|
|
|
});
|