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

@ -15,7 +15,7 @@ function fav(id, acct_id, remote) {
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
httpreq.responseType = 'json'
httpreq.send()
httpreq.onreadystatechange = function () {
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
var json = httpreq.response
if (this.status !== 200) {
@ -75,7 +75,7 @@ function rt(id, acct_id, remote, vis) {
} else {
httpreq.send()
}
httpreq.onreadystatechange = function () {
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
var json = httpreq.response
if (this.status !== 200) {
@ -110,6 +110,7 @@ function rt(id, acct_id, remote, vis) {
}
}
}
function boostWith(vis) {
var id = $('#tootmodal').attr('data-id')
var acct_id = $('#tootmodal').attr('data-acct')
@ -131,7 +132,7 @@ function bkm(id, acct_id, tlid) {
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
httpreq.responseType = 'json'
httpreq.send()
httpreq.onreadystatechange = function () {
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
var json = httpreq.response
if (this.status !== 200) {
@ -167,7 +168,6 @@ async function follow(acct_id, resolve) {
}
if (!acct_id && acct_id != 'selector') {
var acct_id = $('#his-data').attr('use-acct')
} else if (acct_id == 'selector') {
var acct_id = $('#user-acct-sel').val()
}
@ -182,7 +182,8 @@ async function follow(acct_id, resolve) {
var id = $('#his-data').attr('user-id')
if (resolve == 'selector') {
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)
}
var domain = localStorage.getItem('domain_' + acct_id)
@ -200,7 +201,7 @@ async function follow(acct_id, resolve) {
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
httpreq.responseType = 'json'
httpreq.send(JSON.stringify(ent))
httpreq.onreadystatechange = function () {
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
var json = httpreq.response
if (this.status !== 200) {
@ -223,28 +224,47 @@ async function follow(acct_id, resolve) {
}
async function acctResolve(acct_id, 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') {
return false
}
var at = localStorage.getItem('acct_' + acct_id + '_at')
var start = 'https://' + domain + '/api/v2/search?resolve=true&q=' + user
let promise = await fetch(start, {
const at = localStorage.getItem('acct_' + acct_id + '_at')
const options = {
method: 'GET',
headers: {
'content-type': 'application/json',
Authorization: 'Bearer ' + at
Authorization: 'Bearer ' + at,
},
}
})
var idJson = await promise.json()
try {
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]) {
var id = idJson.accounts[0].id
return idJson.accounts[0]
} else {
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) {
if ($('#his-data').hasClass('blocking')) {
@ -260,8 +280,8 @@ function block(acct_id) {
type: 'warning',
showCancelButton: true,
confirmButtonText: lang.lang_yesno,
cancelButtonText: lang.lang_no
}).then(result => {
cancelButtonText: lang.lang_no,
}).then((result) => {
if (result.value) {
if (!acct_id) {
var acct_id = $('#his-data').attr('use-acct')
@ -276,7 +296,7 @@ function block(acct_id) {
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
httpreq.responseType = 'json'
httpreq.send()
httpreq.onreadystatechange = function () {
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
if (this.status !== 200) {
setLog(start, this.status, this.response)
@ -311,8 +331,8 @@ function muteDo(acct_id) {
type: 'warning',
showCancelButton: true,
confirmButtonText: lang.lang_yesno,
cancelButtonText: lang.lang_no
}).then(result => {
cancelButtonText: lang.lang_no,
}).then((result) => {
if (result.value) {
if (!acct_id) {
var acct_id = $('#his-data').attr('use-acct')
@ -334,7 +354,7 @@ function muteDo(acct_id) {
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
httpreq.responseType = 'json'
httpreq.send(rq)
httpreq.onreadystatechange = function () {
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
if (this.status !== 200) {
setLog(start, this.status, this.response)
@ -374,7 +394,7 @@ function del(id, acct_id) {
httpreq.responseType = 'json'
httpreq.send()
}
httpreq.onreadystatechange = function () {
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
if (this.status !== 200) {
setLog(start, this.status, this.response)
@ -390,8 +410,8 @@ function redraft(id, acct_id) {
type: 'warning',
showCancelButton: true,
confirmButtonText: lang.lang_yesno,
cancelButtonText: lang.lang_no
}).then(result => {
cancelButtonText: lang.lang_no,
}).then((result) => {
if (result.value) {
show()
var domain = localStorage.getItem('domain_' + acct_id)
@ -414,7 +434,7 @@ function redraft(id, acct_id) {
httpreq.responseType = 'json'
httpreq.send()
}
httpreq.onreadystatechange = function () {
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
if (this.status !== 200) {
setLog(start, this.status, this.response)
@ -426,24 +446,21 @@ function redraft(id, acct_id) {
}
})
}
function draftToPost(json, acct_id, id) {
$('#post-acct-sel').prop('disabled', true)
$('#post-acct-sel').val(acct_id)
$('select').formSelect()
mdCheck()
mediack = null
if(json.media_attachments) mediack = json.media_attachments[0]
if (json.media_attachments) mediack = json.media_attachments[0]
//メディアがあれば
var media_ids = []
if (mediack) {
for (var i = 0; i <= 4; i++) {
if (json.media_attachments[i]) {
media_ids.push(json.media_attachments[i].id)
$('#preview').append(
'<img src="' +
json.media_attachments[i].preview_url +
'" style="width:50px; max-height:100px;">'
)
$('#preview').append('<img src="' + json.media_attachments[i].preview_url + '" style="width:50px; max-height:100px;">')
} else {
break
}
@ -496,7 +513,7 @@ function pin(id, acct_id) {
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
httpreq.responseType = 'json'
httpreq.send()
httpreq.onreadystatechange = function () {
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
var json = httpreq.response
if (this.status !== 200) {
@ -527,7 +544,7 @@ function request(id, flag, acct_id) {
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
httpreq.responseType = 'json'
httpreq.send()
httpreq.onreadystatechange = function () {
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
var json = httpreq.response
if (this.status !== 200) {
@ -553,7 +570,7 @@ function domainblock(add, flag, acct_id) {
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
httpreq.responseType = 'json'
httpreq.send()
httpreq.onreadystatechange = function () {
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
var json = httpreq.response
if (this.status !== 200) {
@ -580,7 +597,7 @@ function empUser() {
M.toast({ html: id + lang.lang_status_emphas, displayLength: 4000 })
} else {
var can
Object.keys(obj).forEach(function (key) {
Object.keys(obj).forEach(function(key) {
var usT = obj[key]
if (usT != id && !can) {
can = false
@ -612,7 +629,7 @@ function pinUser() {
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
httpreq.responseType = 'json'
httpreq.send()
httpreq.onreadystatechange = function () {
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
var json = httpreq.response
if (this.status !== 200) {
@ -645,23 +662,23 @@ function staEx(mode) {
method: 'GET',
headers: {
'content-type': 'application/json',
Authorization: 'Bearer ' + at
}
Authorization: 'Bearer ' + at,
},
})
.then(function (response) {
.then(function(response) {
if (!response.ok) {
response.text().then(function (text) {
response.text().then(function(text) {
setLog(response.url, response.status, text)
})
}
return response.json()
})
.catch(function (error) {
.catch(function(error) {
todo(error)
setLog(start, 'JSON', error)
console.error(error)
})
.then(function (json) {
.then(function(json) {
if (json.statuses) {
if (json.statuses[0]) {
var id = json.statuses[0].id
@ -677,6 +694,7 @@ function staEx(mode) {
})
return
}
function toggleAction(elm) {
console.log(elm)
const instance = M.Dropdown.init(elm)

View File

@ -42,6 +42,7 @@ function remoteOnly(tlid, type) {
}
columnReload(tlid, type)
}
function remoteOnlyCk(tlid) {
var multi = localStorage.getItem('column')
var obj = JSON.parse(multi)
@ -125,6 +126,7 @@ function catchToggle(tlid) {
parseColumn(tlid)
}
}
function catchCheck(tlid) {
var catchck = localStorage.getItem('catch_' + tlid)
if (catchck) {
@ -135,6 +137,7 @@ function catchCheck(tlid) {
$('#sta-del-' + tlid).css('color', 'red')
}
}
function delreset(tlid) {
$('[tlid=' + tlid + '] .by_delcatch').hide()
$('[tlid=' + tlid + '] .by_delcatch').remove()
@ -146,6 +149,7 @@ function filterMenu() {
$('.menu-content').addClass('hide')
$('#filter-box').removeClass('hide')
}
function filter() {
$('#filtered-words').html('')
$('#filter-edit-id').val('')
@ -160,23 +164,23 @@ function filter() {
Authorization: 'Bearer ' + at,
},
})
.then(function (response) {
.then(function(response) {
if (!response.ok) {
response.text().then(function (text) {
response.text().then(function(text) {
setLog(response.url, response.status, text)
})
}
return response.json()
})
.catch(function (error) {
.catch(function(error) {
todo(error)
setLog(start, 'JSON', error)
console.error(error)
})
.then(function (json) {
.then(function(json) {
if (json) {
var filters = ''
Object.keys(json).forEach(function (key) {
Object.keys(json).forEach(function(key) {
var filterword = json[key]
var context = filterword.context.join(',')
filters =
@ -199,11 +203,13 @@ function filter() {
}
})
}
function filterTime(day, hour, min) {
$('#days_filter').val(day)
$('#hours_filter').val(hour)
$('#mins_filter').val(min)
}
function makeNewFilter() {
var acct_id = $('#filter-acct-sel').val()
var phr = $('#filter-add-word').val()
@ -256,7 +262,7 @@ function makeNewFilter() {
expires_in: time,
})
)
httpreq.onreadystatechange = function () {
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
var json = httpreq.response
if (this.status !== 200) {
@ -280,6 +286,7 @@ function makeNewFilter() {
}
}
}
function filterEdit(id, acct_id) {
$('#filter-add-word').val('')
$('#home_filter').prop('checked', false)
@ -303,26 +310,26 @@ function filterEdit(id, acct_id) {
Authorization: 'Bearer ' + at,
},
})
.then(function (response) {
.then(function(response) {
if (!response.ok) {
response.text().then(function (text) {
response.text().then(function(text) {
setLog(response.url, response.status, text)
})
}
return response.json()
})
.catch(function (error) {
.catch(function(error) {
todo(error)
setLog(start, 'JSON', error)
console.error(error)
})
.then(function (json) {
.then(function(json) {
if (json) {
var now = new Date()
now = now.getTime()
var now = Math.floor(now / 1000)
$('#filter-add-word').val(json.phrase)
Object.keys(json.context).forEach(function (key) {
Object.keys(json.context).forEach(function(key) {
var context = json.context[key]
$('[value=' + context + ']').prop('checked', true)
})
@ -342,6 +349,7 @@ function filterEdit(id, acct_id) {
}
})
}
function filterDel(id, acct_id) {
var domain = localStorage.getItem('domain_' + acct_id)
var at = localStorage.getItem('acct_' + acct_id + '_at')
@ -352,7 +360,7 @@ function filterDel(id, acct_id) {
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
httpreq.responseType = 'json'
httpreq.send()
httpreq.onreadystatechange = function () {
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
var json = httpreq.response
if (this.status !== 200) {
@ -363,6 +371,7 @@ function filterDel(id, acct_id) {
}
}
}
function getFilter(acct_id) {
var domain = localStorage.getItem('domain_' + acct_id)
var at = localStorage.getItem('acct_' + acct_id + '_at')
@ -375,26 +384,27 @@ function getFilter(acct_id) {
Authorization: 'Bearer ' + at,
},
})
.then(function (response) {
.then(function(response) {
if (!response.ok) {
response.text().then(function (text) {
response.text().then(function(text) {
setLog(response.url, response.status, text)
})
}
return response.json()
})
.catch(function (error) {
.catch(function(error) {
todo(error)
setLog(start, 'JSON', error)
console.error(error)
})
.then(function (json) {
.then(function(json) {
localStorage.setItem('filter_' + acct_id, JSON.stringify(json))
})
} else {
localStorage.setItem('filter_' + acct_id, JSON.stringify({}))
}
}
function getFilterType(json, type) {
if (!json) {
return []
@ -407,7 +417,7 @@ function getFilterType(json, type) {
type = 'notifi'
}
var mutedfilters = []
Object.keys(json).forEach(function (key) {
Object.keys(json).forEach(function(key) {
var filterword = json[key]
var phrases = filterword.phrase
var arr = filterword.context
@ -421,6 +431,7 @@ function getFilterType(json, type) {
})
return mutedfilters
}
function getFilterTypeByAcct(acct_id, type) {
if (localStorage.getItem('filter_' + acct_id) != 'undefined') {
var mute = getFilterType(JSON.parse(localStorage.getItem('filter_' + acct_id)), type)
@ -429,6 +440,7 @@ function getFilterTypeByAcct(acct_id, type) {
}
return mute
}
function filterUpdate(acct_id) {
var domain = localStorage.getItem('domain_' + acct_id)
var at = localStorage.getItem('acct_' + acct_id + '_at')
@ -440,20 +452,20 @@ function filterUpdate(acct_id) {
Authorization: 'Bearer ' + at,
},
})
.then(function (response) {
.then(function(response) {
if (!response.ok) {
response.text().then(function (text) {
response.text().then(function(text) {
setLog(response.url, response.status, text)
})
}
return response.json()
})
.catch(function (error) {
.catch(function(error) {
todo(error)
setLog(start, 'JSON', error)
console.error(error)
})
.then(function (json) {
.then(function(json) {
localStorage.setItem('filter_' + acct_id, JSON.stringify(json))
filterUpdateInternal(json, 'home')
filterUpdateInternal(json, 'local')
@ -461,6 +473,7 @@ function filterUpdate(acct_id) {
filterUpdateInternal(json, 'pub')
})
}
function filterUpdateInternal(json, type) {
var home = getFilterType(json, type)
var wordmute = localStorage.getItem('word_mute')
@ -469,11 +482,11 @@ function filterUpdateInternal(json, type) {
home = home.concat(wordmute)
}
if (home) {
$('[data-acct=' + acct_id + '] [data-type=' + type + '] .cvo').each(function (i, elem) {
$('[data-acct=' + acct_id + '] [data-type=' + type + '] .cvo').each(function(i, elem) {
var id = $(elem).attr('toot-id')
$('[toot-id=' + id + ']').removeClass('hide')
var text = $(elem).find('.toot').html()
Object.keys(home).forEach(function (key8) {
Object.keys(home).forEach(function(key8) {
var word = home[key8]
var regExp = new RegExp(word.replace(/[.*+?^=!:${}()|[\]\/\\]/g, '\\$&'), 'g')
if ($.strip_tags(text).match(regExp)) {
@ -523,11 +536,11 @@ function exclude(key) {
} else {
excludetxt = '?exclude_types[]=poll'
}
} else {
}
} else {}
localStorage.setItem('exclude-' + key, excludetxt)
parseColumn(key)
}
function excludeCk(key, target) {
var exc = localStorage.getItem('exclude-' + key)
if (!exc) {
@ -539,6 +552,7 @@ function excludeCk(key, target) {
return ''
}
}
function checkNotfFilter(tlid) {
var excludetxt = localStorage.getItem('exclude-' + tlid)
if (!excludetxt || excludetxt != '') {
@ -547,10 +561,12 @@ function checkNotfFilter(tlid) {
return false
}
}
function resetNotfFilter(tlid) {
localStorage.setItem('exclude-' + tlid, '')
parseColumn(tlid)
}
function notfFilter(id, tlid, acct_id) {
var excludetxt = localStorage.getItem('exclude-' + tlid)
if (excludetxt || excludetxt != '') {

View File

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

View File

@ -544,12 +544,7 @@ function insertFont(name) {
}
function copyColor(from, to) {
let props = [
'background', 'subcolor', 'text', 'accent',
'modal', 'modalFooter', 'third', 'forth',
'bottom', 'emphasized', 'postbox', 'active',
'selected', 'selectedWithShared'
]
let props = ['background', 'subcolor', 'text', 'accent', 'modal', 'modalFooter', 'third', 'forth', 'bottom', 'emphasized', 'postbox', 'active', 'selected', 'selectedWithShared']
let i = 0
let color
for (tag of props) {
@ -589,11 +584,7 @@ function customComp(preview) {
var textC = $('#color-picker1_value').val()
var accentC = $('#color-picker3_value').val()
var multi = localStorage.getItem('multi')
let advanced = [
'modal', 'modalFooter', 'third', 'forth',
'bottom', 'emphasized', 'postbox', 'active',
'selected', 'selectedWithShared'
]
let advanced = ['modal', 'modalFooter', 'third', 'forth', 'bottom', 'emphasized', 'postbox', 'active', 'selected', 'selectedWithShared']
var advanceTheme = {}
let i = 4
for (tag of advanced) {
@ -606,9 +597,7 @@ function customComp(preview) {
var my = JSON.parse(multi)[0].name
var id = $('#custom-edit-sel').val()
const defaults = [
'black', 'blue', 'brown', 'green', 'indigo', 'polar', 'snow', 'white'
]
const defaults = ['black', 'blue', 'brown', 'green', 'indigo', 'polar', 'snow', 'white']
if (id == 'add_new' || defaults.includes(id)) {
id = makeCID()
}
@ -622,11 +611,11 @@ function customComp(preview) {
background: bgC,
subcolor: subcolorC,
text: textC,
accent: accentC
accent: accentC,
},
advanced: advanceTheme,
id: id,
version: '2'
version: '2',
}
$('#custom_json').val(JSON.stringify(json))
if (preview) {
@ -640,7 +629,6 @@ function customComp(preview) {
})
postMessage(['themeJsonCreate', JSON.stringify(json)], '*')
}
}
function deleteIt() {
@ -710,16 +698,11 @@ function customConnect(raw) {
$('#color-picker2_value').val(args.primary.subcolor)
//Accent
$('#color-picker3_value').val(args.primary.accent)
let advanced = [
'modal', 'modalFooter', 'third', 'forth',
'bottom', 'emphasized', 'postbox', 'active',
'selected', 'selectedWithShared'
]
let advanced = ['modal', 'modalFooter', 'third', 'forth', 'bottom', 'emphasized', 'postbox', 'active', 'selected', 'selectedWithShared']
let i = 4
for (tag of advanced) {
if (args.advanced[tag]) {
$(`#color-picker${i}_value`).val(args.advanced[tag])
}
$(`#use-color_${i}`).prop('checked', true)
i++
@ -765,7 +748,7 @@ function customSoundSave(key, file) {
}
function pluginLoad() {
$('#plugin-edit-sel').val('add_new')
$(".plugin_delete").addClass('disabled')
$('.plugin_delete').addClass('disabled')
var template = ''
var pgns = localStorage.getItem('plugins')
var args = JSON.parse(pgns ? pgns : '[]')
@ -783,9 +766,9 @@ function pluginEdit() {
$('#plugin').attr('data-id', id)
if (id == 'add_new') {
editor.setValue('', -1)
$(".plugin_delete").addClass('disabled')
$('.plugin_delete').addClass('disabled')
} else {
$(".plugin_delete").removeClass('disabled')
$('.plugin_delete').removeClass('disabled')
var pgns = localStorage.getItem('plugins')
var args = JSON.parse(pgns ? pgns : '[]')
Object.keys(args).forEach(function (key) {
@ -823,7 +806,7 @@ function completePlugin(comp) {
id = makeCID()
args.push({
id: id,
content: inputPlugin
content: inputPlugin,
})
} else {
Object.keys(args).forEach(function (key) {
@ -857,7 +840,7 @@ async function deletePlugin() {
const alert = await Swal.fire({
title: 'delete',
icon: 'warning',
showCancelButton: true
showCancelButton: true,
})
if (!alert) return false
editor.setValue('', -1)
@ -959,4 +942,6 @@ function lastFmSet() {
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) {
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/)
var mode = m[1]
var codex = m[2]
if (mode == "user") {
udgEx(codex, "main")
if (mode == 'user') {
udgEx(codex, 'main')
}
}
function udgEx(user, acct_id) {
if (user == "selector") {
user = $("#his-acct").attr("fullname")
async function udgEx(user, acct_id) {
if (user == 'selector') {
user = $('#his-acct').attr('fullname')
}
if (acct_id == "selector") {
acct_id = $("#user-acct-sel").val()
if (acct_id == 'selector') {
acct_id = $('#user-acct-sel').val()
}
if (acct_id == "main") {
acct_id = localStorage.getItem("main")
if (acct_id == 'main') {
acct_id = localStorage.getItem('main')
}
console.log("Get user data of " + user)
var domain = localStorage.getItem("domain_" + acct_id)
if (localStorage.getItem("mode_" + domain) == "misskey") {
console.log('Get user data of ' + user)
var domain = localStorage.getItem('domain_' + acct_id)
if (localStorage.getItem('mode_' + domain) == 'misskey') {
return false
}
var at = localStorage.getItem("acct_" + acct_id + "_at")
var start = "https://" + domain + "/api/v2/search?resolve=true&q=" + encodeURIComponent(user)
var at = localStorage.getItem('acct_' + acct_id + '_at')
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({
title: 'Loading...',
html: lang.lang_details_fetch,
@ -34,103 +45,104 @@ function udgEx(user, acct_id) {
onBeforeOpen: () => {
Swal.showLoading()
},
onClose: () => { },
}).then((result) => { })
onClose: () => {},
}).then((result) => {})
fetch(start, {
method: "GET",
method: 'GET',
headers: {
"content-type": "application/json",
Authorization: "Bearer " + at
}
'content-type': 'application/json',
Authorization: 'Bearer ' + at,
},
})
.then(function (response) {
.then(function(response) {
if (!response.ok) {
Swal.close()
response.text().then(function (text) {
response.text().then(function(text) {
setLog(response.url, response.status, text)
})
}
return response.json()
})
.catch(function (error) {
.catch(function(error) {
todo(error)
setLog(start, "JSON", error)
setLog(start, 'JSON', error)
console.error(error)
})
.then(function (json) {
.then(function(json) {
if (json.accounts[0]) {
var id = json.accounts[0].id
udg(id, acct_id, true)
} else {
Swal.close()
postMessage(["openUrl", user], "*")
postMessage(['openUrl', user], '*')
}
})
return true
}
function udg(user, acct_id, isSwal) {
reset()
if (!user) {
user = localStorage.getItem("user-id_" + acct_id)
user = localStorage.getItem('user-id_' + acct_id)
}
todo("User Data Loading...")
var domain = localStorage.getItem("domain_" + acct_id)
if (localStorage.getItem("mode_" + domain) == "misskey") {
todo('User Data Loading...')
var domain = localStorage.getItem('domain_' + acct_id)
if (localStorage.getItem('mode_' + domain) == 'misskey') {
misskeyUdg(user, acct_id)
return
}
var at = localStorage.getItem("acct_" + acct_id + "_at")
var start = "https://" + domain + "/api/v1/accounts/" + user
var at = localStorage.getItem('acct_' + acct_id + '_at')
var start = 'https://' + domain + '/api/v1/accounts/' + user
fetch(start, {
method: "GET",
method: 'GET',
headers: {
"content-type": "application/json",
Authorization: "Bearer " + at
}
'content-type': 'application/json',
Authorization: 'Bearer ' + at,
},
})
.then(function (response) {
if(isSwal) Swal.close()
.then(function(response) {
if (isSwal) Swal.close()
if (!response.ok) {
response.text().then(function (text) {
response.text().then(function(text) {
setLog(response.url, response.status, text)
})
}
return response.json()
})
.catch(function (error) {
.catch(function(error) {
todo(error)
setLog(start, "JSON", error)
setLog(start, 'JSON', error)
console.error(error)
})
.then(function (json) {
.then(function(json) {
//一つ前のユーザーデータ
if (!localStorage.getItem("history")) {
$("#his-history-btn").prop("disabled", true)
if (!localStorage.getItem('history')) {
$('#his-history-btn').prop('disabled', true)
} else {
$("#his-history-btn").prop("disabled", false)
$("#his-data").attr("history", localStorage.getItem("history"))
$('#his-history-btn').prop('disabled', false)
$('#his-data').attr('history', localStorage.getItem('history'))
}
//moved設定時
if (json.moved) {
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>",
displayLength: 4000
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,
})
}
$("#his-data").modal("open")
$("#his-data").attr("user-id", user)
$("#his-data").attr("use-acct", acct_id)
$('#his-data').modal('open')
$('#his-data').attr('user-id', user)
$('#his-data').attr('use-acct', acct_id)
if (json.username != json.acct) {
//Remote
$("#his-data").attr("remote", "true")
$('#his-data').attr('remote', 'true')
var fullname = json.acct
} else {
$("#his-data").attr("remote", "false")
var fullname = json.acct + "@" + domain
$('#his-data').attr('remote', 'false')
var fullname = json.acct + '@' + domain
}
utlShow(json.id, "", acct_id)
flw(json.id, "", acct_id)
fer(json.id, "", acct_id)
utlShow(json.id, '', acct_id)
flw(json.id, '', acct_id)
fer(json.id, '', acct_id)
var dis_name = escapeHTML(json.display_name)
dis_name = twemoji.parse(dis_name)
@ -142,11 +154,11 @@ function udg(user, acct_id, isSwal) {
}
//絵文字があれば
if (actemojick) {
Object.keys(json.emojis).forEach(function (key5) {
Object.keys(json.emojis).forEach(function(key5) {
var emoji = json.emojis[key5]
var shortcode = emoji.shortcode
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)
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>';
//note=note.replace(/#(\S+)/gi, tags)
//note=note.replace(/\s@([a-zA-Z_0-9@.-]+)/gi, mens)
$("#his-name").html(dis_name)
$("#his-acct").text(json.acct)
$("#his-acct").attr("fullname", fullname)
$("#his-prof").attr("src", json.avatar)
$("#util-add").removeClass("hide")
$('#his-name').html(dis_name)
$('#his-acct').text(json.acct)
$('#his-acct').attr('fullname', fullname)
$('#his-prof').attr('src', json.avatar)
$('#util-add').removeClass('hide')
const title = $('.column-first').html()
$("#my-data-nav .anc-link").removeClass("active-back")
$('.column-first').addClass("active-back")
$('#my-data-nav .anc-link').removeClass('active-back')
$('.column-first').addClass('active-back')
$('#his-data-title').html(title)
$("#his-data").css("background-image", "url(" + json.header + ")")
$("#his-sta").text(json.statuses_count)
$("#his-follow").text(json.following_count)
$('#his-data').css('background-image', 'url(' + json.header + ')')
$('#his-sta').text(json.statuses_count)
$('#his-follow').text(json.following_count)
var flerc = json.followers_count
if (flerc < 0) {
flerc = "-"
flerc = '-'
}
$("#his-follower").text(flerc)
$("#his-since").text(crat(json.created_at))
$("#his-openin").attr("data-href", json.url)
$('#his-follower').text(flerc)
$('#his-since').text(crat(json.created_at))
$('#his-openin').attr('data-href', json.url)
if (json.fields) {
var table = ""
var table = ''
if (json.fields.length > 0) {
$("#his-des").css("max-height", "250px")
$('#his-des').css('max-height', '250px')
table = '<table id="his-field">'
for (var i = 0; i < json.fields.length; i++) {
var fname = json.fields[i].name
var fval = json.fields[i].value
if (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 when = lang.lang_showontl_verified + ':' + crat(json.fields[i].verified_at)
var color = 'rgba(121,189,154,.25);'
} else {
var when = ""
var color = "inherit"
var when = ''
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>"
$("#his-des").html(twemoji.parse(note))
table = table + '</table>'
$('#his-des').html(twemoji.parse(note))
} 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 {
$("#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) {
$("#his-bot").html(lang.lang_showontl_botacct)
$("#his-bot").removeClass("hide")
$('#his-bot').html(lang.lang_showontl_botacct)
$('#his-bot').removeClass('hide')
}
$("#his-des").attr("data-acct", acct_id)
$("#his-data").css("background-size", "cover")
$("#his-float-timeline").css("height", $("#his-data-show").height() + "px")
localStorage.setItem("history", user)
$('#his-des').attr('data-acct', acct_id)
$('#his-data').css('background-size', 'cover')
$('#his-float-timeline').css('height', $('#his-data-show').height() + 'px')
localStorage.setItem('history', user)
//自分の時
if (json.acct == localStorage.getItem("user_" + acct_id)) {
showFav("", acct_id)
showBlo("", acct_id)
showMut("", acct_id)
showDom("", acct_id)
showReq("", acct_id)
showFrl("", acct_id)
$("#his-name-val").val(json.display_name)
if (json.acct == localStorage.getItem('user_' + acct_id)) {
showFav('', acct_id)
showBlo('', acct_id)
showMut('', acct_id)
showDom('', acct_id)
showReq('', acct_id)
showFrl('', acct_id)
$('#his-name-val').val(json.display_name)
if (json.fields.length > 0) {
if (json.fields[0]) {
$("#his-f1-name").val(json.fields[0].name)
$("#his-f1-val").val($.strip_tags(json.fields[0].value))
$('#his-f1-name').val(json.fields[0].name)
$('#his-f1-val').val($.strip_tags(json.fields[0].value))
}
if (json.fields[1]) {
$("#his-f2-name").val(json.fields[1].name)
$("#his-f2-val").val($.strip_tags(json.fields[1].value))
$('#his-f2-name').val(json.fields[1].name)
$('#his-f2-val').val($.strip_tags(json.fields[1].value))
}
if (json.fields[2]) {
$("#his-f3-name").val(json.fields[2].name)
$("#his-f3-val").val($.strip_tags(json.fields[2].value))
$('#his-f3-name').val(json.fields[2].name)
$('#his-f3-val').val($.strip_tags(json.fields[2].value))
}
if (json.fields[3]) {
$("#his-f4-name").val(json.fields[3].name)
$("#his-f4-val").val($.strip_tags(json.fields[3].value))
$('#his-f4-name').val(json.fields[3].name)
$('#his-f4-val').val($.strip_tags(json.fields[3].value))
}
}
var des = json.note
des = des.replace(/<br \/>/g, "\n")
des = des.replace(/<br \/>/g, '\n')
des = $.strip_tags(des)
$("#his-des-val").val(des)
$("#his-follow-btn").hide()
$("#his-block-btn").hide()
$("#his-mute-btn").hide()
$("#his-notf-btn").hide()
$("#his-domain-btn").hide()
$("#his-emp-btn").hide()
$(".only-my-data").show()
$(".only-his-data").hide()
if (localStorage.getItem("main") == acct_id) {
$("#his-main-acct").hide()
$('#his-des-val').val(des)
$('#his-follow-btn').hide()
$('#his-block-btn').hide()
$('#his-mute-btn').hide()
$('#his-notf-btn').hide()
$('#his-domain-btn').hide()
$('#his-emp-btn').hide()
$('.only-my-data').show()
$('.only-his-data').hide()
if (localStorage.getItem('main') == acct_id) {
$('#his-main-acct').hide()
}
} else {
relations(user, acct_id)
$(".only-my-data").hide()
$(".only-his-data").show()
$('.only-my-data').hide()
$('.only-his-data').show()
}
todc()
if (json.locked) {
@ -267,320 +289,324 @@ function udg(user, acct_id, isSwal) {
udAdd(acct_id, user, json.url)
})
}
function misskeyUdg(user, acct_id) {
reset()
if (!user) {
user = localStorage.getItem("user-id_" + acct_id)
user = localStorage.getItem('user-id_' + acct_id)
}
todo("User Data Loading...")
var domain = localStorage.getItem("domain_" + acct_id)
if (localStorage.getItem("mode_" + domain) != "misskey") {
todo('User Data Loading...')
var domain = localStorage.getItem('domain_' + acct_id)
if (localStorage.getItem('mode_' + domain) != 'misskey') {
udg(user, acct_id)
return
}
var at = localStorage.getItem("acct_" + acct_id + "_at")
var start = "https://" + domain + "/api/users/show"
var at = localStorage.getItem('acct_' + acct_id + '_at')
var start = 'https://' + domain + '/api/users/show'
fetch(start, {
method: "POST",
method: 'POST',
headers: {
"content-type": "application/json"
'content-type': 'application/json',
},
body: JSON.stringify({
i: at,
userId: user
userId: user,
}),
})
})
.then(function (response) {
.then(function(response) {
if (!response.ok) {
response.text().then(function (text) {
response.text().then(function(text) {
setLog(response.url, response.status, text)
})
}
return response.json()
})
.catch(function (error) {
.catch(function(error) {
todo(error)
setLog(start, "JSON", error)
setLog(start, 'JSON', error)
console.error(error)
})
.then(function (json) {
.then(function(json) {
//一つ前のユーザーデータ
if (!localStorage.getItem("history")) {
$("#his-history-btn").prop("disabled", true)
if (!localStorage.getItem('history')) {
$('#his-history-btn').prop('disabled', true)
} else {
$("#his-history-btn").prop("disabled", false)
$("#his-data").attr("history", localStorage.getItem("history"))
$('#his-history-btn').prop('disabled', false)
$('#his-data').attr('history', localStorage.getItem('history'))
}
$("#his-data").modal("open")
$("#his-data").attr("user-id", user)
$("#his-data").attr("use-acct", acct_id)
$('#his-data').modal('open')
$('#his-data').attr('user-id', user)
$('#his-data').attr('use-acct', acct_id)
if (json.host) {
//Remote
$("#his-data").attr("remote", "false")
var fullname = json.username + "@" + json.host
$('#his-data').attr('remote', 'false')
var fullname = json.username + '@' + json.host
} else {
$("#his-data").attr("remote", "false")
var fullname = json.acct + "@" + domain
$('#his-data').attr('remote', 'false')
var fullname = json.acct + '@' + domain
}
utlShow(json.id, "", acct_id)
flw(json.id, "", acct_id)
fer(json.id, "", acct_id)
utlShow(json.id, '', acct_id)
flw(json.id, '', acct_id)
fer(json.id, '', acct_id)
if (json.name) {
var dis_name = escapeHTML(json.name)
dis_name = twemoji.parse(dis_name)
} else {
var dis_name = json.name
}
$("#his-name").html(dis_name)
$("#his-acct").text(json.username)
$("#his-acct").attr("fullname", fullname)
$("#his-prof").attr("src", json.avatarUrl)
$("#his-data").css("background-image", "url(" + json.bannerUrl + ")")
$("#his-sta").text(json.notesCount)
$("#his-follow").text(json.followingCount)
$("#his-follower").text(json.followersCount)
$("#his-since").text(crat(json.createdAt))
$('#his-name').html(dis_name)
$('#his-acct').text(json.username)
$('#his-acct').attr('fullname', fullname)
$('#his-prof').attr('src', json.avatarUrl)
$('#his-data').css('background-image', 'url(' + json.bannerUrl + ')')
$('#his-sta').text(json.notesCount)
$('#his-follow').text(json.followingCount)
$('#his-follower').text(json.followersCount)
$('#his-since').text(crat(json.createdAt))
var note = escapeHTML(json.description)
$("#his-des").html(twemoji.parse(note))
$('#his-des').html(twemoji.parse(note))
if (json.isCat) {
$("#his-bot").html("Cat" + twemoji.parse("😺"))
$('#his-bot').html('Cat' + twemoji.parse('😺'))
}
$("#his-data").css("background-size", "cover")
localStorage.setItem("history", user)
$('#his-data').css('background-size', 'cover')
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);
//showMut('', acct_id);
//showReq('', acct_id);
showFrl("", acct_id)
$("#his-name-val").val(json.name)
showFrl('', acct_id)
$('#his-name-val').val(json.name)
var des = json.note
des = nl2br(des)
des = $.strip_tags(des)
$("#his-des-val").val(des)
$("#his-follow-btn").hide()
$("#his-block-btn").hide()
$("#his-mute-btn").hide()
$("#his-notf-btn").hide()
$("#his-domain-btn").hide()
$("#his-emp-btn").hide()
$(".only-my-data").show()
$(".only-his-data").hide()
if (localStorage.getItem("main") == acct_id) {
$("#his-main-acct").hide()
$('#his-des-val').val(des)
$('#his-follow-btn').hide()
$('#his-block-btn').hide()
$('#his-mute-btn').hide()
$('#his-notf-btn').hide()
$('#his-domain-btn').hide()
$('#his-emp-btn').hide()
$('.only-my-data').show()
$('.only-his-data').hide()
if (localStorage.getItem('main') == acct_id) {
$('#his-main-acct').hide()
}
} else {
if (json.isFollowing) {
//自分がフォローしている
$("#his-data").addClass("following")
$("#his-follow-btn-text").text(lang.lang_status_unfollow)
$('#his-data').addClass('following')
$('#his-follow-btn-text').text(lang.lang_status_unfollow)
hisList(user, acct_id)
} else {
$("#his-follow-btn-text").text(lang.lang_status_follow)
$('#his-follow-btn-text').text(lang.lang_status_follow)
}
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) {
$("#his-data").addClass("muting")
$("#his-mute-btn-text").text(lang.lang_status_unmute)
$('#his-data').addClass('muting')
$('#his-mute-btn-text').text(lang.lang_status_unmute)
} else {
$("#his-mute-btn-text").text(lang.lang_status_mute)
$('#his-mute-btn-text').text(lang.lang_status_mute)
}
$(".only-my-data").hide()
$(".only-his-data").show()
$('.only-my-data').hide()
$('.only-his-data').show()
}
todc()
})
}
//一つ前のユーザーデータ表示
function historyShow() {
var acct_id = $("#his-data").attr("use-acct")
var user = $("#his-data").attr("history")
udg(user, acct_id, "true")
var acct_id = $('#his-data').attr('use-acct')
var user = $('#his-data').attr('history')
udg(user, acct_id, 'true')
}
//選択アカウントのプロフ
function profShow() {
var acct_id = $("#post-acct-sel").val()
var user = localStorage.getItem("user-id_" + acct_id)
var acct_id = $('#post-acct-sel').val()
var user = localStorage.getItem('user-id_' + acct_id)
udg(user, acct_id)
hide()
}
//FF関係取得
function relations(user, acct_id) {
var domain = localStorage.getItem("domain_" + acct_id)
var at = localStorage.getItem("acct_" + acct_id + "_at")
var start = "https://" + domain + "/api/v1/accounts/relationships?id=" + user
var domain = localStorage.getItem('domain_' + acct_id)
var at = localStorage.getItem('acct_' + acct_id + '_at')
var start = 'https://' + domain + '/api/v1/accounts/relationships?id=' + user
fetch(start, {
method: "GET",
method: 'GET',
headers: {
"content-type": "application/json",
Authorization: "Bearer " + at
}
'content-type': 'application/json',
Authorization: 'Bearer ' + at,
},
})
.then(function (response) {
.then(function(response) {
if (!response.ok) {
response.text().then(function (text) {
response.text().then(function(text) {
setLog(response.url, response.status, text)
})
}
return response.json()
})
.catch(function (error) {
.catch(function(error) {
todo(error)
setLog(start, "JSON", error)
setLog(start, 'JSON', error)
console.error(error)
})
.then(function (json) {
.then(function(json) {
var json = json[0]
if (json.requested) {
//フォロリク中
$('#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) {
//自分がフォローしている
$("#his-data").addClass("following")
$("#his-follow-btn-text").text(lang.lang_status_unfollow)
$('#his-data').addClass('following')
$('#his-follow-btn-text').text(lang.lang_status_unfollow)
hisList(user, acct_id)
} else {
$("#his-follow-btn-text").text(lang.lang_status_follow)
$('#his-follow-btn-text').text(lang.lang_status_follow)
}
if (json.followed_by) {
//フォローされてる
$("#his-relation").text(lang.lang_showontl_followed)
$('#his-relation').text(lang.lang_showontl_followed)
}
if (json.blocking) {
$("#his-data").addClass("blocking")
$("#his-block-btn-text").text(lang.lang_status_unblock)
$('#his-data').addClass('blocking')
$('#his-block-btn-text').text(lang.lang_status_unblock)
} else {
$("#his-block-btn-text").text(lang.lang_status_block)
$('#his-block-btn-text').text(lang.lang_status_block)
}
if (json.muting) {
$("#his-data").addClass("muting")
$("#his-mute-btn-text").text(lang.lang_status_unmute)
$('#his-data').addClass('muting')
$('#his-mute-btn-text').text(lang.lang_status_unmute)
} else {
$("#his-mute-btn-text").text(lang.lang_status_mute)
$('#his-mute-btn-text').text(lang.lang_status_mute)
}
if (json.muting_notifications) {
$("#his-data").addClass("mutingNotf")
$("#his-notf-btn-text").text(lang.lang_showontl_notf + lang.lang_status_unmute)
$('#his-data').addClass('mutingNotf')
$('#his-notf-btn-text').text(lang.lang_showontl_notf + lang.lang_status_unmute)
} 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) {
$("#his-data").addClass("blockingDom")
$("#his-domain-btn-text").text(lang.lang_showontl_domain + lang.lang_status_unblock)
$('#his-data').addClass('blockingDom')
$('#his-domain-btn-text').text(lang.lang_showontl_domain + lang.lang_status_unblock)
} 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
if (json.endorsed) {
$("#his-end-btn").addClass("endorsed")
$("#his-end-btn-text").text(lang.lang_status_unendorse)
$('#his-end-btn').addClass('endorsed')
$('#his-end-btn-text').text(lang.lang_status_unendorse)
} else {
$("#his-end-btn").removeClass("endorsed")
$("#his-end-btn-text").text(lang.lang_status_endorse)
$('#his-end-btn').removeClass('endorsed')
$('#his-end-btn-text').text(lang.lang_status_endorse)
}
//Blocked
if (json.blocked_by) {
$("#my-data-nav .btn").addClass("disabled")
$(".his-var-content").hide()
$("#his-float-blocked").show()
$("#his-follow-btn").hide()
$('#my-data-nav .btn').addClass('disabled')
$('.his-var-content').hide()
$('#his-float-blocked').show()
$('#his-follow-btn').hide()
}
})
}
function profbrws() {
var url = $("#his-openin").attr("data-href")
postMessage(["openUrl", url], "*")
var url = $('#his-openin').attr('data-href')
postMessage(['openUrl', url], '*')
}
function setMain() {
var acct_id = $("#his-data").attr("use-acct")
localStorage.setItem("main", acct_id)
var acct_id = $('#his-data').attr('use-acct')
localStorage.setItem('main', acct_id)
multiSelector(true)
M.toast({ html: lang.lang_manager_mainAcct, displayLength: 3000 })
}
//オールリセット
function hisclose() {
$("#his-data").modal("close")
$('#his-data').modal('close')
reset()
$("#his-data").attr("history", "")
localStorage.removeItem("history")
$('#his-data').attr('history', '')
localStorage.removeItem('history')
}
function reset() {
$(".his-var-content:eq(0)").show()
$(".his-var-content:gt(0)").hide()
$("#my-data-nav .btn").removeClass("disabled")
$(".active-back").removeClass("active-back")
$(".column-first").addClass("active-back")
$("#his-name").text("Loading")
$("#his-acct").text("")
$("#his-prof").attr("src", "../../img/loading.svg")
$("#his-data").css("background-image", "url(../../img/loading.svg)")
$("#his-sta").text("")
$("#his-follow").text("")
$("#his-follower").text("")
$("#his-des").html("")
$("#his-data").css("background-size", "cover")
$("#his-since").text("")
$("#his-data").removeClass("following")
$("#his-data").removeClass("muting")
$("#his-data").removeClass("blocking")
$("#his-data").removeClass("mutingNotf")
$("#his-data").removeClass("blockingDom")
$("#his-end-btn").removeClass("endorsed")
$("#his-des").css("max-height", "250px")
$("#his-bot").html("")
$("#his-bot").addClass("hide")
$("#his-follow-btn").show()
$("#his-block-btn").show()
$("#his-mute-btn").show()
$("#his-notf-btn").show()
$("#his-domain-btn").show()
$("#his-emp-btn").show()
$("#his-follow-btn-text").text(lang.lang_status_follow)
$("#his-mute-btn-text").text(lang.lang_status_mute)
$("#his-block-btn-text").text(lang.lang_status_block)
$("#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-relation").text("")
$(".cont-series").html("")
$("#domainblock").val("")
$("#his-lists-a").html(lang.lang_showontl_listwarn)
$("#his-lists-b").html("")
$("#his-name-val").val("")
$("#his-des-val").val("")
$("#his-f1-name").val("")
$("#his-f1-val").val("")
$("#his-f2-name").val("")
$("#his-f2-val").val("")
$("#his-f3-name").val("")
$("#his-f3-val").val("")
$("#his-f4-name").val("")
$("#his-f4-val").val("")
$("#his-endorse").html("")
$("#his-openin").attr("data-href", "")
$("#his-float-timeline").show()
$("#his-float-blocked").hide()
$("#his-main-acct").show()
$("#his-proof-prof").html("")
$('.his-var-content:eq(0)').show()
$('.his-var-content:gt(0)').hide()
$('#my-data-nav .btn').removeClass('disabled')
$('.active-back').removeClass('active-back')
$('.column-first').addClass('active-back')
$('#his-name').text('Loading')
$('#his-acct').text('')
$('#his-prof').attr('src', '../../img/loading.svg')
$('#his-data').css('background-image', 'url(../../img/loading.svg)')
$('#his-sta').text('')
$('#his-follow').text('')
$('#his-follower').text('')
$('#his-des').html('')
$('#his-data').css('background-size', 'cover')
$('#his-since').text('')
$('#his-data').removeClass('following')
$('#his-data').removeClass('muting')
$('#his-data').removeClass('blocking')
$('#his-data').removeClass('mutingNotf')
$('#his-data').removeClass('blockingDom')
$('#his-end-btn').removeClass('endorsed')
$('#his-des').css('max-height', '250px')
$('#his-bot').html('')
$('#his-bot').addClass('hide')
$('#his-follow-btn').show()
$('#his-block-btn').show()
$('#his-mute-btn').show()
$('#his-notf-btn').show()
$('#his-domain-btn').show()
$('#his-emp-btn').show()
$('#his-follow-btn-text').text(lang.lang_status_follow)
$('#his-mute-btn-text').text(lang.lang_status_mute)
$('#his-block-btn-text').text(lang.lang_status_block)
$('#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-relation').text('')
$('.cont-series').html('')
$('#domainblock').val('')
$('#his-lists-a').html(lang.lang_showontl_listwarn)
$('#his-lists-b').html('')
$('#his-name-val').val('')
$('#his-des-val').val('')
$('#his-f1-name').val('')
$('#his-f1-val').val('')
$('#his-f2-name').val('')
$('#his-f2-val').val('')
$('#his-f3-name').val('')
$('#his-f3-val').val('')
$('#his-f4-name').val('')
$('#his-f4-val').val('')
$('#his-endorse').html('')
$('#his-openin').attr('data-href', '')
$('#his-float-timeline').show()
$('#his-float-blocked').hide()
$('#his-main-acct').show()
$('#his-proof-prof').html('')
$('#his-data').removeClass('locked')
$('#his-data').removeClass('requesting')
}
$("#my-data-nav .anc-link").on("click", function () {
var target = $(this).attr("go")
$('#my-data-nav .anc-link').on('click', function() {
var target = $(this).attr('go')
if (target) {
let title = $(this).html()
if (target === '#his-tl') $("#util-add").removeClass("hide")
if (target != '#his-tl') $("#util-add").addClass("hide")
if (target === '#his-tl') $('#util-add').removeClass('hide')
if (target != '#his-tl') $('#util-add').addClass('hide')
$('#his-data-title').html(title)
$("#my-data-nav .anc-link").removeClass("active-back")
$(this).addClass("active-back")
$('#my-data-nav .anc-link').removeClass('active-back')
$(this).addClass('active-back')
$(target).show()
$(".his-var-content:not(" + target + ")").hide()
$('.his-var-content:not(' + target + ')').hide()
}
})

View File

@ -27,7 +27,7 @@
<body class="">
<script>
var ver = '22.2.0 (Koume)'
var gitHash = '9758a2a7d8f1b504193126c20fd96ccf42945cd8'
var gitHash = '5621ffbe42a1de361ccee0e679c97d30da436aab'
//betaを入れるとバージョンチェックしない
//var ver="beta";
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="padding-top:5px;">Main author: Cutls@1m.cutls.com</a>
<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';"
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/9758a2a7d8f1b504193126c20fd96ccf42945cd8"
<a href="https://app.fossa.com/projects/git%2Bgithub.com%2Fcutls%2FTheDesk/refs/branch/master/5621ffbe42a1de361ccee0e679c97d30da436aab"
alt="FOSSA Status"><img
src="https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcutls%2FTheDesk.svg?type=small" /></a>
<br>