jquery: fix obsolete uses of success (#3548).

This commit is contained in:
evazion
2018-04-26 23:53:49 -05:00
parent f7748a2ed7
commit a49cb1c105
5 changed files with 11 additions and 14 deletions

View File

@@ -73,10 +73,10 @@
var commentary = Danbooru.ArtistCommentary.from_post_id(id); var commentary = Danbooru.ArtistCommentary.from_post_id(id);
} }
commentary.then(Danbooru.ArtistCommentary.fill_commentary).done(function (success) { commentary.then(Danbooru.ArtistCommentary.fill_commentary).then(function (success) {
var message = success ? "Artist commentary copied." : "Artist commentary copied; conflicting fields ignored."; var message = success ? "Artist commentary copied." : "Artist commentary copied; conflicting fields ignored.";
Danbooru.notice(message); Danbooru.notice(message);
}).fail(function () { }).catch(function () {
Danbooru.notice("Fetching artist commentary failed."); Danbooru.notice("Fetching artist commentary failed.");
}); });

View File

@@ -530,7 +530,7 @@
} }
Danbooru.Autocomplete.saved_search_source = function(term, resp) { Danbooru.Autocomplete.saved_search_source = function(term, resp) {
return Danbooru.SavedSearch.labels(term).success(function(labels) { return Danbooru.SavedSearch.labels(term).then(function(labels) {
resp(labels.map(function(label) { resp(labels.map(function(label) {
return { return {
label: label.replace(/_/g, " "), label: label.replace(/_/g, " "),

View File

@@ -485,7 +485,7 @@ Danbooru.Note = {
var text = $textarea.val(); var text = $textarea.val();
$note_body.data("original-body", text); $note_body.data("original-body", text);
Danbooru.Note.Body.set_text($note_body, $note_box, "Loading..."); Danbooru.Note.Body.set_text($note_body, $note_box, "Loading...");
$.get("/note_previews.json", {body: text}).success(function(data) { $.get("/note_previews.json", {body: text}).then(function(data) {
Danbooru.Note.Body.set_text($note_body, $note_box, data.body); Danbooru.Note.Body.set_text($note_body, $note_box, data.body);
Danbooru.Note.Box.resize_inner_border($note_box); Danbooru.Note.Box.resize_inner_border($note_box);
$note_body.show(); $note_body.show();
@@ -518,7 +518,7 @@ Danbooru.Note = {
var $note_box = Danbooru.Note.Box.find(id); var $note_box = Danbooru.Note.Box.find(id);
$note_box.find(".note-box-inner-border").addClass("unsaved"); $note_box.find(".note-box-inner-border").addClass("unsaved");
Danbooru.Note.Body.set_text($note_body, $note_box, "Loading..."); Danbooru.Note.Body.set_text($note_body, $note_box, "Loading...");
$.get("/note_previews.json", {body: text}).success(function(data) { $.get("/note_previews.json", {body: text}).then(function(data) {
Danbooru.Note.Body.set_text($note_body, $note_box, data.body); Danbooru.Note.Body.set_text($note_body, $note_box, data.body);
$note_body.show(); $note_body.show();
}); });

View File

@@ -577,7 +577,7 @@
Danbooru.Post.initialize_saved_searches = function() { Danbooru.Post.initialize_saved_searches = function() {
$("#saved_search_labels").autocomplete({ $("#saved_search_labels").autocomplete({
source: function(req, resp) { source: function(req, resp) {
Danbooru.SavedSearch.labels(req.term).success(function(labels) { Danbooru.SavedSearch.labels(req.term).then(function(labels) {
resp(labels.map(function(label) { resp(labels.map(function(label) {
return { return {
label: label.replace(/_/g, " "), label: label.replace(/_/g, " "),

View File

@@ -101,14 +101,11 @@
} }
Danbooru.Upload.fetch_source_data = function(url, referer_url) { Danbooru.Upload.fetch_source_data = function(url, referer_url) {
var xhr = $.getJSON("/source.json", { url: url, ref: referer_url }); return $.getJSON("/source.json", { url: url, ref: referer_url })
.then(Danbooru.Upload.fill_source_info)
xhr.success(Danbooru.Upload.fill_source_info); .catch(function(data) {
xhr.fail(function(data) { $("#source-info span#loading-data").html("Error: " + data.responseJSON["message"])
$("#source-info span#loading-data").html("Error: " + data.responseJSON["message"]) });
});
return xhr;
} }
Danbooru.Upload.fill_source_info = function(data) { Danbooru.Upload.fill_source_info = function(data) {