today shinchoku

This commit is contained in:
cutls 2020-07-21 12:44:53 +09:00
parent d92a9ae1ae
commit 541ebbbb19
9 changed files with 181 additions and 206 deletions

View File

@ -605,4 +605,4 @@ textarea {
.linux .win,
.darwin .win {
display: none;
}
}

View File

@ -38,10 +38,10 @@ async function ck() {
const acct = obj[key]
if (acct.domain) {
let refreshed = await refresh(key, true)
if(refreshed) req = true
if (refreshed) req = true
}
}
if(req) {
if (req) {
Swal.fire({
title: 'Reload required',
text: lang.lang_login_changedData,
@ -50,18 +50,18 @@ async function ck() {
confirmButtonText: lang.lang_no,
cancelButtonText: lang.lang_yesno
}).then(result => {
if(result) location.reload()
if (result) location.reload()
})
}
if (obj[0].domain) {
showElm('#tl')
ticker()
multiSelector(false)
parseColumn()
verck(ver)
showElm('.stw')
const tips = localStorage.getItem('tips')
if (tips) {
tips(tips)
const tipsType = localStorage.getItem('tips')
if (tipsType) {
tips(tipsType)
}
document.querySelector('#something-wrong img').setAttribute('src', '../../img/thinking.svg')
}
@ -78,7 +78,7 @@ async function refresh(target, loadskip) {
}
const start = `https://${domain}/api/v1/accounts/verify_credentials`
let json
try{
try {
json = await getApi(start, at)
} catch {
return false
@ -88,7 +88,7 @@ async function refresh(target, loadskip) {
M.toast({ html: lang.lang_fatalerroroccured + 'Error:' + json.error, displayLength: 5000 })
return
}
if(!json) return false
if (!json) return false
let avatar = json['avatar']
//missingがmissingなやつ
if (avatar == '/avatars/original/missing.png' || !avatar) {
@ -131,7 +131,7 @@ async function refresh(target, loadskip) {
}
//MarkdownやBBCodeの対応、文字数制限をチェック
//絶対ストリーミングを閉じさせないマン
function ckdb(acct_id) {
async function ckdb(acct_id) {
const domain = localStorage.getItem(`domain_${acct_id}`)
if (domain == 'kirishima.cloud') {
localStorage.setItem('kirishima', true)
@ -148,34 +148,39 @@ function ckdb(acct_id) {
var json = idata
if (json[quoteMarker] == 'enabled') {
localStorage.setItem('quoters', true)
localStorage.setItem(`quote_${acct_id}`, true)
localStorage.setItem(quoteMarker, true)
}
}
if (!isMisskey(domain)) {
const start = `https://${domain}/api/v1/instance`
const json = getApi(start, null)
let json
try {
json = await getApi(start, null)
} catch {
return null
}
if (!json || json.error) {
return
}
const mtc = json['max_toot_chars']
if (mtc) {
localStorage.setItem(`letters_${acct_id}`, mtc)
localStorage.setItem(letters, mtc)
}
if (json['feature_quote']) {
localStorage.setItem(`quote_${acct_id}`, true)
localStorage.setItem(quoteMarker, true)
}
const str = json['urls']['streaming_api']
if (str) {
localStorage.setItem(`streaming_${acct_id}`, str)
localStorage.setItem(`streaming_${domain}`, str)
}
}
}
//アカウントを選択…を実装
function multiSelector(parseC) {
if (!acctList) return false
const obj = acctList
let template
function multiSelector() {
let obj = acctList
//if (!obj) obj = JSON.parse(localStorage.getItem('multi'))
let template = ''
//StringなのはlocalStorageがStringしか返さないから
let lastUsed = '0'
if (localStorage.getItem('mainuse') == 'main') {
@ -195,7 +200,7 @@ function multiSelector(parseC) {
} else {
for (let i = 0; i < obj.length; i++) {
const acct = obj[i]
const strKey = i?.toString()
const strKey = i.toString()
if (strKey == lastUsed) {
sel = 'selected'
const domain = acct.domain
@ -205,7 +210,7 @@ function multiSelector(parseC) {
textarea.setAttribute('data-length', letters)
} else {
//手動でアカマネで変えれちゃうから
const maxLetters = localStorage.getItem('letters_' + strKey)
const maxLetters = localStorage.getItem(`${domain}_letters`)
if (maxLetters > 0) {
textarea.setAttribute('data-length', maxLetters)
} else {
@ -234,36 +239,37 @@ function multiSelector(parseC) {
if (domain == 'imastodon.net') {
trendTag()
} else {
if(document.querySelector('#trendtag')) this.innerHTML = ''
if (document.querySelector('#trendtag')) document.querySelector('#trendtag').innerHTML = ''
}
} else {
sel = ''
}
template = `
<option value="${strKey}" data-icon="${acct.prof}" class="left circle" ${sel}>
@${acct.user} ${acct.domain}
template = template + `
<option value="${strKey}" data-icon="${acct.prof}" class="left circle" ${sel}>@${acct.user}@${acct.domain}
</option>
`
appendPrepend('.acct-sel', template, 'append')
}
appendPrepend('#src-acct-sel', '<option value="tootsearch">Tootsearch</option>', 'append')
appendPrepend('#add-acct-sel', `
const forSrc = template + '<option value="tootsearch">Tootsearch</option>'
const forAdd = template + `
<option value="noauth">${lang.lang_login_noauth}</option>
<option value="webview">Twitter</option>
`, 'append')
appendPrepend('#dir-acct-sel', `<option value="noauth">${lang.lang_login_noauth}</option>`, 'append')
}
const elems = document.querySelectorAll('select');
M.FormSelect.init(elems, null);
if (!parseC) {
parseColumn(null, true)
`
const forDir = template + `<option value="noauth">${lang.lang_login_noauth}</option>`
document.querySelector('#post-acct-sel').innerHTML = template
document.querySelector('#list-acct-sel').innerHTML = template
document.querySelector('#filter-acct-sel').innerHTML = template
document.querySelector('#src-acct-sel').innerHTML = forSrc
document.querySelector('#add-acct-sel').innerHTML = forAdd
document.querySelector('#dir-acct-sel').innerHTML = forDir
}
const elems = document.querySelectorAll('select')
M.FormSelect.init(elems, null)
}
//インスタンスティッカー
async function ticker() {
const start = 'https://toot-app.thedesk.top/toot/index.php'
const json = await getApi(start, null)
if(json) localStorage.setItem('ticker', JSON.stringify(json))
if (json) localStorage.setItem('ticker', JSON.stringify(json))
}
function isMisskey(domain) {
return localStorage.getItem(`mode_${domain}`) == 'misskey'

View File

@ -1,56 +1,30 @@
//アカウントマネージャ
//最初に読むやつ
function load() {
$('#acct-list').html('')
document.querySelector('#acct-list').innerHTML = ''
if (location.search) {
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/)
var mode = m[1]
var codex = m[2]
const m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/)
const mode = m[1]
const codex = m[2]
if (mode == 'first' && codex == 'true') {
$('body').addClass('first')
} else {
setAllClasses('body', 'first', 'add')
}
}
var prof = localStorage.getItem('prof')
$('.my-prof').attr('src', prof)
var name = localStorage.getItem('name')
$('#now-name').text(name)
var user = localStorage.getItem('user')
$('#now-user').text(user)
var domain = localStorage.getItem('domain')
$('.now-domain').text(domain)
var multi = localStorage.getItem('multi')
if (!multi) {
var obj = []
} else {
var obj = JSON.parse(multi)
}
if (obj[0]) {
if (!obj[0].at) {
obj = []
localStorage.removeItem('multi')
}
}
console.table(obj)
var domains = []
var templete
$('#acct-list').html('')
Object.keys(obj).forEach(function(key) {
var acct = obj[key]
var list = key * 1 + 1
if (acct.background != 'def' && acct.text != 'def') {
var style = 'style="background-color:#' + acct.background + '; color:' + acct.text + ';"'
} else {
var style = ''
}
if (acct.name) {
var name = acct.name
} else {
var name = acct.user
}
const multi = localStorage.getItem('multi')
if (!multi) return false
const obj = JSON.parse(multi)
let domains = []
let template = ''
document.querySelector('#acct-list').innerHTML = ''
for (let i = 0; i < obj.length; i++) {
const acct = obj[i]
const list = (parseInt(i) + 1).toString()
let style = ''
if (acct.background != 'def' && acct.text != 'def') style = `style="background-color:#${acct.background}; color:${acct.text};"`
let name = acct.user
if (acct.name) name = acct.name
domains.push(acct.domain)
templete = `
template = template + `
<div id="acct_${key}" class="card" ${style}>
<div class="card-content ">
<span class="lts">${list}.</span><img src="${acct.prof}" width="40" height="40" />
@ -67,70 +41,61 @@ function load() {
</div>
</div>
`
$('#acct-list').append(templete)
colorpicker(key)
})
colorpicker(i)
}
document.querySelector('#acct-list').innerHTML = template
//lodash dependent
domains = _.uniq(domains)
$('#domain-list').html('')
Object.keys(domains).forEach(function(key2) {
var domain = domains[key2]
if (localStorage.getItem('letters_' + key2)) {
var maxChars = localStorage.getItem('letters_' + key2)
} else {
var maxChars = 500
}
var templete = `
<li class="collection-item transparent">
<div>
<p class="title">${domain}</p>
${lang.lang_manager_maxChars} <input style="width: 100px" value="${maxChars}" id="maxChars${key2}">
<button class="btn-flat waves-effect" onclick="maxChars('${domain}', '${key2}')">
<i class="material-icons">send</i>
</button>
<button class="btn-flat waves-effect secondary-content" onclick="data('${domain}', '${key2}')">
<i class="material-icons left">info</i>${lang.lang_manager_info}
</button>
</div></li>
document.querySelector('#domain-list').innerHTML = ''
const keymap = Object.keys(domains)
let templateDomainList = ''
for(let j = 0; j < domains.length; j++) {
const key = keymap[j]
const domain = domains[key]
let maxChars = 500
const thisLtrs = localStorage.getItem(`${domain}_letters`)
if(thisLtrs) maxChars = thisLtrs
templateDomainList = templateDomainList + `
<li class="collection-item transparent">
<div>
<p class="title">${domain}</p>
${lang.lang_manager_maxChars} <input style="width: 100px" value="${maxChars}" id="maxChars${key2}">
<button class="btn-flat waves-effect" onclick="maxChars('${domain}', '${key2}')">
<i class="material-icons">send</i>
</button>
<button class="btn-flat waves-effect secondary-content" onclick="data('${domain}', '${key2}')">
<i class="material-icons left">info</i>${lang.lang_manager_info}
</button>
</div>
</li>
`
$('#domain-list').append(templete)
})
}
document.querySelector('#domain-list').innnerHTML = templateDomainList
multisel()
var acctN = localStorage.getItem('acct')
let acctN = localStorage.getItem('acct')
if (!acctN) {
localStorage.setItem('acct', 0)
var acctN = 0
acctN = 0
}
//全部チェックアリでいいと思うの
$('#linux').prop('checked', true)
}
//最初に読む
load()
support()
function maxChars(domain, uid) {
var value = $('#maxChars' + uid).val()
if(value*1 < 1 || !Number.isInteger(value*1)) {
const value = document.querySelector(`#maxChars${uid}`).value
if (parseInt(value) < 1 || !Number.isInteger(parseInt(value))) {
Swal.fire({
type: 'error',
title: 'Error'
})
return false
}
var multi = localStorage.getItem('multi')
if (!multi) {
var obj = []
} else {
var obj = JSON.parse(multi)
const multi = localStorage.getItem('multi')
if(!multi) return false
const obj = JSON.parse(multi)
for(let k = 0; k < obj.length; k++) {
if (obj[k].domain == domain) localStorage.setItem(`${domain}_letters`, value)
}
if (obj[0]) {
if (!obj[0].at) {
obj = []
localStorage.removeItem('multi')
}
}
Object.keys(obj).forEach(function(key) {
if(obj[key].domain == domain) localStorage.setItem('letters_' + key, value)
})
console.log('#maxChars' + uid, value)
load()
}
//instances.social/instances API
@ -208,7 +173,7 @@ function multiDel(target) {
cancelButtonText: lang.lang_no
}).then(result => {
if (result.value) {
Object.keys(obj).forEach(function(key) {
Object.keys(obj).forEach(function (key) {
var nk = key - 1
//公開範囲(差分のみ)
if (key >= target) {
@ -243,7 +208,7 @@ function multiDel(target) {
var col = localStorage.getItem('column')
var oldcols = JSON.parse(col)
var newcols = []
Object.keys(oldcols).forEach(function(key) {
Object.keys(oldcols).forEach(function (key) {
var nk = key - 1
var oldcol = oldcols[key]
if (target < oldcol.domain) {
@ -253,19 +218,19 @@ function multiDel(target) {
}
var type = oldcol.type
var data = null
if(oldcol.data) {
if (oldcol.data) {
data = oldcol.data
}
var background = null
if(oldcol.background) {
if (oldcol.background) {
background = oldcol.background
}
var text = null
if(oldcol.text) {
if (oldcol.text) {
text = oldcol.text
}
var left_fold = false
if(oldcol.left_fold) {
if (oldcol.left_fold) {
left_fold = true
}
//消した垢のコラムじゃないときコピー
@ -303,7 +268,7 @@ function multiDel2(target) {
obj.splice(target, 1)
var json = JSON.stringify(obj)
localStorage.setItem('multi', json)
Object.keys(obj).forEach(function(key) {
Object.keys(obj).forEach(function (key) {
if (key >= target) {
var oldvis = localStorage.getItem('vis-memory-' + key)
if (oldvis) {
@ -331,7 +296,7 @@ function multiDel2(target) {
} else {
var cobj = JSON.parse(col)
}
Object.keys(cobj).forEach(function(key) {
Object.keys(cobj).forEach(function (key) {
var column = cobj[key]
if (column.domain > target) {
var nk = key - 1
@ -351,7 +316,7 @@ function multiDel2(target) {
//サポートインスタンス
function support() {
Object.keys(idata).forEach(function(key) {
Object.keys(idata).forEach(function (key) {
var instance = idata[key]
if (instance == 'instance') {
templete =
@ -399,7 +364,7 @@ function login(url) {
website: 'https://thedesk.top'
})
)
httpreq.onreadystatechange = function() {
httpreq.onreadystatechange = function () {
if (httpreq.readyState === 4) {
var json = httpreq.response
if (this.status !== 200) {
@ -437,20 +402,20 @@ function versionChecker(url) {
'content-type': 'application/json'
}
})
.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) {
var version = json.version
if (version) {
var reg = version.match(/^([0-9])\.[0-9]\.[0-9]/u)
@ -476,25 +441,25 @@ function versionCompat(prefix, ver, title, real) {
'content-type': 'application/json'
}
})
.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) {
var complete = false
var ct = 0
var jl = 0
var jl2 = 0
Object.keys(json).forEach(function(key) {
Object.keys(json).forEach(function (key) {
var data = json[key]
if (data) {
jl++
@ -581,7 +546,7 @@ function misskeyLogin(url) {
]
})
)
httpreq.onreadystatechange = function() {
httpreq.onreadystatechange = function () {
if (httpreq.readyState === 4) {
var json = httpreq.response
if (this.status !== 200) {
@ -605,7 +570,7 @@ function misskeyAuth(url, mkc) {
appSecret: mkc
})
)
httpreq.onreadystatechange = function() {
httpreq.onreadystatechange = function () {
if (httpreq.readyState === 4) {
var json = httpreq.response
if (this.status !== 200) {
@ -657,7 +622,7 @@ function code(code) {
appSecret: localStorage.getItem('mkc')
})
)
httpreq.onreadystatechange = function() {
httpreq.onreadystatechange = function () {
if (httpreq.readyState === 4) {
var json = httpreq.response
if (this.status !== 200) {
@ -716,7 +681,7 @@ function code(code) {
code: code
})
)
httpreq.onreadystatechange = function() {
httpreq.onreadystatechange = function () {
if (httpreq.readyState === 4) {
var json = httpreq.response
if (this.status !== 200) {
@ -741,20 +706,20 @@ function getdata(domain, 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.error) {
console.error('Error:' + json.error)
M.toast({ html: lang.lang_fatalerroroccured + 'Error:' + json.error, displayLength: 5000 })
@ -862,25 +827,25 @@ function refresh(target) {
Authorization: 'Bearer ' + obj[target].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)
})
}
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.error) {
console.error('Error:' + json.error)
M.toast({ html: lang.lang_fatalerroroccured + 'Error:' + json.error, displayLength: 5000 })
@ -934,7 +899,7 @@ function misskeyRefresh(obj, target, url) {
i: obj[target].at
})
)
httpreq.onreadystatechange = function() {
httpreq.onreadystatechange = function () {
if (httpreq.readyState === 4) {
var json = httpreq.response
if (this.status !== 200) {
@ -983,7 +948,7 @@ function multisel() {
$('#src-acct-sel').html('<option value="tootsearch">Tootsearch</option>')
$('#add-acct-sel').html('<option value="noauth">' + lang.lang_login_noauth + '</option>')
} else {
Object.keys(obj).forEach(function(key) {
Object.keys(obj).forEach(function (key) {
var acct = obj[key]
var list = key * 1 + 1
if (key == last) {
@ -1073,10 +1038,10 @@ var oldSuggest
var suggest
input.addEventListener(
'focus',
function() {
function () {
$('#ins-suggest').html('')
window.clearInterval(timer)
timer = window.setInterval(function() {
timer = window.setInterval(function () {
var new_val = input.value
if (prev_val != new_val) {
if (new_val.length > 3) {
@ -1089,23 +1054,23 @@ input.addEventListener(
'Bearer tC8F6xWGWBUwGScyNevYlx62iO6fdQ4oIK0ad68Oo7ZKB8GQdGpjW9TKxBnIh8grAhvd5rw3iyP9JPamoDpeLQdz62EToPJUW99hDx8rfuJfGdjQuimZPTbIOx0woA5M'
}
})
.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.error) {
var urls = 'Suggest:'
Object.keys(json.instances).forEach(function(key) {
Object.keys(json.instances).forEach(function (key) {
var url = json.instances[key]
urls =
urls +
@ -1127,7 +1092,7 @@ input.addEventListener(
input.addEventListener(
'blur',
function() {
function () {
window.clearInterval(timer)
},
false

View File

@ -314,7 +314,7 @@ function appendPrepend(query, elm, action) {
const allTarget = document.querySelectorAll(query)
for (let i = 0; i < allTarget.length; i++) {
const target = allTarget[i]
if (action == 'prepend') target.prependChild(document.createTextNode(elm))
if (action == 'prepend') target.insertBefore(elm, target.firstChild)
if (action == 'append') target.appendChild(document.createTextNode(elm))
}
}

View File

@ -2,11 +2,12 @@
//アカウント変えた時にBBとかMDとか
function mdCheck() {
var acct_id = $('#post-acct-sel').val()
var profimg = localStorage.getItem('prof_' + acct_id)
/*var profimg = localStorage.getItem('prof_' + acct_id)
if (!profimg) {
profimg = '../../img/missing.svg'
}
$('#acct-sel-prof').attr('src', profimg)
*/
if (localStorage.getItem('post_' + acct_id)) {
$('#toot-post-btn').text(
localStorage.getItem('post_' + acct_id) +
@ -50,7 +51,7 @@ function mdCheck() {
if (idata[domain + '_letters']) {
$('#textarea').attr('data-length', idata[domain + '_letters'])
} else {
var maxletters = localStorage.getItem('letters_' + acct_id)
var maxletters = localStorage.getItem(domain + 'letters_')
if (maxletters > 0) {
$('#textarea').attr('data-length', maxletters)
} else {

View File

@ -42,7 +42,6 @@ function parseColumn(target, dontclose) {
var multi = localStorage.getItem('multi')
if (multi) {
var obj = JSON.parse(multi)
var templete
Object.keys(obj).forEach(function (key) {
var acct = obj[key]
@ -102,6 +101,7 @@ function parseColumn(target, dontclose) {
$('.box, .boxIn').resizable('destroy')
}
}
console.log(obj)
var basekey = 0
for (var key = 0; key < obj.length; key++) {
var next = key + 1
@ -508,6 +508,8 @@ function parseColumn(target, dontclose) {
}
}
}
console.log('multiSelector')
multiSelector()
$('.box, .boxIn').resizable({
minHeight: 50,
minWidth: 50,

View File

@ -32,7 +32,6 @@ function mini() {
function show() {
$('#post-box').addClass('appear')
$('#textarea').focus()
console.log('show' + localStorage.getItem('postbox-left'))
var left = localStorage.getItem('postbox-left')
if (left > $('body').width() - $('#post-box').width()) {
left = $('body').width() - $('#post-box').width()
@ -55,10 +54,12 @@ function show() {
}
$('#post-box').fadeIn()
$('#textarea').characterCounter()
mdCheck()
}
$(function () {
$('#post-box').draggable({
handle: '#post-bar',
stop: function () {

View File

@ -33,20 +33,20 @@ function udgEx(user, 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.accounts[0]) {
var id = json.accounts[0].id;
udg(id, acct_id);
@ -76,20 +76,20 @@ function udg(user, 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 (!localStorage.getItem("history")) {
$("#his-history-btn").prop("disabled", true);
@ -129,7 +129,7 @@ function udg(user, acct_id) {
}
//絵文字があれば
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">';
@ -239,7 +239,7 @@ function udg(user, acct_id) {
$(".only-his-data").show();
}
todc();
if(json.locked) {
if (json.locked) {
$('#his-data').addClass('locked')
} else {
$('#his-data').removeClass('locked')
@ -271,20 +271,20 @@ function misskeyUdg(user, acct_id) {
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);
console.error(error);
})
.then(function(json) {
.then(function (json) {
//一つ前のユーザーデータ
if (!localStorage.getItem("history")) {
$("#his-history-btn").prop("disabled", true);
@ -402,22 +402,22 @@ function relations(user, 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) {
var json = json[0];
if(json.requested) {
if (json.requested) {
//フォロリク中
$('#his-data').addClass('following')
$("#his-follow-btn-text").text(lang.lang_status_requesting)
@ -482,7 +482,7 @@ function profbrws() {
function setMain() {
var acct_id = $("#his-data").attr("use-acct");
localStorage.setItem("main", acct_id);
multiSelector(true);
multiSelector();
M.toast({ html: lang.lang_manager_mainAcct, displayLength: 3000 });
}
//オールリセット
@ -551,7 +551,7 @@ function reset() {
$('#his-data').removeClass('locked')
$('#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");
if (target) {
$("#my-data-nav .anc-link").removeClass("active-back");

View File

@ -69,7 +69,7 @@
<div class="pwa">
@@codesetupwarn@@<br />
<label>
<input type="checkbox" class="filled-in" id="linux" />
<input type="checkbox" class="filled-in checked" id="linux" checked />
<span>@@codesetup@@</span>
</label>
<br />
@ -128,17 +128,17 @@
<div id="instance-data">
Some instance data by
<a href="https://instances.social" target="_blank">instances.social API</a><br />
<h5 id="ins-title"></h5>
Administered by:<a id="ins-admin"></a><br />
<span id="ins-desc"></span><br />
<h5 id="ins-title" class="ins-loading"></h5>
Administered by:<a id="ins-admin" class="ins-loading"></a><br />
<span id="ins-desc" class="ins-loading"></span><br />
<img src="../../img/loading.svg" id="ins-prof" width="200" /><br />
<br />
@@domain@@:<span id="ins-name"></span><br />
@@connect@@:<span id="ins-connect"></span>@@ko@@<br />
@@toots@@:<span id="ins-toot"></span>@@ko@@<br />
@@users@@:<span id="ins-user"></span>@@users@@<br />
@@safety@@:<span id="ins-per"></span>%<br />
@@ver@@:<span id="ins-ver"></span>@<span id="ins-upd"></span><br />
@@domain@@:<span id="ins-name" class="ins-loading"></span><br />
@@connect@@:<span id="ins-connect" class="ins-loading"></span>@@ko@@<br />
@@toots@@:<span id="ins-toot" class="ins-loading"></span>@@ko@@<br />
@@users@@:<span id="ins-user" class="ins-loading"></span>@@users@@<br />
@@safety@@:<span id="ins-per" class="ins-loading"></span>%<br />
@@ver@@:<span id="ins-ver" class="ins-loading"></span>@<span id="ins-upd" class="ins-loading"></span><br />
</div>
</div>
<script type="text/javascript" src="../../js/ui/theme.js"></script>