Add in-line ban capabilities

Anyone with the ability to create bans can now do so via the drop down
menu on all posts.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2022-06-23 22:27:26 -07:00
parent 1e61522f7a
commit 647aedfc67
4 changed files with 53 additions and 12 deletions

View File

@@ -31,18 +31,17 @@ function closeMenu(e) {
function openMenu(e) {
e.preventDefault();
let sender = e.target;
let reportButton = $("<a>")
.text("Report")
.attr("href", "#")
.on("click", (e) => { return openReportWindow(e, $(sender.parentElement)); });
let menuList = $("<ul></ul>")
.append($("<lh><strong>Actions</strong></lh>").addClass("post_menu_item"))
.append(
$('<li></li>')
.addClass("post_menu_item")
.append(reportButton)
)
.addClass("post_menu_items");
window.menuItemFactories.forEach(factory => {
item = factory(sender.parentElement);
menuList.append(
$("<li></li>")
.addClass("post_menu_item")
.append(item)
);
});
let rect = sender.getBoundingClientRect();
let menu = $("<div></div>")
.addClass("post_menu")
@@ -62,7 +61,7 @@ function openReportWindow(e, postElement) {
window.top.reportWindow.close();
}
//let postId = sender.parentElement.getAttribute("id").substring(1);
let reportUrl = postElement.attr("data-report-url");
let reportUrl = $(postElement).attr("data-report-url");
window.reportWindow = new WinBox("New Report", {
url: reportUrl,
modal: true,
@@ -74,8 +73,16 @@ function openReportWindow(e, postElement) {
function onLoad(e) {
window.reportWindow = null;
window.menuItemFactories.push(
(postElement) =>
$("<a>")
.text("Report")
.attr("href", "#")
.on("click", (e) => { return openReportWindow(e, postElement); })
);
}
$(document).on("click", documentClick);
$(document).on("click", ".post_id", doQuote);
$(window).on("load", onLoad);
$(window).on("load", onLoad);
window.menuItemFactories = [];