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);
}
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.";
Danbooru.notice(message);
}).fail(function () {
}).catch(function () {
Danbooru.notice("Fetching artist commentary failed.");
});

View File

@@ -530,7 +530,7 @@
}
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) {
return {
label: label.replace(/_/g, " "),

View File

@@ -485,7 +485,7 @@ Danbooru.Note = {
var text = $textarea.val();
$note_body.data("original-body", text);
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.Box.resize_inner_border($note_box);
$note_body.show();
@@ -518,7 +518,7 @@ Danbooru.Note = {
var $note_box = Danbooru.Note.Box.find(id);
$note_box.find(".note-box-inner-border").addClass("unsaved");
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);
$note_body.show();
});

View File

@@ -577,7 +577,7 @@
Danbooru.Post.initialize_saved_searches = function() {
$("#saved_search_labels").autocomplete({
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) {
return {
label: label.replace(/_/g, " "),

View File

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