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

54 lines
1.5 KiB
JavaScript
Raw Normal View History

2018-04-07 14:31:09 +10:00
/*リプライ*/
function re(id,at,acct_id,mode){
2018-07-28 07:25:12 +10:00
localStorage.setItem("nohide",true);
2018-04-07 14:31:09 +10:00
show();
$("#reply").val(id);
var te=$("#textarea").val();
$("#textarea").val("@"+at+" "+te);
2018-07-30 21:03:49 +10:00
$("#rec").text(lang_yesno[lang]);
2018-04-07 14:31:09 +10:00
$("#post-acct-sel").val(acct_id);
2018-05-10 02:01:06 +10:00
$("#post-acct-sel").prop("disabled", true);
2018-04-07 14:31:09 +10:00
$('select').material_select();
2018-07-29 17:37:54 +10:00
$("#textarea").attr("placeholder",lang_usetxtbox_reply[lang]);
2018-04-07 14:31:09 +10:00
$("#textarea").focus();
2018-08-21 04:26:14 +10:00
var profimg=localStorage.getItem("prof_"+acct_id);
if(!profimg){
profimg="./img/missing.svg";
}
$("#acct-sel-prof").attr("src",profimg);
2018-04-07 14:31:09 +10:00
vis(mode);
}
function reEx(id){
$('#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);
}
//引用
function qt(id,acct_id,at,url){
2018-07-28 07:25:12 +10:00
localStorage.setItem("nohide",true);
2018-04-07 14:31:09 +10:00
var qt = localStorage.getItem("quote");
if(!qt){
var qt="simple";
}
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);
}
$("#textarea").focus();
$("#post-acct-sel").val(acct_id);
$('select').material_select();
}