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 »");
|
||||
|
||||
@@ -221,30 +221,6 @@ div#c-post-versions, div#c-artist-versions {
|
||||
}
|
||||
}
|
||||
|
||||
div#c-posts, div#c-uploads {
|
||||
/* Fetch source data box */
|
||||
div#source-info {
|
||||
border-radius: 4px;
|
||||
border: 1px solid var(--fetch-source-data-border-color);
|
||||
|
||||
&:not(.loading) #source-info-loading { display: none; }
|
||||
&.loading #source-info-content { display: none; }
|
||||
&.loading #fetch-data-manual { display: none; }
|
||||
|
||||
ul {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
dt, dd, li {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
dt, #source-info-tags li {
|
||||
margin-right: 1em;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Container for the tag edit <textarea>, header, and related tags buttons. */
|
||||
#tags-container {
|
||||
max-width: 60rem;
|
||||
|
||||
Reference in New Issue
Block a user