posts/show: load flag/appeal/replacement dialogs via ajax (#3922).
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
let PostAppeal = {};
|
||||
|
||||
PostAppeal.initialize_all = function() {
|
||||
if ($("#c-posts").length && $("#a-show").length) {
|
||||
this.initialize_appeal();
|
||||
}
|
||||
}
|
||||
|
||||
PostAppeal.initialize_appeal = function() {
|
||||
$("#appeal-dialog").dialog({
|
||||
autoOpen: false,
|
||||
width: 700,
|
||||
modal: true,
|
||||
buttons: {
|
||||
"Submit": function() {
|
||||
$("#appeal-dialog form").submit();
|
||||
$(this).dialog("close");
|
||||
},
|
||||
"Cancel": function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("#appeal").on("click.danbooru", function(e) {
|
||||
e.preventDefault();
|
||||
$("#appeal-dialog").dialog("open");
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
PostAppeal.initialize_all();
|
||||
});
|
||||
|
||||
export default PostAppeal
|
||||
@@ -1,39 +0,0 @@
|
||||
let PostFlag = {};
|
||||
|
||||
PostFlag.initialize_all = function() {
|
||||
if ($("#c-posts").length && $("#a-show").length) {
|
||||
this.initialize_flag();
|
||||
}
|
||||
}
|
||||
|
||||
PostFlag.initialize_flag = function() {
|
||||
$("#flag-dialog").dialog({
|
||||
autoOpen: false,
|
||||
width: 700,
|
||||
modal: true,
|
||||
buttons: {
|
||||
"Submit": function() {
|
||||
$("#flag-dialog form").submit();
|
||||
$(this).dialog("close");
|
||||
},
|
||||
"Cancel": function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#flag-dialog form').submit(function() {
|
||||
$('#flag-dialog').dialog('close');
|
||||
});
|
||||
|
||||
$("#flag").on("click.danbooru", function(e) {
|
||||
e.preventDefault();
|
||||
$("#flag-dialog").dialog("open");
|
||||
});
|
||||
}
|
||||
|
||||
$(function() {
|
||||
PostFlag.initialize_all();
|
||||
});
|
||||
|
||||
export default PostFlag
|
||||
@@ -31,7 +31,6 @@ Post.initialize_all = function() {
|
||||
this.initialize_post_image_resize_links();
|
||||
this.initialize_post_image_resize_to_window_link();
|
||||
this.initialize_similar();
|
||||
this.initialize_replace_image_dialog();
|
||||
this.initialize_gestures();
|
||||
|
||||
if ((Utility.meta("always-resize-images") === "true") || (Utility.meta("viewport") && (window.screen.width <= 660))) {
|
||||
@@ -616,32 +615,6 @@ Post.initialize_saved_searches = function() {
|
||||
});
|
||||
}
|
||||
|
||||
Post.initialize_replace_image_dialog = function() {
|
||||
$("#replace-image-dialog").dialog({
|
||||
autoOpen: false,
|
||||
width: 700,
|
||||
modal: true,
|
||||
buttons: {
|
||||
"Submit": function() {
|
||||
$("#replace-image-dialog form").submit();
|
||||
$(this).dialog("close");
|
||||
},
|
||||
"Cancel": function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#replace-image-dialog form').submit(function() {
|
||||
$('#replace-image-dialog').dialog('close');
|
||||
});
|
||||
|
||||
$("#replace-image").on("click.danbooru", function(e) {
|
||||
e.preventDefault();
|
||||
$("#replace-image-dialog").dialog("open");
|
||||
});
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
Post.initialize_all();
|
||||
});
|
||||
|
||||
@@ -36,6 +36,31 @@ Utility.error = function(msg) {
|
||||
}
|
||||
}
|
||||
|
||||
Utility.dialog = function(title, html) {
|
||||
const $dialog = $(html).dialog({
|
||||
title: title,
|
||||
width: 700,
|
||||
modal: true,
|
||||
close: function() {
|
||||
// Defer removing the dialog to avoid detaching the <form> tag before the
|
||||
// form is submitted (which would prevent the submission from going through).
|
||||
$(() => $dialog.dialog("destroy"));
|
||||
},
|
||||
buttons: {
|
||||
"Submit": function() {
|
||||
$dialog.find("form").submit();
|
||||
},
|
||||
"Cancel": function() {
|
||||
$dialog.dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$dialog.find("form").on("submit.danbooru", function() {
|
||||
$dialog.dialog("close");
|
||||
});
|
||||
}
|
||||
|
||||
Utility.keydown = function(keys, namespace, handler) {
|
||||
if (Utility.meta("enable-js-navigation") === "true") {
|
||||
$(document).on("keydown.danbooru." + namespace, null, keys, handler);
|
||||
|
||||
Reference in New Issue
Block a user