forked from e621ng/e621ng
[ESLint] Fix core complaints
This commit is contained in:
parent
697efbc376
commit
82891b91d1
@ -9,10 +9,10 @@ Artist.update = function (id, params) {
|
|||||||
type: "PUT",
|
type: "PUT",
|
||||||
url: "/artists/" + id + ".json",
|
url: "/artists/" + id + ".json",
|
||||||
data: params,
|
data: params,
|
||||||
success: function(data) {
|
success: function() {
|
||||||
Utility.notice("Artist updated.");
|
Utility.notice("Artist updated.");
|
||||||
},
|
},
|
||||||
error: function(data) {
|
error: function() {
|
||||||
Utility.error(`There was an error updating <a href="/artists/${id}">artist #${id}</a>`);
|
Utility.error(`There was an error updating <a href="/artists/${id}">artist #${id}</a>`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -9,7 +9,7 @@ Blacklist.post_count = 0;
|
|||||||
Blacklist.entries = [];
|
Blacklist.entries = [];
|
||||||
|
|
||||||
Blacklist.entryGet = function (line) {
|
Blacklist.entryGet = function (line) {
|
||||||
return $.grep(Blacklist.entries, function (e, i) {
|
return $.grep(Blacklist.entries, function (e) {
|
||||||
return e.tags === line;
|
return e.tags === line;
|
||||||
})[0];
|
})[0];
|
||||||
};
|
};
|
||||||
@ -326,7 +326,7 @@ Blacklist.initialize_blacklist_editor = function () {
|
|||||||
}
|
}
|
||||||
}).done(function () {
|
}).done(function () {
|
||||||
Utility.notice("Blacklist updated");
|
Utility.notice("Blacklist updated");
|
||||||
}).fail(function (data, status, xhr) {
|
}).fail(function () {
|
||||||
Utility.error("Failed to update blacklist");
|
Utility.error("Failed to update blacklist");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ Comment.show_all = function(e) {
|
|||||||
current_comment_section.html(data.html);
|
current_comment_section.html(data.html);
|
||||||
Comment.reinitialize_all();
|
Comment.reinitialize_all();
|
||||||
$(window).trigger("e621:add_deferred_posts", data.posts);
|
$(window).trigger("e621:add_deferred_posts", data.posts);
|
||||||
}).fail(function(data) {
|
}).fail(function() {
|
||||||
Utility.error("Failed to fetch all comments for this post.");
|
Utility.error("Failed to fetch all comments for this post.");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -65,10 +65,10 @@ Comment.hide = function (e) {
|
|||||||
url: `/comments/${cid}/hide.json`,
|
url: `/comments/${cid}/hide.json`,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (data) {
|
}).done(function () {
|
||||||
$(`.comment[data-comment-id="${cid}"] div.author h1`).append(" (hidden)");
|
$(`.comment[data-comment-id="${cid}"] div.author h1`).append(" (hidden)");
|
||||||
$(`.comment[data-comment-id="${cid}"]`).attr('data-is-deleted', 'true');
|
$(`.comment[data-comment-id="${cid}"]`).attr('data-is-deleted', 'true');
|
||||||
}).fail(function (data) {
|
}).fail(function () {
|
||||||
Utility.error("Failed to hide comment.");
|
Utility.error("Failed to hide comment.");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -83,11 +83,11 @@ Comment.unhide = function (e) {
|
|||||||
url: `/comments/${cid}/unhide.json`,
|
url: `/comments/${cid}/unhide.json`,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (data) {
|
}).done(function () {
|
||||||
const $author = $(`.comment[data-comment-id="${cid}"] div.author h1`);
|
const $author = $(`.comment[data-comment-id="${cid}"] div.author h1`);
|
||||||
$author.text($author.text().replace(" (hidden)", ""));
|
$author.text($author.text().replace(" (hidden)", ""));
|
||||||
$(`.comment[data-comment-id="${cid}"]`).attr('data-is-deleted', 'false');
|
$(`.comment[data-comment-id="${cid}"]`).attr('data-is-deleted', 'false');
|
||||||
}).fail(function (data) {
|
}).fail(function () {
|
||||||
Utility.error("Failed to unhide comment.");
|
Utility.error("Failed to unhide comment.");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -102,9 +102,9 @@ Comment.delete = function (e) {
|
|||||||
url: `/comments/${cid}.json`,
|
url: `/comments/${cid}.json`,
|
||||||
type: 'DELETE',
|
type: 'DELETE',
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (data) {
|
}).done(function () {
|
||||||
parent.remove();
|
parent.remove();
|
||||||
}).fail(function (data) {
|
}).fail(function () {
|
||||||
Utility.error("Failed to delete comment.");
|
Utility.error("Failed to delete comment.");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -23,7 +23,7 @@ function initSearch() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#theme-switcher").change(function(e) {
|
$("#theme-switcher").change(function() {
|
||||||
let theme = $(this).val();
|
let theme = $(this).val();
|
||||||
LS.put("theme", theme);
|
LS.put("theme", theme);
|
||||||
$("body").attr("data-th-main", theme);
|
$("body").attr("data-th-main", theme);
|
||||||
@ -60,9 +60,9 @@ $(function() {
|
|||||||
method: "PUT",
|
method: "PUT",
|
||||||
url: path,
|
url: path,
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(data => {
|
}).done(() => {
|
||||||
location.reload();
|
location.reload();
|
||||||
}).fail(data => {
|
}).fail(() => {
|
||||||
Utility.error("Failed to revert to specified version.");
|
Utility.error("Failed to revert to specified version.");
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
@ -42,7 +42,7 @@ Favorite.create = function (post_id) {
|
|||||||
Post.notice_update("dec");
|
Post.notice_update("dec");
|
||||||
Favorite.after_action(post_id, 1);
|
Favorite.after_action(post_id, 1);
|
||||||
Utility.notice("Favorite added");
|
Utility.notice("Favorite added");
|
||||||
}).fail(function (data, status, xhr) {
|
}).fail(function (data) {
|
||||||
Utility.error("Error: " + data.responseJSON.message);
|
Utility.error("Error: " + data.responseJSON.message);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -60,7 +60,7 @@ Favorite.destroy = function (post_id) {
|
|||||||
Post.notice_update("dec");
|
Post.notice_update("dec");
|
||||||
Favorite.after_action(post_id, -1);
|
Favorite.after_action(post_id, -1);
|
||||||
Utility.notice("Favorite removed");
|
Utility.notice("Favorite removed");
|
||||||
}).fail(function (data, status, xhr) {
|
}).fail(function (data) {
|
||||||
Utility.error("Error: " + data.responseJSON.message);
|
Utility.error("Error: " + data.responseJSON.message);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -84,11 +84,11 @@ ForumPost.vote_remove = function(evt) {
|
|||||||
type: "DELETE",
|
type: "DELETE",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
accept: "text/javascript",
|
accept: "text/javascript",
|
||||||
}).done(function(data) {
|
}).done(function() {
|
||||||
$(evt.target).parents(".own-forum-vote").remove();
|
$(evt.target).parents(".own-forum-vote").remove();
|
||||||
$(`#forum-post-votes-for-${id} .forum-post-vote-block`).show();
|
$(`#forum-post-votes-for-${id} .forum-post-vote-block`).show();
|
||||||
Utility.notice("Vote removed.");
|
Utility.notice("Vote removed.");
|
||||||
}).fail(function(data) {
|
}).fail(function() {
|
||||||
Utility.error("Failed to unvote on forum post.");
|
Utility.error("Failed to unvote on forum post.");
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -136,10 +136,10 @@ ForumPost.hide = function (e) {
|
|||||||
url: `/forum_posts/${fpid}/hide.json`,
|
url: `/forum_posts/${fpid}/hide.json`,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (data) {
|
}).done(function () {
|
||||||
$(`.forum-post[data-forum-post-id="${fpid}"] div.author h4`).append(" (hidden)");
|
$(`.forum-post[data-forum-post-id="${fpid}"] div.author h4`).append(" (hidden)");
|
||||||
$(`.forum-post[data-forum-post-id="${fpid}"]`).attr('data-is-hidden', 'true');
|
$(`.forum-post[data-forum-post-id="${fpid}"]`).attr('data-is-hidden', 'true');
|
||||||
}).fail(function (data) {
|
}).fail(function () {
|
||||||
Utility.error("Failed to hide post.");
|
Utility.error("Failed to hide post.");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -154,11 +154,11 @@ ForumPost.unhide = function (e) {
|
|||||||
url: `/forum_posts/${fpid}/unhide.json`,
|
url: `/forum_posts/${fpid}/unhide.json`,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (data) {
|
}).done(function () {
|
||||||
const $author = $(`.forum-post[data-forum-post-id="${fpid}"] div.author h4`);
|
const $author = $(`.forum-post[data-forum-post-id="${fpid}"] div.author h4`);
|
||||||
$author.text($author.text().replace(" (hidden)", ""));
|
$author.text($author.text().replace(" (hidden)", ""));
|
||||||
$(`.forum-post[data-forum-post-id="${fpid}"]`).attr('data-is-hidden', 'false');
|
$(`.forum-post[data-forum-post-id="${fpid}"]`).attr('data-is-hidden', 'false');
|
||||||
}).fail(function (data) {
|
}).fail(function () {
|
||||||
Utility.error("Failed to unhide post.");
|
Utility.error("Failed to unhide post.");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -13,6 +13,7 @@ let LS = {
|
|||||||
try {
|
try {
|
||||||
return JSON.parse(value);
|
return JSON.parse(value);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,14 +16,14 @@ let Note = {
|
|||||||
$note_box.attr("data-id", String(id));
|
$note_box.attr("data-id", String(id));
|
||||||
$note_box.draggable({
|
$note_box.draggable({
|
||||||
containment: $("#image"),
|
containment: $("#image"),
|
||||||
stop: function(e, ui) {
|
stop: function() {
|
||||||
Note.Box.update_data_attributes($note_box);
|
Note.Box.update_data_attributes($note_box);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$note_box.resizable({
|
$note_box.resizable({
|
||||||
containment: $("#image"),
|
containment: $("#image"),
|
||||||
handles: "se, nw",
|
handles: "se, nw",
|
||||||
stop: function(e, ui) {
|
stop: function() {
|
||||||
Note.Box.update_data_attributes($note_box);
|
Note.Box.update_data_attributes($note_box);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -406,11 +406,11 @@ let Note = {
|
|||||||
return hash;
|
return hash;
|
||||||
},
|
},
|
||||||
|
|
||||||
error_handler: function(xhr, status, exception) {
|
error_handler: function(xhr) {
|
||||||
Utility.error("Error: " + (xhr.responseJSON.reason || xhr.responseJSON.reasons.join("; ")));
|
Utility.error("Error: " + (xhr.responseJSON.reason || xhr.responseJSON.reasons.join("; ")));
|
||||||
},
|
},
|
||||||
|
|
||||||
success_handler: function(data, status, xhr) {
|
success_handler: function(data) {
|
||||||
var $note_box = null;
|
var $note_box = null;
|
||||||
|
|
||||||
if (data.html_id) { // new note
|
if (data.html_id) { // new note
|
||||||
|
@ -54,7 +54,7 @@ PostModeMenu.initialize_selector = function() {
|
|||||||
$("#mode-box-mode").val(LS.get("mode"));
|
$("#mode-box-mode").val(LS.get("mode"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#mode-box-mode").on("change.danbooru", function(e) {
|
$("#mode-box-mode").on("change.danbooru", function() {
|
||||||
PostModeMenu.change();
|
PostModeMenu.change();
|
||||||
$("#tag-script-field:visible").focus().select();
|
$("#tag-script-field:visible").focus().select();
|
||||||
});
|
});
|
||||||
@ -103,7 +103,7 @@ PostModeMenu.close_edit_form = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PostModeMenu.initialize_tag_script_field = function() {
|
PostModeMenu.initialize_tag_script_field = function() {
|
||||||
$("#tag-script-field").blur(function(e) {
|
$("#tag-script-field").blur(function() {
|
||||||
const script = $(this).val();
|
const script = $(this).val();
|
||||||
|
|
||||||
const current_script_id = LS.get("current_tag_script_id");
|
const current_script_id = LS.get("current_tag_script_id");
|
||||||
|
@ -34,7 +34,7 @@ PostReplacement.approve = function (id, penalize_current_uploader) {
|
|||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function () {
|
}).done(function () {
|
||||||
set_status($row, "approved");
|
set_status($row, "approved");
|
||||||
}).fail(function (data, status, xhr) {
|
}).fail(function (data) {
|
||||||
Utility.error(data.responseText);
|
Utility.error(data.responseText);
|
||||||
set_status($row, "replacement failed");
|
set_status($row, "replacement failed");
|
||||||
});
|
});
|
||||||
@ -51,7 +51,7 @@ PostReplacement.reject = function (id) {
|
|||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function () {
|
}).done(function () {
|
||||||
set_status($row, "rejected");
|
set_status($row, "rejected");
|
||||||
}).fail(function (data, status, xhr) {
|
}).fail(function (data) {
|
||||||
Utility.error(data.responseText);
|
Utility.error(data.responseText);
|
||||||
set_status($row, "rejecting failed");
|
set_status($row, "rejecting failed");
|
||||||
});
|
});
|
||||||
@ -69,7 +69,7 @@ PostReplacement.promote = function (id) {
|
|||||||
}).done(function (data) {
|
}).done(function (data) {
|
||||||
Utility.notice(`Replacement promoted to post #${data.post.id}`);
|
Utility.notice(`Replacement promoted to post #${data.post.id}`);
|
||||||
set_status($row, "promoted");
|
set_status($row, "promoted");
|
||||||
}).fail(function (data, status, xhr) {
|
}).fail(function (data) {
|
||||||
Utility.error(data.responseText);
|
Utility.error(data.responseText);
|
||||||
set_status($row, "promoting failed");
|
set_status($row, "promoting failed");
|
||||||
});
|
});
|
||||||
@ -83,10 +83,10 @@ PostReplacement.toggle_penalize = function ($target) {
|
|||||||
type: "PUT",
|
type: "PUT",
|
||||||
url: `/post_replacements/${id}/toggle_penalize.json`,
|
url: `/post_replacements/${id}/toggle_penalize.json`,
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (data) {
|
}).done(function () {
|
||||||
$target.removeClass("disabled-link");
|
$target.removeClass("disabled-link");
|
||||||
$currentStatus.text($currentStatus.text() == "yes" ? "no" : "yes");
|
$currentStatus.text($currentStatus.text() == "yes" ? "no" : "yes");
|
||||||
}).fail(function (data, status, xhr) {
|
}).fail(function (data) {
|
||||||
Utility.error(data.responseText);
|
Utility.error(data.responseText);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ PostSet.add_post = function (set_id, post_id) {
|
|||||||
url: "/post_sets/" + set_id + "/add_posts.json",
|
url: "/post_sets/" + set_id + "/add_posts.json",
|
||||||
data: {post_ids: [post_id]},
|
data: {post_ids: [post_id]},
|
||||||
}).fail(function (data) {
|
}).fail(function (data) {
|
||||||
var message = $.map(data.responseJSON.errors, function(msg, attr) { return msg; }).join('; ');
|
var message = $.map(data.responseJSON.errors, function(msg) { return msg; }).join('; ');
|
||||||
Post.notice_update("dec");
|
Post.notice_update("dec");
|
||||||
$(window).trigger('danbooru:error', "Error: " + message);
|
$(window).trigger('danbooru:error', "Error: " + message);
|
||||||
}).done(function () {
|
}).done(function () {
|
||||||
@ -32,7 +32,7 @@ PostSet.remove_post = function (set_id, post_id) {
|
|||||||
url: "/post_sets/" + set_id + "/remove_posts.json",
|
url: "/post_sets/" + set_id + "/remove_posts.json",
|
||||||
data: {post_ids: [post_id]},
|
data: {post_ids: [post_id]},
|
||||||
}).fail(function (data) {
|
}).fail(function (data) {
|
||||||
var message = $.map(data.responseJSON.errors, function(msg, attr) { return msg; }).join('; ');
|
var message = $.map(data.responseJSON.errors, function(msg) { return msg; }).join('; ');
|
||||||
Post.notice_update("dec");
|
Post.notice_update("dec");
|
||||||
$(window).trigger('danbooru:error', "Error: " + message);
|
$(window).trigger('danbooru:error', "Error: " + message);
|
||||||
}).done(function () {
|
}).done(function () {
|
||||||
|
@ -22,11 +22,11 @@ PostVersion.initialize_undo = function () {
|
|||||||
$(event.target).find(".post-version-select:not(:disabled)").prop("checked", (_, checked) => !checked).change();
|
$(event.target).find(".post-version-select:not(:disabled)").prop("checked", (_, checked) => !checked).change();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#post-version-select-all").on("change.danbooru", function (event) {
|
$("#post-version-select-all").on("change.danbooru", function () {
|
||||||
$(".post-version-select:not(:disabled)").prop("checked", $("#post-version-select-all").prop("checked")).change();
|
$(".post-version-select:not(:disabled)").prop("checked", $("#post-version-select-all").prop("checked")).change();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".post-version-select").on("change.danbooru", function (event) {
|
$(".post-version-select").on("change.danbooru", function () {
|
||||||
let checked = $(".post-version-select:checked");
|
let checked = $(".post-version-select:checked");
|
||||||
$("#subnav-undo-selected-link").text(`Undo selected (${checked.length})`).toggle(checked.length > 0);
|
$("#subnav-undo-selected-link").text(`Undo selected (${checked.length})`).toggle(checked.length > 0);
|
||||||
});
|
});
|
||||||
|
@ -106,7 +106,7 @@ Post.open_edit_dialog = function() {
|
|||||||
at: "right-20",
|
at: "right-20",
|
||||||
of: window
|
of: window
|
||||||
},
|
},
|
||||||
drag: function(e, ui) {
|
drag: function() {
|
||||||
if (Utility.meta("enable-auto-complete") === "true") {
|
if (Utility.meta("enable-auto-complete") === "true") {
|
||||||
$tag_string.data("uiAutocomplete").close();
|
$tag_string.data("uiAutocomplete").close();
|
||||||
}
|
}
|
||||||
@ -118,7 +118,7 @@ Post.open_edit_dialog = function() {
|
|||||||
var pin_button = $("<button/>").button({icons: {primary: "ui-icon-pin-w"}, label: "pin", text: false});
|
var pin_button = $("<button/>").button({icons: {primary: "ui-icon-pin-w"}, label: "pin", text: false});
|
||||||
pin_button.css({width: "20px", height: "20px", position: "absolute", right: "28.4px"});
|
pin_button.css({width: "20px", height: "20px", position: "absolute", right: "28.4px"});
|
||||||
dialog.parent().children(".ui-dialog-titlebar").append(pin_button);
|
dialog.parent().children(".ui-dialog-titlebar").append(pin_button);
|
||||||
pin_button.on("click.danbooru", function(e) {
|
pin_button.on("click.danbooru", function() {
|
||||||
var dialog_widget = $('.ui-dialog:has(#edit-dialog)');
|
var dialog_widget = $('.ui-dialog:has(#edit-dialog)');
|
||||||
var pos = dialog_widget.offset();
|
var pos = dialog_widget.offset();
|
||||||
|
|
||||||
@ -139,9 +139,9 @@ Post.open_edit_dialog = function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dialog.parent().mouseout(function(e) {
|
dialog.parent().mouseout(function() {
|
||||||
dialog.parent().css({"opacity": 0.6, "transition": "opacity .4s ease"});
|
dialog.parent().css({"opacity": 0.6, "transition": "opacity .4s ease"});
|
||||||
}).mouseover(function(e) {
|
}).mouseover(function() {
|
||||||
dialog.parent().css({"opacity": 1, "transition": "opacity .2s ease"});
|
dialog.parent().css({"opacity": 1, "transition": "opacity .2s ease"});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ Post.open_edit_dialog = function() {
|
|||||||
$tag_string.focus().selectEnd().height($tag_string[0].scrollHeight);
|
$tag_string.focus().selectEnd().height($tag_string[0].scrollHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
Post.close_edit_dialog = function(e, ui) {
|
Post.close_edit_dialog = function() {
|
||||||
$("#form").appendTo($("#c-posts #edit,#c-uploads #a-new"));
|
$("#form").appendTo($("#c-posts #edit,#c-uploads #a-new"));
|
||||||
$("#edit-dialog").remove();
|
$("#edit-dialog").remove();
|
||||||
var $tag_string = $("#post_tag_string");
|
var $tag_string = $("#post_tag_string");
|
||||||
@ -225,7 +225,7 @@ class E6Swipe extends ZingTouch.Swipe {
|
|||||||
const dist = distanceBetweenTwoPoints([acc.last.x, acc.last.y], [move.x, move.y]);
|
const dist = distanceBetweenTwoPoints([acc.last.x, acc.last.y], [move.x, move.y]);
|
||||||
return {vel: acc.vel + vel, angle: [acc.angle[0] + Math.cos(angle), acc.angle[1] + Math.sin(angle)], dist: acc.dist + dist, last: move};
|
return {vel: acc.vel + vel, angle: [acc.angle[0] + Math.cos(angle), acc.angle[1] + Math.sin(angle)], dist: acc.dist + dist, last: move};
|
||||||
}, {vel: 0, angle: 0, dist: 0, last: null});
|
}, {vel: 0, angle: 0, dist: 0, last: null});
|
||||||
const initial = input.initial;
|
// const initial = input.initial;
|
||||||
// Add total gesture motion as a bias.
|
// Add total gesture motion as a bias.
|
||||||
// totals.vel += getVelocity([initial.x, initial.y, initial.time], [input.current.x, input.current.y, input.current.time]);
|
// totals.vel += getVelocity([initial.x, initial.y, initial.time], [input.current.x, input.current.y, input.current.time]);
|
||||||
// totals.angle += getAngle([initial.x, initial.y], [input.current.x, input.current.y]) + Math.PI;
|
// totals.angle += getAngle([initial.x, initial.y], [input.current.x, input.current.y]) + Math.PI;
|
||||||
@ -387,7 +387,7 @@ Post.initialize_links = function() {
|
|||||||
data: {
|
data: {
|
||||||
other_post_id: other_post_id
|
other_post_id: other_post_id
|
||||||
},
|
},
|
||||||
success: function(data) {
|
success: function() {
|
||||||
$(window).trigger("danbooru:notice", "Successfully copied notes to <a href='" + other_post_id + "'>post #" + other_post_id + "</a>");
|
$(window).trigger("danbooru:notice", "Successfully copied notes to <a href='" + other_post_id + "'>post #" + other_post_id + "</a>");
|
||||||
},
|
},
|
||||||
error: function(data) {
|
error: function(data) {
|
||||||
@ -481,9 +481,8 @@ Post.resize_video = function (post, target_size) {
|
|||||||
|
|
||||||
function original_sources() {
|
function original_sources() {
|
||||||
target_sources.push({type: 'video/webm', url: post?.file?.url});
|
target_sources.push({type: 'video/webm', url: post?.file?.url});
|
||||||
if (typeof post?.sample?.alternates?.original !== 'unknown') {
|
if (typeof post?.sample?.alternates?.original !== "undefined")
|
||||||
target_sources.push({type: 'video/mp4', url: post?.sample?.alternates?.original?.urls[1]});
|
target_sources.push({type: 'video/mp4', url: post?.sample?.alternates?.original?.urls[1]});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (target_size) {
|
switch (target_size) {
|
||||||
@ -498,7 +497,7 @@ Post.resize_video = function (post, target_size) {
|
|||||||
original_sources();
|
original_sources();
|
||||||
desired_classes.push('fit-window-vertical');
|
desired_classes.push('fit-window-vertical');
|
||||||
break;
|
break;
|
||||||
default:
|
default: {
|
||||||
$notice.show();
|
$notice.show();
|
||||||
const alternate = post?.sample?.alternates[target_size];
|
const alternate = post?.sample?.alternates[target_size];
|
||||||
target_sources.push({type: 'video/webm; codecs="vp9"', url: alternate.urls[0]});
|
target_sources.push({type: 'video/webm; codecs="vp9"', url: alternate.urls[0]});
|
||||||
@ -506,6 +505,7 @@ Post.resize_video = function (post, target_size) {
|
|||||||
desired_classes.push('fit-window');
|
desired_classes.push('fit-window');
|
||||||
update_resize_percentage(post?.sample?.alternates[target_size]?.width, post?.file?.width);
|
update_resize_percentage(post?.sample?.alternates[target_size]?.width, post?.file?.width);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$video.removeClass();
|
$video.removeClass();
|
||||||
$video.empty(); // Yank any sources out of the list to prevent browsers from being pants on head.
|
$video.empty(); // Yank any sources out of the list to prevent browsers from being pants on head.
|
||||||
@ -644,7 +644,7 @@ Post.initialize_resize = function () {
|
|||||||
Post.resize_notes();
|
Post.resize_notes();
|
||||||
}
|
}
|
||||||
|
|
||||||
$image.on('load', function (e) {
|
$image.on('load', function () {
|
||||||
Post.resize_notes();
|
Post.resize_notes();
|
||||||
$("#image-container").removeClass("image-loading");
|
$("#image-container").removeClass("image-loading");
|
||||||
});
|
});
|
||||||
@ -749,7 +749,7 @@ Post.update = function(post_id, params) {
|
|||||||
Post.notice_update("dec");
|
Post.notice_update("dec");
|
||||||
Post.update_data(data);
|
Post.update_data(data);
|
||||||
},
|
},
|
||||||
error: function(data) {
|
error: function() {
|
||||||
Post.notice_update("dec");
|
Post.notice_update("dec");
|
||||||
$(window).trigger("danbooru:error", 'There was an error updating <a href="/posts/' + post_id + '">post #' + post_id + '</a>');
|
$(window).trigger("danbooru:error", 'There was an error updating <a href="/posts/' + post_id + '">post #' + post_id + '</a>');
|
||||||
}
|
}
|
||||||
@ -765,9 +765,9 @@ Post.delete_with_reason = function(post_id, reason, reload_after_delete) {
|
|||||||
url: `/moderator/post/posts/${post_id}/delete.json`,
|
url: `/moderator/post/posts/${post_id}/delete.json`,
|
||||||
data: {commit: "Delete", reason: reason, move_favorites: true}
|
data: {commit: "Delete", reason: reason, move_favorites: true}
|
||||||
}).fail(function(data) {
|
}).fail(function(data) {
|
||||||
var message = $.map(data.responseJSON.errors, function(msg, attr) { return msg; }).join('; ');
|
var message = $.map(data.responseJSON.errors, function(msg) { return msg; }).join('; ');
|
||||||
$(window).trigger('danbooru:error', "Error: " + message);
|
$(window).trigger('danbooru:error', "Error: " + message);
|
||||||
}).done(function(data) {
|
}).done(function() {
|
||||||
$(window).trigger("danbooru:notice", "Deleted post.");
|
$(window).trigger("danbooru:notice", "Deleted post.");
|
||||||
if(reload_after_delete) {
|
if(reload_after_delete) {
|
||||||
location.reload();
|
location.reload();
|
||||||
@ -790,7 +790,7 @@ Post.undelete = function(post_id, callback) {
|
|||||||
// var message = $.map(data.responseJSON.errors, function(msg, attr) { return msg; }).join('; ');
|
// var message = $.map(data.responseJSON.errors, function(msg, attr) { return msg; }).join('; ');
|
||||||
const message = data.responseJSON.message;
|
const message = data.responseJSON.message;
|
||||||
$(window).trigger('danbooru:error', "Error: " + message);
|
$(window).trigger('danbooru:error', "Error: " + message);
|
||||||
}).done(function(data) {
|
}).done(function() {
|
||||||
$(window).trigger("danbooru:notice", "Undeleted post.");
|
$(window).trigger("danbooru:notice", "Undeleted post.");
|
||||||
$(`article#post_${post_id}`).attr('data-flags', 'active');
|
$(`article#post_${post_id}`).attr('data-flags', 'active');
|
||||||
if(callback) callback();
|
if(callback) callback();
|
||||||
@ -811,7 +811,7 @@ Post.unflag = function(post_id, approval, reload = true) {
|
|||||||
}).fail(function(data) {
|
}).fail(function(data) {
|
||||||
const message = data.responseJSON.message;
|
const message = data.responseJSON.message;
|
||||||
$(window).trigger('danbooru:error', "Error: " + message);
|
$(window).trigger('danbooru:error', "Error: " + message);
|
||||||
}).done(function(data) {
|
}).done(function() {
|
||||||
$(window).trigger("danbooru:notice", "Unflagged post");
|
$(window).trigger("danbooru:notice", "Unflagged post");
|
||||||
if (reload) {
|
if (reload) {
|
||||||
location.reload();
|
location.reload();
|
||||||
@ -830,9 +830,9 @@ Post.unapprove = function(post_id) {
|
|||||||
url: "/moderator/post/approval.json",
|
url: "/moderator/post/approval.json",
|
||||||
data: {post_id: post_id}
|
data: {post_id: post_id}
|
||||||
}).fail(function(data) {
|
}).fail(function(data) {
|
||||||
var message = $.map(data.responseJSON.errors, function(msg, attr) { return msg; }).join('; ');
|
var message = $.map(data.responseJSON.errors, function(msg) { return msg; }).join('; ');
|
||||||
$(window).trigger('danbooru:error', "Error: " + message);
|
$(window).trigger('danbooru:error', "Error: " + message);
|
||||||
}).done(function(data) {
|
}).done(function() {
|
||||||
$(window).trigger("danbooru:notice", "Unapproved post.");
|
$(window).trigger("danbooru:notice", "Unapproved post.");
|
||||||
location.reload();
|
location.reload();
|
||||||
}).always(function() {
|
}).always(function() {
|
||||||
@ -844,9 +844,9 @@ Post.unapprove = function(post_id) {
|
|||||||
Post.destroy = function(post_id, reason) {
|
Post.destroy = function(post_id, reason) {
|
||||||
$.post(`/moderator/post/posts/${post_id}/expunge.json`, { reason }
|
$.post(`/moderator/post/posts/${post_id}/expunge.json`, { reason }
|
||||||
).fail(data => {
|
).fail(data => {
|
||||||
var message = $.map(data.responseJSON.errors, function(msg, attr) { return msg; }).join("; ");
|
var message = $.map(data.responseJSON.errors, function(msg) { return msg; }).join("; ");
|
||||||
$(window).trigger("danbooru:error", "Error: " + message);
|
$(window).trigger("danbooru:error", "Error: " + message);
|
||||||
}).done(data => {
|
}).done(() => {
|
||||||
location.href = `/admin/destroyed_posts/${post_id}`;
|
location.href = `/admin/destroyed_posts/${post_id}`;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -855,7 +855,7 @@ Post.regenerate_image_samples = function(post_id) {
|
|||||||
$.post(`/moderator/post/posts/${post_id}/regenerate_thumbnails.json`, {}
|
$.post(`/moderator/post/posts/${post_id}/regenerate_thumbnails.json`, {}
|
||||||
).fail(data => {
|
).fail(data => {
|
||||||
Utility.error("Error: " + data.responseJSON.reason);
|
Utility.error("Error: " + data.responseJSON.reason);
|
||||||
}).done(data => {
|
}).done(() => {
|
||||||
Utility.notice("Image samples regenerated.");
|
Utility.notice("Image samples regenerated.");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -864,7 +864,7 @@ Post.regenerate_video_samples = function(post_id) {
|
|||||||
$.post(`/moderator/post/posts/${post_id}/regenerate_videos.json`, {}
|
$.post(`/moderator/post/posts/${post_id}/regenerate_videos.json`, {}
|
||||||
).fail(data => {
|
).fail(data => {
|
||||||
Utility.error("Error: " + data.responseJSON.reason);
|
Utility.error("Error: " + data.responseJSON.reason);
|
||||||
}).done(data => {
|
}).done(() => {
|
||||||
Utility.notice("Video samples will be regenerated in a few minutes.");
|
Utility.notice("Video samples will be regenerated in a few minutes.");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -876,9 +876,9 @@ Post.approve = function(post_id, callback) {
|
|||||||
"/moderator/post/approval.json",
|
"/moderator/post/approval.json",
|
||||||
{ "post_id": post_id }
|
{ "post_id": post_id }
|
||||||
).fail(function(data) {
|
).fail(function(data) {
|
||||||
const message = $.map(data.responseJSON.errors, function(msg, attr) { return msg; }).join("; ");
|
const message = $.map(data.responseJSON.errors, function(msg) { return msg; }).join("; ");
|
||||||
Danbooru.error("Error: " + message);
|
Danbooru.error("Error: " + message);
|
||||||
}).done(function(data) {
|
}).done(function() {
|
||||||
var $post = $("#post_" + post_id);
|
var $post = $("#post_" + post_id);
|
||||||
if ($post.length) {
|
if ($post.length) {
|
||||||
$post.data("flags", $post.data("flags").replace(/pending/, ""));
|
$post.data("flags", $post.data("flags").replace(/pending/, ""));
|
||||||
@ -901,9 +901,9 @@ Post.disapprove = function(post_id, reason, message) {
|
|||||||
"/moderator/post/disapprovals.json",
|
"/moderator/post/disapprovals.json",
|
||||||
{"post_disapproval[post_id]": post_id, "post_disapproval[reason]": reason, "post_disapproval[message]": message}
|
{"post_disapproval[post_id]": post_id, "post_disapproval[reason]": reason, "post_disapproval[message]": message}
|
||||||
).fail(function(data) {
|
).fail(function(data) {
|
||||||
var message = $.map(data.responseJSON.errors, function(msg, attr) { return msg; }).join("; ");
|
var message = $.map(data.responseJSON.errors, function(msg) { return msg; }).join("; ");
|
||||||
$(window).trigger("danbooru:error", "Error: " + message);
|
$(window).trigger("danbooru:error", "Error: " + message);
|
||||||
}).done(function(data) {
|
}).done(function() {
|
||||||
if ($("#c-posts #a-show").length) {
|
if ($("#c-posts #a-show").length) {
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
@ -916,7 +916,7 @@ Post.disapprove = function(post_id, reason, message) {
|
|||||||
Post.update_tag_count = function(event) {
|
Post.update_tag_count = function(event) {
|
||||||
let string = "0 tags";
|
let string = "0 tags";
|
||||||
let count = 0;
|
let count = 0;
|
||||||
let count2 = 1;
|
// let count2 = 1;
|
||||||
|
|
||||||
if (event) {
|
if (event) {
|
||||||
let tags = [...new Set($(event.target).val().match(/\S+/g))];
|
let tags = [...new Set($(event.target).val().match(/\S+/g))];
|
||||||
@ -994,7 +994,7 @@ Post.set_as_avatar = function(id) {
|
|||||||
headers: {
|
headers: {
|
||||||
accept: '*/*;q=0.5,text/javascript'
|
accept: '*/*;q=0.5,text/javascript'
|
||||||
}
|
}
|
||||||
}).done(function(data) {
|
}).done(function() {
|
||||||
$(window).trigger("danbooru:notice", "Post set as avatar");
|
$(window).trigger("danbooru:notice", "Post set as avatar");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -17,10 +17,10 @@ class TagRelationships {
|
|||||||
url: `/${route}/${id}/approve.json`,
|
url: `/${route}/${id}/approve.json`,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (data) {
|
}).done(function () {
|
||||||
Utility.notice(`Accepted ${human}.`);
|
Utility.notice(`Accepted ${human}.`);
|
||||||
parent.slideUp('fast');
|
parent.slideUp('fast');
|
||||||
}).fail(function (data) {
|
}).fail(function () {
|
||||||
Utility.error(`Failed to accept ${human}.`);
|
Utility.error(`Failed to accept ${human}.`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -41,10 +41,10 @@ class TagRelationships {
|
|||||||
url: `/${route}/${id}.json`,
|
url: `/${route}/${id}.json`,
|
||||||
type: 'DELETE',
|
type: 'DELETE',
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).done(function (data) {
|
}).done(function () {
|
||||||
Utility.notice(`Rejected ${human}.`);
|
Utility.notice(`Rejected ${human}.`);
|
||||||
parent.slideUp('fast');
|
parent.slideUp('fast');
|
||||||
}).fail(function (data) {
|
}).fail(function () {
|
||||||
Utility.error(`Failed to reject ${human}.`);
|
Utility.error(`Failed to reject ${human}.`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ Takedown.destroy = function (id) {
|
|||||||
data: {
|
data: {
|
||||||
"id": id
|
"id": id
|
||||||
}
|
}
|
||||||
}).done(function (data) {
|
}).done(function () {
|
||||||
Utility.notice("Takedown deleted");
|
Utility.notice("Takedown deleted");
|
||||||
$("#takedown-" + id).fadeOut("fast");
|
$("#takedown-" + id).fadeOut("fast");
|
||||||
}).fail(function (data) {
|
}).fail(function (data) {
|
||||||
@ -128,7 +128,7 @@ Takedown.remove_post = function (id, post_id) {
|
|||||||
id: id,
|
id: id,
|
||||||
post_ids: post_id
|
post_ids: post_id
|
||||||
}
|
}
|
||||||
}).done(function (data) {
|
}).done(function () {
|
||||||
Utility.notice("Post #" + post_id + " removed from takedown")
|
Utility.notice("Post #" + post_id + " removed from takedown")
|
||||||
$("#takedown-post-" + post_id).remove();
|
$("#takedown-post-" + post_id).remove();
|
||||||
}).fail(function (data) {
|
}).fail(function (data) {
|
||||||
|
@ -36,7 +36,7 @@ class UserWarnable {
|
|||||||
Comment.reinitialize_all();
|
Comment.reinitialize_all();
|
||||||
ForumPost.reinitialize_all();
|
ForumPost.reinitialize_all();
|
||||||
DText.initialize_all_inputs();
|
DText.initialize_all_inputs();
|
||||||
}).fail(data => {
|
}).fail(() => {
|
||||||
Utility.error("Failed to mark as warned.");
|
Utility.error("Failed to mark as warned.");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -18,7 +18,7 @@ export default [
|
|||||||
"@stylistic/js": stylistic,
|
"@stylistic/js": stylistic,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
"no-unused-vars": "off",
|
"no-unused-vars": "warn",
|
||||||
|
|
||||||
// https://eslint.style/packages/js
|
// https://eslint.style/packages/js
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user