Fix #3867: Add namespaces to all Javascript events.
This commit is contained in:
@@ -13,14 +13,14 @@ Upload.initialize_all = function() {
|
||||
if ($("#image").prop("complete")) {
|
||||
this.initialize_image();
|
||||
} else {
|
||||
$("#image").on("load error", this.initialize_image);
|
||||
$("#image").on("load.danbooru error.danbooru", this.initialize_image);
|
||||
}
|
||||
this.initialize_info_bookmarklet();
|
||||
this.initialize_similar();
|
||||
this.initialize_submit();
|
||||
$("#related-tags-button").trigger("click");
|
||||
|
||||
$("#toggle-artist-commentary").click(function(e) {
|
||||
$("#toggle-artist-commentary").on("click.danbooru", function(e) {
|
||||
Upload.toggle_commentary();
|
||||
e.preventDefault();
|
||||
});
|
||||
@@ -32,25 +32,27 @@ Upload.initialize_all = function() {
|
||||
}
|
||||
|
||||
Upload.initialize_submit = function() {
|
||||
$("#form").submit(function(e) {
|
||||
var error_messages = [];
|
||||
if (($("#upload_file").val() === "") && ($("#upload_source").val() === "") && $("#upload_md5_confirmation").val() === "") {
|
||||
error_messages.push("Must choose file or specify source");
|
||||
}
|
||||
if (!$("#upload_rating_s").prop("checked") && !$("#upload_rating_q").prop("checked") && !$("#upload_rating_e").prop("checked") &&
|
||||
($("#upload_tag_string").val().search(/\brating:[sqe]/i) < 0)) {
|
||||
error_messages.push("Must specify a rating");
|
||||
}
|
||||
if (error_messages.length === 0) {
|
||||
$("#submit-button").prop("disabled", "true");
|
||||
$("#submit-button").prop("value", "Submitting...");
|
||||
$("#client-errors").hide();
|
||||
} else {
|
||||
$("#client-errors").html("<strong>Error</strong>: " + error_messages.join(", "));
|
||||
$("#client-errors").show();
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
$("#form").on("submit.danbooru", Upload.validate_upload);
|
||||
}
|
||||
|
||||
Upload.validate_upload = function (e) {
|
||||
var error_messages = [];
|
||||
if (($("#upload_file").val() === "") && ($("#upload_source").val() === "") && $("#upload_md5_confirmation").val() === "") {
|
||||
error_messages.push("Must choose file or specify source");
|
||||
}
|
||||
if (!$("#upload_rating_s").prop("checked") && !$("#upload_rating_q").prop("checked") && !$("#upload_rating_e").prop("checked") &&
|
||||
($("#upload_tag_string").val().search(/\brating:[sqe]/i) < 0)) {
|
||||
error_messages.push("Must specify a rating");
|
||||
}
|
||||
if (error_messages.length === 0) {
|
||||
$("#submit-button").prop("disabled", "true");
|
||||
$("#submit-button").prop("value", "Submitting...");
|
||||
$("#client-errors").hide();
|
||||
} else {
|
||||
$("#client-errors").html("<strong>Error</strong>: " + error_messages.join(", "));
|
||||
$("#client-errors").show();
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
Upload.initialize_iqdb_source = function() {
|
||||
@@ -70,14 +72,14 @@ Upload.initialize_enter_on_tags = function() {
|
||||
}
|
||||
|
||||
Upload.initialize_similar = function() {
|
||||
$("#similar-button").click(function(e) {
|
||||
$("#similar-button").on("click.danbooru", function(e) {
|
||||
$.get("/iqdb_queries", {"url": $("#upload_source").val()}).done(function(html) {$("#iqdb-similar").html(html).show()});
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
|
||||
Upload.initialize_info_bookmarklet = function() {
|
||||
$("#upload_source").change(function (e) {
|
||||
$("#upload_source").on("change.danbooru", function (e) {
|
||||
$("#fetch-data-manual").click();
|
||||
});
|
||||
|
||||
@@ -85,7 +87,7 @@ Upload.initialize_info_bookmarklet = function() {
|
||||
}
|
||||
|
||||
Upload.initialize_info_manual = function() {
|
||||
$("#fetch-data-manual").click(function(e) {
|
||||
$("#fetch-data-manual").on("click.danbooru", function(e) {
|
||||
var source = $("#upload_source,#post_source").val();
|
||||
var referer = $("#upload_referer_url").val();
|
||||
|
||||
@@ -178,7 +180,7 @@ Upload.initialize_image = function() {
|
||||
Post.resize_image_to_window($image);
|
||||
Post.initialize_post_image_resize_to_window_link();
|
||||
Upload.update_scale();
|
||||
$("#image-resize-to-window-link").click(Upload.update_scale);
|
||||
$("#image-resize-to-window-link").on("click.danbooru", Upload.update_scale);
|
||||
}
|
||||
|
||||
Upload.toggle_commentary = function() {
|
||||
|
||||
Reference in New Issue
Block a user