diff --git a/app/js/login/login.js b/app/js/login/login.js index dbbb9b7d..5ae36bc6 100644 --- a/app/js/login/login.js +++ b/app/js/login/login.js @@ -489,6 +489,7 @@ function multiSelector(parseC) { }); $("#src-acct-sel").append('Tootsearch'); $("#add-acct-sel").append('' + lang.lang_login_noauth + 'Twitter'); + $("#dir-acct-sel").append('' + lang.lang_login_noauth + ''); } $('select').formSelect(); if(!parseC){ diff --git a/app/js/tl/directory.js b/app/js/tl/directory.js new file mode 100644 index 00000000..c5fee767 --- /dev/null +++ b/app/js/tl/directory.js @@ -0,0 +1,69 @@ +//ディレクトリ +//ディレクトリトグル +function dirMenu() { + $("#dir-contents").html(""); + directory(); + $("#left-menu div").removeClass("active"); + $("#dirMenu").addClass("active"); + $(".menu-content").addClass("hide"); + $("#dir-box").removeClass("hide"); +} +function dirselCk() { + var acct = $("#dir-acct-sel").val(); + if (acct == "noauth") { + $("#dirNoAuth").removeClass("hide"); + } else { + $("#dirNoAuth").addClass("hide"); + directory(); + } +} +function directory(isMore) { + var order = $("[name=sort]:checked").val() + if (!order) { + order = "active" + } + var local_only = $("#local_only:checked").val() + if (local_only) { + local_only = "true" + } else { + local_only = "false" + } + var acct_id = $("#dir-acct-sel").val(); + if (acct_id == "noauth") { + var domain = $("#dirNoAuth-url").val(); + var at = ""; + } else { + var domain = localStorage.getItem("domain_" + acct_id); + var at = localStorage.getItem("acct_" + acct_id + "_at"); + } + if (isMore) { + var addOffset = $("#dir-contents .cvo").length + } else { + var addOffset = 0 + $("#dir-contents").html(""); + } + var start = "https://" + domain + "/api/v1/directory?order=" + order + "&local=" + local_only + "&offset=" + addOffset + console.log(start) + fetch(start, { + method: 'GET', + headers: { + 'content-type': 'application/json', + 'Authorization': 'Bearer ' + at + }, + }).then(function (response) { + return response.json(); + }).catch(function (error) { + //todo(error); + console.error(error); + }).then(function (json) { + if (json) { + $("#moreDir").removeClass("disabled") + var html = userparse(json, null, acct_id, "dir", null) + $("#dir-contents").append(html) + jQuery("time.timeago").timeago(); + } else { + $("#moreDir").addClass("disabled") + } + + }); +} \ No newline at end of file diff --git a/app/js/tl/parse.js b/app/js/tl/parse.js index 96fad252..203be604 100644 --- a/app/js/tl/parse.js +++ b/app/js/tl/parse.js @@ -1014,12 +1014,21 @@ function userparse(obj, auth, acct_id, tlid, popup) { } else { var avatar = "../../img/missing.svg"; } - + if(tlid == "dir" && acct_id == "noauth"){ + var udg ='' + }else{ + var udg ='' + } + if(tlid == "dir"){ + var latest = date(toot.last_status_at, "relative"); + var authhtml = 'Last: ' + latest + + ''; + } templete = templete + '' + notftext + - '' + + '' + udg + '' + '' + @@ -1033,7 +1042,6 @@ function userparse(obj, auth, acct_id, tlid, popup) { 'Followers:' + toot.followers_count + '' + authhtml + '' + - '' + ''; } diff --git a/app/view/make/index.sample.html b/app/view/make/index.sample.html index a91e82a1..85e202bb 100644 --- a/app/view/make/index.sample.html +++ b/app/view/make/index.sample.html @@ -6,6 +6,7 @@ + @@ -464,7 +465,8 @@ - timeline@@timeline@@ people→@@follow@@ @@ -472,7 +474,8 @@ class="material-icons">people←@@follower@@ list@@list@@ - star@@favRegist@@ more_vert@@more@@ @@ -505,8 +508,8 @@ class="material-icons">account_box@@operateOtherAcct@@ - group_workUser Matching + group_workUser + Matching @@ -606,7 +609,8 @@ Powered by Mastodon User Matching - @@get@@ + @@get@@ @@blocked@@ @@ -747,6 +751,8 @@ class="material-icons">search@@search@@ view_headline@@list@@ + recent_actors@@directory@@ filter_list@@filter@@ + + + + + + + + + search@@show@@ + + + + + @@active@@ + + + + @@newcomer@@ + + + + @@local_only@@ + + + @@more@@ + + @@ -1071,7 +1107,7 @@ - + @@ -1091,6 +1127,7 @@ + diff --git a/app/view/make/language/en/index.json b/app/view/make/language/en/index.json index 84ecded4..1678e68b 100644 --- a/app/view/make/language/en/index.json +++ b/app/view/make/language/en/index.json @@ -164,5 +164,10 @@ "changeTips":"Change Tips", "help":"Help", "about":"About TheDesk", - "hereAddColumns":"<- Add TL" + "hereAddColumns":"<- Add TL", + "show": "Show", + "directory": "Directory", + "active": "Recently active", + "newcomer": "New arrivals", + "local_only": "Local only" } \ No newline at end of file diff --git a/app/view/make/language/ja/index.json b/app/view/make/language/ja/index.json index c7afa65b..bc64b09a 100644 --- a/app/view/make/language/ja/index.json +++ b/app/view/make/language/ja/index.json @@ -163,5 +163,10 @@ "changeTips":"Tips変更", "help":"ヘルプ", "about":"このソフトについて", - "hereAddColumns":"←ここからTL追加" + "hereAddColumns":"←ここからTL追加", + "show": "表示", + "directory": "ディレクトリ", + "active": "最新活動順", + "newcomer": "新規順", + "local_only": "ローカルのみ" } \ No newline at end of file