thedesk/app/js/post/use-txtbox.js

82 lines
2.2 KiB
JavaScript
Raw Permalink Normal View History

2018-04-07 14:31:09 +10:00
/*リプライ*/
2019-05-19 17:39:30 +10:00
function re(id, ats_cm, acct_id, mode) {
2019-11-09 00:52:54 +11:00
clear()
var ats = ats_cm.split(',')
localStorage.setItem('nohide', true)
show()
$('#reply').val(id)
2019-05-19 17:39:30 +10:00
for (var i = 0; i < ats.length; i++) {
2019-11-09 00:52:54 +11:00
var at = ats[i]
var te = $('#textarea').val()
if (at != localStorage.getItem('user_' + acct_id)) {
$('#textarea').val('@' + at + ' ' + te)
2019-03-21 15:39:30 +11:00
}
2019-03-13 02:51:07 +11:00
}
2019-11-09 00:52:54 +11:00
$('#rec').text(lang.lang_yesno)
$('#post-acct-sel').val(acct_id)
$('#post-acct-sel').prop('disabled', true)
2020-07-05 20:45:21 +10:00
//$('select').formSelect()
mdCheck()
2019-11-09 00:52:54 +11:00
$('#textarea').attr('placeholder', lang.lang_usetxtbox_reply)
$('#textarea').focus()
var profimg = localStorage.getItem('prof_' + acct_id)
2019-05-19 17:39:30 +10:00
if (!profimg) {
2019-11-09 00:52:54 +11:00
profimg = '../../img/missing.svg'
2018-08-21 04:26:14 +10:00
}
2019-11-09 00:52:54 +11:00
$('#acct-sel-prof').attr('src', profimg)
vis(mode)
2018-04-07 14:31:09 +10:00
}
2019-05-19 17:39:30 +10:00
function reEx(id) {
2019-11-09 00:52:54 +11:00
$('#tootmodal').modal('close')
var at = $('#tootmodal').attr('data-user')
var acct_id = $('#status-acct-sel').val()
var mode = $('#tootmodal .vis-data').attr('data-vis')
re(id, at, acct_id, mode)
2018-04-07 14:31:09 +10:00
}
//引用
2019-05-19 17:39:30 +10:00
function qt(id, acct_id, at, url) {
2019-11-09 00:52:54 +11:00
localStorage.setItem('nohide', true)
var qt = localStorage.getItem('quote')
2019-05-19 17:39:30 +10:00
if (!qt) {
2019-11-09 00:52:54 +11:00
var qt = 'simple'
2018-04-07 14:31:09 +10:00
}
2019-11-09 00:52:54 +11:00
if (qt == 'nothing') {
return false
2019-03-13 02:51:07 +11:00
}
2019-11-09 00:52:54 +11:00
if (qt == 'simple') {
show()
$('#textarea').val('\n' + url)
} else if (qt == 'mention') {
show()
$('#textarea').val('\n' + url + ' From:@' + at)
} else if (qt == 'full') {
show()
var html = $('[toot-id=' + id + '] .toot').html()
html = html.match(/^<p>(.+)<\/p>$/)[1]
html = html.replace(/<br\s?\/?>/, '\n')
html = html.replace(/<p>/, '\n')
html = html.replace(/<\/p>/, '\n')
html = $.strip_tags(html)
$('#textarea').val('\n' + '@' + at + ' ' + html + '\n' + url)
} else if (qt == 'apiQuote') {
clear()
localStorage.setItem('nohide', true)
show()
$('#quote').val(id)
$('#post-acct-sel').val(acct_id)
$('#post-acct-sel').prop('disabled', true)
2020-07-05 20:45:21 +10:00
//$('select').formSelect()
2019-11-09 00:52:54 +11:00
$('#textarea').attr('placeholder', lang.lang_usetxtbox_reply)
$('#textarea').focus()
var profimg = localStorage.getItem('prof_' + acct_id)
2019-09-08 02:33:01 +10:00
if (!profimg) {
2019-11-09 00:52:54 +11:00
profimg = '../../img/missing.svg'
2019-09-08 02:33:01 +10:00
}
2019-11-09 00:52:54 +11:00
$('#acct-sel-prof').attr('src', profimg)
2018-04-07 14:31:09 +10:00
}
2019-11-09 00:52:54 +11:00
$('#post-acct-sel').val(acct_id)
2020-07-05 20:45:21 +10:00
//$('select').formSelect()
mdCheck()
2019-11-09 00:52:54 +11:00
$('#textarea').focus()
}