|
|
@ -29,15 +29,15 @@ $(function () {
|
|
|
|
var msg = i18nMsg;
|
|
|
|
var msg = i18nMsg;
|
|
|
|
var douban = "https://api.douban.com";
|
|
|
|
var douban = "https://api.douban.com";
|
|
|
|
var dbSearch = "/v2/book/search";
|
|
|
|
var dbSearch = "/v2/book/search";
|
|
|
|
var dbDone = true;
|
|
|
|
var dbDone = 0;
|
|
|
|
|
|
|
|
|
|
|
|
var google = "https://www.googleapis.com";
|
|
|
|
var google = "https://www.googleapis.com";
|
|
|
|
var ggSearch = "/books/v1/volumes";
|
|
|
|
var ggSearch = "/books/v1/volumes";
|
|
|
|
var ggDone = false;
|
|
|
|
var ggDone = 0;
|
|
|
|
|
|
|
|
|
|
|
|
var comicvine = "https://comicvine.gamespot.com";
|
|
|
|
var comicvine = "https://comicvine.gamespot.com";
|
|
|
|
var cvSearch = "/api/search/";
|
|
|
|
var cvSearch = "/api/search/";
|
|
|
|
var cvDone = false;
|
|
|
|
var cvDone = 0;
|
|
|
|
|
|
|
|
|
|
|
|
var showFlag = 0;
|
|
|
|
var showFlag = 0;
|
|
|
|
|
|
|
|
|
|
|
@ -73,7 +73,9 @@ $(function () {
|
|
|
|
if (showFlag === 1) {
|
|
|
|
if (showFlag === 1) {
|
|
|
|
$("#meta-info").html("<ul id=\"book-list\" class=\"media-list\"></ul>");
|
|
|
|
$("#meta-info").html("<ul id=\"book-list\" class=\"media-list\"></ul>");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!ggDone && !dbDone) {
|
|
|
|
if ((ggDone == 3 || (ggDone == 1 && ggResults.length === 0)) &&
|
|
|
|
|
|
|
|
(dbDone == 3 || (ggDone == 1 && dbResults.length === 0)) &&
|
|
|
|
|
|
|
|
(cvDone == 3 || (ggDone == 1 && cvResults.length === 0))) {
|
|
|
|
$("#meta-info").html("<p class=\"text-danger\">" + msg.no_result + "</p>");
|
|
|
|
$("#meta-info").html("<p class=\"text-danger\">" + msg.no_result + "</p>");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -93,7 +95,8 @@ $(function () {
|
|
|
|
return [year, month, day].join("-");
|
|
|
|
return [year, month, day].join("-");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (ggDone && ggResults.length > 0) {
|
|
|
|
if (ggResults.length > 0) {
|
|
|
|
|
|
|
|
if (ggDone < 2) {
|
|
|
|
ggResults.forEach(function(result) {
|
|
|
|
ggResults.forEach(function(result) {
|
|
|
|
var book = {
|
|
|
|
var book = {
|
|
|
|
id: result.id,
|
|
|
|
id: result.id,
|
|
|
@ -121,9 +124,14 @@ $(function () {
|
|
|
|
|
|
|
|
|
|
|
|
$("#book-list").append($book);
|
|
|
|
$("#book-list").append($book);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
ggDone = false;
|
|
|
|
ggDone = 2;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
ggDone = 3;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (dbDone && dbResults.length > 0) {
|
|
|
|
|
|
|
|
|
|
|
|
if (dbResults.length > 0) {
|
|
|
|
|
|
|
|
if (dbDone < 2) {
|
|
|
|
dbResults.forEach(function(result) {
|
|
|
|
dbResults.forEach(function(result) {
|
|
|
|
var seriesTitle = "";
|
|
|
|
var seriesTitle = "";
|
|
|
|
if (result.series) {
|
|
|
|
if (result.series) {
|
|
|
@ -168,9 +176,13 @@ $(function () {
|
|
|
|
|
|
|
|
|
|
|
|
$("#book-list").append($book);
|
|
|
|
$("#book-list").append($book);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
dbDone = false;
|
|
|
|
dbDone = 2;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
dbDone = 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (cvDone && cvResults.length > 0) {
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cvResults.length > 0) {
|
|
|
|
|
|
|
|
if (cvDone < 2) {
|
|
|
|
cvResults.forEach(function(result) {
|
|
|
|
cvResults.forEach(function(result) {
|
|
|
|
var seriesTitle = "";
|
|
|
|
var seriesTitle = "";
|
|
|
|
if (result.volume.name) {
|
|
|
|
if (result.volume.name) {
|
|
|
@ -214,7 +226,10 @@ $(function () {
|
|
|
|
|
|
|
|
|
|
|
|
$("#book-list").append($book);
|
|
|
|
$("#book-list").append($book);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
cvDone = false;
|
|
|
|
cvDone = 2;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
cvDone = 3;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -227,11 +242,10 @@ $(function () {
|
|
|
|
success: function success(data) {
|
|
|
|
success: function success(data) {
|
|
|
|
if ("items" in data) {
|
|
|
|
if ("items" in data) {
|
|
|
|
ggResults = data.items;
|
|
|
|
ggResults = data.items;
|
|
|
|
ggDone = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
complete: function complete() {
|
|
|
|
complete: function complete() {
|
|
|
|
ggDone = true;
|
|
|
|
ggDone = 1;
|
|
|
|
showResult();
|
|
|
|
showResult();
|
|
|
|
$("#show-google").trigger("change");
|
|
|
|
$("#show-google").trigger("change");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -252,7 +266,7 @@ $(function () {
|
|
|
|
$("#meta-info").html("<p class=\"text-danger\">" + msg.search_error + "!</p>" + $("#meta-info")[0].innerHTML);
|
|
|
|
$("#meta-info").html("<p class=\"text-danger\">" + msg.search_error + "!</p>" + $("#meta-info")[0].innerHTML);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
complete: function complete() {
|
|
|
|
complete: function complete() {
|
|
|
|
dbDone = true;
|
|
|
|
dbDone = 1;
|
|
|
|
showResult();
|
|
|
|
showResult();
|
|
|
|
$("#show-douban").trigger("change");
|
|
|
|
$("#show-douban").trigger("change");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -274,7 +288,7 @@ $(function () {
|
|
|
|
$("#meta-info").html("<p class=\"text-danger\">" + msg.search_error + "!</p>" + $("#meta-info")[0].innerHTML);
|
|
|
|
$("#meta-info").html("<p class=\"text-danger\">" + msg.search_error + "!</p>" + $("#meta-info")[0].innerHTML);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
complete: function complete() {
|
|
|
|
complete: function complete() {
|
|
|
|
cvDone = true;
|
|
|
|
cvDone = 1;
|
|
|
|
showResult();
|
|
|
|
showResult();
|
|
|
|
$("#show-comics").trigger("change");
|
|
|
|
$("#show-comics").trigger("change");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -283,6 +297,10 @@ $(function () {
|
|
|
|
|
|
|
|
|
|
|
|
function doSearch (keyword) {
|
|
|
|
function doSearch (keyword) {
|
|
|
|
showFlag = 0;
|
|
|
|
showFlag = 0;
|
|
|
|
|
|
|
|
dbDone = ggDone = cvDone = 0;
|
|
|
|
|
|
|
|
dbResults = [];
|
|
|
|
|
|
|
|
ggResults = [];
|
|
|
|
|
|
|
|
cvResults = [];
|
|
|
|
$("#meta-info").text(msg.loading);
|
|
|
|
$("#meta-info").text(msg.loading);
|
|
|
|
if (keyword) {
|
|
|
|
if (keyword) {
|
|
|
|
dbSearchBook(keyword);
|
|
|
|
dbSearchBook(keyword);
|
|
|
|