mirror of
https://github.com/gnh1201/caterpillar.git
synced 2025-09-05 17:31:03 +00:00
Update console.html
This commit is contained in:
parent
7810e85dec
commit
ff381b8e3e
12
console.html
12
console.html
|
@ -400,17 +400,25 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
search: function(...args) {
|
search: function(...args) {
|
||||||
|
set_default_env({
|
||||||
|
"page": 1
|
||||||
|
});
|
||||||
|
|
||||||
var term = this;
|
var term = this;
|
||||||
var q = encodeURIComponent(args.join(' '));
|
var q = encodeURIComponent(args.join(' '));
|
||||||
var url = "https://serp.catswords.net/api.php?q=" + q;
|
var url = "https://serp.catswords.net/api.php?q=" + q;
|
||||||
|
|
||||||
|
if (env.page > 1) {
|
||||||
|
url += "&p=" + env.page + "&t=0";
|
||||||
|
}
|
||||||
|
|
||||||
$.get(url, function(data) {
|
$.get(url, function(data) {
|
||||||
if ("error" in data) {
|
if ("error" in data) {
|
||||||
term.echo(data.error.message);
|
term.echo(data.error.message);
|
||||||
term.echo('');
|
term.echo('');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var results = Object.values(data);
|
var results = Object.values(data);
|
||||||
if (results.length > 0) {
|
if (results.length > 0) {
|
||||||
results.forEach(function(x) {
|
results.forEach(function(x) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user