sources: factor out 'Fetch source data' box into view component.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import Uploads from './uploads.js.erb';
|
||||
import SourceDataComponent from '../../../components/source_data_component/source_data_component.js';
|
||||
import Utility from './utility';
|
||||
|
||||
let RelatedTag = {};
|
||||
@@ -17,7 +17,7 @@ RelatedTag.initialize_all = function() {
|
||||
|
||||
// Initialize the recent/favorite/translated/artist tag columns once, the first time the related tags are shown.
|
||||
$(document).one("danbooru:show-related-tags", RelatedTag.initialize_recent_and_favorite_tags);
|
||||
$(document).one("danbooru:show-related-tags", Uploads.fetch_data_manual);
|
||||
$(document).one("danbooru:show-related-tags", SourceDataComponent.fetchData);
|
||||
|
||||
// Show the related tags automatically when the "Edit" tab is opened, or by default on the uploads page.
|
||||
$(document).on("danbooru:open-post-edit-tab", RelatedTag.show);
|
||||
|
||||
@@ -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 »");
|
||||
|
||||
Reference in New Issue
Block a user