From 5d6e8cf9b34e33913ff68271f1bf5fe6a5425d75 Mon Sep 17 00:00:00 2001 From: Cutls Date: Fri, 30 Aug 2019 01:46:19 +0900 Subject: [PATCH] Add: search offset --- app/js/tl/src.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/app/js/tl/src.js b/app/js/tl/src.js index 956f8358..9e6c3a59 100644 --- a/app/js/tl/src.js +++ b/app/js/tl/src.js @@ -11,8 +11,14 @@ function searchMenu() { } //検索取得 -function src(mode) { - $("#src-contents").html(""); +function src(mode, offset) { + if(!offset){ + $("#src-contents").html(""); + var add = "" + }else{ + var add = "&type=accounts&offset=" + $("#src-accts .cvo").length + } + var q = $("#src").val(); var acct_id = $("#src-acct-sel").val(); if (acct_id == "tootsearch") { @@ -28,7 +34,7 @@ function src(mode) { var user = $('#his-data').attr("user-id"); } if (!mode) { - var start = "https://" + domain + "/api/v2/search?q=" + q + var start = "https://" + domain + "/api/v2/search?q=" + q + add } else { var start = "https://" + domain + "/api/v1/search?q=" + q } @@ -69,7 +75,13 @@ function src(mode) { //アカウント if (json.accounts[0]) { var templete = userparse(json.accounts, '', acct_id); - $("#src-contents").append("
Accounts
" + templete); + console.log(templete) + if(!offset){ + $("#src-contents").append("
Accounts
" + templete + '
more...'); + }else{ + $("#src-accts").append(templete) + } + } jQuery("time.timeago").timeago(); });