gosora/themes/nox/public/misc.js

38 lines
1.4 KiB
JavaScript
Raw Normal View History

2018-09-20 10:45:33 +00:00
"use strict";
(() => {
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) {
$(".alerts").html(phraseBox["alerts"]["alerts.no_alerts_short"]);
$(".user_box").removeClass("has_alerts");
2018-09-20 10:45:33 +00:00
} else {
// TODO: Localise this
$(".alerts").html(alertCount + " new alerts");
$(".user_box").addClass("has_alerts");
2018-09-20 10:45:33 +00:00
}
You can now manage the attachments for an opening post by hitting edit. The update system now uses the database as the source of truth for the last version rather than lastSchema.json Refactored several structs and bits of code, so we can avoid allocations for contexts where we never use a relative time. Clicking on the relative times on the topic list and the forum page should now take you to the post on the last page rather than just the last page. Added the reltime template function. Fixed some obsolete bits of code. Fixed some spelling mistakes. Fixed a bug where MaxBytesReader was capped at the maxFileSize rather than r.ContentLength. All of the client side templates should work again now. Shortened some statement names to save some horizontal space. accUpdateBuilder and SimpleUpdate now use updatePrebuilder behind the scenes to simplify things. Renamed selectItem to builder in AccSelectBuilder. Added a Total() method to accCountBuilder to reduce the amount of boilerplate used for row count queries. The "_builder" strings have been replaced with empty strings to help save memory, to make things slightly faster and to open the door to removing the query name in many contexts down the line. Added the open_edit and close_edit client hooks. Removed many query name checks. Split the attachment logic into separate functions and de-duplicated it between replies and topics. Improved the UI for editing topics in Nox. Used type aliases to reduce the amount of boilerplate in tables.go and patches.go Reduced the amount of boilerplate in the action post logic. Eliminated a map and a slice in the topic page for users who haven't given any likes. E.g. Guests. Fixed some long out-dated parts of the update instructions. Updated the update instructions to remove mention of the obsolete lastSchema.json Fixed a bug in init.js where /api/me was being loaded for guests. Added the MiniTopicGet, GlobalCount and CountInTopic methods to AttachmentStore. Added the MiniAttachment struct. Split the mod floaters out into their own template to reduce duplication. Removed a couple of redundant ParseForms. Added the common.skipUntilIfExistsOrLine function. Added the NotFoundJS and NotFoundJSQ functions. Added the lastReplyID and attachCount columns to the topics table.
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
addInitHook("end_init", () => {
$(".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"
});
// 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");
});
})();