add toot-edit
This commit is contained in:
parent
cb9a3c4af1
commit
742b93bbef
|
@ -82,7 +82,13 @@ function post(mode, postvis, dry) {
|
||||||
$('.toot-btn-group').prop('disabled', true)
|
$('.toot-btn-group').prop('disabled', true)
|
||||||
todo('Posting')
|
todo('Posting')
|
||||||
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||||
var start = 'https://' + domain + '/api/v1/statuses'
|
let start = 'https://' + domain + '/api/v1/statuses'
|
||||||
|
let method = 'POST'
|
||||||
|
const editTarget = $('#tootmodal').attr('data-edit')
|
||||||
|
if (editTarget) {
|
||||||
|
start = start + `/${editTarget}`
|
||||||
|
method = 'PUT'
|
||||||
|
}
|
||||||
var reply = $('#reply').val()
|
var reply = $('#reply').val()
|
||||||
if (str.indexOf(localStorage.getItem('stable')) == -1) {
|
if (str.indexOf(localStorage.getItem('stable')) == -1) {
|
||||||
str + ' #' + localStorage.getItem('stable')
|
str + ' #' + localStorage.getItem('stable')
|
||||||
|
@ -174,7 +180,7 @@ function post(mode, postvis, dry) {
|
||||||
return toot
|
return toot
|
||||||
}
|
}
|
||||||
var httpreq = new XMLHttpRequest()
|
var httpreq = new XMLHttpRequest()
|
||||||
httpreq.open('POST', start, true)
|
httpreq.open(method, start, true)
|
||||||
httpreq.setRequestHeader('Content-Type', 'application/json')
|
httpreq.setRequestHeader('Content-Type', 'application/json')
|
||||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
||||||
httpreq.setRequestHeader('Idempotency-Key', ideKey)
|
httpreq.setRequestHeader('Idempotency-Key', ideKey)
|
||||||
|
@ -375,5 +381,6 @@ function clear() {
|
||||||
width = 300
|
width = 300
|
||||||
}
|
}
|
||||||
$('#post-box').css('width', width)
|
$('#post-box').css('width', width)
|
||||||
|
$('#tootmodal').attr('data-edit', null)
|
||||||
mdCheck()
|
mdCheck()
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ function fav(id, acct_id, remote) {
|
||||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
||||||
httpreq.responseType = 'json'
|
httpreq.responseType = 'json'
|
||||||
httpreq.send()
|
httpreq.send()
|
||||||
httpreq.onreadystatechange = function() {
|
httpreq.onreadystatechange = function () {
|
||||||
if (httpreq.readyState === 4) {
|
if (httpreq.readyState === 4) {
|
||||||
var json = httpreq.response
|
var json = httpreq.response
|
||||||
if (this.status !== 200) {
|
if (this.status !== 200) {
|
||||||
|
@ -75,7 +75,7 @@ function rt(id, acct_id, remote, vis) {
|
||||||
} else {
|
} else {
|
||||||
httpreq.send()
|
httpreq.send()
|
||||||
}
|
}
|
||||||
httpreq.onreadystatechange = function() {
|
httpreq.onreadystatechange = function () {
|
||||||
if (httpreq.readyState === 4) {
|
if (httpreq.readyState === 4) {
|
||||||
var json = httpreq.response
|
var json = httpreq.response
|
||||||
if (this.status !== 200) {
|
if (this.status !== 200) {
|
||||||
|
@ -132,7 +132,7 @@ function bkm(id, acct_id, tlid) {
|
||||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
||||||
httpreq.responseType = 'json'
|
httpreq.responseType = 'json'
|
||||||
httpreq.send()
|
httpreq.send()
|
||||||
httpreq.onreadystatechange = function() {
|
httpreq.onreadystatechange = function () {
|
||||||
if (httpreq.readyState === 4) {
|
if (httpreq.readyState === 4) {
|
||||||
var json = httpreq.response
|
var json = httpreq.response
|
||||||
if (this.status !== 200) {
|
if (this.status !== 200) {
|
||||||
|
@ -201,7 +201,7 @@ async function follow(acct_id, resolve) {
|
||||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
||||||
httpreq.responseType = 'json'
|
httpreq.responseType = 'json'
|
||||||
httpreq.send(JSON.stringify(ent))
|
httpreq.send(JSON.stringify(ent))
|
||||||
httpreq.onreadystatechange = function() {
|
httpreq.onreadystatechange = function () {
|
||||||
if (httpreq.readyState === 4) {
|
if (httpreq.readyState === 4) {
|
||||||
var json = httpreq.response
|
var json = httpreq.response
|
||||||
if (this.status !== 200) {
|
if (this.status !== 200) {
|
||||||
|
@ -296,7 +296,7 @@ function block(acct_id) {
|
||||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
||||||
httpreq.responseType = 'json'
|
httpreq.responseType = 'json'
|
||||||
httpreq.send()
|
httpreq.send()
|
||||||
httpreq.onreadystatechange = function() {
|
httpreq.onreadystatechange = function () {
|
||||||
if (httpreq.readyState === 4) {
|
if (httpreq.readyState === 4) {
|
||||||
if (this.status !== 200) {
|
if (this.status !== 200) {
|
||||||
setLog(start, this.status, this.response)
|
setLog(start, this.status, this.response)
|
||||||
|
@ -364,7 +364,7 @@ function muteDo(acct_id) {
|
||||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
||||||
httpreq.responseType = 'json'
|
httpreq.responseType = 'json'
|
||||||
httpreq.send(rq)
|
httpreq.send(rq)
|
||||||
httpreq.onreadystatechange = function() {
|
httpreq.onreadystatechange = function () {
|
||||||
if (httpreq.readyState === 4) {
|
if (httpreq.readyState === 4) {
|
||||||
if (this.status !== 200) {
|
if (this.status !== 200) {
|
||||||
setLog(start, this.status, this.response)
|
setLog(start, this.status, this.response)
|
||||||
|
@ -413,7 +413,7 @@ function del(id, acct_id) {
|
||||||
httpreq.responseType = 'json'
|
httpreq.responseType = 'json'
|
||||||
httpreq.send()
|
httpreq.send()
|
||||||
}
|
}
|
||||||
httpreq.onreadystatechange = function() {
|
httpreq.onreadystatechange = function () {
|
||||||
if (httpreq.readyState === 4) {
|
if (httpreq.readyState === 4) {
|
||||||
if (this.status !== 200) {
|
if (this.status !== 200) {
|
||||||
setLog(start, this.status, this.response)
|
setLog(start, this.status, this.response)
|
||||||
|
@ -453,7 +453,31 @@ function redraft(id, acct_id) {
|
||||||
httpreq.responseType = 'json'
|
httpreq.responseType = 'json'
|
||||||
httpreq.send()
|
httpreq.send()
|
||||||
}
|
}
|
||||||
httpreq.onreadystatechange = function() {
|
httpreq.onreadystatechange = function () {
|
||||||
|
if (httpreq.readyState === 4) {
|
||||||
|
if (this.status !== 200) {
|
||||||
|
setLog(start, this.status, this.response)
|
||||||
|
}
|
||||||
|
var json = httpreq.response
|
||||||
|
draftToPost(json, acct_id, null)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// edit
|
||||||
|
function editToot(id, acct_id) {
|
||||||
|
show()
|
||||||
|
var domain = localStorage.getItem('domain_' + acct_id)
|
||||||
|
var at = localStorage.getItem('acct_' + acct_id + '_at')
|
||||||
|
var start = 'https://' + domain + '/api/v1/statuses/' + id + '/source'
|
||||||
|
var httpreq = new XMLHttpRequest()
|
||||||
|
httpreq.open('GET', start, true)
|
||||||
|
httpreq.setRequestHeader('Content-Type', 'application/json')
|
||||||
|
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
||||||
|
httpreq.responseType = 'json'
|
||||||
|
httpreq.send()
|
||||||
|
httpreq.onreadystatechange = function () {
|
||||||
if (httpreq.readyState === 4) {
|
if (httpreq.readyState === 4) {
|
||||||
if (this.status !== 200) {
|
if (this.status !== 200) {
|
||||||
setLog(start, this.status, this.response)
|
setLog(start, this.status, this.response)
|
||||||
|
@ -462,14 +486,13 @@ function redraft(id, acct_id) {
|
||||||
draftToPost(json, acct_id, id)
|
draftToPost(json, acct_id, 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)
|
||||||
$('select').formSelect()
|
$('select').formSelect()
|
||||||
|
if (id) $('#tootmodal').attr('data-edit', id)
|
||||||
mdCheck()
|
mdCheck()
|
||||||
mediack = null
|
mediack = null
|
||||||
if (json.media_attachments) mediack = json.media_attachments[0]
|
if (json.media_attachments) mediack = json.media_attachments[0]
|
||||||
|
@ -532,7 +555,7 @@ function pin(id, acct_id) {
|
||||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
||||||
httpreq.responseType = 'json'
|
httpreq.responseType = 'json'
|
||||||
httpreq.send()
|
httpreq.send()
|
||||||
httpreq.onreadystatechange = function() {
|
httpreq.onreadystatechange = function () {
|
||||||
if (httpreq.readyState === 4) {
|
if (httpreq.readyState === 4) {
|
||||||
var json = httpreq.response
|
var json = httpreq.response
|
||||||
if (this.status !== 200) {
|
if (this.status !== 200) {
|
||||||
|
@ -563,7 +586,7 @@ function request(id, flag, acct_id) {
|
||||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
||||||
httpreq.responseType = 'json'
|
httpreq.responseType = 'json'
|
||||||
httpreq.send()
|
httpreq.send()
|
||||||
httpreq.onreadystatechange = function() {
|
httpreq.onreadystatechange = function () {
|
||||||
if (httpreq.readyState === 4) {
|
if (httpreq.readyState === 4) {
|
||||||
var json = httpreq.response
|
var json = httpreq.response
|
||||||
if (this.status !== 200) {
|
if (this.status !== 200) {
|
||||||
|
@ -589,7 +612,7 @@ function domainblock(add, flag, acct_id) {
|
||||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
||||||
httpreq.responseType = 'json'
|
httpreq.responseType = 'json'
|
||||||
httpreq.send()
|
httpreq.send()
|
||||||
httpreq.onreadystatechange = function() {
|
httpreq.onreadystatechange = function () {
|
||||||
if (httpreq.readyState === 4) {
|
if (httpreq.readyState === 4) {
|
||||||
var json = httpreq.response
|
var json = httpreq.response
|
||||||
if (this.status !== 200) {
|
if (this.status !== 200) {
|
||||||
|
@ -616,7 +639,7 @@ function empUser() {
|
||||||
M.toast({ html: id + lang.lang_status_emphas, displayLength: 4000 })
|
M.toast({ html: id + lang.lang_status_emphas, displayLength: 4000 })
|
||||||
} else {
|
} else {
|
||||||
var can
|
var can
|
||||||
Object.keys(obj).forEach(function(key) {
|
Object.keys(obj).forEach(function (key) {
|
||||||
var usT = obj[key]
|
var usT = obj[key]
|
||||||
if (usT != id && !can) {
|
if (usT != id && !can) {
|
||||||
can = false
|
can = false
|
||||||
|
@ -648,7 +671,7 @@ function pinUser() {
|
||||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
||||||
httpreq.responseType = 'json'
|
httpreq.responseType = 'json'
|
||||||
httpreq.send()
|
httpreq.send()
|
||||||
httpreq.onreadystatechange = function() {
|
httpreq.onreadystatechange = function () {
|
||||||
if (httpreq.readyState === 4) {
|
if (httpreq.readyState === 4) {
|
||||||
var json = httpreq.response
|
var json = httpreq.response
|
||||||
if (this.status !== 200) {
|
if (this.status !== 200) {
|
||||||
|
@ -684,20 +707,20 @@ function staEx(mode) {
|
||||||
Authorization: 'Bearer ' + at,
|
Authorization: 'Bearer ' + at,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(function(response) {
|
.then(function (response) {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
response.text().then(function(text) {
|
response.text().then(function (text) {
|
||||||
setLog(response.url, response.status, text)
|
setLog(response.url, response.status, text)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return response.json()
|
return response.json()
|
||||||
})
|
})
|
||||||
.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 (json.statuses) {
|
if (json.statuses) {
|
||||||
if (json.statuses[0]) {
|
if (json.statuses[0]) {
|
||||||
var id = json.statuses[0].id
|
var id = json.statuses[0].id
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
//トゥートの詳細
|
//トゥートの詳細
|
||||||
function details(id, acct_id, tlid, mode) {
|
async function details(id, acct_id, tlid, mode) {
|
||||||
if (mode == 'dm') {
|
if (mode == 'dm') {
|
||||||
$('.dm-hide').hide()
|
$('.dm-hide').hide()
|
||||||
} else {
|
} else {
|
||||||
$('.dm-hide').show()
|
$('.dm-hide').show()
|
||||||
}
|
}
|
||||||
const context = localStorage.getItem('moreContext')
|
const context = localStorage.getItem('moreContext')
|
||||||
if(context != 'yes') {
|
if (context != 'yes') {
|
||||||
$('.contextTool').hide()
|
$('.contextTool').hide()
|
||||||
} else {
|
} else {
|
||||||
$('.contextTool').show()
|
$('.contextTool').show()
|
||||||
|
@ -39,25 +39,17 @@ function details(id, acct_id, tlid, mode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
fetch(start, i)
|
const response = await fetch(start, i)
|
||||||
.then(function(response) {
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
response.text().then(function(text) {
|
response.text().then(function (text) {
|
||||||
setLog(response.url, response.status, text)
|
setLog(response.url, response.status, text)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return response.json()
|
const json = await response.json()
|
||||||
})
|
|
||||||
.catch(function(error) {
|
|
||||||
todo(error)
|
|
||||||
setLog(start, 'JSON', error)
|
|
||||||
console.error(error)
|
|
||||||
})
|
|
||||||
.then(function(json) {
|
|
||||||
console.log(['Toot data:', json])
|
console.log(['Toot data:', json])
|
||||||
if (!$('#timeline_' + tlid + ' #pub_' + id).length) {
|
if (!$('#timeline_' + tlid + ' #pub_' + id).length) {
|
||||||
var html = parse([json], '', acct_id)
|
var html = parse([json], '', acct_id, '', '', mute)
|
||||||
$('#toot-this').html(html)
|
$('#toot-this').html(html)
|
||||||
jQuery('time.timeago').timeago()
|
jQuery('time.timeago').timeago()
|
||||||
}
|
}
|
||||||
|
@ -112,6 +104,18 @@ function details(id, acct_id, tlid, mode) {
|
||||||
afterFTLToot(id, acct_id, dom)
|
afterFTLToot(id, acct_id, dom)
|
||||||
faved(id, acct_id)
|
faved(id, acct_id)
|
||||||
rted(id, acct_id)
|
rted(id, acct_id)
|
||||||
|
if (json.edited_at) {
|
||||||
|
$('.edited-hide').show()
|
||||||
|
try {
|
||||||
|
const history = await (await fetch(`https://${domain}/api/v1/statuses/${id}/history`, i)).json()
|
||||||
|
const temp = parse(history, 'noauth', acct_id)
|
||||||
|
console.log(temp)
|
||||||
|
$('#toot-edit').html(temp)
|
||||||
|
} catch(e) { console.error(e) }
|
||||||
|
} else {
|
||||||
|
$('#toot-edit').html('')
|
||||||
|
$('.edited-hide').hide()
|
||||||
|
}
|
||||||
if ($('#toot-this div').hasClass('cvo')) {
|
if ($('#toot-this div').hasClass('cvo')) {
|
||||||
$('#toot-this').removeClass('cvo')
|
$('#toot-this').removeClass('cvo')
|
||||||
} else {
|
} else {
|
||||||
|
@ -122,7 +126,11 @@ function details(id, acct_id, tlid, mode) {
|
||||||
if (!$('#activator').hasClass('active')) {
|
if (!$('#activator').hasClass('active')) {
|
||||||
$('#det-col').collapsible('open', 4)
|
$('#det-col').collapsible('open', 4)
|
||||||
}
|
}
|
||||||
})
|
} catch (e) {
|
||||||
|
todo(error)
|
||||||
|
setLog(start, 'JSON', error)
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//返信タイムライン
|
//返信タイムライン
|
||||||
|
@ -145,20 +153,20 @@ function replyTL(id, acct_id) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
fetch(start, i)
|
fetch(start, i)
|
||||||
.then(function(response) {
|
.then(function (response) {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
response.text().then(function(text) {
|
response.text().then(function (text) {
|
||||||
setLog(response.url, response.status, text)
|
setLog(response.url, response.status, text)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return response.json()
|
return response.json()
|
||||||
})
|
})
|
||||||
.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) {
|
||||||
var mute = getFilterTypeByAcct(acct_id, 'thread')
|
var mute = getFilterTypeByAcct(acct_id, 'thread')
|
||||||
if (localStorage.getItem('mode_' + domain) == 'misskey') {
|
if (localStorage.getItem('mode_' + domain) == 'misskey') {
|
||||||
var templete = misskeyParse([json], '', acct_id, '', '', mute)
|
var templete = misskeyParse([json], '', acct_id, '', '', mute)
|
||||||
|
@ -201,20 +209,20 @@ function getContext(id, acct_id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fetch(start, i)
|
fetch(start, i)
|
||||||
.then(function(response) {
|
.then(function (response) {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
response.text().then(function(text) {
|
response.text().then(function (text) {
|
||||||
setLog(response.url, response.status, text)
|
setLog(response.url, response.status, text)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return response.json()
|
return response.json()
|
||||||
})
|
})
|
||||||
.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('mode_' + domain) == 'misskey') {
|
if (localStorage.getItem('mode_' + domain) == 'misskey') {
|
||||||
json.reverse()
|
json.reverse()
|
||||||
var templete = misskeyParse(json, '', acct_id, '', '', [])
|
var templete = misskeyParse(json, '', acct_id, '', '', [])
|
||||||
|
@ -269,20 +277,20 @@ function beforeToot(id, acct_id, domain) {
|
||||||
untilID: id
|
untilID: id
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then(function(response) {
|
.then(function (response) {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
response.text().then(function(text) {
|
response.text().then(function (text) {
|
||||||
setLog(response.url, response.status, text)
|
setLog(response.url, response.status, text)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return response.json()
|
return response.json()
|
||||||
})
|
})
|
||||||
.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) {
|
||||||
var templete = misskeyParse(json, 'noauth', acct_id)
|
var templete = misskeyParse(json, 'noauth', acct_id)
|
||||||
$('#toot-before').html(templete)
|
$('#toot-before').html(templete)
|
||||||
jQuery('time.timeago').timeago()
|
jQuery('time.timeago').timeago()
|
||||||
|
@ -295,20 +303,20 @@ function beforeToot(id, acct_id, domain) {
|
||||||
'content-type': 'application/json'
|
'content-type': 'application/json'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(function(response) {
|
.then(function (response) {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
response.text().then(function(text) {
|
response.text().then(function (text) {
|
||||||
setLog(response.url, response.status, text)
|
setLog(response.url, response.status, text)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return response.json()
|
return response.json()
|
||||||
})
|
})
|
||||||
.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) {
|
||||||
var templete = parse(json, 'noauth', acct_id)
|
var templete = parse(json, 'noauth', acct_id)
|
||||||
if (templete != '') {
|
if (templete != '') {
|
||||||
$('#toot-before .no-data').hide()
|
$('#toot-before .no-data').hide()
|
||||||
|
@ -335,20 +343,20 @@ function userToot(id, acct_id, user) {
|
||||||
userId: user
|
userId: user
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.then(function(response) {
|
.then(function (response) {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
response.text().then(function(text) {
|
response.text().then(function (text) {
|
||||||
setLog(response.url, response.status, text)
|
setLog(response.url, response.status, text)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return response.json()
|
return response.json()
|
||||||
})
|
})
|
||||||
.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) {
|
||||||
var templete = misskeyParse(json, 'noauth', acct_id)
|
var templete = misskeyParse(json, 'noauth', acct_id)
|
||||||
$('#user-before').html(templete)
|
$('#user-before').html(templete)
|
||||||
jQuery('time.timeago').timeago()
|
jQuery('time.timeago').timeago()
|
||||||
|
@ -362,20 +370,20 @@ function userToot(id, acct_id, user) {
|
||||||
Authorization: 'Bearer ' + at
|
Authorization: 'Bearer ' + at
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(function(response) {
|
.then(function (response) {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
response.text().then(function(text) {
|
response.text().then(function (text) {
|
||||||
setLog(response.url, response.status, text)
|
setLog(response.url, response.status, text)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return response.json()
|
return response.json()
|
||||||
})
|
})
|
||||||
.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) {
|
||||||
var templete = parse(json, '', acct_id)
|
var templete = parse(json, '', acct_id)
|
||||||
if (templete != '') {
|
if (templete != '') {
|
||||||
$('#user-before .no-data').hide()
|
$('#user-before .no-data').hide()
|
||||||
|
@ -396,20 +404,20 @@ function afterToot(id, acct_id, domain) {
|
||||||
'content-type': 'application/json'
|
'content-type': 'application/json'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(function(response) {
|
.then(function (response) {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
response.text().then(function(text) {
|
response.text().then(function (text) {
|
||||||
setLog(response.url, response.status, text)
|
setLog(response.url, response.status, text)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return response.json()
|
return response.json()
|
||||||
})
|
})
|
||||||
.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) {
|
||||||
var templete = parse(json, 'noauth', acct_id)
|
var templete = parse(json, 'noauth', acct_id)
|
||||||
if (templete != '') {
|
if (templete != '') {
|
||||||
$('#ltl-after .no-data').hide()
|
$('#ltl-after .no-data').hide()
|
||||||
|
@ -430,20 +438,20 @@ function afterUserToot(id, acct_id, user) {
|
||||||
Authorization: 'Bearer ' + at
|
Authorization: 'Bearer ' + at
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(function(response) {
|
.then(function (response) {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
response.text().then(function(text) {
|
response.text().then(function (text) {
|
||||||
setLog(response.url, response.status, text)
|
setLog(response.url, response.status, text)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return response.json()
|
return response.json()
|
||||||
})
|
})
|
||||||
.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) {
|
||||||
var templete = parse(json, '', acct_id)
|
var templete = parse(json, '', acct_id)
|
||||||
if (templete != '') {
|
if (templete != '') {
|
||||||
$('#user-after .no-data').hide()
|
$('#user-after .no-data').hide()
|
||||||
|
@ -463,20 +471,20 @@ function afterFTLToot(id, acct_id, domain) {
|
||||||
'content-type': 'application/json'
|
'content-type': 'application/json'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(function(response) {
|
.then(function (response) {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
response.text().then(function(text) {
|
response.text().then(function (text) {
|
||||||
setLog(response.url, response.status, text)
|
setLog(response.url, response.status, text)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return response.json()
|
return response.json()
|
||||||
})
|
})
|
||||||
.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) {
|
||||||
var templete = parse(json, 'noauth', acct_id)
|
var templete = parse(json, 'noauth', acct_id)
|
||||||
if (templete != '') {
|
if (templete != '') {
|
||||||
$('#ftl-after .no-data').hide()
|
$('#ftl-after .no-data').hide()
|
||||||
|
@ -501,20 +509,20 @@ function faved(id, acct_id) {
|
||||||
Authorization: 'Bearer ' + at
|
Authorization: 'Bearer ' + at
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(function(response) {
|
.then(function (response) {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
response.text().then(function(text) {
|
response.text().then(function (text) {
|
||||||
setLog(response.url, response.status, text)
|
setLog(response.url, response.status, text)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return response.json()
|
return response.json()
|
||||||
})
|
})
|
||||||
.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) {
|
||||||
var templete = userparse(json, '', acct_id)
|
var templete = userparse(json, '', acct_id)
|
||||||
if (templete != '') {
|
if (templete != '') {
|
||||||
$('#toot-fav .no-data').hide()
|
$('#toot-fav .no-data').hide()
|
||||||
|
@ -539,20 +547,20 @@ function rted(id, acct_id) {
|
||||||
Authorization: 'Bearer ' + at
|
Authorization: 'Bearer ' + at
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(function(response) {
|
.then(function (response) {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
response.text().then(function(text) {
|
response.text().then(function (text) {
|
||||||
setLog(response.url, response.status, text)
|
setLog(response.url, response.status, text)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return response.json()
|
return response.json()
|
||||||
})
|
})
|
||||||
.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) {
|
||||||
var templete = userparse(json, '', acct_id)
|
var templete = userparse(json, '', acct_id)
|
||||||
$('#toot-rt').html(templete)
|
$('#toot-rt').html(templete)
|
||||||
jQuery('time.timeago').timeago()
|
jQuery('time.timeago').timeago()
|
||||||
|
@ -614,20 +622,20 @@ function trans(tar, to, elem) {
|
||||||
fetch(exec, {
|
fetch(exec, {
|
||||||
method: 'GET'
|
method: 'GET'
|
||||||
})
|
})
|
||||||
.then(function(response) {
|
.then(function (response) {
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
response.text().then(function(text) {
|
response.text().then(function (text) {
|
||||||
setLog(response.url, response.status, text)
|
setLog(response.url, response.status, text)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return response.json()
|
return response.json()
|
||||||
})
|
})
|
||||||
.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(text) {
|
.then(function (text) {
|
||||||
elem.parents('.cvo').find('.toot').append('<span class="gray translate">' + text.text + '</span>')
|
elem.parents('.cvo').find('.toot').append('<span class="gray translate">' + text.text + '</span>')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -482,6 +482,9 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
|
||||||
var locked = ' <i class="fas fa-lock red-text"></i>'
|
var locked = ' <i class="fas fa-lock red-text"></i>'
|
||||||
} else {
|
} else {
|
||||||
var locked = ''
|
var locked = ''
|
||||||
|
}
|
||||||
|
if (toot.edited_at) {
|
||||||
|
locked = locked + ` <i class="material-icons teal-text" style="font-size: 0.8rem" title="Edited at ${date(toot.edited_at, 'absolute')}">create</i>`
|
||||||
}
|
}
|
||||||
if (!toot.application) {
|
if (!toot.application) {
|
||||||
var via = ''
|
var via = ''
|
||||||
|
@ -642,7 +645,6 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
|
||||||
} else {
|
} else {
|
||||||
var desc = ''
|
var desc = ''
|
||||||
}
|
}
|
||||||
console.log('https://' + domain + '/storage/no-preview.png')
|
|
||||||
if (media.preview_url == 'https://' + domain + '/storage/no-preview.png') {
|
if (media.preview_url == 'https://' + domain + '/storage/no-preview.png') {
|
||||||
purl = url
|
purl = url
|
||||||
nsfwmes = '<div class="nsfw-media">Unavailable preview</div>'
|
nsfwmes = '<div class="nsfw-media">Unavailable preview</div>'
|
||||||
|
@ -664,10 +666,9 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
|
||||||
viewer = ''
|
viewer = ''
|
||||||
hasmedia = 'nomedia'
|
hasmedia = 'nomedia'
|
||||||
}
|
}
|
||||||
var menck = toot.mentions[0]
|
|
||||||
var mentions = ''
|
var mentions = ''
|
||||||
//メンションであれば
|
//メンションであれば
|
||||||
if (menck) {
|
if (toot.mentions && toot.mentions[0]) {
|
||||||
mentions = ''
|
mentions = ''
|
||||||
var to_mention = []
|
var to_mention = []
|
||||||
Object.keys(toot.mentions).forEach(function (key3) {
|
Object.keys(toot.mentions).forEach(function (key3) {
|
||||||
|
@ -1144,6 +1145,10 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type, onlyContent) {
|
||||||
style="padding:0; padding-top: 5px;">
|
style="padding:0; padding-top: 5px;">
|
||||||
<i class="material-icons" aria-hidden="true">redo</i>${lang.lang_parse_redraft}
|
<i class="material-icons" aria-hidden="true">redo</i>${lang.lang_parse_redraft}
|
||||||
</li>
|
</li>
|
||||||
|
<li class="${if_mine}" onclick="editToot('${uniqueid}','${acct_id}')"
|
||||||
|
style="padding:0; padding-top: 5px;">
|
||||||
|
<i class="material-icons" aria-hidden="true">create</i>${lang.lang_edit}(v3.5.0~)
|
||||||
|
</li>
|
||||||
${trans}
|
${trans}
|
||||||
<li onclick="postMessage(['openUrl', '${toot.url}'], '*')"
|
<li onclick="postMessage(['openUrl', '${toot.url}'], '*')"
|
||||||
style="padding:0; padding-top: 5px;">
|
style="padding:0; padding-top: 5px;">
|
||||||
|
@ -1565,6 +1570,13 @@ function mastodonBaseStreaming(acct_id) {
|
||||||
filterUpdate(acct_id)
|
filterUpdate(acct_id)
|
||||||
} else if (~typeA.indexOf('announcement')) {
|
} else if (~typeA.indexOf('announcement')) {
|
||||||
announ(acct_id, tlid)
|
announ(acct_id, tlid)
|
||||||
|
} else if (typeA === 'status.update') {
|
||||||
|
const tl = JSON.parse(mess.data).stream
|
||||||
|
const obj = JSON.parse(JSON.parse(mess.data).payload)
|
||||||
|
const tls = getTlMeta(tl[0], tl, acct_id, obj)
|
||||||
|
const template = insertTl(obj, tls, true)
|
||||||
|
$(`[unique-id=${obj.id}]`).html(template)
|
||||||
|
$(`[unique-id=${obj.id}] [unique-id=${obj.id}]`).unwrap()
|
||||||
} else if (typeA == 'notification') {
|
} else if (typeA == 'notification') {
|
||||||
const obj = JSON.parse(JSON.parse(mess.data).payload)
|
const obj = JSON.parse(JSON.parse(mess.data).payload)
|
||||||
let template = ''
|
let template = ''
|
||||||
|
@ -1635,7 +1647,7 @@ function mastodonBaseStreaming(acct_id) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function insertTl(obj, tls) {
|
function insertTl(obj, tls, dry) {
|
||||||
for (const timeline of tls) {
|
for (const timeline of tls) {
|
||||||
const { id, voice, type, acct_id } = timeline
|
const { id, voice, type, acct_id } = timeline
|
||||||
const mute = getFilterTypeByAcct(acct_id, type)
|
const mute = getFilterTypeByAcct(acct_id, type)
|
||||||
|
@ -1645,6 +1657,7 @@ function insertTl(obj, tls) {
|
||||||
say(obj.content)
|
say(obj.content)
|
||||||
}
|
}
|
||||||
const template = parse([obj], type, acct_id, id, '', mute, type)
|
const template = parse([obj], type, acct_id, id, '', mute, type)
|
||||||
|
if (dry) return template
|
||||||
console.log($(`#timeline_box_${id}_box .tl-box`).scrollTop(), `timeline_box_${id}_box .tl-box`)
|
console.log($(`#timeline_box_${id}_box .tl-box`).scrollTop(), `timeline_box_${id}_box .tl-box`)
|
||||||
if (
|
if (
|
||||||
$(`#timeline_box_${id}_box .tl-box`).scrollTop() === 0
|
$(`#timeline_box_${id}_box .tl-box`).scrollTop() === 0
|
||||||
|
|
|
@ -50,6 +50,10 @@
|
||||||
<div class="collapsible-header"><i class="text-darken-3 false fas fa-retweet"></i>@@btedPeople@@</div>
|
<div class="collapsible-header"><i class="text-darken-3 false fas fa-retweet"></i>@@btedPeople@@</div>
|
||||||
<div class="collapsible-body toot-reset" id="toot-rt"></div>
|
<div class="collapsible-body toot-reset" id="toot-rt"></div>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="edited-hide">
|
||||||
|
<div class="collapsible-header"><i class="material-icons">create</i>@@editHistory@@</div>
|
||||||
|
<div class="collapsible-body toot-reset" id="toot-edit"></div>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="dm-hide" style="max-width: 450px">
|
<div class="dm-hide" style="max-width: 450px">
|
||||||
@@useOtherAcct1@@(<i class="fas fa-retweet"></i>/<i class="fas fa-star"></i>@@useOtherAcct2@@)<br />
|
@@useOtherAcct1@@(<i class="fas fa-retweet"></i>/<i class="fas fa-star"></i>@@useOtherAcct2@@)<br />
|
||||||
|
|
|
@ -65,6 +65,7 @@
|
||||||
"afterFTL": "Federated TL after this toot",
|
"afterFTL": "Federated TL after this toot",
|
||||||
"favedPeople": "People who favourited it",
|
"favedPeople": "People who favourited it",
|
||||||
"btedPeople": "People who boosted it",
|
"btedPeople": "People who boosted it",
|
||||||
|
"editHistory": "Edit history",
|
||||||
"useOtherAcct1": "Use other account",
|
"useOtherAcct1": "Use other account",
|
||||||
"useOtherAcct2": ":unfav and unBT are disabled.",
|
"useOtherAcct2": ":unfav and unBT are disabled.",
|
||||||
"btWithVis": "Boost with visibility",
|
"btWithVis": "Boost with visibility",
|
||||||
|
|
|
@ -63,6 +63,7 @@
|
||||||
"afterFTL": "これより後の連合TL(誰のトゥート言及してんねん)",
|
"afterFTL": "これより後の連合TL(誰のトゥート言及してんねん)",
|
||||||
"favedPeople": "誰がお気に入りに登録してるんや",
|
"favedPeople": "誰がお気に入りに登録してるんや",
|
||||||
"btedPeople": "誰がお気に入りブーストしたんや",
|
"btedPeople": "誰がお気に入りブーストしたんや",
|
||||||
|
"editHistory": "編集履歴",
|
||||||
"useOtherAcct1": "他のアカウント使う",
|
"useOtherAcct1": "他のアカウント使う",
|
||||||
"useOtherAcct2": "の解除はできひん",
|
"useOtherAcct2": "の解除はできひん",
|
||||||
"btWithVis": "公開範囲も決めてからブースト",
|
"btWithVis": "公開範囲も決めてからブースト",
|
||||||
|
|
|
@ -65,6 +65,7 @@
|
||||||
"afterFTL": "これより後の連合TL(言及確認)",
|
"afterFTL": "これより後の連合TL(言及確認)",
|
||||||
"favedPeople": "このトゥートをお気に入りに登録した人",
|
"favedPeople": "このトゥートをお気に入りに登録した人",
|
||||||
"btedPeople": "このトゥートをブーストした人",
|
"btedPeople": "このトゥートをブーストした人",
|
||||||
|
"editHistory": "編集履歴",
|
||||||
"useOtherAcct1": "他のアカウントを使用",
|
"useOtherAcct1": "他のアカウントを使用",
|
||||||
"useOtherAcct2": "の解除はできません",
|
"useOtherAcct2": "の解除はできません",
|
||||||
"btWithVis": "公開範囲を指定してブースト",
|
"btWithVis": "公開範囲を指定してブースト",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user