forked from Shinonome/dots-hyprland
sidebar: booru: page support
This commit is contained in:
@@ -73,17 +73,21 @@ class BooruService extends Service {
|
|||||||
const userArgs = `${msg}${this._nsfw ? '' : ' rating:safe'}`.split(/\s+/);
|
const userArgs = `${msg}${this._nsfw ? '' : ' rating:safe'}`.split(/\s+/);
|
||||||
|
|
||||||
let taglist = [];
|
let taglist = [];
|
||||||
|
let page = 1;
|
||||||
// Construct body/headers
|
// Construct body/headers
|
||||||
for (let i = 0; i < userArgs.length; i++) {
|
for (let i = 0; i < userArgs.length; i++) {
|
||||||
const thisArg = userArgs[i].trim();
|
const thisArg = userArgs[i].trim();
|
||||||
if (thisArg.length == 0 || thisArg == '.' || thisArg == '*') continue;
|
if (thisArg.length == 0 || thisArg == '.' || thisArg == '*') continue;
|
||||||
|
else if(!isNaN(thisArg)) page = parseInt(thisArg);
|
||||||
else taglist.push(thisArg);
|
else taglist.push(thisArg);
|
||||||
}
|
}
|
||||||
const newMessageId = this._queries.length;
|
const newMessageId = this._queries.length;
|
||||||
this._queries.push(taglist.length == 0 ? ['*'] : taglist);
|
this._queries.push(taglist.length == 0 ? ['*', `${page}`] : [...taglist, `${page}`]);
|
||||||
this.emit('newResponse', newMessageId);
|
this.emit('newResponse', newMessageId);
|
||||||
const params = {
|
const params = {
|
||||||
'tags': taglist.join('+'),
|
'tags': taglist.join('+'),
|
||||||
|
'page': `${page}`,
|
||||||
|
'limit': `${userOptions.sidebar.imageBooruCount}`,
|
||||||
};
|
};
|
||||||
const paramString = paramStringFromObj(params);
|
const paramString = paramStringFromObj(params);
|
||||||
// Fetch
|
// Fetch
|
||||||
|
|||||||
Reference in New Issue
Block a user