add new fi

This commit is contained in:
cutls 2021-06-18 16:16:37 +09:00
parent 36ad187296
commit d62bc57368
8 changed files with 4235 additions and 4586 deletions

View File

@ -1,60 +1,71 @@
//ディレクトリ
//ディレクトリトグル
function dirMenu() {
$("#dir-contents").html("")
directory()
$("#left-menu a").removeClass("active")
$("#dirMenu").addClass("active")
$(".menu-content").addClass("hide")
$("#dir-box").removeClass("hide")
$('#dir-contents').html('')
directory('directory')
$('#left-menu a').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")
var acct = $('#dir-acct-sel').val()
if (acct == 'noauth') {
$('#dirNoAuth').removeClass('hide')
} else {
$("#dirNoAuth").addClass("hide")
directory()
$('#dirNoAuth').addClass('hide')
directory('check')
}
}
function directory(isMore) {
var order = $("[name=sort]:checked").val()
function dirChange(mode) {
if (mode === 'directory') $('#directoryConfig').removeClass('hide')
if (mode === 'suggest') $('#directoryConfig').addClass('hide')
directory(mode)
}
function directory(modeRaw, isMore) {
const mode = modeRaw === 'check' ? $('[name=dirsug]:checked').val() : modeRaw
var order = $('[name=sort]:checked').val()
if (!order) {
order = "active"
order = 'active'
}
var local_only = $("#local_only:checked").val()
var local_only = $('#local_only:checked').val()
if (local_only) {
local_only = "true"
local_only = 'true'
} else {
local_only = "false"
local_only = 'false'
}
var acct_id = $("#dir-acct-sel").val()
if (acct_id == "noauth") {
var domain = $("#dirNoAuth-url").val()
var at = ""
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")
var domain = localStorage.getItem('domain_' + acct_id)
var at = localStorage.getItem('acct_' + acct_id + '_at')
}
if (isMore) {
var addOffset = $("#dir-contents .cvo").length
$("#dir-contents").append(`<div class="progress transparent"><div class="indeterminate"></div></div>`)
var addOffset = $('#dir-contents .cvo').length
$('#dir-contents').append(`<div class="progress transparent"><div class="indeterminate"></div></div>`)
} else {
var addOffset = 0
$("#dir-contents").html(`<div class="progress transparent"><div class="indeterminate"></div></div>`)
$('#dir-contents').html(`<div class="progress transparent"><div class="indeterminate"></div></div>`)
}
var start = "https://" + domain + "/api/v1/directory?order=" + order + "&local=" + local_only + "&offset=" + addOffset
let start = `https://${domain}/api/v1/directory?order=${order}&local=${local_only}&offset=${addOffset}`
if (mode === 'suggest') start = `https://${domain}/api/v2/suggestions`
console.log(start)
fetch(start, {
method: "GET",
method: 'GET',
headers: {
"content-type": "application/json",
Authorization: "Bearer " + at
}
'content-type': 'application/json',
Authorization: 'Bearer ' + at,
},
})
.then(function(response) {
$("#dir-contents .progress").remove()
$('#dir-contents .progress').remove()
if (!response.ok) {
$('#dir-contents').html(`v2 follow suggestion is supported by Mastodon 3.4.0 or above.`)
response.text().then(function(text) {
setLog(response.url, response.status, text)
})
@ -62,17 +73,24 @@ function directory(isMore) {
return response.json()
})
.catch(function(error) {
setLog(start, "JSON", error)
setLog(start, 'JSON', 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()
$('#moreDir').removeClass('disabled')
let obj = []
if (mode === 'suggest') {
$('#moreDir').addClass('disabled')
for (const suggest of json) obj.push(suggest.account)
} else {
$("#moreDir").addClass("disabled")
obj = json
}
var html = userparse(obj, null, acct_id, 'dir', null)
$('#dir-contents').append(html)
jQuery('time.timeago').timeago()
} else {
$('#moreDir').addClass('disabled')
}
})
}

View File

@ -1,6 +1,7 @@
//TL取得
moreloading = false
var errorct = 0
function tl(type, data, acct_id, tlid, delc, voice, mode) {
scrollevent()
$('#unread_' + tlid + ' .material-icons').removeClass('teal-text')
@ -182,7 +183,7 @@ function tl(type, data, acct_id, tlid, delc, voice, mode) {
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
$('#landing_' + tlid).append(`<div>${response.status}</div><div>${escapeHTML(text)}`)
$('#landing_' + tlid).append(`<div>${response.status}</div><div>${$.strip_tags(text)}`)
setLog(response.url, response.status, text)
})
}
@ -269,17 +270,14 @@ function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
}
}
}
function stremaingSubscribe(type, acct_id, data, unsubscribe) {
let command = 'subscribe'
if (unsubscribe) command = 'unsubscribe'
let stream
const domain = localStorage.getItem('domain_' + acct_id)
if (type == 'home') return false
if (type === 'local' || type === 'mix') { stream = 'public:local' }
else if (type === 'local-media') { stream = 'public:local:media' }
else if (type === 'pub') { stream = 'public' }
else if (type === 'pub-media') { stream = 'public:media' }
else if (type === 'list') {
if (type === 'local' || type === 'mix') { stream = 'public:local' } else if (type === 'local-media') { stream = 'public:local:media' } else if (type === 'pub') { stream = 'public' } else if (type === 'pub-media') { stream = 'public:media' } else if (type === 'list') {
mastodonBaseWs[domain].send(JSON.stringify({ type: command, stream: 'list', list: data }))
return true
} else if (type === 'tag') {
@ -296,6 +294,7 @@ function stremaingSubscribe(type, acct_id, data, unsubscribe) {
}
mastodonBaseWs[domain].send(JSON.stringify({ type: command, stream: stream }))
}
function oldStreaming(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
var misskey = false
const domain = localStorage.getItem(`domain_${acct_id}`)
@ -317,7 +316,8 @@ function oldStreaming(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
var add = ''
if (remoteOnlyCk(tlid)) {
add = '&remote=true'
} var start =
}
var start =
wss + '/api/v1/streaming/?stream=public:media&access_token=' + at + add
} else if (type == 'local') {
var start =
@ -415,9 +415,7 @@ function oldStreaming(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
$('[unique-id=' + JSON.parse(mess.data).payload + ']').remove()
}
} else if (typeA == 'update' || typeA == 'conversation') {
if (
!$('#unread_' + tlid + ' .material-icons').hasClass('teal-text')
) {
if (!$('#unread_' + tlid + ' .material-icons').hasClass('teal-text')) {
//markers show中はダメ
var obj = JSON.parse(JSON.parse(mess.data).payload)
if (
@ -969,6 +967,7 @@ function typePs(type) {
return 'userList'
}
}
function misskeycom(type, data) {
if (type == 'home') {
return 'timeline'
@ -1024,6 +1023,7 @@ function icon(type) {
}
return response
}
function reconnector(tlid, type, acct_id, data, mode) {
console.log('%c Reconnector:' + mode + '(timeline' + tlid + ')', 'color:pink')
if (type == 'mix' || type == 'integrated' || type == 'plus') {
@ -1053,6 +1053,7 @@ function reconnector(tlid, type, acct_id, data, mode) {
}
M.toast({ html: lang.lang_tl_reconnect, displayLength: 2000 })
}
function columnReload(tlid, type) {
$('#notice_icon_' + tlid).addClass('red-text')
$('#unread_' + tlid + ' .material-icons').removeClass('teal-text')
@ -1152,6 +1153,7 @@ function getMarker(tlid, type, acct_id) {
}
})
}
function showUnread(tlid, type, acct_id) {
if ($('#unread_' + tlid + ' .material-icons').hasClass('teal-text')) {
goTop(tlid)
@ -1205,6 +1207,7 @@ function showUnread(tlid, type, acct_id) {
})
}
var ueloadlock = false
function ueload(tlid) {
if (ueloadlock) {
return false
@ -1261,6 +1264,7 @@ function ueload(tlid) {
ueloadlock = false
})
}
function asRead(callback) {
//Markers
var markers = localStorage.getItem('markers')
@ -1320,6 +1324,7 @@ function asRead(callback) {
}
}
}
function asReadEnd() {
//Markers
var markers = localStorage.getItem('markers')
@ -1397,6 +1402,7 @@ function getBookmark(acct_id, tlid, more) {
}
}
}
function getUtl(acct_id, tlid, data, more) {
moreloading = true

File diff suppressed because it is too large Load Diff

View File

@ -179,6 +179,7 @@
"foundBug": "I found a bug",
"show": "Show",
"directory": "Directory",
"discover": "Discover",
"active": "Recently active",
"newcomer": "New arrivals",
"local_only": "Local only",

View File

@ -177,6 +177,7 @@
"foundBug": "バグあるんやけど",
"show": "表示",
"directory": "ディレクトリ",
"discover": "見つける",
"active": "最新活動順",
"newcomer": "新規順",
"local_only": "ローカルだけ",

View File

@ -93,7 +93,7 @@
"change": "変更",
"followReq": "フォローリクエスト",
"likeHimOrHer": "似てる",
"frc":"おすすめ",
"frc": "おすすめフォロー",
"more": "もっと",
"endorse": "紹介する",
"openinbrowser": "ブラウザで開く",
@ -179,6 +179,7 @@
"foundBug": "バグを見つけた",
"show": "表示",
"directory": "ディレクトリ",
"discover": "見つける",
"active": "最新活動順",
"newcomer": "新規順",
"local_only": "ローカルのみ",

File diff suppressed because it is too large Load Diff

View File

@ -688,7 +688,7 @@
style="width:100%; max-width:40rem;"><img src="../../img/desk_full.svg" class="left" width="25"
style="padding-top:5px;">Main author: Cutls@1m.cutls.com</a>
<br>
TheDesk @ <a href="https://github.com/cutls/TheDesk/commits/5621ffbe42a1de361ccee0e679c97d30da436aab">5621ffbe42a1de361ccee0e679c97d30da436aab</a> - <a
TheDesk @ <a href="https://github.com/cutls/TheDesk/commits/36ad187296f74ae3ed6cb12a4ef26b27d8d13d0f">36ad187296f74ae3ed6cb12a4ef26b27d8d13d0f</a> - <a
onclick="checkupd(); return localStorage.removeItem('new-ver-skip'); location.href='index.html';"
class="pointer pwa">Sprawdź aktualizacje</a><br>
<br>
@ -698,7 +698,7 @@
<img src="https://status.cutls.com/badge-service?site=thedesk.top">
</a><br>
<h5>OSS License</h5>
<a href="https://app.fossa.com/projects/git%2Bgithub.com%2Fcutls%2FTheDesk/refs/branch/master/5621ffbe42a1de361ccee0e679c97d30da436aab"
<a href="https://app.fossa.com/projects/git%2Bgithub.com%2Fcutls%2FTheDesk/refs/branch/master/36ad187296f74ae3ed6cb12a4ef26b27d8d13d0f"
alt="FOSSA Status"><img
src="https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcutls%2FTheDesk.svg?type=small" /></a>
<br>