sources: factor out 'Fetch source data' box into view component.

This commit is contained in:
evazion
2021-02-25 18:54:15 -06:00
parent 0eea654a48
commit e1ef94faf7
13 changed files with 74 additions and 59 deletions

View File

@@ -14,8 +14,6 @@ Upload.IQDB_HIGH_SIMILARITY = 70;
Upload.initialize_all = function() {
if ($("#c-uploads,#c-posts").length) {
Utility.keydown("return", "submit", Upload.submit_form, "#upload_tag_string, #post_tag_string");
$("#upload_source").on("change.danbooru", Upload.fetch_data_manual);
$(document).on("click.danbooru", "#fetch-data-manual", Upload.fetch_data_manual);
}
if ($("#c-uploads").length) {
@@ -159,18 +157,6 @@ Upload.update_scale = function() {
}
}
Upload.fetch_data_manual = function(e) {
var url = $("#upload_source,#post_source").val();
var ref = $("#upload_referer_url").val();
if (/^https?:\/\//.test(url)) {
$("#source-info").addClass("loading");
$.get("/source.js", { url: url, ref: ref }).always(resp => $("#source-info").removeClass("loading"));
}
e.preventDefault();
}
Upload.toggle_commentary = function() {
if ($(".artist-commentary").is(":visible")) {
$("#toggle-artist-commentary").text("show »");