add: draft
This commit is contained in:
parent
7d9ab19eef
commit
f2a4900f18
|
@ -64,9 +64,10 @@ textarea {
|
||||||
}
|
}
|
||||||
#emoji {
|
#emoji {
|
||||||
}
|
}
|
||||||
#suggest {
|
#suggest, #draft {
|
||||||
max-height: 23rem;
|
max-height: 23rem;
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
#emoji-list {
|
#emoji-list {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
@ -23,6 +23,7 @@ function emojiToggle(reaction) {
|
||||||
}
|
}
|
||||||
$('#post-box').css('width', width + 'px')
|
$('#post-box').css('width', width + 'px')
|
||||||
$('#suggest').html('')
|
$('#suggest').html('')
|
||||||
|
$('#draft').html('')
|
||||||
if (!localStorage.getItem('emojis_' + acct_id)) {
|
if (!localStorage.getItem('emojis_' + acct_id)) {
|
||||||
var html = `<button class="btn waves-effect green" style="width:100%; padding:0; margin-top:0;" onclick="emojiGet('true');">${lang.lang_emoji_get}</button>`
|
var html = `<button class="btn waves-effect green" style="width:100%; padding:0; margin-top:0;" onclick="emojiGet('true');">${lang.lang_emoji_get}</button>`
|
||||||
$('#emoji-list').html(html)
|
$('#emoji-list').html(html)
|
||||||
|
@ -31,10 +32,12 @@ function emojiToggle(reaction) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$('#poll').addClass('hide')
|
$('#poll').addClass('hide')
|
||||||
|
$('#draft').addClass('hide')
|
||||||
$('#right-side').hide()
|
$('#right-side').hide()
|
||||||
$('#right-side').css('width', '300px')
|
$('#right-side').css('width', '300px')
|
||||||
$('#emoji').addClass('hide')
|
$('#emoji').addClass('hide')
|
||||||
$('#suggest').html('')
|
$('#suggest').html('')
|
||||||
|
$('#draft').html('')
|
||||||
$('#left-side').css('width', '100%')
|
$('#left-side').css('width', '100%')
|
||||||
var width = localStorage.getItem('postbox-width')
|
var width = localStorage.getItem('postbox-width')
|
||||||
if (width) {
|
if (width) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ function sec() {
|
||||||
}
|
}
|
||||||
post(null, mode)
|
post(null, mode)
|
||||||
}
|
}
|
||||||
function post(mode, postvis) {
|
function post(mode, postvis, dry) {
|
||||||
if ($('#toot-post-btn').prop('disabled')) {
|
if ($('#toot-post-btn').prop('disabled')) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ function post(mode, postvis) {
|
||||||
console.log('This toot will be posted at:' + scheduled)
|
console.log('This toot will be posted at:' + scheduled)
|
||||||
schedule()
|
schedule()
|
||||||
toot.scheduled_at = scheduled
|
toot.scheduled_at = scheduled
|
||||||
if($('#sch-box').hasClass('expire')) {
|
if ($('#sch-box').hasClass('expire')) {
|
||||||
toot.scheduled_at = null
|
toot.scheduled_at = null
|
||||||
toot.expires_at = scheduled
|
toot.expires_at = scheduled
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ function post(mode, postvis) {
|
||||||
}
|
}
|
||||||
if (!$('#poll').hasClass('hide')) {
|
if (!$('#poll').hasClass('hide')) {
|
||||||
var options = []
|
var options = []
|
||||||
$('.mastodon-choice').map(function() {
|
$('.mastodon-choice').map(function () {
|
||||||
var choice = $(this).val()
|
var choice = $(this).val()
|
||||||
if (choice != '') {
|
if (choice != '') {
|
||||||
options.push(choice)
|
options.push(choice)
|
||||||
|
@ -159,6 +159,13 @@ function post(mode, postvis) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.table(toot)
|
console.table(toot)
|
||||||
|
if (dry) {
|
||||||
|
$('#ideKey').val('')
|
||||||
|
$('.toot-btn-group').prop('disabled', false)
|
||||||
|
todc()
|
||||||
|
toot['TheDeskAcctId'] = acct_id
|
||||||
|
return toot
|
||||||
|
}
|
||||||
var httpreq = new XMLHttpRequest()
|
var httpreq = new XMLHttpRequest()
|
||||||
httpreq.open('POST', start, true)
|
httpreq.open('POST', start, true)
|
||||||
httpreq.setRequestHeader('Content-Type', 'application/json')
|
httpreq.setRequestHeader('Content-Type', 'application/json')
|
||||||
|
@ -166,11 +173,11 @@ function post(mode, postvis) {
|
||||||
httpreq.setRequestHeader('Idempotency-Key', ideKey)
|
httpreq.setRequestHeader('Idempotency-Key', ideKey)
|
||||||
httpreq.responseType = 'json'
|
httpreq.responseType = 'json'
|
||||||
httpreq.send(JSON.stringify(toot))
|
httpreq.send(JSON.stringify(toot))
|
||||||
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) {
|
||||||
if(media && this.status == 422) {
|
if (media && this.status == 422) {
|
||||||
$('#ideKey').val('')
|
$('#ideKey').val('')
|
||||||
$('.toot-btn-group').prop('disabled', false)
|
$('.toot-btn-group').prop('disabled', false)
|
||||||
alertProcessUnfinished()
|
alertProcessUnfinished()
|
||||||
|
@ -201,7 +208,7 @@ function post(mode, postvis) {
|
||||||
}
|
}
|
||||||
function expPostMode() {
|
function expPostMode() {
|
||||||
$('#sch-box').toggleClass('expire')
|
$('#sch-box').toggleClass('expire')
|
||||||
if($('#sch-box').hasClass('expire')) {
|
if ($('#sch-box').hasClass('expire')) {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
type: 'info',
|
type: 'info',
|
||||||
title: 'Expiring toot On'
|
title: 'Expiring toot On'
|
||||||
|
@ -270,7 +277,7 @@ function misskeyPost() {
|
||||||
httpreq.setRequestHeader('Content-Type', 'application/json')
|
httpreq.setRequestHeader('Content-Type', 'application/json')
|
||||||
httpreq.responseType = 'json'
|
httpreq.responseType = 'json'
|
||||||
httpreq.send(JSON.stringify(toot))
|
httpreq.send(JSON.stringify(toot))
|
||||||
httpreq.onreadystatechange = function() {
|
httpreq.onreadystatechange = function () {
|
||||||
if (httpreq.readyState === 4) {
|
if (httpreq.readyState === 4) {
|
||||||
if (str.indexOf(localStorage.getItem('stable')) == -1) {
|
if (str.indexOf(localStorage.getItem('stable')) == -1) {
|
||||||
localStorage.removeItem('stable')
|
localStorage.removeItem('stable')
|
||||||
|
@ -339,7 +346,7 @@ function clear() {
|
||||||
$('#mins_poll').val(6)
|
$('#mins_poll').val(6)
|
||||||
$('#poll').addClass('hide')
|
$('#poll').addClass('hide')
|
||||||
$('#pollsta').text(lang.lang_no)
|
$('#pollsta').text(lang.lang_no)
|
||||||
$('.mastodon-choice').map(function() {
|
$('.mastodon-choice').map(function () {
|
||||||
$(this).val('')
|
$(this).val('')
|
||||||
})
|
})
|
||||||
localStorage.removeItem('image')
|
localStorage.removeItem('image')
|
||||||
|
|
|
@ -100,8 +100,8 @@ function cw_show(e) {
|
||||||
$(e).parent().parent().find('.cw_hide').toggleClass('cw')
|
$(e).parent().parent().find('.cw_hide').toggleClass('cw')
|
||||||
$(e).parent().find('.cw_long').toggleClass('hide')
|
$(e).parent().find('.cw_long').toggleClass('hide')
|
||||||
}
|
}
|
||||||
$(function() {
|
$(function () {
|
||||||
$('#cw-text').on('change', function(event) {
|
$('#cw-text').on('change', function (event) {
|
||||||
var acct_id = $('#post-acct-sel').val()
|
var acct_id = $('#post-acct-sel').val()
|
||||||
var domain = localStorage.getItem('domain_' + acct_id)
|
var domain = localStorage.getItem('domain_' + acct_id)
|
||||||
var cwlen = $('#cw-text').val().length
|
var cwlen = $('#cw-text').val().length
|
||||||
|
@ -126,3 +126,79 @@ function schedule() {
|
||||||
$('#sch-box').addClass('sch-avail')
|
$('#sch-box').addClass('sch-avail')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//下書き機能
|
||||||
|
function draftToggle() {
|
||||||
|
if ($('#draft').hasClass('hide')) {
|
||||||
|
$('#draft').removeClass('hide')
|
||||||
|
$('#right-side').show()
|
||||||
|
$('#right-side').css('width', '300px')
|
||||||
|
$('#left-side').css('width', 'calc(100% - 300px)')
|
||||||
|
var width = localStorage.getItem('postbox-width')
|
||||||
|
if (width) {
|
||||||
|
width = width.replace('px', '') * 1 + 300
|
||||||
|
} else {
|
||||||
|
width = 600
|
||||||
|
}
|
||||||
|
$('#post-box').css('width', width + 'px')
|
||||||
|
$('#suggest').html('')
|
||||||
|
$('#draft').html('')
|
||||||
|
draftDraw()
|
||||||
|
} else {
|
||||||
|
$('#poll').addClass('hide')
|
||||||
|
$('#draft').addClass('hide')
|
||||||
|
$('#right-side').hide()
|
||||||
|
$('#right-side').css('width', '300px')
|
||||||
|
$('#emoji').addClass('hide')
|
||||||
|
$('#suggest').html('')
|
||||||
|
$('#draft').html('')
|
||||||
|
$('#left-side').css('width', '100%')
|
||||||
|
var width = localStorage.getItem('postbox-width')
|
||||||
|
if (width) {
|
||||||
|
width = width.replace('px', '') * 1
|
||||||
|
} else {
|
||||||
|
width = 300
|
||||||
|
}
|
||||||
|
$('#post-box').css('width', width + 'px')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function draftDraw() {
|
||||||
|
var draft = localStorage.getItem('draft')
|
||||||
|
var html = `<button class="btn waves-effect green" style="width:100%; padding:0; margin-top:0;" onclick="addToDraft();">${lang.lang_secure_draft}</button>`
|
||||||
|
if (draft) {
|
||||||
|
var draftObj = JSON.parse(draft)
|
||||||
|
for (let i = 0; i < draftObj.length; i++) {
|
||||||
|
var toot = draftObj[i]
|
||||||
|
html = html + `<div class="tootInDraft">
|
||||||
|
<i class="waves-effect gray material-icons" onclick="useThisDraft(${i})" title="${lang.lang_secure_userThis}">reply</i>
|
||||||
|
<i class="waves-effect gray material-icons" onclick="deleteThisDraft(${i})" title="${lang.lang_secure_deleteThis}">cancel</i>
|
||||||
|
${escapeHTML(toot.status).replace(/\n/, '').substr(0, 10)}
|
||||||
|
</div>`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$('#draft').html(html)
|
||||||
|
}
|
||||||
|
function addToDraft() {
|
||||||
|
var json = post(null, null, true)
|
||||||
|
var draft = localStorage.getItem('draft')
|
||||||
|
var draftObj = []
|
||||||
|
if (draft) draftObj = JSON.parse(draft)
|
||||||
|
draftObj.push(json)
|
||||||
|
draft = JSON.stringify(draftObj)
|
||||||
|
localStorage.setItem('draft', draft)
|
||||||
|
draftDraw()
|
||||||
|
}
|
||||||
|
function useThisDraft(i) {
|
||||||
|
var draft = localStorage.getItem('draft')
|
||||||
|
var draftObj = JSON.parse(draft)
|
||||||
|
draftToPost(draftObj[i], draftObj[i]['TheDeskAcctId'], 0)
|
||||||
|
draftToggle()
|
||||||
|
}
|
||||||
|
function deleteThisDraft(i) {
|
||||||
|
var draft = localStorage.getItem('draft')
|
||||||
|
var draftObj = JSON.parse(draft)
|
||||||
|
draftObj.splice(i, 1)
|
||||||
|
draft = JSON.stringify(draftObj)
|
||||||
|
localStorage.setItem('draft', draft)
|
||||||
|
draftDraw()
|
||||||
|
}
|
|
@ -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) {
|
||||||
|
@ -131,7 +131,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) {
|
||||||
|
@ -160,7 +160,7 @@ function bkm(id, acct_id, tlid) {
|
||||||
|
|
||||||
//フォロー
|
//フォロー
|
||||||
async function follow(acct_id, resolve) {
|
async function follow(acct_id, resolve) {
|
||||||
if($('#his-data').hasClass('locked')) {
|
if ($('#his-data').hasClass('locked')) {
|
||||||
locked = true
|
locked = true
|
||||||
} else {
|
} else {
|
||||||
locked = false
|
locked = false
|
||||||
|
@ -178,7 +178,7 @@ async function follow(acct_id, resolve) {
|
||||||
var flag = 'follow'
|
var flag = 'follow'
|
||||||
var flagm = 'create'
|
var flagm = 'create'
|
||||||
}
|
}
|
||||||
|
|
||||||
var id = $('#his-data').attr('user-id')
|
var id = $('#his-data').attr('user-id')
|
||||||
if (resolve == 'selector') {
|
if (resolve == 'selector') {
|
||||||
var fullacct = $('#his-acct').attr('fullname')
|
var fullacct = $('#his-acct').attr('fullname')
|
||||||
|
@ -200,7 +200,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) {
|
||||||
|
@ -212,7 +212,7 @@ async function follow(acct_id, resolve) {
|
||||||
$('#his-follow-btn-text').text(lang.lang_status_follow)
|
$('#his-follow-btn-text').text(lang.lang_status_follow)
|
||||||
} else {
|
} else {
|
||||||
$('#his-data').addClass('following')
|
$('#his-data').addClass('following')
|
||||||
if(locked) {
|
if (locked) {
|
||||||
$('#his-follow-btn-text').text(lang.lang_status_requesting)
|
$('#his-follow-btn-text').text(lang.lang_status_requesting)
|
||||||
} else {
|
} else {
|
||||||
$('#his-follow-btn-text').text(lang.lang_status_unfollow)
|
$('#his-follow-btn-text').text(lang.lang_status_unfollow)
|
||||||
|
@ -278,7 +278,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)
|
||||||
|
@ -338,7 +338,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)
|
||||||
|
@ -378,7 +378,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)
|
||||||
|
@ -420,69 +420,73 @@ 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 (httpreq.readyState === 4) {
|
||||||
if (this.status !== 200) {
|
if (this.status !== 200) {
|
||||||
setLog(start, this.status, this.response)
|
setLog(start, this.status, this.response)
|
||||||
}
|
}
|
||||||
var json = httpreq.response
|
var json = httpreq.response
|
||||||
$('#post-acct-sel').prop('disabled', true)
|
draftToPost(json, acct_id, id)
|
||||||
$('#post-acct-sel').val(acct_id)
|
|
||||||
$('select').formSelect()
|
|
||||||
mdCheck()
|
|
||||||
var medias = $('[toot-id=' + id + ']').attr('data-medias')
|
|
||||||
var 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;">'
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var vismode = $('[toot-id=' + id + '] .vis-data').attr('data-vis')
|
|
||||||
vis(vismode)
|
|
||||||
var medias = media_ids.join(',');
|
|
||||||
$('#media').val(medias)
|
|
||||||
localStorage.setItem('nohide', true)
|
|
||||||
show()
|
|
||||||
if (json.text) {
|
|
||||||
var html = json.text
|
|
||||||
} else {
|
|
||||||
var html = $('[toot-id=' + id + '] .toot').html()
|
|
||||||
html = html.replace(/^<p>(.+)<\/p>$/, '$1')
|
|
||||||
html = html.replace(/<br\s?\/?>/, '\n')
|
|
||||||
html = html.replace(/<p>/, '\n')
|
|
||||||
html = html.replace(/<\/p>/, '\n')
|
|
||||||
html = html.replace(/<img[\s\S]*alt="(.+?)"[\s\S]*?>/g, '$1')
|
|
||||||
html = $.strip_tags(html)
|
|
||||||
}
|
|
||||||
$('#textarea').val(html)
|
|
||||||
if (json.spoiler_text) {
|
|
||||||
cw()
|
|
||||||
$('#cw-text').val(json.spoiler_text)
|
|
||||||
}
|
|
||||||
if (json.sensitive) {
|
|
||||||
$('#nsfw').addClass('yellow-text')
|
|
||||||
$('#nsfw').html('visibility')
|
|
||||||
$('#nsfw').addClass('nsfw-avail')
|
|
||||||
}
|
|
||||||
if (json.in_reply_to_id) {
|
|
||||||
$('#reply').val(json.in_reply_to_id)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
function draftToPost(json, acct_id, id) {
|
||||||
|
$('#post-acct-sel').prop('disabled', true)
|
||||||
|
$('#post-acct-sel').val(acct_id)
|
||||||
|
$('select').formSelect()
|
||||||
|
mdCheck()
|
||||||
|
var medias = $('[toot-id=' + id + ']').attr('data-medias')
|
||||||
|
mediack = null
|
||||||
|
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;">'
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var vismode = json.visibility
|
||||||
|
vis(vismode)
|
||||||
|
var medias = media_ids.join(',')
|
||||||
|
$('#media').val(medias)
|
||||||
|
localStorage.setItem('nohide', true)
|
||||||
|
show()
|
||||||
|
if (json.text) {
|
||||||
|
var html = json.text
|
||||||
|
} else {
|
||||||
|
var html = json.status
|
||||||
|
html = html.replace(/^<p>(.+)<\/p>$/, '$1')
|
||||||
|
html = html.replace(/<br\s?\/?>/, '\n')
|
||||||
|
html = html.replace(/<p>/, '\n')
|
||||||
|
html = html.replace(/<\/p>/, '\n')
|
||||||
|
html = html.replace(/<img[\s\S]*alt="(.+?)"[\s\S]*?>/g, '$1')
|
||||||
|
html = $.strip_tags(html)
|
||||||
|
}
|
||||||
|
$('#textarea').val(html)
|
||||||
|
if (json.spoiler_text) {
|
||||||
|
cw()
|
||||||
|
$('#cw-text').val(json.spoiler_text)
|
||||||
|
}
|
||||||
|
if (json.sensitive) {
|
||||||
|
$('#nsfw').addClass('yellow-text')
|
||||||
|
$('#nsfw').html('visibility')
|
||||||
|
$('#nsfw').addClass('nsfw-avail')
|
||||||
|
}
|
||||||
|
if (json.in_reply_to_id) {
|
||||||
|
$('#reply').val(json.in_reply_to_id)
|
||||||
|
}
|
||||||
|
}
|
||||||
//ピン留め
|
//ピン留め
|
||||||
function pin(id, acct_id) {
|
function pin(id, acct_id) {
|
||||||
if ($(`.cvo[unique-id=${id}]`).hasClass('pined')) {
|
if ($(`.cvo[unique-id=${id}]`).hasClass('pined')) {
|
||||||
|
@ -499,7 +503,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) {
|
||||||
|
@ -530,7 +534,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) {
|
||||||
|
@ -556,7 +560,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) {
|
||||||
|
@ -583,7 +587,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
|
||||||
|
@ -615,7 +619,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) {
|
||||||
|
@ -651,20 +655,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
|
||||||
|
|
|
@ -18,7 +18,7 @@ input.addEventListener(
|
||||||
var new_val = input.value
|
var new_val = input.value
|
||||||
if (new_val == '') {
|
if (new_val == '') {
|
||||||
$('#suggest').html('')
|
$('#suggest').html('')
|
||||||
if ($('#poll').hasClass('hide') && $('#emoji').hasClass('hide')) {
|
if ($('#poll').hasClass('hide') && $('#emoji').hasClass('hide') && $('#draft').hasClass('hide')) {
|
||||||
$('#right-side').hide()
|
$('#right-side').hide()
|
||||||
$('#right-side').css('width', '300px')
|
$('#right-side').css('width', '300px')
|
||||||
$('#left-side').css('width', '100%')
|
$('#left-side').css('width', '100%')
|
||||||
|
@ -41,7 +41,7 @@ input.addEventListener(
|
||||||
var q = acct[1]
|
var q = acct[1]
|
||||||
} else {
|
} else {
|
||||||
$('#suggest').html('')
|
$('#suggest').html('')
|
||||||
if ($('#poll').hasClass('hide') && $('#emoji').hasClass('hide')) {
|
if ($('#poll').hasClass('hide') && $('#emoji').hasClass('hide') && $('#draft').hasClass('hide')) {
|
||||||
$('#right-side').hide()
|
$('#right-side').hide()
|
||||||
$('#right-side').css('width', '300px')
|
$('#right-side').css('width', '300px')
|
||||||
$('#left-side').css('width', '100%')
|
$('#left-side').css('width', '100%')
|
||||||
|
@ -138,6 +138,7 @@ input.addEventListener(
|
||||||
$('#post-box').css('width', width + 'px')
|
$('#post-box').css('width', width + 'px')
|
||||||
$('#poll').addClass('hide')
|
$('#poll').addClass('hide')
|
||||||
$('#emoji').addClass('hide')
|
$('#emoji').addClass('hide')
|
||||||
|
$('#draft').addClass('hide')
|
||||||
}
|
}
|
||||||
} else if (json.accounts[0] && acct[1]) {
|
} else if (json.accounts[0] && acct[1]) {
|
||||||
var accts = ''
|
var accts = ''
|
||||||
|
@ -165,8 +166,9 @@ input.addEventListener(
|
||||||
$('#suggest').html(accts)
|
$('#suggest').html(accts)
|
||||||
$('#poll').addClass('hide')
|
$('#poll').addClass('hide')
|
||||||
$('#emoji').addClass('hide')
|
$('#emoji').addClass('hide')
|
||||||
|
$('#draft').addClass('hide')
|
||||||
} else {
|
} else {
|
||||||
if ($('#poll').hasClass('hide') && $('#emoji').hasClass('hide')) {
|
if ($('#poll').hasClass('hide') && $('#emoji').hasClass('hide') && $('#draft').hasClass('hide')) {
|
||||||
$('#right-side').hide()
|
$('#right-side').hide()
|
||||||
$('#right-side').css('width', '300px')
|
$('#right-side').css('width', '300px')
|
||||||
$('#left-side').css('width', '100%')
|
$('#left-side').css('width', '100%')
|
||||||
|
@ -226,7 +228,7 @@ function tagInsert(code, del) {
|
||||||
}
|
}
|
||||||
sentence = before + word + after
|
sentence = before + word + after
|
||||||
textarea.value = sentence
|
textarea.value = sentence
|
||||||
if ($('#poll').hasClass('hide') && $('#emoji').hasClass('hide')) {
|
if ($('#poll').hasClass('hide') && $('#emoji').hasClass('hide') && $('#draft').hasClass('hide')) {
|
||||||
$('#right-side').hide()
|
$('#right-side').hide()
|
||||||
$('#right-side').css('width', '300px')
|
$('#right-side').css('width', '300px')
|
||||||
$('#left-side').css('width', '50%')
|
$('#left-side').css('width', '50%')
|
||||||
|
|
|
@ -25,6 +25,7 @@ function pollToggle() {
|
||||||
}
|
}
|
||||||
$('#post-box').css('width', width + 'px')
|
$('#post-box').css('width', width + 'px')
|
||||||
$('#emoji').addClass('hide')
|
$('#emoji').addClass('hide')
|
||||||
|
$('#draft').addClass('hide')
|
||||||
$('#poll').addClass('hide')
|
$('#poll').addClass('hide')
|
||||||
$('#pollsta').text(lang.lang_no)
|
$('#pollsta').text(lang.lang_no)
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,6 +278,9 @@
|
||||||
<li>
|
<li>
|
||||||
<a onclick="pollToggle();">@@poll@@</a>
|
<a onclick="pollToggle();">@@poll@@</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a onclick="draftToggle();">@@draft@@</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<!--hidden area-->
|
<!--hidden area-->
|
||||||
<input type="hidden" id="reply" />
|
<input type="hidden" id="reply" />
|
||||||
|
@ -297,6 +300,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div id="right-side">
|
<div id="right-side">
|
||||||
<div id="suggest" class="right-side-content"></div>
|
<div id="suggest" class="right-side-content"></div>
|
||||||
|
<div id="draft" class="hide right-side-content"></div>
|
||||||
<!--絵文字ピッカー-->
|
<!--絵文字ピッカー-->
|
||||||
<div id="emoji" class="hide right-side-content">
|
<div id="emoji" class="hide right-side-content">
|
||||||
<span class="gray sml">@@emojiWarn@@
|
<span class="gray sml">@@emojiWarn@@
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
"thingsEmoji":"Emojis of tools",
|
"thingsEmoji":"Emojis of tools",
|
||||||
"symbolEmoji":"Emojis of symbols",
|
"symbolEmoji":"Emojis of symbols",
|
||||||
"flagsEmoji":"Emojis of flags",
|
"flagsEmoji":"Emojis of flags",
|
||||||
|
"draft": "Draft",
|
||||||
"poll":"Poll",
|
"poll":"Poll",
|
||||||
"pollDdisabled":"Polls: Disabled",
|
"pollDdisabled":"Polls: Disabled",
|
||||||
"pollProvider":"Provider of Poll",
|
"pollProvider":"Provider of Poll",
|
||||||
|
|
|
@ -87,6 +87,9 @@
|
||||||
"lang_status_endorse": "Feature on profile",
|
"lang_status_endorse": "Feature on profile",
|
||||||
"lang_status_followers": "Followers",
|
"lang_status_followers": "Followers",
|
||||||
"lang_status_active": "Last status",
|
"lang_status_active": "Last status",
|
||||||
|
"lang_secure_draft": "Add to draft",
|
||||||
|
"lang_secure_useThis": "Use this",
|
||||||
|
"lang_secure_deleteThis": "Delete this",
|
||||||
"lang_suggest_nodata": "Please get emojis list in order to show suggestion.",
|
"lang_suggest_nodata": "Please get emojis list in order to show suggestion.",
|
||||||
"lang_usetxtbox_reply": "Reply Mode. Ctrl+Shift+C to clear.",
|
"lang_usetxtbox_reply": "Reply Mode. Ctrl+Shift+C to clear.",
|
||||||
"lang_cards_check": " check",
|
"lang_cards_check": " check",
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
"thingsEmoji":"もの",
|
"thingsEmoji":"もの",
|
||||||
"symbolEmoji":"記号",
|
"symbolEmoji":"記号",
|
||||||
"flagsEmoji":"国旗",
|
"flagsEmoji":"国旗",
|
||||||
|
"draft": "下書き(タンス)",
|
||||||
"poll":"アンケート",
|
"poll":"アンケート",
|
||||||
"pollDdisabled":"アンケート付けへん",
|
"pollDdisabled":"アンケート付けへん",
|
||||||
"pollProvider":"アンケートのプロバイダ",
|
"pollProvider":"アンケートのプロバイダ",
|
||||||
|
|
|
@ -86,6 +86,9 @@
|
||||||
"lang_status_endorse": "プロフで紹介する",
|
"lang_status_endorse": "プロフで紹介する",
|
||||||
"lang_status_followers": "フォロワー",
|
"lang_status_followers": "フォロワー",
|
||||||
"lang_status_active": "最新トゥート",
|
"lang_status_active": "最新トゥート",
|
||||||
|
"lang_secure_draft": "タンスになおす",
|
||||||
|
"lang_secure_useThis": "使う",
|
||||||
|
"lang_secure_deleteThis": "ほかす",
|
||||||
"lang_suggest_nodata": "サジェストしたいんやけど、絵文字リストを取得してくれへん?",
|
"lang_suggest_nodata": "サジェストしたいんやけど、絵文字リストを取得してくれへん?",
|
||||||
"lang_usetxtbox_reply": "返信モードや。やめるときはCtrl+Shift+Cな。",
|
"lang_usetxtbox_reply": "返信モードや。やめるときはCtrl+Shift+Cな。",
|
||||||
"lang_cards_check": "チェック",
|
"lang_cards_check": "チェック",
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
"thingsEmoji":"もの",
|
"thingsEmoji":"もの",
|
||||||
"symbolEmoji":"記号",
|
"symbolEmoji":"記号",
|
||||||
"flagsEmoji":"国旗",
|
"flagsEmoji":"国旗",
|
||||||
|
"draft": "下書き",
|
||||||
"poll":"アンケート",
|
"poll":"アンケート",
|
||||||
"pollDdisabled":"アンケートを使用しない",
|
"pollDdisabled":"アンケートを使用しない",
|
||||||
"pollProvider":"アンケートのプロバイダ",
|
"pollProvider":"アンケートのプロバイダ",
|
||||||
|
|
|
@ -88,6 +88,9 @@
|
||||||
"lang_status_endorse": "プロフで紹介する",
|
"lang_status_endorse": "プロフで紹介する",
|
||||||
"lang_status_followers": "フォロワー",
|
"lang_status_followers": "フォロワー",
|
||||||
"lang_status_active": "最新トゥート",
|
"lang_status_active": "最新トゥート",
|
||||||
|
"lang_secure_draft": "下書きに追加",
|
||||||
|
"lang_secure_useThis": "使う",
|
||||||
|
"lang_secure_deleteThis": "削除",
|
||||||
"lang_suggest_nodata": "サジェストのために絵文字リストを取得してください。",
|
"lang_suggest_nodata": "サジェストのために絵文字リストを取得してください。",
|
||||||
"lang_usetxtbox_reply": "返信モードです。クリアするときはCtrl+Shift+Cを押してください。",
|
"lang_usetxtbox_reply": "返信モードです。クリアするときはCtrl+Shift+Cを押してください。",
|
||||||
"lang_cards_check": "チェック",
|
"lang_cards_check": "チェック",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user