with acct lookup

This commit is contained in:
cutls 2021-06-02 15:59:36 +09:00
parent 5621ffbe42
commit 36ad187296
8 changed files with 2174 additions and 2120 deletions

8
.prettierrc Normal file
View File

@ -0,0 +1,8 @@
{
"tabWidth": 4,
"useTabs": true,
"semi": false,
"singleQuote": true,
"printWidth": 200,
"jsxBracketSameLine": true
}

View File

@ -110,6 +110,7 @@ function rt(id, acct_id, remote, vis) {
} }
} }
} }
function boostWith(vis) { function boostWith(vis) {
var id = $('#tootmodal').attr('data-id') var id = $('#tootmodal').attr('data-id')
var acct_id = $('#tootmodal').attr('data-acct') var acct_id = $('#tootmodal').attr('data-acct')
@ -167,7 +168,6 @@ async function follow(acct_id, resolve) {
} }
if (!acct_id && acct_id != 'selector') { if (!acct_id && acct_id != 'selector') {
var acct_id = $('#his-data').attr('use-acct') var acct_id = $('#his-data').attr('use-acct')
} else if (acct_id == 'selector') { } else if (acct_id == 'selector') {
var acct_id = $('#user-acct-sel').val() var acct_id = $('#user-acct-sel').val()
} }
@ -182,7 +182,8 @@ async function follow(acct_id, resolve) {
var id = $('#his-data').attr('user-id') var id = $('#his-data').attr('user-id')
if (resolve == 'selector') { if (resolve == 'selector') {
var fullacct = $('#his-acct').attr('fullname') var fullacct = $('#his-acct').attr('fullname')
var id = await acctResolve(acct_id, fullacct) var data = await acctResolve(acct_id, fullacct)
var { id } = data
console.log(id) console.log(id)
} }
var domain = localStorage.getItem('domain_' + acct_id) var domain = localStorage.getItem('domain_' + acct_id)
@ -223,28 +224,47 @@ async function follow(acct_id, resolve) {
} }
async function acctResolve(acct_id, user) { async function acctResolve(acct_id, user) {
console.log('Get user data of ' + user) console.log('Get user data of ' + user)
var domain = localStorage.getItem('domain_' + acct_id) const domain = localStorage.getItem('domain_' + acct_id)
if (localStorage.getItem('mode_' + domain) == 'misskey') { if (localStorage.getItem('mode_' + domain) == 'misskey') {
return false return false
} }
var at = localStorage.getItem('acct_' + acct_id + '_at') const at = localStorage.getItem('acct_' + acct_id + '_at')
var start = 'https://' + domain + '/api/v2/search?resolve=true&q=' + user const options = {
let promise = await fetch(start, {
method: 'GET', method: 'GET',
headers: { headers: {
'content-type': 'application/json', 'content-type': 'application/json',
Authorization: 'Bearer ' + at Authorization: 'Bearer ' + at,
},
} }
}) try {
var idJson = await promise.json() const start = `https://${domain}/api/v1/accounts/lookup?acct=${user}`
const promise = fetch(start, options)
const idJson = await promise.json()
if (idJson) {
return idJson
} else {
return await acctResolveLegacy(domain, user, options)
}
} catch {
return await acctResolveLegacy(domain, user, options)
}
}
async function acctResolveLegacy(domain, user, options) {
console.log(`Get user data of ${user} with legacy method`)
try {
const start = 'https://' + domain + '/api/v2/search?resolve=true&q=' + user
const promise = fetch(start, options)
const idJson = await promise.json()
if (idJson.accounts[0]) { if (idJson.accounts[0]) {
var id = idJson.accounts[0].id return idJson.accounts[0]
} else { } else {
M.toast({ html: lang.lang_fatalerroroccured, displayLength: 2000 }) M.toast({ html: lang.lang_fatalerroroccured, displayLength: 2000 })
} }
return id } catch {
console.log('Error occured on searching and fetching with resolve')
}
} }
//ブロック //ブロック
function block(acct_id) { function block(acct_id) {
if ($('#his-data').hasClass('blocking')) { if ($('#his-data').hasClass('blocking')) {
@ -260,8 +280,8 @@ function block(acct_id) {
type: 'warning', type: 'warning',
showCancelButton: true, showCancelButton: true,
confirmButtonText: lang.lang_yesno, confirmButtonText: lang.lang_yesno,
cancelButtonText: lang.lang_no cancelButtonText: lang.lang_no,
}).then(result => { }).then((result) => {
if (result.value) { if (result.value) {
if (!acct_id) { if (!acct_id) {
var acct_id = $('#his-data').attr('use-acct') var acct_id = $('#his-data').attr('use-acct')
@ -311,8 +331,8 @@ function muteDo(acct_id) {
type: 'warning', type: 'warning',
showCancelButton: true, showCancelButton: true,
confirmButtonText: lang.lang_yesno, confirmButtonText: lang.lang_yesno,
cancelButtonText: lang.lang_no cancelButtonText: lang.lang_no,
}).then(result => { }).then((result) => {
if (result.value) { if (result.value) {
if (!acct_id) { if (!acct_id) {
var acct_id = $('#his-data').attr('use-acct') var acct_id = $('#his-data').attr('use-acct')
@ -390,8 +410,8 @@ function redraft(id, acct_id) {
type: 'warning', type: 'warning',
showCancelButton: true, showCancelButton: true,
confirmButtonText: lang.lang_yesno, confirmButtonText: lang.lang_yesno,
cancelButtonText: lang.lang_no cancelButtonText: lang.lang_no,
}).then(result => { }).then((result) => {
if (result.value) { if (result.value) {
show() show()
var domain = localStorage.getItem('domain_' + acct_id) var domain = localStorage.getItem('domain_' + acct_id)
@ -426,6 +446,7 @@ function redraft(id, acct_id) {
} }
}) })
} }
function draftToPost(json, acct_id, id) { function draftToPost(json, acct_id, id) {
$('#post-acct-sel').prop('disabled', true) $('#post-acct-sel').prop('disabled', true)
$('#post-acct-sel').val(acct_id) $('#post-acct-sel').val(acct_id)
@ -439,11 +460,7 @@ function draftToPost(json, acct_id, id) {
for (var i = 0; i <= 4; i++) { for (var i = 0; i <= 4; i++) {
if (json.media_attachments[i]) { if (json.media_attachments[i]) {
media_ids.push(json.media_attachments[i].id) media_ids.push(json.media_attachments[i].id)
$('#preview').append( $('#preview').append('<img src="' + json.media_attachments[i].preview_url + '" style="width:50px; max-height:100px;">')
'<img src="' +
json.media_attachments[i].preview_url +
'" style="width:50px; max-height:100px;">'
)
} else { } else {
break break
} }
@ -645,8 +662,8 @@ function staEx(mode) {
method: 'GET', method: 'GET',
headers: { headers: {
'content-type': 'application/json', 'content-type': 'application/json',
Authorization: 'Bearer ' + at Authorization: 'Bearer ' + at,
} },
}) })
.then(function(response) { .then(function(response) {
if (!response.ok) { if (!response.ok) {
@ -677,6 +694,7 @@ function staEx(mode) {
}) })
return return
} }
function toggleAction(elm) { function toggleAction(elm) {
console.log(elm) console.log(elm)
const instance = M.Dropdown.init(elm) const instance = M.Dropdown.init(elm)

View File

@ -42,6 +42,7 @@ function remoteOnly(tlid, type) {
} }
columnReload(tlid, type) columnReload(tlid, type)
} }
function remoteOnlyCk(tlid) { function remoteOnlyCk(tlid) {
var multi = localStorage.getItem('column') var multi = localStorage.getItem('column')
var obj = JSON.parse(multi) var obj = JSON.parse(multi)
@ -125,6 +126,7 @@ function catchToggle(tlid) {
parseColumn(tlid) parseColumn(tlid)
} }
} }
function catchCheck(tlid) { function catchCheck(tlid) {
var catchck = localStorage.getItem('catch_' + tlid) var catchck = localStorage.getItem('catch_' + tlid)
if (catchck) { if (catchck) {
@ -135,6 +137,7 @@ function catchCheck(tlid) {
$('#sta-del-' + tlid).css('color', 'red') $('#sta-del-' + tlid).css('color', 'red')
} }
} }
function delreset(tlid) { function delreset(tlid) {
$('[tlid=' + tlid + '] .by_delcatch').hide() $('[tlid=' + tlid + '] .by_delcatch').hide()
$('[tlid=' + tlid + '] .by_delcatch').remove() $('[tlid=' + tlid + '] .by_delcatch').remove()
@ -146,6 +149,7 @@ function filterMenu() {
$('.menu-content').addClass('hide') $('.menu-content').addClass('hide')
$('#filter-box').removeClass('hide') $('#filter-box').removeClass('hide')
} }
function filter() { function filter() {
$('#filtered-words').html('') $('#filtered-words').html('')
$('#filter-edit-id').val('') $('#filter-edit-id').val('')
@ -199,11 +203,13 @@ function filter() {
} }
}) })
} }
function filterTime(day, hour, min) { function filterTime(day, hour, min) {
$('#days_filter').val(day) $('#days_filter').val(day)
$('#hours_filter').val(hour) $('#hours_filter').val(hour)
$('#mins_filter').val(min) $('#mins_filter').val(min)
} }
function makeNewFilter() { function makeNewFilter() {
var acct_id = $('#filter-acct-sel').val() var acct_id = $('#filter-acct-sel').val()
var phr = $('#filter-add-word').val() var phr = $('#filter-add-word').val()
@ -280,6 +286,7 @@ function makeNewFilter() {
} }
} }
} }
function filterEdit(id, acct_id) { function filterEdit(id, acct_id) {
$('#filter-add-word').val('') $('#filter-add-word').val('')
$('#home_filter').prop('checked', false) $('#home_filter').prop('checked', false)
@ -342,6 +349,7 @@ function filterEdit(id, acct_id) {
} }
}) })
} }
function filterDel(id, acct_id) { function filterDel(id, acct_id) {
var domain = localStorage.getItem('domain_' + acct_id) var domain = localStorage.getItem('domain_' + acct_id)
var at = localStorage.getItem('acct_' + acct_id + '_at') var at = localStorage.getItem('acct_' + acct_id + '_at')
@ -363,6 +371,7 @@ function filterDel(id, acct_id) {
} }
} }
} }
function getFilter(acct_id) { function getFilter(acct_id) {
var domain = localStorage.getItem('domain_' + acct_id) var domain = localStorage.getItem('domain_' + acct_id)
var at = localStorage.getItem('acct_' + acct_id + '_at') var at = localStorage.getItem('acct_' + acct_id + '_at')
@ -395,6 +404,7 @@ function getFilter(acct_id) {
localStorage.setItem('filter_' + acct_id, JSON.stringify({})) localStorage.setItem('filter_' + acct_id, JSON.stringify({}))
} }
} }
function getFilterType(json, type) { function getFilterType(json, type) {
if (!json) { if (!json) {
return [] return []
@ -421,6 +431,7 @@ function getFilterType(json, type) {
}) })
return mutedfilters return mutedfilters
} }
function getFilterTypeByAcct(acct_id, type) { function getFilterTypeByAcct(acct_id, type) {
if (localStorage.getItem('filter_' + acct_id) != 'undefined') { if (localStorage.getItem('filter_' + acct_id) != 'undefined') {
var mute = getFilterType(JSON.parse(localStorage.getItem('filter_' + acct_id)), type) var mute = getFilterType(JSON.parse(localStorage.getItem('filter_' + acct_id)), type)
@ -429,6 +440,7 @@ function getFilterTypeByAcct(acct_id, type) {
} }
return mute return mute
} }
function filterUpdate(acct_id) { function filterUpdate(acct_id) {
var domain = localStorage.getItem('domain_' + acct_id) var domain = localStorage.getItem('domain_' + acct_id)
var at = localStorage.getItem('acct_' + acct_id + '_at') var at = localStorage.getItem('acct_' + acct_id + '_at')
@ -461,6 +473,7 @@ function filterUpdate(acct_id) {
filterUpdateInternal(json, 'pub') filterUpdateInternal(json, 'pub')
}) })
} }
function filterUpdateInternal(json, type) { function filterUpdateInternal(json, type) {
var home = getFilterType(json, type) var home = getFilterType(json, type)
var wordmute = localStorage.getItem('word_mute') var wordmute = localStorage.getItem('word_mute')
@ -523,11 +536,11 @@ function exclude(key) {
} else { } else {
excludetxt = '?exclude_types[]=poll' excludetxt = '?exclude_types[]=poll'
} }
} else { } else {}
}
localStorage.setItem('exclude-' + key, excludetxt) localStorage.setItem('exclude-' + key, excludetxt)
parseColumn(key) parseColumn(key)
} }
function excludeCk(key, target) { function excludeCk(key, target) {
var exc = localStorage.getItem('exclude-' + key) var exc = localStorage.getItem('exclude-' + key)
if (!exc) { if (!exc) {
@ -539,6 +552,7 @@ function excludeCk(key, target) {
return '' return ''
} }
} }
function checkNotfFilter(tlid) { function checkNotfFilter(tlid) {
var excludetxt = localStorage.getItem('exclude-' + tlid) var excludetxt = localStorage.getItem('exclude-' + tlid)
if (!excludetxt || excludetxt != '') { if (!excludetxt || excludetxt != '') {
@ -547,10 +561,12 @@ function checkNotfFilter(tlid) {
return false return false
} }
} }
function resetNotfFilter(tlid) { function resetNotfFilter(tlid) {
localStorage.setItem('exclude-' + tlid, '') localStorage.setItem('exclude-' + tlid, '')
parseColumn(tlid) parseColumn(tlid)
} }
function notfFilter(id, tlid, acct_id) { function notfFilter(id, tlid, acct_id) {
var excludetxt = localStorage.getItem('exclude-' + tlid) var excludetxt = localStorage.getItem('exclude-' + tlid)
if (excludetxt || excludetxt != '') { if (excludetxt || excludetxt != '') {

View File

@ -7,6 +7,7 @@ function notf(acct_id, tlid, sys) {
notfCommon(acct_id, tlid, sys) notfCommon(acct_id, tlid, sys)
} }
} }
function notfColumn(acct_id, tlid, sys) { function notfColumn(acct_id, tlid, sys) {
todo('Notifications Loading...') todo('Notifications Loading...')
var native = localStorage.getItem('nativenotf') var native = localStorage.getItem('nativenotf')
@ -22,7 +23,7 @@ function notfColumn(acct_id, tlid, sys) {
httpreq.open('POST', start, true) httpreq.open('POST', start, true)
httpreq.setRequestHeader('Content-Type', 'application/json') httpreq.setRequestHeader('Content-Type', 'application/json')
var body = JSON.stringify({ var body = JSON.stringify({
i: at i: at,
}) })
} else { } else {
var misskey = false var misskey = false
@ -65,7 +66,7 @@ function notfColumn(acct_id, tlid, sys) {
var os = localStorage.getItem('platform') var os = localStorage.getItem('platform')
var options = { var options = {
body: ct + lang.lang_notf_new, body: ct + lang.lang_notf_new,
icon: localStorage.getItem('prof_' + acct_id) icon: localStorage.getItem('prof_' + acct_id),
} }
var n = new Notification('TheDesk:' + domain, options) var n = new Notification('TheDesk:' + domain, options)
} }
@ -117,6 +118,7 @@ function notfColumn(acct_id, tlid, sys) {
var start = 'wss://' + domain + '/?i=' + at var start = 'wss://' + domain + '/?i=' + at
} }
} }
function notfCommon(acct_id, tlid, sys, stream) { function notfCommon(acct_id, tlid, sys, stream) {
todo('Notifications Loading...') todo('Notifications Loading...')
var native = localStorage.getItem('nativenotf') var native = localStorage.getItem('nativenotf')
@ -131,11 +133,11 @@ function notfCommon(acct_id, tlid, sys, stream) {
var i = { var i = {
method: 'POST', method: 'POST',
headers: { headers: {
'content-type': 'application/json' 'content-type': 'application/json',
}, },
body: JSON.stringify({ body: JSON.stringify({
i: at i: at,
}) }),
} }
} else { } else {
var misskey = false var misskey = false
@ -144,8 +146,8 @@ function notfCommon(acct_id, tlid, sys, stream) {
method: 'GET', method: 'GET',
headers: { headers: {
'content-type': 'application/json', 'content-type': 'application/json',
Authorization: 'Bearer ' + at Authorization: 'Bearer ' + at,
} },
} }
} }
if (stream == 'only') { if (stream == 'only') {
@ -184,7 +186,7 @@ function notfCommon(acct_id, tlid, sys, stream) {
var os = localStorage.getItem('platform') var os = localStorage.getItem('platform')
var options = { var options = {
body: ct + lang.lang_notf_new, body: ct + lang.lang_notf_new,
icon: localStorage.getItem('prof_' + acct_id) icon: localStorage.getItem('prof_' + acct_id),
} }
var n = new Notification('TheDesk:' + domain, options) var n = new Notification('TheDesk:' + domain, options)
} }
@ -213,6 +215,7 @@ function notfCommon(acct_id, tlid, sys, stream) {
if (stream != 'no') notfWS(misskey, acct_id, tlid, domain, at) if (stream != 'no') notfWS(misskey, acct_id, tlid, domain, at)
}) })
} }
function notfWS(misskey, acct_id, tlid, domain, at) { function notfWS(misskey, acct_id, tlid, domain, at) {
if (mastodonBaseWsStatus[domain] == 'available') return false if (mastodonBaseWsStatus[domain] == 'available') return false
if (!misskey) { if (!misskey) {
@ -230,7 +233,7 @@ function notfWS(misskey, acct_id, tlid, domain, at) {
acct_id: acct_id, acct_id: acct_id,
type: 'Connect Streaming API(Notf)', type: 'Connect Streaming API(Notf)',
domain: domain, domain: domain,
message: [mess] message: [mess],
}) })
$('i[data-notf=' + acct_id + ']').removeClass('red-text') $('i[data-notf=' + acct_id + ']').removeClass('red-text')
} }
@ -310,7 +313,7 @@ function notfmore(tlid) {
httpreq.setRequestHeader('Content-Type', 'application/json') httpreq.setRequestHeader('Content-Type', 'application/json')
var body = JSON.stringify({ var body = JSON.stringify({
i: at, i: at,
untilID: sid untilID: sid,
}) })
} else { } else {
var misskey = false var misskey = false
@ -374,35 +377,30 @@ function notfmore(tlid) {
function notfToggle(acct, tlid) { function notfToggle(acct, tlid) {
if ($('#notf-box_' + tlid).hasClass('column-hide')) { if ($('#notf-box_' + tlid).hasClass('column-hide')) {
$('#notf-box_' + tlid).css('display', 'block') $('#notf-box_' + tlid).css('display', 'block')
$('#notf-box_' + tlid).animate( $('#notf-box_' + tlid).animate({
{ height: '400px',
height: '400px' }, {
},
{
duration: 300, duration: 300,
complete: function() { complete: function() {
$('#notf-box_' + tlid).css('overflow-y', 'scroll') $('#notf-box_' + tlid).css('overflow-y', 'scroll')
$('#notf-box_' + tlid).removeClass('column-hide') $('#notf-box_' + tlid).removeClass('column-hide')
} },
} })
)
} else { } else {
$('#notf-box_' + tlid).css('overflow-y', 'hidden') $('#notf-box_' + tlid).css('overflow-y', 'hidden')
$('#notf-box_' + tlid).animate( $('#notf-box_' + tlid).animate({
{ height: '0',
height: '0' }, {
},
{
duration: 300, duration: 300,
complete: function() { complete: function() {
$('#notf-box_' + tlid).addClass('column-hide') $('#notf-box_' + tlid).addClass('column-hide')
$('#notf-box_' + tlid).css('display', 'none') $('#notf-box_' + tlid).css('display', 'none')
} },
} })
)
} }
notfCanceler(acct) notfCanceler(acct)
} }
function notfCanceler(acct) { function notfCanceler(acct) {
$('.notf-reply_' + acct).text(0) $('.notf-reply_' + acct).text(0)
localStorage.removeItem('notf-reply_' + acct) localStorage.removeItem('notf-reply_' + acct)
@ -417,13 +415,16 @@ function notfCanceler(acct) {
localStorage.removeItem('notf-follow_' + acct) localStorage.removeItem('notf-follow_' + acct)
$('.notf-follow_' + acct).addClass('hide') $('.notf-follow_' + acct).addClass('hide')
$('.notf-icon_' + acct).removeClass('red-text') $('.notf-icon_' + acct).removeClass('red-text')
var id = $('#announce_' + acct + ' .announcement').first().attr('data-id') var id = $('#announce_' + acct + ' .announcement')
$('.notf-announ_' + acct + '_ct').text("") .first()
.attr('data-id')
$('.notf-announ_' + acct + '_ct').text('')
$(`.boxIn[data-acct=${acct}] .notice-box`).removeClass('has-notf') $(`.boxIn[data-acct=${acct}] .notice-box`).removeClass('has-notf')
if (id) { if (id) {
localStorage.setItem('announ_' + acct, id) localStorage.setItem('announ_' + acct, id)
} }
} }
function allNotfRead() { function allNotfRead() {
var multi = localStorage.getItem('multi') var multi = localStorage.getItem('multi')
if (multi) { if (multi) {

View File

@ -544,12 +544,7 @@ function insertFont(name) {
} }
function copyColor(from, to) { function copyColor(from, to) {
let props = [ let props = ['background', 'subcolor', 'text', 'accent', 'modal', 'modalFooter', 'third', 'forth', 'bottom', 'emphasized', 'postbox', 'active', 'selected', 'selectedWithShared']
'background', 'subcolor', 'text', 'accent',
'modal', 'modalFooter', 'third', 'forth',
'bottom', 'emphasized', 'postbox', 'active',
'selected', 'selectedWithShared'
]
let i = 0 let i = 0
let color let color
for (tag of props) { for (tag of props) {
@ -589,11 +584,7 @@ function customComp(preview) {
var textC = $('#color-picker1_value').val() var textC = $('#color-picker1_value').val()
var accentC = $('#color-picker3_value').val() var accentC = $('#color-picker3_value').val()
var multi = localStorage.getItem('multi') var multi = localStorage.getItem('multi')
let advanced = [ let advanced = ['modal', 'modalFooter', 'third', 'forth', 'bottom', 'emphasized', 'postbox', 'active', 'selected', 'selectedWithShared']
'modal', 'modalFooter', 'third', 'forth',
'bottom', 'emphasized', 'postbox', 'active',
'selected', 'selectedWithShared'
]
var advanceTheme = {} var advanceTheme = {}
let i = 4 let i = 4
for (tag of advanced) { for (tag of advanced) {
@ -606,9 +597,7 @@ function customComp(preview) {
var my = JSON.parse(multi)[0].name var my = JSON.parse(multi)[0].name
var id = $('#custom-edit-sel').val() var id = $('#custom-edit-sel').val()
const defaults = [ const defaults = ['black', 'blue', 'brown', 'green', 'indigo', 'polar', 'snow', 'white']
'black', 'blue', 'brown', 'green', 'indigo', 'polar', 'snow', 'white'
]
if (id == 'add_new' || defaults.includes(id)) { if (id == 'add_new' || defaults.includes(id)) {
id = makeCID() id = makeCID()
} }
@ -622,11 +611,11 @@ function customComp(preview) {
background: bgC, background: bgC,
subcolor: subcolorC, subcolor: subcolorC,
text: textC, text: textC,
accent: accentC accent: accentC,
}, },
advanced: advanceTheme, advanced: advanceTheme,
id: id, id: id,
version: '2' version: '2',
} }
$('#custom_json').val(JSON.stringify(json)) $('#custom_json').val(JSON.stringify(json))
if (preview) { if (preview) {
@ -640,7 +629,6 @@ function customComp(preview) {
}) })
postMessage(['themeJsonCreate', JSON.stringify(json)], '*') postMessage(['themeJsonCreate', JSON.stringify(json)], '*')
} }
} }
function deleteIt() { function deleteIt() {
@ -710,16 +698,11 @@ function customConnect(raw) {
$('#color-picker2_value').val(args.primary.subcolor) $('#color-picker2_value').val(args.primary.subcolor)
//Accent //Accent
$('#color-picker3_value').val(args.primary.accent) $('#color-picker3_value').val(args.primary.accent)
let advanced = [ let advanced = ['modal', 'modalFooter', 'third', 'forth', 'bottom', 'emphasized', 'postbox', 'active', 'selected', 'selectedWithShared']
'modal', 'modalFooter', 'third', 'forth',
'bottom', 'emphasized', 'postbox', 'active',
'selected', 'selectedWithShared'
]
let i = 4 let i = 4
for (tag of advanced) { for (tag of advanced) {
if (args.advanced[tag]) { if (args.advanced[tag]) {
$(`#color-picker${i}_value`).val(args.advanced[tag]) $(`#color-picker${i}_value`).val(args.advanced[tag])
} }
$(`#use-color_${i}`).prop('checked', true) $(`#use-color_${i}`).prop('checked', true)
i++ i++
@ -765,7 +748,7 @@ function customSoundSave(key, file) {
} }
function pluginLoad() { function pluginLoad() {
$('#plugin-edit-sel').val('add_new') $('#plugin-edit-sel').val('add_new')
$(".plugin_delete").addClass('disabled') $('.plugin_delete').addClass('disabled')
var template = '' var template = ''
var pgns = localStorage.getItem('plugins') var pgns = localStorage.getItem('plugins')
var args = JSON.parse(pgns ? pgns : '[]') var args = JSON.parse(pgns ? pgns : '[]')
@ -783,9 +766,9 @@ function pluginEdit() {
$('#plugin').attr('data-id', id) $('#plugin').attr('data-id', id)
if (id == 'add_new') { if (id == 'add_new') {
editor.setValue('', -1) editor.setValue('', -1)
$(".plugin_delete").addClass('disabled') $('.plugin_delete').addClass('disabled')
} else { } else {
$(".plugin_delete").removeClass('disabled') $('.plugin_delete').removeClass('disabled')
var pgns = localStorage.getItem('plugins') var pgns = localStorage.getItem('plugins')
var args = JSON.parse(pgns ? pgns : '[]') var args = JSON.parse(pgns ? pgns : '[]')
Object.keys(args).forEach(function (key) { Object.keys(args).forEach(function (key) {
@ -823,7 +806,7 @@ function completePlugin(comp) {
id = makeCID() id = makeCID()
args.push({ args.push({
id: id, id: id,
content: inputPlugin content: inputPlugin,
}) })
} else { } else {
Object.keys(args).forEach(function (key) { Object.keys(args).forEach(function (key) {
@ -857,7 +840,7 @@ async function deletePlugin() {
const alert = await Swal.fire({ const alert = await Swal.fire({
title: 'delete', title: 'delete',
icon: 'warning', icon: 'warning',
showCancelButton: true showCancelButton: true,
}) })
if (!alert) return false if (!alert) return false
editor.setValue('', -1) editor.setValue('', -1)
@ -959,4 +942,6 @@ function lastFmSet() {
M.toast({ html: 'Complete: last.fm', displayLength: 3000 }) M.toast({ html: 'Complete: last.fm', displayLength: 3000 })
} }
function stopVideo() { return false } function stopVideo() {
return false
}

View File

@ -1,31 +1,42 @@
//ユーザーデータ表示 //ユーザーデータ表示
localStorage.removeItem("history") localStorage.removeItem('history')
//コード受信 //コード受信
if (location.search) { if (location.search) {
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/) var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/)
var mode = m[1] var mode = m[1]
var codex = m[2] var codex = m[2]
if (mode == "user") { if (mode == 'user') {
udgEx(codex, "main") udgEx(codex, 'main')
} }
} }
function udgEx(user, acct_id) {
if (user == "selector") { async function udgEx(user, acct_id) {
user = $("#his-acct").attr("fullname") if (user == 'selector') {
user = $('#his-acct').attr('fullname')
} }
if (acct_id == "selector") { if (acct_id == 'selector') {
acct_id = $("#user-acct-sel").val() acct_id = $('#user-acct-sel').val()
} }
if (acct_id == "main") { if (acct_id == 'main') {
acct_id = localStorage.getItem("main") acct_id = localStorage.getItem('main')
} }
console.log("Get user data of " + user) console.log('Get user data of ' + user)
var domain = localStorage.getItem("domain_" + acct_id) var domain = localStorage.getItem('domain_' + acct_id)
if (localStorage.getItem("mode_" + domain) == "misskey") { if (localStorage.getItem('mode_' + domain) == 'misskey') {
return false return false
} }
var at = localStorage.getItem("acct_" + acct_id + "_at") var at = localStorage.getItem('acct_' + acct_id + '_at')
var start = "https://" + domain + "/api/v2/search?resolve=true&q=" + encodeURIComponent(user) var data = await acctResolve(acct_id, user)
if (data.id) {
var { id } = data
udg(id, acct_id, true)
} else {
Swal.close()
postMessage(['openUrl', user], '*')
}
return true
var start = 'https://' + domain + '/api/v2/search?resolve=true&q=' + encodeURIComponent(user)
Swal.fire({ Swal.fire({
title: 'Loading...', title: 'Loading...',
html: lang.lang_details_fetch, html: lang.lang_details_fetch,
@ -37,11 +48,11 @@ function udgEx(user, acct_id) {
onClose: () => {}, onClose: () => {},
}).then((result) => {}) }).then((result) => {})
fetch(start, { fetch(start, {
method: "GET", method: 'GET',
headers: { headers: {
"content-type": "application/json", 'content-type': 'application/json',
Authorization: "Bearer " + at Authorization: 'Bearer ' + at,
} },
}) })
.then(function(response) { .then(function(response) {
if (!response.ok) { if (!response.ok) {
@ -54,7 +65,7 @@ function udgEx(user, acct_id) {
}) })
.catch(function(error) { .catch(function(error) {
todo(error) todo(error)
setLog(start, "JSON", error) setLog(start, 'JSON', error)
console.error(error) console.error(error)
}) })
.then(function(json) { .then(function(json) {
@ -63,30 +74,31 @@ function udgEx(user, acct_id) {
udg(id, acct_id, true) udg(id, acct_id, true)
} else { } else {
Swal.close() Swal.close()
postMessage(["openUrl", user], "*") postMessage(['openUrl', user], '*')
} }
}) })
return true return true
} }
function udg(user, acct_id, isSwal) { function udg(user, acct_id, isSwal) {
reset() reset()
if (!user) { if (!user) {
user = localStorage.getItem("user-id_" + acct_id) user = localStorage.getItem('user-id_' + acct_id)
} }
todo("User Data Loading...") todo('User Data Loading...')
var domain = localStorage.getItem("domain_" + acct_id) var domain = localStorage.getItem('domain_' + acct_id)
if (localStorage.getItem("mode_" + domain) == "misskey") { if (localStorage.getItem('mode_' + domain) == 'misskey') {
misskeyUdg(user, acct_id) misskeyUdg(user, acct_id)
return return
} }
var at = localStorage.getItem("acct_" + acct_id + "_at") var at = localStorage.getItem('acct_' + acct_id + '_at')
var start = "https://" + domain + "/api/v1/accounts/" + user var start = 'https://' + domain + '/api/v1/accounts/' + user
fetch(start, { fetch(start, {
method: "GET", method: 'GET',
headers: { headers: {
"content-type": "application/json", 'content-type': 'application/json',
Authorization: "Bearer " + at Authorization: 'Bearer ' + at,
} },
}) })
.then(function(response) { .then(function(response) {
if (isSwal) Swal.close() if (isSwal) Swal.close()
@ -99,38 +111,38 @@ function udg(user, acct_id, isSwal) {
}) })
.catch(function(error) { .catch(function(error) {
todo(error) todo(error)
setLog(start, "JSON", error) setLog(start, 'JSON', error)
console.error(error) console.error(error)
}) })
.then(function(json) { .then(function(json) {
//一つ前のユーザーデータ //一つ前のユーザーデータ
if (!localStorage.getItem("history")) { if (!localStorage.getItem('history')) {
$("#his-history-btn").prop("disabled", true) $('#his-history-btn').prop('disabled', true)
} else { } else {
$("#his-history-btn").prop("disabled", false) $('#his-history-btn').prop('disabled', false)
$("#his-data").attr("history", localStorage.getItem("history")) $('#his-data').attr('history', localStorage.getItem('history'))
} }
//moved設定時 //moved設定時
if (json.moved) { if (json.moved) {
M.toast({ M.toast({
html: lang.lang_showontl_movetxt + '<button class="btn-flat toast-action" onclick="udg(\'' + json.moved.id + "','" + acct_id + "')\">" + lang.lang_showontl_movebtn + "</button>", html: lang.lang_showontl_movetxt + '<button class="btn-flat toast-action" onclick="udg(\'' + json.moved.id + "','" + acct_id + '\')">' + lang.lang_showontl_movebtn + '</button>',
displayLength: 4000 displayLength: 4000,
}) })
} }
$("#his-data").modal("open") $('#his-data').modal('open')
$("#his-data").attr("user-id", user) $('#his-data').attr('user-id', user)
$("#his-data").attr("use-acct", acct_id) $('#his-data').attr('use-acct', acct_id)
if (json.username != json.acct) { if (json.username != json.acct) {
//Remote //Remote
$("#his-data").attr("remote", "true") $('#his-data').attr('remote', 'true')
var fullname = json.acct var fullname = json.acct
} else { } else {
$("#his-data").attr("remote", "false") $('#his-data').attr('remote', 'false')
var fullname = json.acct + "@" + domain var fullname = json.acct + '@' + domain
} }
utlShow(json.id, "", acct_id) utlShow(json.id, '', acct_id)
flw(json.id, "", acct_id) flw(json.id, '', acct_id)
fer(json.id, "", acct_id) fer(json.id, '', acct_id)
var dis_name = escapeHTML(json.display_name) var dis_name = escapeHTML(json.display_name)
dis_name = twemoji.parse(dis_name) dis_name = twemoji.parse(dis_name)
@ -146,7 +158,7 @@ function udg(user, acct_id, isSwal) {
var emoji = json.emojis[key5] var emoji = json.emojis[key5]
var shortcode = emoji.shortcode var shortcode = emoji.shortcode
var emoji_url = '<img src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" draggable="false">' var emoji_url = '<img src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" draggable="false">'
var regExp = new RegExp(":" + shortcode + ":", "g") var regExp = new RegExp(':' + shortcode + ':', 'g')
dis_name = dis_name.replace(regExp, emoji_url) dis_name = dis_name.replace(regExp, emoji_url)
note = note.replace(regExp, emoji_url) note = note.replace(regExp, emoji_url)
}) })
@ -156,106 +168,116 @@ function udg(user, acct_id, isSwal) {
//var mens = '<a onclick="udgEx(\'$1\',' + acct_id +')" class="pointer parsed">@$1</a>'; //var mens = '<a onclick="udgEx(\'$1\',' + acct_id +')" class="pointer parsed">@$1</a>';
//note=note.replace(/#(\S+)/gi, tags) //note=note.replace(/#(\S+)/gi, tags)
//note=note.replace(/\s@([a-zA-Z_0-9@.-]+)/gi, mens) //note=note.replace(/\s@([a-zA-Z_0-9@.-]+)/gi, mens)
$("#his-name").html(dis_name) $('#his-name').html(dis_name)
$("#his-acct").text(json.acct) $('#his-acct').text(json.acct)
$("#his-acct").attr("fullname", fullname) $('#his-acct').attr('fullname', fullname)
$("#his-prof").attr("src", json.avatar) $('#his-prof').attr('src', json.avatar)
$("#util-add").removeClass("hide") $('#util-add').removeClass('hide')
const title = $('.column-first').html() const title = $('.column-first').html()
$("#my-data-nav .anc-link").removeClass("active-back") $('#my-data-nav .anc-link').removeClass('active-back')
$('.column-first').addClass("active-back") $('.column-first').addClass('active-back')
$('#his-data-title').html(title) $('#his-data-title').html(title)
$("#his-data").css("background-image", "url(" + json.header + ")") $('#his-data').css('background-image', 'url(' + json.header + ')')
$("#his-sta").text(json.statuses_count) $('#his-sta').text(json.statuses_count)
$("#his-follow").text(json.following_count) $('#his-follow').text(json.following_count)
var flerc = json.followers_count var flerc = json.followers_count
if (flerc < 0) { if (flerc < 0) {
flerc = "-" flerc = '-'
} }
$("#his-follower").text(flerc) $('#his-follower').text(flerc)
$("#his-since").text(crat(json.created_at)) $('#his-since').text(crat(json.created_at))
$("#his-openin").attr("data-href", json.url) $('#his-openin').attr('data-href', json.url)
if (json.fields) { if (json.fields) {
var table = "" var table = ''
if (json.fields.length > 0) { if (json.fields.length > 0) {
$("#his-des").css("max-height", "250px") $('#his-des').css('max-height', '250px')
table = '<table id="his-field">' table = '<table id="his-field">'
for (var i = 0; i < json.fields.length; i++) { for (var i = 0; i < json.fields.length; i++) {
var fname = json.fields[i].name var fname = json.fields[i].name
var fval = json.fields[i].value var fval = json.fields[i].value
if (json.fields[i].verified_at) { if (json.fields[i].verified_at) {
var when = lang.lang_showontl_verified + ":" + crat(json.fields[i].verified_at) var when = lang.lang_showontl_verified + ':' + crat(json.fields[i].verified_at)
var color = "rgba(121,189,154,.25);" var color = 'rgba(121,189,154,.25);'
} else { } else {
var when = "" var when = ''
var color = "inherit" var color = 'inherit'
} }
table = table + '<tr><td class="his-field-title">' + escapeHTML(fname) + '</td><td class="his-field-content" title="' + when + '" style="background-color:' + color + '">' + fval + "</td></tr>" table =
table +
'<tr><td class="his-field-title">' +
escapeHTML(fname) +
'</td><td class="his-field-content" title="' +
when +
'" style="background-color:' +
color +
'">' +
fval +
'</td></tr>'
} }
table = table + "</table>" table = table + '</table>'
$("#his-des").html(twemoji.parse(note)) $('#his-des').html(twemoji.parse(note))
} else { } else {
$("#his-des").css("max-height", "400px") $('#his-des').css('max-height', '400px')
} }
$("#his-table").html(twemoji.parse(table)) $('#his-table').html(twemoji.parse(table))
} else { } else {
$("#his-des").css("max-height", "400px") $('#his-des').css('max-height', '400px')
} }
$("#his-des").html(twemoji.parse(note)) $('#his-des').html(twemoji.parse(note))
if (json.bot) { if (json.bot) {
$("#his-bot").html(lang.lang_showontl_botacct) $('#his-bot').html(lang.lang_showontl_botacct)
$("#his-bot").removeClass("hide") $('#his-bot').removeClass('hide')
} }
$("#his-des").attr("data-acct", acct_id) $('#his-des').attr('data-acct', acct_id)
$("#his-data").css("background-size", "cover") $('#his-data').css('background-size', 'cover')
$("#his-float-timeline").css("height", $("#his-data-show").height() + "px") $('#his-float-timeline').css('height', $('#his-data-show').height() + 'px')
localStorage.setItem("history", user) localStorage.setItem('history', user)
//自分の時 //自分の時
if (json.acct == localStorage.getItem("user_" + acct_id)) { if (json.acct == localStorage.getItem('user_' + acct_id)) {
showFav("", acct_id) showFav('', acct_id)
showBlo("", acct_id) showBlo('', acct_id)
showMut("", acct_id) showMut('', acct_id)
showDom("", acct_id) showDom('', acct_id)
showReq("", acct_id) showReq('', acct_id)
showFrl("", acct_id) showFrl('', acct_id)
$("#his-name-val").val(json.display_name) $('#his-name-val').val(json.display_name)
if (json.fields.length > 0) { if (json.fields.length > 0) {
if (json.fields[0]) { if (json.fields[0]) {
$("#his-f1-name").val(json.fields[0].name) $('#his-f1-name').val(json.fields[0].name)
$("#his-f1-val").val($.strip_tags(json.fields[0].value)) $('#his-f1-val').val($.strip_tags(json.fields[0].value))
} }
if (json.fields[1]) { if (json.fields[1]) {
$("#his-f2-name").val(json.fields[1].name) $('#his-f2-name').val(json.fields[1].name)
$("#his-f2-val").val($.strip_tags(json.fields[1].value)) $('#his-f2-val').val($.strip_tags(json.fields[1].value))
} }
if (json.fields[2]) { if (json.fields[2]) {
$("#his-f3-name").val(json.fields[2].name) $('#his-f3-name').val(json.fields[2].name)
$("#his-f3-val").val($.strip_tags(json.fields[2].value)) $('#his-f3-val').val($.strip_tags(json.fields[2].value))
} }
if (json.fields[3]) { if (json.fields[3]) {
$("#his-f4-name").val(json.fields[3].name) $('#his-f4-name').val(json.fields[3].name)
$("#his-f4-val").val($.strip_tags(json.fields[3].value)) $('#his-f4-val').val($.strip_tags(json.fields[3].value))
} }
} }
var des = json.note var des = json.note
des = des.replace(/<br \/>/g, "\n") des = des.replace(/<br \/>/g, '\n')
des = $.strip_tags(des) des = $.strip_tags(des)
$("#his-des-val").val(des) $('#his-des-val').val(des)
$("#his-follow-btn").hide() $('#his-follow-btn').hide()
$("#his-block-btn").hide() $('#his-block-btn').hide()
$("#his-mute-btn").hide() $('#his-mute-btn').hide()
$("#his-notf-btn").hide() $('#his-notf-btn').hide()
$("#his-domain-btn").hide() $('#his-domain-btn').hide()
$("#his-emp-btn").hide() $('#his-emp-btn').hide()
$(".only-my-data").show() $('.only-my-data').show()
$(".only-his-data").hide() $('.only-his-data').hide()
if (localStorage.getItem("main") == acct_id) { if (localStorage.getItem('main') == acct_id) {
$("#his-main-acct").hide() $('#his-main-acct').hide()
} }
} else { } else {
relations(user, acct_id) relations(user, acct_id)
$(".only-my-data").hide() $('.only-my-data').hide()
$(".only-his-data").show() $('.only-his-data').show()
} }
todc() todc()
if (json.locked) { if (json.locked) {
@ -267,28 +289,29 @@ function udg(user, acct_id, isSwal) {
udAdd(acct_id, user, json.url) udAdd(acct_id, user, json.url)
}) })
} }
function misskeyUdg(user, acct_id) { function misskeyUdg(user, acct_id) {
reset() reset()
if (!user) { if (!user) {
user = localStorage.getItem("user-id_" + acct_id) user = localStorage.getItem('user-id_' + acct_id)
} }
todo("User Data Loading...") todo('User Data Loading...')
var domain = localStorage.getItem("domain_" + acct_id) var domain = localStorage.getItem('domain_' + acct_id)
if (localStorage.getItem("mode_" + domain) != "misskey") { if (localStorage.getItem('mode_' + domain) != 'misskey') {
udg(user, acct_id) udg(user, acct_id)
return return
} }
var at = localStorage.getItem("acct_" + acct_id + "_at") var at = localStorage.getItem('acct_' + acct_id + '_at')
var start = "https://" + domain + "/api/users/show" var start = 'https://' + domain + '/api/users/show'
fetch(start, { fetch(start, {
method: "POST", method: 'POST',
headers: { headers: {
"content-type": "application/json" 'content-type': 'application/json',
}, },
body: JSON.stringify({ body: JSON.stringify({
i: at, i: at,
userId: user userId: user,
}) }),
}) })
.then(function(response) { .then(function(response) {
if (!response.ok) { if (!response.ok) {
@ -300,126 +323,126 @@ function misskeyUdg(user, acct_id) {
}) })
.catch(function(error) { .catch(function(error) {
todo(error) todo(error)
setLog(start, "JSON", error) setLog(start, 'JSON', error)
console.error(error) console.error(error)
}) })
.then(function(json) { .then(function(json) {
//一つ前のユーザーデータ //一つ前のユーザーデータ
if (!localStorage.getItem("history")) { if (!localStorage.getItem('history')) {
$("#his-history-btn").prop("disabled", true) $('#his-history-btn').prop('disabled', true)
} else { } else {
$("#his-history-btn").prop("disabled", false) $('#his-history-btn').prop('disabled', false)
$("#his-data").attr("history", localStorage.getItem("history")) $('#his-data').attr('history', localStorage.getItem('history'))
} }
$("#his-data").modal("open") $('#his-data').modal('open')
$("#his-data").attr("user-id", user) $('#his-data').attr('user-id', user)
$("#his-data").attr("use-acct", acct_id) $('#his-data').attr('use-acct', acct_id)
if (json.host) { if (json.host) {
//Remote //Remote
$("#his-data").attr("remote", "false") $('#his-data').attr('remote', 'false')
var fullname = json.username + "@" + json.host var fullname = json.username + '@' + json.host
} else { } else {
$("#his-data").attr("remote", "false") $('#his-data').attr('remote', 'false')
var fullname = json.acct + "@" + domain var fullname = json.acct + '@' + domain
} }
utlShow(json.id, "", acct_id) utlShow(json.id, '', acct_id)
flw(json.id, "", acct_id) flw(json.id, '', acct_id)
fer(json.id, "", acct_id) fer(json.id, '', acct_id)
if (json.name) { if (json.name) {
var dis_name = escapeHTML(json.name) var dis_name = escapeHTML(json.name)
dis_name = twemoji.parse(dis_name) dis_name = twemoji.parse(dis_name)
} else { } else {
var dis_name = json.name var dis_name = json.name
} }
$("#his-name").html(dis_name) $('#his-name').html(dis_name)
$("#his-acct").text(json.username) $('#his-acct').text(json.username)
$("#his-acct").attr("fullname", fullname) $('#his-acct').attr('fullname', fullname)
$("#his-prof").attr("src", json.avatarUrl) $('#his-prof').attr('src', json.avatarUrl)
$("#his-data").css("background-image", "url(" + json.bannerUrl + ")") $('#his-data').css('background-image', 'url(' + json.bannerUrl + ')')
$("#his-sta").text(json.notesCount) $('#his-sta').text(json.notesCount)
$("#his-follow").text(json.followingCount) $('#his-follow').text(json.followingCount)
$("#his-follower").text(json.followersCount) $('#his-follower').text(json.followersCount)
$("#his-since").text(crat(json.createdAt)) $('#his-since').text(crat(json.createdAt))
var note = escapeHTML(json.description) var note = escapeHTML(json.description)
$("#his-des").html(twemoji.parse(note)) $('#his-des').html(twemoji.parse(note))
if (json.isCat) { if (json.isCat) {
$("#his-bot").html("Cat" + twemoji.parse("😺")) $('#his-bot').html('Cat' + twemoji.parse('😺'))
} }
$("#his-data").css("background-size", "cover") $('#his-data').css('background-size', 'cover')
localStorage.setItem("history", user) localStorage.setItem('history', user)
//自分の時 //自分の時
if (json.username == localStorage.getItem("user_" + acct_id) && !json.host) { if (json.username == localStorage.getItem('user_' + acct_id) && !json.host) {
//showFav('', acct_id); //showFav('', acct_id);
//showMut('', acct_id); //showMut('', acct_id);
//showReq('', acct_id); //showReq('', acct_id);
showFrl("", acct_id) showFrl('', acct_id)
$("#his-name-val").val(json.name) $('#his-name-val').val(json.name)
var des = json.note var des = json.note
des = nl2br(des) des = nl2br(des)
des = $.strip_tags(des) des = $.strip_tags(des)
$("#his-des-val").val(des) $('#his-des-val').val(des)
$("#his-follow-btn").hide() $('#his-follow-btn').hide()
$("#his-block-btn").hide() $('#his-block-btn').hide()
$("#his-mute-btn").hide() $('#his-mute-btn').hide()
$("#his-notf-btn").hide() $('#his-notf-btn').hide()
$("#his-domain-btn").hide() $('#his-domain-btn').hide()
$("#his-emp-btn").hide() $('#his-emp-btn').hide()
$(".only-my-data").show() $('.only-my-data').show()
$(".only-his-data").hide() $('.only-his-data').hide()
if (localStorage.getItem("main") == acct_id) { if (localStorage.getItem('main') == acct_id) {
$("#his-main-acct").hide() $('#his-main-acct').hide()
} }
} else { } else {
if (json.isFollowing) { if (json.isFollowing) {
//自分がフォローしている //自分がフォローしている
$("#his-data").addClass("following") $('#his-data').addClass('following')
$("#his-follow-btn-text").text(lang.lang_status_unfollow) $('#his-follow-btn-text').text(lang.lang_status_unfollow)
hisList(user, acct_id) hisList(user, acct_id)
} else { } else {
$("#his-follow-btn-text").text(lang.lang_status_follow) $('#his-follow-btn-text').text(lang.lang_status_follow)
} }
if (json.isFollowed) { if (json.isFollowed) {
//フォローされてる //フォローされてる
$("#his-relation").text(lang.lang_showontl_followed) $('#his-relation').text(lang.lang_showontl_followed)
} }
$("#his-block-btn").hide() $('#his-block-btn').hide()
if (json.isMuted) { if (json.isMuted) {
$("#his-data").addClass("muting") $('#his-data').addClass('muting')
$("#his-mute-btn-text").text(lang.lang_status_unmute) $('#his-mute-btn-text').text(lang.lang_status_unmute)
} else { } else {
$("#his-mute-btn-text").text(lang.lang_status_mute) $('#his-mute-btn-text').text(lang.lang_status_mute)
} }
$(".only-my-data").hide() $('.only-my-data').hide()
$(".only-his-data").show() $('.only-his-data').show()
} }
todc() todc()
}) })
} }
//一つ前のユーザーデータ表示 //一つ前のユーザーデータ表示
function historyShow() { function historyShow() {
var acct_id = $("#his-data").attr("use-acct") var acct_id = $('#his-data').attr('use-acct')
var user = $("#his-data").attr("history") var user = $('#his-data').attr('history')
udg(user, acct_id, "true") udg(user, acct_id, 'true')
} }
//選択アカウントのプロフ //選択アカウントのプロフ
function profShow() { function profShow() {
var acct_id = $("#post-acct-sel").val() var acct_id = $('#post-acct-sel').val()
var user = localStorage.getItem("user-id_" + acct_id) var user = localStorage.getItem('user-id_' + acct_id)
udg(user, acct_id) udg(user, acct_id)
hide() hide()
} }
//FF関係取得 //FF関係取得
function relations(user, acct_id) { function relations(user, acct_id) {
var domain = localStorage.getItem("domain_" + acct_id) var domain = localStorage.getItem('domain_' + acct_id)
var at = localStorage.getItem("acct_" + acct_id + "_at") var at = localStorage.getItem('acct_' + acct_id + '_at')
var start = "https://" + domain + "/api/v1/accounts/relationships?id=" + user var start = 'https://' + domain + '/api/v1/accounts/relationships?id=' + user
fetch(start, { fetch(start, {
method: "GET", method: 'GET',
headers: { headers: {
"content-type": "application/json", 'content-type': 'application/json',
Authorization: "Bearer " + at Authorization: 'Bearer ' + at,
} },
}) })
.then(function(response) { .then(function(response) {
if (!response.ok) { if (!response.ok) {
@ -431,7 +454,7 @@ function relations(user, acct_id) {
}) })
.catch(function(error) { .catch(function(error) {
todo(error) todo(error)
setLog(start, "JSON", error) setLog(start, 'JSON', error)
console.error(error) console.error(error)
}) })
.then(function(json) { .then(function(json) {
@ -439,148 +462,151 @@ function relations(user, acct_id) {
if (json.requested) { if (json.requested) {
//フォロリク中 //フォロリク中
$('#his-data').addClass('following') $('#his-data').addClass('following')
$("#his-follow-btn-text").text(lang.lang_status_requesting) $('#his-follow-btn-text').text(lang.lang_status_requesting)
} }
if (json.following) { if (json.following) {
//自分がフォローしている //自分がフォローしている
$("#his-data").addClass("following") $('#his-data').addClass('following')
$("#his-follow-btn-text").text(lang.lang_status_unfollow) $('#his-follow-btn-text').text(lang.lang_status_unfollow)
hisList(user, acct_id) hisList(user, acct_id)
} else { } else {
$("#his-follow-btn-text").text(lang.lang_status_follow) $('#his-follow-btn-text').text(lang.lang_status_follow)
} }
if (json.followed_by) { if (json.followed_by) {
//フォローされてる //フォローされてる
$("#his-relation").text(lang.lang_showontl_followed) $('#his-relation').text(lang.lang_showontl_followed)
} }
if (json.blocking) { if (json.blocking) {
$("#his-data").addClass("blocking") $('#his-data').addClass('blocking')
$("#his-block-btn-text").text(lang.lang_status_unblock) $('#his-block-btn-text').text(lang.lang_status_unblock)
} else { } else {
$("#his-block-btn-text").text(lang.lang_status_block) $('#his-block-btn-text').text(lang.lang_status_block)
} }
if (json.muting) { if (json.muting) {
$("#his-data").addClass("muting") $('#his-data').addClass('muting')
$("#his-mute-btn-text").text(lang.lang_status_unmute) $('#his-mute-btn-text').text(lang.lang_status_unmute)
} else { } else {
$("#his-mute-btn-text").text(lang.lang_status_mute) $('#his-mute-btn-text').text(lang.lang_status_mute)
} }
if (json.muting_notifications) { if (json.muting_notifications) {
$("#his-data").addClass("mutingNotf") $('#his-data').addClass('mutingNotf')
$("#his-notf-btn-text").text(lang.lang_showontl_notf + lang.lang_status_unmute) $('#his-notf-btn-text').text(lang.lang_showontl_notf + lang.lang_status_unmute)
} else { } else {
$("#his-notf-btn-text").text(lang.lang_showontl_notf + lang.lang_status_mute) $('#his-notf-btn-text').text(lang.lang_showontl_notf + lang.lang_status_mute)
} }
if (json.domain_blocking) { if (json.domain_blocking) {
$("#his-data").addClass("blockingDom") $('#his-data').addClass('blockingDom')
$("#his-domain-btn-text").text(lang.lang_showontl_domain + lang.lang_status_unblock) $('#his-domain-btn-text').text(lang.lang_showontl_domain + lang.lang_status_unblock)
} else { } else {
$("#his-domain-btn-text").text(lang.lang_showontl_domain + lang.lang_status_block) $('#his-domain-btn-text').text(lang.lang_showontl_domain + lang.lang_status_block)
} }
//Endorsed //Endorsed
if (json.endorsed) { if (json.endorsed) {
$("#his-end-btn").addClass("endorsed") $('#his-end-btn').addClass('endorsed')
$("#his-end-btn-text").text(lang.lang_status_unendorse) $('#his-end-btn-text').text(lang.lang_status_unendorse)
} else { } else {
$("#his-end-btn").removeClass("endorsed") $('#his-end-btn').removeClass('endorsed')
$("#his-end-btn-text").text(lang.lang_status_endorse) $('#his-end-btn-text').text(lang.lang_status_endorse)
} }
//Blocked //Blocked
if (json.blocked_by) { if (json.blocked_by) {
$("#my-data-nav .btn").addClass("disabled") $('#my-data-nav .btn').addClass('disabled')
$(".his-var-content").hide() $('.his-var-content').hide()
$("#his-float-blocked").show() $('#his-float-blocked').show()
$("#his-follow-btn").hide() $('#his-follow-btn').hide()
} }
}) })
} }
function profbrws() { function profbrws() {
var url = $("#his-openin").attr("data-href") var url = $('#his-openin').attr('data-href')
postMessage(["openUrl", url], "*") postMessage(['openUrl', url], '*')
} }
function setMain() { function setMain() {
var acct_id = $("#his-data").attr("use-acct") var acct_id = $('#his-data').attr('use-acct')
localStorage.setItem("main", acct_id) localStorage.setItem('main', acct_id)
multiSelector(true) multiSelector(true)
M.toast({ html: lang.lang_manager_mainAcct, displayLength: 3000 }) M.toast({ html: lang.lang_manager_mainAcct, displayLength: 3000 })
} }
//オールリセット //オールリセット
function hisclose() { function hisclose() {
$("#his-data").modal("close") $('#his-data').modal('close')
reset() reset()
$("#his-data").attr("history", "") $('#his-data').attr('history', '')
localStorage.removeItem("history") localStorage.removeItem('history')
} }
function reset() { function reset() {
$(".his-var-content:eq(0)").show() $('.his-var-content:eq(0)').show()
$(".his-var-content:gt(0)").hide() $('.his-var-content:gt(0)').hide()
$("#my-data-nav .btn").removeClass("disabled") $('#my-data-nav .btn').removeClass('disabled')
$(".active-back").removeClass("active-back") $('.active-back').removeClass('active-back')
$(".column-first").addClass("active-back") $('.column-first').addClass('active-back')
$("#his-name").text("Loading") $('#his-name').text('Loading')
$("#his-acct").text("") $('#his-acct').text('')
$("#his-prof").attr("src", "../../img/loading.svg") $('#his-prof').attr('src', '../../img/loading.svg')
$("#his-data").css("background-image", "url(../../img/loading.svg)") $('#his-data').css('background-image', 'url(../../img/loading.svg)')
$("#his-sta").text("") $('#his-sta').text('')
$("#his-follow").text("") $('#his-follow').text('')
$("#his-follower").text("") $('#his-follower').text('')
$("#his-des").html("") $('#his-des').html('')
$("#his-data").css("background-size", "cover") $('#his-data').css('background-size', 'cover')
$("#his-since").text("") $('#his-since').text('')
$("#his-data").removeClass("following") $('#his-data').removeClass('following')
$("#his-data").removeClass("muting") $('#his-data').removeClass('muting')
$("#his-data").removeClass("blocking") $('#his-data').removeClass('blocking')
$("#his-data").removeClass("mutingNotf") $('#his-data').removeClass('mutingNotf')
$("#his-data").removeClass("blockingDom") $('#his-data').removeClass('blockingDom')
$("#his-end-btn").removeClass("endorsed") $('#his-end-btn').removeClass('endorsed')
$("#his-des").css("max-height", "250px") $('#his-des').css('max-height', '250px')
$("#his-bot").html("") $('#his-bot').html('')
$("#his-bot").addClass("hide") $('#his-bot').addClass('hide')
$("#his-follow-btn").show() $('#his-follow-btn').show()
$("#his-block-btn").show() $('#his-block-btn').show()
$("#his-mute-btn").show() $('#his-mute-btn').show()
$("#his-notf-btn").show() $('#his-notf-btn').show()
$("#his-domain-btn").show() $('#his-domain-btn').show()
$("#his-emp-btn").show() $('#his-emp-btn').show()
$("#his-follow-btn-text").text(lang.lang_status_follow) $('#his-follow-btn-text').text(lang.lang_status_follow)
$("#his-mute-btn-text").text(lang.lang_status_mute) $('#his-mute-btn-text').text(lang.lang_status_mute)
$("#his-block-btn-text").text(lang.lang_status_block) $('#his-block-btn-text').text(lang.lang_status_block)
$("#his-notf-btn").text(lang.lang_showontl_notf + lang.lang_status_mute) $('#his-notf-btn').text(lang.lang_showontl_notf + lang.lang_status_mute)
$("#his-domain-btn").text(lang.lang_showontl_domain + lang.lang_status_block) $('#his-domain-btn').text(lang.lang_showontl_domain + lang.lang_status_block)
$("#his-relation").text("") $('#his-relation').text('')
$(".cont-series").html("") $('.cont-series').html('')
$("#domainblock").val("") $('#domainblock').val('')
$("#his-lists-a").html(lang.lang_showontl_listwarn) $('#his-lists-a').html(lang.lang_showontl_listwarn)
$("#his-lists-b").html("") $('#his-lists-b').html('')
$("#his-name-val").val("") $('#his-name-val').val('')
$("#his-des-val").val("") $('#his-des-val').val('')
$("#his-f1-name").val("") $('#his-f1-name').val('')
$("#his-f1-val").val("") $('#his-f1-val').val('')
$("#his-f2-name").val("") $('#his-f2-name').val('')
$("#his-f2-val").val("") $('#his-f2-val').val('')
$("#his-f3-name").val("") $('#his-f3-name').val('')
$("#his-f3-val").val("") $('#his-f3-val').val('')
$("#his-f4-name").val("") $('#his-f4-name').val('')
$("#his-f4-val").val("") $('#his-f4-val').val('')
$("#his-endorse").html("") $('#his-endorse').html('')
$("#his-openin").attr("data-href", "") $('#his-openin').attr('data-href', '')
$("#his-float-timeline").show() $('#his-float-timeline').show()
$("#his-float-blocked").hide() $('#his-float-blocked').hide()
$("#his-main-acct").show() $('#his-main-acct').show()
$("#his-proof-prof").html("") $('#his-proof-prof').html('')
$('#his-data').removeClass('locked') $('#his-data').removeClass('locked')
$('#his-data').removeClass('requesting') $('#his-data').removeClass('requesting')
} }
$("#my-data-nav .anc-link").on("click", function () { $('#my-data-nav .anc-link').on('click', function() {
var target = $(this).attr("go") var target = $(this).attr('go')
if (target) { if (target) {
let title = $(this).html() let title = $(this).html()
if (target === '#his-tl') $("#util-add").removeClass("hide") if (target === '#his-tl') $('#util-add').removeClass('hide')
if (target != '#his-tl') $("#util-add").addClass("hide") if (target != '#his-tl') $('#util-add').addClass('hide')
$('#his-data-title').html(title) $('#his-data-title').html(title)
$("#my-data-nav .anc-link").removeClass("active-back") $('#my-data-nav .anc-link').removeClass('active-back')
$(this).addClass("active-back") $(this).addClass('active-back')
$(target).show() $(target).show()
$(".his-var-content:not(" + target + ")").hide() $('.his-var-content:not(' + target + ')').hide()
} }
}) })

View File

@ -27,7 +27,7 @@
<body class=""> <body class="">
<script> <script>
var ver = '22.2.0 (Koume)' var ver = '22.2.0 (Koume)'
var gitHash = '9758a2a7d8f1b504193126c20fd96ccf42945cd8' var gitHash = '5621ffbe42a1de361ccee0e679c97d30da436aab'
//betaを入れるとバージョンチェックしない //betaを入れるとバージョンチェックしない
//var ver="beta"; //var ver="beta";
var acct_id = 0 var acct_id = 0

View File

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