More prettier
This commit is contained in:
@@ -1,67 +1,67 @@
|
||||
//BBCodeとMarkdownの入力・パーサー
|
||||
//アカウント変えた時にBBとかMDとか
|
||||
function mdCheck(){
|
||||
function mdCheck() {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var profimg=localStorage.getItem("prof_"+acct_id);
|
||||
if(!profimg){
|
||||
profimg="../../img/missing.svg";
|
||||
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)+"("+localStorage.getItem("domain_"+acct_id)+")");
|
||||
}else{
|
||||
$("#toot-post-btn").text(lang.lang_toot+"("+localStorage.getItem("domain_"+acct_id)+")");
|
||||
}
|
||||
if(!localStorage.getItem("bb_"+acct_id) && !localStorage.getItem("md_"+acct_id)){
|
||||
$(".markdown").addClass("hide");
|
||||
$("#acct-sel-prof").attr("src", profimg);
|
||||
if (localStorage.getItem("post_" + acct_id)) {
|
||||
$("#toot-post-btn").text(localStorage.getItem("post_" + acct_id) + "(" + localStorage.getItem("domain_" + acct_id) + ")");
|
||||
} else {
|
||||
$("#toot-post-btn").text(lang.lang_toot + "(" + localStorage.getItem("domain_" + acct_id) + ")");
|
||||
}
|
||||
if (!localStorage.getItem("bb_" + acct_id) && !localStorage.getItem("md_" + acct_id)) {
|
||||
$(".markdown").addClass("hide");
|
||||
$(".anti-markdown").addClass("hide");
|
||||
}else{
|
||||
} else {
|
||||
$(".anti-markdown").removeClass("hide");
|
||||
}
|
||||
if($(".markdown").hasClass("hide")){
|
||||
localStorage.setItem("md","hide");
|
||||
}else{
|
||||
}
|
||||
if ($(".markdown").hasClass("hide")) {
|
||||
localStorage.setItem("md", "hide");
|
||||
} else {
|
||||
localStorage.removeItem("md");
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
if(domain=="itabashi.0j0.jp"){
|
||||
if (domain == "itabashi.0j0.jp") {
|
||||
$("#limited-button").removeClass("hide");
|
||||
}else{
|
||||
} else {
|
||||
$("#limited-button").addClass("hide");
|
||||
}
|
||||
if(domain=="kirishima.cloud"){
|
||||
if (domain == "kirishima.cloud") {
|
||||
$("#faicon-btn").show();
|
||||
}else{
|
||||
} else {
|
||||
$("#faicon-btn").hide();
|
||||
}
|
||||
if(domain=="imastodon.net"){
|
||||
if (domain == "imastodon.net") {
|
||||
trendTag();
|
||||
}else{
|
||||
} else {
|
||||
$("#trendtag").html("");
|
||||
}
|
||||
if(localStorage.getItem("mode_" + domain)=="misskey"){
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
Materialize.toast(lang.lang_bbmd_misskey, 5000);
|
||||
}
|
||||
if(idata[domain+"_letters"]){
|
||||
$("#textarea").attr("data-length", idata[domain+"_letters"])
|
||||
}else{
|
||||
if (idata[domain + "_letters"]) {
|
||||
$("#textarea").attr("data-length", idata[domain + "_letters"])
|
||||
} else {
|
||||
$("#textarea").attr("data-length", 500)
|
||||
}
|
||||
if(idata[domain+"_glitch"]==="true"){
|
||||
if (idata[domain + "_glitch"] === "true") {
|
||||
$("#local-button").removeClass("hide");
|
||||
}else{
|
||||
} else {
|
||||
$("#local-button").addClass("hide");
|
||||
}
|
||||
var multi = localStorage.getItem("multi");
|
||||
if (multi) {
|
||||
var obj = JSON.parse(multi);
|
||||
if(obj[acct_id].background && obj[acct_id].background!="def" && obj[acct_id].text && obj[acct_id].text!="def"){
|
||||
if (obj[acct_id].background && obj[acct_id].background != "def" && obj[acct_id].text && obj[acct_id].text != "def") {
|
||||
$("#toot-post-btn").removeClass("indigo");
|
||||
$("#toot-post-btn").css("background-color","#"+obj[acct_id].background);
|
||||
$("#toot-post-btn").css("color",obj[acct_id].text);
|
||||
}else{
|
||||
$("#toot-post-btn").css("background-color","");
|
||||
$("#toot-post-btn").css("color","");
|
||||
$("#toot-post-btn").css("background-color", "#" + obj[acct_id].background);
|
||||
$("#toot-post-btn").css("color", obj[acct_id].text);
|
||||
} else {
|
||||
$("#toot-post-btn").css("background-color", "");
|
||||
$("#toot-post-btn").css("color", "");
|
||||
$("#toot-post-btn").addClass("indigo");
|
||||
|
||||
}
|
||||
@@ -69,248 +69,248 @@ function mdCheck(){
|
||||
loadVis();
|
||||
}
|
||||
//BOXのトグルボタン
|
||||
function mdToggle(){
|
||||
function mdToggle() {
|
||||
$(".markdown").toggleClass("hide");
|
||||
$(".anti-markdown").toggleClass("hide");
|
||||
if($(".markdown").hasClass("hide")){
|
||||
localStorage.setItem("md","hide");
|
||||
}else{
|
||||
if ($(".markdown").hasClass("hide")) {
|
||||
localStorage.setItem("md", "hide");
|
||||
} else {
|
||||
localStorage.removeItem("md");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//最初に読み込みます(MD対応インスタンスかチェック)
|
||||
if(localStorage.getItem("md")=="hide"){
|
||||
if (localStorage.getItem("md") == "hide") {
|
||||
$(".markdown").addClass("hide");
|
||||
$(".anti-markdown").removeClass("hide");
|
||||
}
|
||||
//タグを選んだ時に(BB版)
|
||||
function tagsel(tag){
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
if(!localStorage.getItem("bb_"+acct_id)){
|
||||
return false;
|
||||
}
|
||||
if(tag=="large" || tag=="size" || tag=="color" || tag=="colorhex"){
|
||||
var sub=$("#"+tag).val();
|
||||
var sub = sub.replace( /#/g , "" ) ;
|
||||
surroundHTML(tag+"="+sub,tag);
|
||||
}else if(tag=="flip=vertical" || tag=="flip=horizontal"){
|
||||
surroundHTML(tag,"flip");
|
||||
}else{
|
||||
surroundHTML(tag,tag);
|
||||
}
|
||||
$("#textarea").focus();
|
||||
}
|
||||
//HTMLをエスケープしてXSSを防ぐ
|
||||
function escape_html (string) {
|
||||
if(typeof string !== 'string') {
|
||||
return string;
|
||||
}
|
||||
return string.replace(/[&'`"<>]/g, function(match) {
|
||||
return {
|
||||
'&': '&',
|
||||
"'": ''',
|
||||
'`': '`',
|
||||
'"': '"',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
}[match]
|
||||
});
|
||||
function tagsel(tag) {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
if (!localStorage.getItem("bb_" + acct_id)) {
|
||||
return false;
|
||||
}
|
||||
if (tag == "large" || tag == "size" || tag == "color" || tag == "colorhex") {
|
||||
var sub = $("#" + tag).val();
|
||||
var sub = sub.replace(/#/g, "");
|
||||
surroundHTML(tag + "=" + sub, tag);
|
||||
} else if (tag == "flip=vertical" || tag == "flip=horizontal") {
|
||||
surroundHTML(tag, "flip");
|
||||
} else {
|
||||
surroundHTML(tag, tag);
|
||||
}
|
||||
$("#textarea").focus();
|
||||
}
|
||||
//HTMLをエスケープしてXSSを防ぐ
|
||||
function escape_html(string) {
|
||||
if (typeof string !== 'string') {
|
||||
return string;
|
||||
}
|
||||
return string.replace(/[&'`"<>]/g, function (match) {
|
||||
return {
|
||||
'&': '&',
|
||||
"'": ''',
|
||||
'`': '`',
|
||||
'"': '"',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
}[match]
|
||||
});
|
||||
}
|
||||
//テキストボックスで選択したやつをタグで囲む(BB版)
|
||||
function surroundHTML(tagS,tagE) {
|
||||
function surroundHTML(tagS, tagE) {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
if(!localStorage.getItem("bb_"+acct_id)){
|
||||
return false;
|
||||
}
|
||||
var target = document.getElementById("textarea");
|
||||
var pos = getAreaRange(target);
|
||||
|
||||
var val = target.value;
|
||||
var range = val.slice(pos.start, pos.end);
|
||||
var beforeNode = val.slice(0, pos.start);
|
||||
var afterNode = val.slice(pos.end);
|
||||
var insertNode;
|
||||
if (range || pos.start != pos.end) {
|
||||
insertNode = '[' + tagS + ']' + range + '[/' + tagE + ']';
|
||||
target.value = beforeNode + insertNode + afterNode;
|
||||
}
|
||||
|
||||
else if (pos.start == pos.end) {
|
||||
insertNode = '[' + tagS + ']' + '[/' + tagE + ']';
|
||||
target.value = beforeNode + insertNode + afterNode;
|
||||
}
|
||||
}
|
||||
function markdown(tag,ck,br,space){
|
||||
if(space=="before"){
|
||||
tagE=tag;
|
||||
tag=" "+tag;
|
||||
}else{
|
||||
tagE=tag;
|
||||
}
|
||||
surroundMD(tag,tagE,ck,br);
|
||||
$("#textarea").focus();
|
||||
}
|
||||
function surroundMD(tagS,tagE,ck,br) {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
if(!localStorage.getItem("md_"+acct_id)){
|
||||
return false;
|
||||
}
|
||||
var target = document.getElementById("textarea");
|
||||
var pos = getAreaRange(target);
|
||||
|
||||
var val = target.value;
|
||||
var range = val.slice(pos.start, pos.end);
|
||||
var beforeNode = val.slice(0, pos.start);
|
||||
var afterNode = val.slice(pos.end);
|
||||
var insertNode;
|
||||
if(br=="yes"){
|
||||
var br="\n";
|
||||
}else{
|
||||
var br="";
|
||||
if (!localStorage.getItem("bb_" + acct_id)) {
|
||||
return false;
|
||||
}
|
||||
var target = document.getElementById("textarea");
|
||||
var pos = getAreaRange(target);
|
||||
|
||||
var val = target.value;
|
||||
var range = val.slice(pos.start, pos.end);
|
||||
var beforeNode = val.slice(0, pos.start);
|
||||
var afterNode = val.slice(pos.end);
|
||||
var insertNode;
|
||||
if (range || pos.start != pos.end) {
|
||||
insertNode = '[' + tagS + ']' + range + '[/' + tagE + ']';
|
||||
target.value = beforeNode + insertNode + afterNode;
|
||||
}
|
||||
|
||||
else if (pos.start == pos.end) {
|
||||
insertNode = '[' + tagS + ']' + '[/' + tagE + ']';
|
||||
target.value = beforeNode + insertNode + afterNode;
|
||||
}
|
||||
}
|
||||
function markdown(tag, ck, br, space) {
|
||||
if (space == "before") {
|
||||
tagE = tag;
|
||||
tag = " " + tag;
|
||||
} else {
|
||||
tagE = tag;
|
||||
}
|
||||
surroundMD(tag, tagE, ck, br);
|
||||
$("#textarea").focus();
|
||||
}
|
||||
function surroundMD(tagS, tagE, ck, br) {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
if (!localStorage.getItem("md_" + acct_id)) {
|
||||
return false;
|
||||
}
|
||||
var target = document.getElementById("textarea");
|
||||
var pos = getAreaRange(target);
|
||||
|
||||
var val = target.value;
|
||||
var range = val.slice(pos.start, pos.end);
|
||||
var beforeNode = val.slice(0, pos.start);
|
||||
var afterNode = val.slice(pos.end);
|
||||
var insertNode;
|
||||
if (br == "yes") {
|
||||
var br = "\n";
|
||||
} else {
|
||||
var br = "";
|
||||
}
|
||||
|
||||
if ((range || pos.start != pos.end) && ck == "yes") {
|
||||
insertNode = tagS + range + tagE;
|
||||
target.value = beforeNode + insertNode + br + afterNode;
|
||||
}
|
||||
|
||||
else if (pos.start == pos.end || ck == "no") {
|
||||
insertNode = tagS + range;
|
||||
target.value = beforeNode + insertNode + br + afterNode;
|
||||
}
|
||||
|
||||
if ((range || pos.start != pos.end )&& ck=="yes") {
|
||||
insertNode = tagS + range + tagE ;
|
||||
target.value = beforeNode + insertNode + br + afterNode;
|
||||
}
|
||||
|
||||
else if (pos.start == pos.end || ck=="no") {
|
||||
insertNode = tagS + range;
|
||||
target.value = beforeNode + insertNode + br + afterNode;
|
||||
}
|
||||
}
|
||||
|
||||
//テキストボックスの前後チェック
|
||||
function getAreaRange(obj) {
|
||||
var pos = new Object();
|
||||
if(window.getSelection()) {
|
||||
if (window.getSelection()) {
|
||||
pos.start = obj.selectionStart;
|
||||
pos.end = obj.selectionEnd;
|
||||
pos.end = obj.selectionEnd;
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
//Markdownのリンク挿入
|
||||
function markdownLink(){
|
||||
function markdownLink() {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
if(!localStorage.getItem("md_"+acct_id)){
|
||||
return false;
|
||||
}
|
||||
var linkIns="["+$("#linkt").val()+"]"+"("+$("#link2").val()+")";
|
||||
if(linkIns!="[]()"){
|
||||
$("#textarea").val($("#textarea").val()+linkIns);
|
||||
$("#linkt").val("");
|
||||
$("#link2").val("");
|
||||
$("#textarea").focus();
|
||||
if (!localStorage.getItem("md_" + acct_id)) {
|
||||
return false;
|
||||
}
|
||||
var linkIns = "[" + $("#linkt").val() + "]" + "(" + $("#link2").val() + ")";
|
||||
if (linkIns != "[]()") {
|
||||
$("#textarea").val($("#textarea").val() + linkIns);
|
||||
$("#linkt").val("");
|
||||
$("#link2").val("");
|
||||
$("#textarea").focus();
|
||||
}
|
||||
}
|
||||
//Markdownのimg挿入
|
||||
function markdownImage(){
|
||||
function markdownImage() {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
if(!localStorage.getItem("md_"+acct_id)){
|
||||
return false;
|
||||
}
|
||||
var imgIns="!["+$("#image").val()+"]"+"("+$("#image2").val()+")";
|
||||
if(imgIns!="![]()"){
|
||||
$("#textarea").val($("#textarea").val()+imgIns);
|
||||
$("#image").val("");
|
||||
$("#image2").val("");
|
||||
$("#textarea").focus();
|
||||
if (!localStorage.getItem("md_" + acct_id)) {
|
||||
return false;
|
||||
}
|
||||
var imgIns = "![" + $("#image").val() + "]" + "(" + $("#image2").val() + ")";
|
||||
if (imgIns != "![]()") {
|
||||
$("#textarea").val($("#textarea").val() + imgIns);
|
||||
$("#image").val("");
|
||||
$("#image2").val("");
|
||||
$("#textarea").focus();
|
||||
}
|
||||
}
|
||||
//文字数をチェック(hタグ用)
|
||||
function str_count(all, part) {
|
||||
return (all.match(new RegExp(part, "g")) || []).length;
|
||||
return (all.match(new RegExp(part, "g")) || []).length;
|
||||
}
|
||||
|
||||
//プレビュー
|
||||
function preview(){
|
||||
$("#preview-field").show();
|
||||
$("#toot-field").hide();
|
||||
$("#preview-btn").hide();
|
||||
var bb=escape_html($("#textarea").val());
|
||||
function preview() {
|
||||
$("#preview-field").show();
|
||||
$("#toot-field").hide();
|
||||
$("#preview-btn").hide();
|
||||
var bb = escape_html($("#textarea").val());
|
||||
//quote
|
||||
var bb=bb.replace(/>(.+)$/g,'<blockquote>$1<\/blockquote>');
|
||||
var bb = bb.replace(/>(.+)$/g, '<blockquote>$1<\/blockquote>');
|
||||
//spin
|
||||
var bb=bb.replace(/\[spin\](.+)\[\/spin\]/g,'<span class="fa fa-spin">$1<\/span>');
|
||||
var bb = bb.replace(/\[spin\](.+)\[\/spin\]/g, '<span class="fa fa-spin">$1<\/span>');
|
||||
//pulse
|
||||
var bb=bb.replace(/\[pulse\](.+)\[\/pulse\]/g,'<span class="bbcode-pulse-loading">$1<\/span>');
|
||||
var bb = bb.replace(/\[pulse\](.+)\[\/pulse\]/g, '<span class="bbcode-pulse-loading">$1<\/span>');
|
||||
//large
|
||||
var bb=bb.replace(/\[large=([0-9]{1,2})x\](.+)\[\/large\]/g,'<span class="fa fa-$1x">$2<\/span>');
|
||||
var bb = bb.replace(/\[large=([0-9]{1,2})x\](.+)\[\/large\]/g, '<span class="fa fa-$1x">$2<\/span>');
|
||||
//vertical
|
||||
var bb=bb.replace(/\[flip=vertical\](.+)\[\/flip\]/g,'<span class="fa fa-flip-vertical">$1<\/span>');
|
||||
var bb = bb.replace(/\[flip=vertical\](.+)\[\/flip\]/g, '<span class="fa fa-flip-vertical">$1<\/span>');
|
||||
//horizontal
|
||||
var bb=bb.replace(/\[flip=horizontal\](.+)\[\/flip\]/g,'<span class="fa fa-flip-horizontal">$1<\/span>');
|
||||
var bb = bb.replace(/\[flip=horizontal\](.+)\[\/flip\]/g, '<span class="fa fa-flip-horizontal">$1<\/span>');
|
||||
//b
|
||||
var bb=bb.replace(/\[b\](.+)\[\/b\]/g,'<b>$1<\/b>');
|
||||
var bb = bb.replace(/\[b\](.+)\[\/b\]/g, '<b>$1<\/b>');
|
||||
//i
|
||||
var bb=bb.replace(/\[i\](.+)\[\/i\]/g,'<i>$1<\/i>');
|
||||
var bb = bb.replace(/\[i\](.+)\[\/i\]/g, '<i>$1<\/i>');
|
||||
//u
|
||||
var bb=bb.replace(/\[u\](.+)\[\/u\]/g,'<u>$1<\/u>');
|
||||
var bb = bb.replace(/\[u\](.+)\[\/u\]/g, '<u>$1<\/u>');
|
||||
//s
|
||||
var bb=bb.replace(/\[s\](.+)\[\/s\]/g,'<s>$1<\/s>');
|
||||
var bb = bb.replace(/\[s\](.+)\[\/s\]/g, '<s>$1<\/s>');
|
||||
//size
|
||||
var bb=bb.replace(/\[size=([0-9]{1,2})\](.+)\[\/size\]/g,'<span style="font-size:$1px">$2<\/span>');
|
||||
var bb = bb.replace(/\[size=([0-9]{1,2})\](.+)\[\/size\]/g, '<span style="font-size:$1px">$2<\/span>');
|
||||
//colorhex
|
||||
var bb=bb.replace(/\[colorhex=([A-Fa-f0-9]+)\](.+)\[\/colorhex\]/g,'<span style="color:#$1">$2<\/span>');
|
||||
var bb = bb.replace(/\[colorhex=([A-Fa-f0-9]+)\](.+)\[\/colorhex\]/g, '<span style="color:#$1">$2<\/span>');
|
||||
//code
|
||||
var bb=bb.replace(/`(.+)`/g,'<code>$1<\/code>');
|
||||
var bb = bb.replace(/`(.+)`/g, '<code>$1<\/code>');
|
||||
//head
|
||||
var m;
|
||||
m=bb.match(/^#{1,6}(.+)$/gm);
|
||||
if(m){
|
||||
for(let i = 0; i < m.length; i++) {
|
||||
var t=m[i].match(/^#{1,6}(.+)$/);
|
||||
var indexct='<h'+str_count(m[i],"#")+'>'+t[1]+'</h'+str_count(m[i],"#")+'>';
|
||||
var bb=bb.replace(new RegExp(m[i], ""),indexct);
|
||||
}
|
||||
m = bb.match(/^#{1,6}(.+)$/gm);
|
||||
if (m) {
|
||||
for (let i = 0; i < m.length; i++) {
|
||||
var t = m[i].match(/^#{1,6}(.+)$/);
|
||||
var indexct = '<h' + str_count(m[i], "#") + '>' + t[1] + '</h' + str_count(m[i], "#") + '>';
|
||||
var bb = bb.replace(new RegExp(m[i], ""), indexct);
|
||||
}
|
||||
}
|
||||
//list(ul)
|
||||
var li;
|
||||
li=bb.match(/^\- (.+)$/gm);
|
||||
if(li){
|
||||
for(let l = 0; l < li.length; l++) {
|
||||
var u=li[l].match(/^\- (.+)$/);
|
||||
var listUl='<li>'+u[1]+'</li>';
|
||||
if(l == 0){
|
||||
listUl='<ul>'+listUl;
|
||||
li = bb.match(/^\- (.+)$/gm);
|
||||
if (li) {
|
||||
for (let l = 0; l < li.length; l++) {
|
||||
var u = li[l].match(/^\- (.+)$/);
|
||||
var listUl = '<li>' + u[1] + '</li>';
|
||||
if (l == 0) {
|
||||
listUl = '<ul>' + listUl;
|
||||
}
|
||||
if (l == li.length - 1) {
|
||||
listUl = listUl + '</ul>';
|
||||
}
|
||||
var bb = bb.replace(new RegExp(li[l], ""), listUl);
|
||||
}
|
||||
if(l==li.length-1){
|
||||
listUl=listUl+'</ul>';
|
||||
}
|
||||
var bb=bb.replace(new RegExp(li[l], ""),listUl);
|
||||
}
|
||||
}
|
||||
//list(ol)
|
||||
var li;
|
||||
li=bb.match(/^1\. (.+)$/gm);
|
||||
if(li){
|
||||
for(let l = 0; l < li.length; l++) {
|
||||
var u=li[l].match(/^1\. (.+)$/);
|
||||
var listUl='<li>'+u[1]+'</li>';
|
||||
if(l === 0){
|
||||
listUl='<ol>'+listUl;
|
||||
li = bb.match(/^1\. (.+)$/gm);
|
||||
if (li) {
|
||||
for (let l = 0; l < li.length; l++) {
|
||||
var u = li[l].match(/^1\. (.+)$/);
|
||||
var listUl = '<li>' + u[1] + '</li>';
|
||||
if (l === 0) {
|
||||
listUl = '<ol>' + listUl;
|
||||
}
|
||||
if (l === li.length - 1) {
|
||||
listUl = listUl + '</ol>';
|
||||
}
|
||||
var bb = bb.replace(new RegExp(li[l], ""), listUl);
|
||||
}
|
||||
if(l===li.length-1){
|
||||
listUl=listUl+'</ol>';
|
||||
}
|
||||
var bb=bb.replace(new RegExp(li[l], ""),listUl);
|
||||
}
|
||||
}
|
||||
//img
|
||||
var bb=bb.replace(/!\[(.+)\]\((https:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)\)/g,'<img src="$2" text="$1" style="width:100%">');
|
||||
var bb = bb.replace(/!\[(.+)\]\((https:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)\)/g, '<img src="$2" text="$1" style="width:100%">');
|
||||
//link
|
||||
var bb=bb.replace(/\[(.+)\]\((https?:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)\)/g,'<a href="$2" target="_blank">$1<\/a>');
|
||||
bb=nl2br(bb);
|
||||
bb=bb.replace(new RegExp("</li><br />", "g"),"");
|
||||
var bb = bb.replace(/\[(.+)\]\((https?:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)\)/g, '<a href="$2" target="_blank">$1<\/a>');
|
||||
bb = nl2br(bb);
|
||||
bb = bb.replace(new RegExp("</li><br />", "g"), "");
|
||||
$("#md-preview").html(bb);
|
||||
}
|
||||
//Editで戻る
|
||||
function previewEdit(){
|
||||
$("#preview-field").hide();
|
||||
$("#toot-field").show();
|
||||
$("#preview-btn").show();
|
||||
$("#md-preview").html("");
|
||||
}
|
||||
}
|
||||
//Editで戻る
|
||||
function previewEdit() {
|
||||
$("#preview-field").hide();
|
||||
$("#toot-field").show();
|
||||
$("#preview-btn").show();
|
||||
$("#md-preview").html("");
|
||||
}
|
@@ -2,26 +2,26 @@
|
||||
var obj = $("body");
|
||||
var system;
|
||||
//ドラッグスタート
|
||||
obj.on('dragstart', function(e) {
|
||||
obj.on('dragstart', function (e) {
|
||||
system = "locked"
|
||||
});
|
||||
//何もなくファイルが通過
|
||||
obj.on('dragend', function(e) {
|
||||
obj.on('dragend', function (e) {
|
||||
system = "";
|
||||
});
|
||||
//ドラッグファイルが画面上に
|
||||
obj.on('dragenter', function(e) {
|
||||
obj.on('dragenter', function (e) {
|
||||
if (system != "locked") {
|
||||
$("#drag").css('display', 'flex');
|
||||
}
|
||||
|
||||
});
|
||||
$("body").on('dragover', function(e) {
|
||||
$("body").on('dragover', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
//ドロップした
|
||||
$("body").on('drop', function(e) {
|
||||
$("body").on('drop', function (e) {
|
||||
if (system != "locked") {
|
||||
$("#drag").css('display', 'none');
|
||||
e.preventDefault();
|
||||
@@ -30,7 +30,7 @@ $("body").on('drop', function(e) {
|
||||
}
|
||||
});
|
||||
//何もなくファイルが通過
|
||||
$("#drag").on('dragleave', function(e) {
|
||||
$("#drag").on('dragleave', function (e) {
|
||||
$("#drag").css('display', 'none');
|
||||
});
|
||||
|
||||
@@ -38,23 +38,23 @@ $("#drag").on('dragleave', function(e) {
|
||||
function pimg(files) {
|
||||
console.table(files);
|
||||
for (i = 0; i < files.length; i++) {
|
||||
var dot=files[i].path.match(/\.(.+)$/)[1];
|
||||
if(dot=="bmp" || dot=="BMP"){
|
||||
var dot = files[i].path.match(/\.(.+)$/)[1];
|
||||
if (dot == "bmp" || dot == "BMP") {
|
||||
var electron = require("electron");
|
||||
var ipc = electron.ipcRenderer;
|
||||
ipc.send('bmp-image', [files[i].path,i]);
|
||||
todo(lang.lang_progress);
|
||||
|
||||
}else{
|
||||
handleFileUpload(files[i], obj,i);
|
||||
var ipc = electron.ipcRenderer;
|
||||
ipc.send('bmp-image', [files[i].path, i]);
|
||||
todo(lang.lang_progress);
|
||||
|
||||
} else {
|
||||
handleFileUpload(files[i], obj, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
var electron = require("electron");
|
||||
var ipc = electron.ipcRenderer;
|
||||
ipc.on('bmp-img-comp', function (event, b64) {
|
||||
media(b64[0],"image/png",b64[1]);
|
||||
});
|
||||
media(b64[0], "image/png", b64[1]);
|
||||
});
|
||||
//ドラッグ・アンド・ドロップを終了
|
||||
function closedrop() {
|
||||
$("#drag").css('display', 'none');
|
||||
@@ -67,7 +67,7 @@ function fileselect() {
|
||||
//ファイル読み込み
|
||||
function handleFileUpload(files, obj, no) {
|
||||
var fr = new FileReader();
|
||||
fr.onload = function(evt) {
|
||||
fr.onload = function (evt) {
|
||||
var b64 = evt.target.result;
|
||||
$('#b64-box').val(b64);
|
||||
var ret = media(b64, files["type"], no)
|
||||
@@ -82,26 +82,26 @@ function media(b64, type, no) {
|
||||
var c = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
var cl = c.length;
|
||||
var r = "";
|
||||
for(var i=0; i<l; i++){
|
||||
r += c[Math.floor(Math.random()*cl)];
|
||||
for (var i = 0; i < l; i++) {
|
||||
r += c[Math.floor(Math.random() * cl)];
|
||||
}
|
||||
if ($("#media").val()) {
|
||||
$("#media").val($("#media").val() + ',' + "tmp_"+r);
|
||||
$("#media").val($("#media").val() + ',' + "tmp_" + r);
|
||||
} else {
|
||||
$("#media").val("tmp_"+r);
|
||||
$("#media").val("tmp_" + r);
|
||||
}
|
||||
$(".toot-btn-group").prop("disabled", true);
|
||||
$("#post-acct-sel").prop("disabled", true);
|
||||
localStorage.setItem("image","busy");
|
||||
localStorage.setItem("image", "busy");
|
||||
todo("Image Upload...");
|
||||
var media = toBlob(b64, type);
|
||||
var fd = new FormData();
|
||||
fd.append('file', media);
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var httpreq = new XMLHttpRequest();
|
||||
if(localStorage.getItem("mode_" + domain)=="misskey"){
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var start = "https://" + domain + "/api/drive/files/create";
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.upload.addEventListener("progress", progshow, false);
|
||||
@@ -111,12 +111,12 @@ function media(b64, type, no) {
|
||||
} else {
|
||||
var nsfw = false;
|
||||
}
|
||||
var previewer="url"
|
||||
var previewer = "url"
|
||||
fd.append('i', at);
|
||||
//fd.append('isSensitive', nsfw);
|
||||
httpreq.send(fd);
|
||||
}else{
|
||||
var previewer="preview_url"
|
||||
} else {
|
||||
var previewer = "preview_url"
|
||||
var start = "https://" + domain + "/api/v1/media";
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.upload.addEventListener("progress", progshow, false);
|
||||
@@ -124,12 +124,12 @@ function media(b64, type, no) {
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreq.send(fd);
|
||||
}
|
||||
httpreq.onreadystatechange = function() {
|
||||
httpreq.onreadystatechange = function () {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
var img = localStorage.getItem("img");
|
||||
if (json.type.indexOf("image")!=-1) {
|
||||
var html = '<img src="' + json[previewer] + '" class="preview-img pointer" data-media="'+json["id"]+'" onclick="deleteImage(\''+json["id"]+'\')" title="'+lang.lang_postimg_delete+'">';
|
||||
if (json.type.indexOf("image") != -1) {
|
||||
var html = '<img src="' + json[previewer] + '" class="preview-img pointer" data-media="' + json["id"] + '" onclick="deleteImage(\'' + json["id"] + '\')" title="' + lang.lang_postimg_delete + '">';
|
||||
$('#preview').append(html);
|
||||
} else {
|
||||
$('#preview').append(lang.lang_postimg_previewdis);
|
||||
@@ -138,11 +138,11 @@ function media(b64, type, no) {
|
||||
var img = "no-act";
|
||||
}
|
||||
if (img != "inline") {
|
||||
var mediav=$("#media").val();
|
||||
var regExp = new RegExp("tmp_"+r, "g");
|
||||
var mediav = $("#media").val();
|
||||
var regExp = new RegExp("tmp_" + r, "g");
|
||||
mediav = mediav.replace(regExp, json["id"]);
|
||||
$("#media").val(mediav);
|
||||
|
||||
|
||||
}
|
||||
if (img == "url") {
|
||||
$("#textarea").val($("#textarea").val() + " " + json["text_url"])
|
||||
@@ -178,59 +178,59 @@ function toBlob(base64, type) {
|
||||
return blob;
|
||||
}
|
||||
//画像を貼り付けたら…
|
||||
var element = document.querySelector("#textarea");
|
||||
element.addEventListener("paste", function(e){
|
||||
if (!e.clipboardData || !e.clipboardData.items) {
|
||||
return true;
|
||||
}
|
||||
// DataTransferItemList に画像が含まれいない場合は終了する
|
||||
var element = document.querySelector("#textarea");
|
||||
element.addEventListener("paste", function (e) {
|
||||
if (!e.clipboardData || !e.clipboardData.items) {
|
||||
return true;
|
||||
}
|
||||
// DataTransferItemList に画像が含まれいない場合は終了する
|
||||
var imageItems = [...e.clipboardData.items].filter(i => i.type.startsWith('image'));
|
||||
if (imageItems.length == 0) {
|
||||
if (imageItems.length == 0) {
|
||||
console.warn("it is not image")
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ファイルとして得る
|
||||
// DataTransferItem の kind は file なので getAsString ではなく getAsFile を呼ぶ
|
||||
var imageFile = imageItems[0].getAsFile();
|
||||
var imageType = imageItems[0].type;
|
||||
// ファイルとして得る
|
||||
// DataTransferItem の kind は file なので getAsString ではなく getAsFile を呼ぶ
|
||||
var imageFile = imageItems[0].getAsFile();
|
||||
var imageType = imageItems[0].type;
|
||||
|
||||
// FileReaderで読み込む
|
||||
var fr = new FileReader();
|
||||
fr.onload = function(e) {
|
||||
// onload内ではe.target.resultにbase64が入っているのであとは煮るなり焼くなり
|
||||
// FileReaderで読み込む
|
||||
var fr = new FileReader();
|
||||
fr.onload = function (e) {
|
||||
// onload内ではe.target.resultにbase64が入っているのであとは煮るなり焼くなり
|
||||
var base64 = e.target.result;
|
||||
var mediav = $("#media").val();
|
||||
if(mediav){
|
||||
var i=mediav.split(",").length;
|
||||
if (mediav) {
|
||||
var i = mediav.split(",").length;
|
||||
}
|
||||
// DataTransferItem の type に mime tipes があるのでそれを使う
|
||||
// DataTransferItem の type に mime tipes があるのでそれを使う
|
||||
media(base64, imageType, i)
|
||||
};
|
||||
fr.readAsDataURL(imageFile);
|
||||
};
|
||||
fr.readAsDataURL(imageFile);
|
||||
|
||||
// 画像以外がペーストされたときのために、元に戻しておく
|
||||
// 画像以外がペーストされたときのために、元に戻しておく
|
||||
});
|
||||
//Adobeフォトエディタ
|
||||
function adobe(){
|
||||
function adobe() {
|
||||
var agree = localStorage.getItem("adobeagree");
|
||||
ipc.send('adobe', agree);
|
||||
}
|
||||
ipc.on('adobeagree', function (event, arg) {
|
||||
localStorage.setItem("adobeagree",arg);
|
||||
});
|
||||
function deleteImage(key){
|
||||
if(!confirm(lang.lang_postimg_delete)){
|
||||
localStorage.setItem("adobeagree", arg);
|
||||
});
|
||||
function deleteImage(key) {
|
||||
if (!confirm(lang.lang_postimg_delete)) {
|
||||
return false;
|
||||
}
|
||||
var media = $("#media").val();
|
||||
var arr=media.split(",");
|
||||
for(var i=0;i<media.length;i++){
|
||||
if(arr[i]==key){
|
||||
arr.splice(i, 1);
|
||||
break;
|
||||
var arr = media.split(",");
|
||||
for (var i = 0; i < media.length; i++) {
|
||||
if (arr[i] == key) {
|
||||
arr.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$("#media").val(arr.join(","));
|
||||
$('#preview [data-media='+key+']').remove();
|
||||
$('#preview [data-media=' + key + ']').remove();
|
||||
}
|
@@ -1,241 +1,241 @@
|
||||
//Renpost
|
||||
function renote(id, acct_id, remote) {
|
||||
if ($("#pub_" + id).hasClass("rted")) {
|
||||
return false;
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/notes/create";
|
||||
if(localStorage.getItem("mode_" + domain)!="misskey"){
|
||||
if ($("#pub_" + id).hasClass("rted")) {
|
||||
return false;
|
||||
}
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/notes/create";
|
||||
if (localStorage.getItem("mode_" + domain) != "misskey") {
|
||||
return false;
|
||||
}
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send(JSON.stringify({i:at,renoteId:id}));
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
httpreq.send(JSON.stringify({ i: at, renoteId: id }));
|
||||
httpreq.onreadystatechange = function () {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(["Success: renote",json]);
|
||||
console.log(["Success: renote", json]);
|
||||
$("[toot-id=" + id + "]").addClass("rted");
|
||||
$(".rt_"+id).toggleClass("teal-text");
|
||||
}
|
||||
}
|
||||
$(".rt_" + id).toggleClass("teal-text");
|
||||
}
|
||||
}
|
||||
}
|
||||
//Renote
|
||||
function renoteqt(id, acct_id) {
|
||||
localStorage.setItem("nohide",true);
|
||||
show();
|
||||
$("#reply").val("renote_"+id);
|
||||
$("#rec").text("Renote");
|
||||
$("#post-acct-sel").val(acct_id);
|
||||
$("#post-acct-sel").prop("disabled", true);
|
||||
$('select').material_select();
|
||||
$("#textarea").attr("placeholder",lang.lang_misskeyparse_qt);
|
||||
$("#textarea").focus();
|
||||
localStorage.setItem("nohide", true);
|
||||
show();
|
||||
$("#reply").val("renote_" + id);
|
||||
$("#rec").text("Renote");
|
||||
$("#post-acct-sel").val(acct_id);
|
||||
$("#post-acct-sel").prop("disabled", true);
|
||||
$('select').material_select();
|
||||
$("#textarea").attr("placeholder", lang.lang_misskeyparse_qt);
|
||||
$("#textarea").focus();
|
||||
}
|
||||
//Reply
|
||||
function misskeyreply(id, acct_id) {
|
||||
localStorage.setItem("nohide",true);
|
||||
show();
|
||||
$("#reply").val(id);
|
||||
$("#rec").text("Renote");
|
||||
$("#post-acct-sel").val(acct_id);
|
||||
$("#post-acct-sel").prop("disabled", true);
|
||||
$('select').material_select();
|
||||
$("#textarea").attr("placeholder",lang.lang_misskeyparse_qt);
|
||||
$("#textarea").focus();
|
||||
localStorage.setItem("nohide", true);
|
||||
show();
|
||||
$("#reply").val(id);
|
||||
$("#rec").text("Renote");
|
||||
$("#post-acct-sel").val(acct_id);
|
||||
$("#post-acct-sel").prop("disabled", true);
|
||||
$('select').material_select();
|
||||
$("#textarea").attr("placeholder", lang.lang_misskeyparse_qt);
|
||||
$("#textarea").focus();
|
||||
}
|
||||
//Reaction
|
||||
function reactiontoggle(id,acct_id,tlid){
|
||||
function reactiontoggle(id, acct_id, tlid) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/notes/show";
|
||||
if(localStorage.getItem("mode_" + domain)!="misskey"){
|
||||
if (localStorage.getItem("mode_" + domain) != "misskey") {
|
||||
return false;
|
||||
}
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send(JSON.stringify({i:at,noteId:id}));
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
httpreq.send(JSON.stringify({ i: at, noteId: id }));
|
||||
httpreq.onreadystatechange = function () {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(["Success: reaction",json]);
|
||||
if(json.reactions){
|
||||
var reactions=["like","love","laugh","hmm","surprise","congrats","angry","confused","pudding","rip"];
|
||||
for(var i=0;i<reactions.length;i++){
|
||||
if(json.reactions[reactions[i]]){
|
||||
$("#pub_" + id +" .re-"+reactions[i]+"ct").text(json.reactions[reactions[i]])
|
||||
$("#pub_" + id +" .re-"+reactions[i]).removeClass("hide")
|
||||
}else{
|
||||
$("#pub_" + id +" .re-"+reactions[i]+"ct").text(0)
|
||||
if($("#pub_" + id +" .reactions").hasClass("fullreact")){
|
||||
$("#pub_" + id +" .re-"+reactions[i]).addClass("hide")
|
||||
}else{
|
||||
$("#pub_" + id +" .re-"+reactions[i]).removeClass("hide")
|
||||
console.log(["Success: reaction", json]);
|
||||
if (json.reactions) {
|
||||
var reactions = ["like", "love", "laugh", "hmm", "surprise", "congrats", "angry", "confused", "pudding", "rip"];
|
||||
for (var i = 0; i < reactions.length; i++) {
|
||||
if (json.reactions[reactions[i]]) {
|
||||
$("#pub_" + id + " .re-" + reactions[i] + "ct").text(json.reactions[reactions[i]])
|
||||
$("#pub_" + id + " .re-" + reactions[i]).removeClass("hide")
|
||||
} else {
|
||||
$("#pub_" + id + " .re-" + reactions[i] + "ct").text(0)
|
||||
if ($("#pub_" + id + " .reactions").hasClass("fullreact")) {
|
||||
$("#pub_" + id + " .re-" + reactions[i]).addClass("hide")
|
||||
} else {
|
||||
$("#pub_" + id + " .re-" + reactions[i]).removeClass("hide")
|
||||
}
|
||||
$("#pub_" + id +" .re-"+reactions[i]+"ct").text(json.reactions[reactions[i]])
|
||||
$("#pub_" + id + " .re-" + reactions[i] + "ct").text(json.reactions[reactions[i]])
|
||||
}
|
||||
}
|
||||
$("#pub_" + id +" .reactions").removeClass("hide");
|
||||
$("#pub_" + id +" .reactions").toggleClass("fullreact")
|
||||
}else{
|
||||
if($("#pub_" + id +" .reactions").hasClass("fullreact")){
|
||||
$("#pub_" + id +" .reactions").addClass("hide")
|
||||
$("#pub_" + id +" .reactions").removeClass("fullreact")
|
||||
}else{
|
||||
$("#pub_" + id +" .reactions").removeClass("hide");
|
||||
$("#pub_" + id +" .reaction").removeClass("hide");
|
||||
$("#pub_" + id +" .reactions").addClass("fullreact");
|
||||
$("#pub_" + id + " .reactions").removeClass("hide");
|
||||
$("#pub_" + id + " .reactions").toggleClass("fullreact")
|
||||
} else {
|
||||
if ($("#pub_" + id + " .reactions").hasClass("fullreact")) {
|
||||
$("#pub_" + id + " .reactions").addClass("hide")
|
||||
$("#pub_" + id + " .reactions").removeClass("fullreact")
|
||||
} else {
|
||||
$("#pub_" + id + " .reactions").removeClass("hide");
|
||||
$("#pub_" + id + " .reaction").removeClass("hide");
|
||||
$("#pub_" + id + " .reactions").addClass("fullreact");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#pub_" + id +" .freeReact").toggleClass("hide");
|
||||
$("#pub_" + id + " .freeReact").toggleClass("hide");
|
||||
}
|
||||
//reactioncustom
|
||||
function reactioncustom(acct_id,id){
|
||||
function reactioncustom(acct_id, id) {
|
||||
$("#reply").val(id);
|
||||
$("#unreact").hide();
|
||||
$("#addreact").removeClass("hide");
|
||||
$("#post-acct-sel").val(acct_id);
|
||||
$('select').material_select();
|
||||
localStorage.setItem("nohide",true);
|
||||
$("#post-acct-sel").val(acct_id);
|
||||
$('select').material_select();
|
||||
localStorage.setItem("nohide", true);
|
||||
show()
|
||||
emojiToggle(true)
|
||||
$("#left-side").hide();
|
||||
$("#default-emoji").hide();
|
||||
}
|
||||
function reactRefresh(acct_id,id){
|
||||
function reactRefresh(acct_id, id) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/notes/show";
|
||||
|
||||
var req={};
|
||||
req.i=at;
|
||||
req.noteId=id;
|
||||
var i={
|
||||
|
||||
var req = {};
|
||||
req.i = at;
|
||||
req.noteId = id;
|
||||
var i = {
|
||||
method: "POST",
|
||||
body: JSON.stringify(req),
|
||||
}
|
||||
fetch(start, i,
|
||||
).then(function(response) {
|
||||
).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
if(!json){
|
||||
}).then(function (json) {
|
||||
if (!json) {
|
||||
return false;
|
||||
}
|
||||
var poll="";
|
||||
if(json.error){
|
||||
var poll = "";
|
||||
if (json.error) {
|
||||
$("[toot-id=" + id + "]").hide();
|
||||
$("[toot-id=" + id + "]").remove();
|
||||
}else{
|
||||
$("[toot-id=" + id + "]").remove();
|
||||
} else {
|
||||
reactRefreshCore(json)
|
||||
}
|
||||
});
|
||||
}
|
||||
function reactRefreshCore(json){
|
||||
var id=json.id;
|
||||
if(json.reactions){
|
||||
$("#pub_" + id +" .reactions").removeClass("hide")
|
||||
var regExp = new RegExp( ":", "g" ) ;
|
||||
Object.keys(json.reactions).forEach(function(keye) {
|
||||
keyeClass=keye.replace(regExp,'');
|
||||
if(json.reactions[keye]){
|
||||
$("#pub_" + id +" .re-"+keyeClass+"ct").text(json.reactions[keye])
|
||||
$("#pub_" + id +" .re-"+keyeClass).removeClass("hide")
|
||||
}else{
|
||||
$("#pub_" + id +" .re-"+keyeClass+"ct").text(0)
|
||||
if($("#pub_" + id +" .reactions").hasClass("fullreact")){
|
||||
$("#pub_" + id +" .re-"+keyeClass).addClass("hide")
|
||||
function reactRefreshCore(json) {
|
||||
var id = json.id;
|
||||
if (json.reactions) {
|
||||
$("#pub_" + id + " .reactions").removeClass("hide")
|
||||
var regExp = new RegExp(":", "g");
|
||||
Object.keys(json.reactions).forEach(function (keye) {
|
||||
keyeClass = keye.replace(regExp, '');
|
||||
if (json.reactions[keye]) {
|
||||
$("#pub_" + id + " .re-" + keyeClass + "ct").text(json.reactions[keye])
|
||||
$("#pub_" + id + " .re-" + keyeClass).removeClass("hide")
|
||||
} else {
|
||||
$("#pub_" + id + " .re-" + keyeClass + "ct").text(0)
|
||||
if ($("#pub_" + id + " .reactions").hasClass("fullreact")) {
|
||||
$("#pub_" + id + " .re-" + keyeClass).addClass("hide")
|
||||
}
|
||||
$("#pub_" + id +" .re-"+keyeClass+"ct").text(json.reactions[keye])
|
||||
$("#pub_" + id + " .re-" + keyeClass + "ct").text(json.reactions[keye])
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function emojiReaction(emoji){
|
||||
function emojiReaction(emoji) {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var id = $("#reply").val();
|
||||
reaction(emoji,id,acct_id,null)
|
||||
reaction(emoji, id, acct_id, null)
|
||||
clear();
|
||||
hide();
|
||||
}
|
||||
function reaction(mode,id,acct_id,tlid){
|
||||
function reaction(mode, id, acct_id, tlid) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
if($(".fav_"+id).hasClass("yellow-text")){
|
||||
var flag="delete";
|
||||
}else{
|
||||
var flag="create";
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if ($(".fav_" + id).hasClass("yellow-text")) {
|
||||
var flag = "delete";
|
||||
} else {
|
||||
var flag = "create";
|
||||
}
|
||||
var start = "https://" + domain + "/api/notes/reactions/"+flag;
|
||||
if(localStorage.getItem("mode_" + domain)!="misskey"){
|
||||
var start = "https://" + domain + "/api/notes/reactions/" + flag;
|
||||
if (localStorage.getItem("mode_" + domain) != "misskey") {
|
||||
return false;
|
||||
}
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send(JSON.stringify({i:at,noteId:id,reaction:mode}));
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
$(".fav_"+id).toggleClass("yellow-text");
|
||||
}
|
||||
}
|
||||
httpreq.send(JSON.stringify({ i: at, noteId: id, reaction: mode }));
|
||||
httpreq.onreadystatechange = function () {
|
||||
if (httpreq.readyState === 4) {
|
||||
$(".fav_" + id).toggleClass("yellow-text");
|
||||
}
|
||||
}
|
||||
}
|
||||
//Vote
|
||||
function vote(acct_id,id,to){
|
||||
function vote(acct_id, id, to) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/notes/polls/vote";
|
||||
if(localStorage.getItem("mode_" + domain)!="misskey"){
|
||||
if (localStorage.getItem("mode_" + domain) != "misskey") {
|
||||
return false;
|
||||
}
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send(JSON.stringify({i:at,noteId:id,choice:to}));
|
||||
httpreq.onreadystatechange = function() {
|
||||
voterefresh(acct_id,id)
|
||||
}
|
||||
httpreq.send(JSON.stringify({ i: at, noteId: id, choice: to }));
|
||||
httpreq.onreadystatechange = function () {
|
||||
voterefresh(acct_id, id)
|
||||
}
|
||||
}
|
||||
function voterefresh(acct_id,id){
|
||||
function voterefresh(acct_id, id) {
|
||||
var httpreqd = new XMLHttpRequest();
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/notes/show";
|
||||
httpreqd.open('POST', start, true);
|
||||
httpreqd.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreqd.open('POST', start, true);
|
||||
httpreqd.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreqd.responseType = 'json';
|
||||
httpreqd.send(JSON.stringify({i:at,noteId:id}));
|
||||
httpreqd.onreadystatechange = function() {
|
||||
if (httpreqd.readyState == 4) {
|
||||
httpreqd.send(JSON.stringify({ i: at, noteId: id }));
|
||||
httpreqd.onreadystatechange = function () {
|
||||
if (httpreqd.readyState == 4) {
|
||||
var json = httpreqd.response;
|
||||
if(!json){
|
||||
if (!json) {
|
||||
return false;
|
||||
}
|
||||
var poll="";
|
||||
if(json.poll){
|
||||
var choices=json.poll.choices;
|
||||
Object.keys(choices).forEach(function(keyc) {
|
||||
var poll = "";
|
||||
if (json.poll) {
|
||||
var choices = json.poll.choices;
|
||||
Object.keys(choices).forEach(function (keyc) {
|
||||
var choice = choices[keyc];
|
||||
if(choice.isVoted){
|
||||
var myvote=twemoji.parse("✅");
|
||||
}else{
|
||||
var myvote="";
|
||||
if (choice.isVoted) {
|
||||
var myvote = twemoji.parse("✅");
|
||||
} else {
|
||||
var myvote = "";
|
||||
}
|
||||
poll=poll+'<div class="pointer vote" onclick="vote(\''+acct_id+'\',\''+json.id+'\','+choice.id+')">'+escapeHTML(choice.text)+'('+choice.votes+''+myvote+')</div>';
|
||||
poll = poll + '<div class="pointer vote" onclick="vote(\'' + acct_id + '\',\'' + json.id + '\',' + choice.id + ')">' + escapeHTML(choice.text) + '(' + choice.votes + '' + myvote + ')</div>';
|
||||
});
|
||||
$(".vote_"+json.id).html(poll)
|
||||
}
|
||||
}
|
||||
}
|
||||
$(".vote_" + json.id).html(poll)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,163 +1,163 @@
|
||||
/*投稿系*/
|
||||
/*投稿系*/
|
||||
//投稿
|
||||
function sec(){
|
||||
var mode=localStorage.getItem("sec");
|
||||
function sec() {
|
||||
var mode = localStorage.getItem("sec");
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
if(~domain.indexOf("kirishima.cloud")>=0 && mode=="local"){
|
||||
mode="unlisted";
|
||||
if (~domain.indexOf("kirishima.cloud") >= 0 && mode == "local") {
|
||||
mode = "unlisted";
|
||||
}
|
||||
post(null,mode);
|
||||
post(null, mode);
|
||||
}
|
||||
function post(mode,postvis) {
|
||||
if($("#toot-post-btn").prop("disabled")){
|
||||
function post(mode, postvis) {
|
||||
if ($("#toot-post-btn").prop("disabled")) {
|
||||
return false;
|
||||
}
|
||||
var str = $("#textarea").val();
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
localStorage.setItem("last-use", acct_id);
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
if(domain=="theboss.tech"){
|
||||
if(~str.indexOf("#")){
|
||||
if(str.indexOf("#theboss_tech")=="-1"){
|
||||
if(!confirm(lang.lang_post_tagTL)){
|
||||
if (domain == "theboss.tech") {
|
||||
if (~str.indexOf("#")) {
|
||||
if (str.indexOf("#theboss_tech") == "-1") {
|
||||
if (!confirm(lang.lang_post_tagTL)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(domain=="dtp-mstdn.jp"){
|
||||
if(~str.indexOf("#")){
|
||||
if(str.indexOf("#dtp")=="-1"){
|
||||
if(!confirm(lang.lang_post_tagTL)){
|
||||
if (domain == "dtp-mstdn.jp") {
|
||||
if (~str.indexOf("#")) {
|
||||
if (str.indexOf("#dtp") == "-1") {
|
||||
if (!confirm(lang.lang_post_tagTL)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!localStorage.getItem("cw_sentence")){
|
||||
var cw_sent=500;
|
||||
}else{
|
||||
var cw_sent=localStorage.getItem("cw_sentence");
|
||||
if (!localStorage.getItem("cw_sentence")) {
|
||||
var cw_sent = 500;
|
||||
} else {
|
||||
var cw_sent = localStorage.getItem("cw_sentence");
|
||||
}
|
||||
if(!localStorage.getItem("cw_letters")){
|
||||
var cw_ltres=500;
|
||||
}else{
|
||||
var cw_ltres=localStorage.getItem("cw_letters");
|
||||
if (!localStorage.getItem("cw_letters")) {
|
||||
var cw_ltres = 500;
|
||||
} else {
|
||||
var cw_ltres = localStorage.getItem("cw_letters");
|
||||
}
|
||||
if(domain!="kirishima.cloud"){
|
||||
if(mode!="pass" && !$("#cw").hasClass("cw-avail") && (str.length>cw_sent || (str.split("\n").length - 1)>cw_ltres)){
|
||||
var electron = require("electron");
|
||||
var remote=electron.remote;
|
||||
var dialog=remote.dialog;
|
||||
var plus=str.replace(/\n/g,"").slice(0,10)+"...";
|
||||
const options = {
|
||||
type: 'info',
|
||||
title: lang.lang_post_cwtitle,
|
||||
message: lang.lang_post_cwtxt+plus,
|
||||
buttons: [lang.lang_post_btn1,lang.lang_post_btn2, lang.lang_post_btn3]
|
||||
}
|
||||
dialog.showMessageBox(options, function(arg) {
|
||||
if(arg===1){
|
||||
$("#cw-text").show();
|
||||
$("#cw").addClass("yellow-text");
|
||||
$("#cw").addClass("cw-avail");
|
||||
$("#cw-text").val(plus);
|
||||
post("pass");
|
||||
}else if(arg===2){
|
||||
post("pass");
|
||||
if (domain != "kirishima.cloud") {
|
||||
if (mode != "pass" && !$("#cw").hasClass("cw-avail") && (str.length > cw_sent || (str.split("\n").length - 1) > cw_ltres)) {
|
||||
var electron = require("electron");
|
||||
var remote = electron.remote;
|
||||
var dialog = remote.dialog;
|
||||
var plus = str.replace(/\n/g, "").slice(0, 10) + "...";
|
||||
const options = {
|
||||
type: 'info',
|
||||
title: lang.lang_post_cwtitle,
|
||||
message: lang.lang_post_cwtxt + plus,
|
||||
buttons: [lang.lang_post_btn1, lang.lang_post_btn2, lang.lang_post_btn3]
|
||||
}
|
||||
})
|
||||
return false;
|
||||
dialog.showMessageBox(options, function (arg) {
|
||||
if (arg === 1) {
|
||||
$("#cw-text").show();
|
||||
$("#cw").addClass("yellow-text");
|
||||
$("#cw").addClass("cw-avail");
|
||||
$("#cw-text").val(plus);
|
||||
post("pass");
|
||||
} else if (arg === 2) {
|
||||
post("pass");
|
||||
}
|
||||
})
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(localStorage.getItem("mode_" + domain)=="misskey"){
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
misskeyPost();
|
||||
return;
|
||||
}
|
||||
$(".toot-btn-group").prop("disabled", true);
|
||||
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";
|
||||
var reply = $("#reply").val();
|
||||
if(str.indexOf(localStorage.getItem("stable"))==-1){
|
||||
str+" #"+localStorage.getItem("stable");
|
||||
if (str.indexOf(localStorage.getItem("stable")) == -1) {
|
||||
str + " #" + localStorage.getItem("stable");
|
||||
}
|
||||
var toot={
|
||||
var toot = {
|
||||
status: str
|
||||
}
|
||||
if(reply){
|
||||
toot.in_reply_to_id=reply
|
||||
if (reply) {
|
||||
toot.in_reply_to_id = reply
|
||||
}
|
||||
var media = $("#media").val();
|
||||
if(media){
|
||||
toot.media_ids=media.split(",");
|
||||
if (media) {
|
||||
toot.media_ids = media.split(",");
|
||||
}
|
||||
if ($("#nsfw").hasClass("nsfw-avail")) {
|
||||
var nsfw = "true";
|
||||
toot.sensitive=nsfw;
|
||||
toot.sensitive = nsfw;
|
||||
} else {
|
||||
var nsfw = "false";
|
||||
}
|
||||
if(postvis){
|
||||
if (postvis) {
|
||||
var vis = postvis;
|
||||
}else{
|
||||
} else {
|
||||
var vis = $("#vis").text();
|
||||
}
|
||||
|
||||
if(vis!="inherit" && vis!="local"){
|
||||
toot.visibility=vis;
|
||||
}else if(vis=="local"){
|
||||
toot.status=str+"👁️";
|
||||
|
||||
if (vis != "inherit" && vis != "local") {
|
||||
toot.visibility = vis;
|
||||
} else if (vis == "local") {
|
||||
toot.status = str + "👁️";
|
||||
}
|
||||
//ここに非公開・未収載タグについてwarn
|
||||
if(domain!="kirishima.cloud" && domain!="imastodon.net"){
|
||||
if(~str.indexOf("#")){
|
||||
if(vis == "local" || vis=="unlisted" || vis=="direct" || vis=="private"){
|
||||
if(!confirm(lang.lang_post_tagVis)){
|
||||
return false;
|
||||
if (domain != "kirishima.cloud" && domain != "imastodon.net") {
|
||||
if (~str.indexOf("#")) {
|
||||
if (vis == "local" || vis == "unlisted" || vis == "direct" || vis == "private") {
|
||||
if (!confirm(lang.lang_post_tagVis)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($("#cw").hasClass("cw-avail")) {
|
||||
var spo = $("#cw-text").val();
|
||||
cw();
|
||||
toot.spoiler_text=spo;
|
||||
toot.spoiler_text = spo;
|
||||
} else {
|
||||
var spo = "";
|
||||
}
|
||||
if ($("#sch-box").hasClass("sch-avail")) {
|
||||
var scheduled=formattimeutc(new Date(Date.parse($("#sch-date").val())))
|
||||
console.log("This toot will be posted at:"+scheduled)
|
||||
var scheduled = formattimeutc(new Date(Date.parse($("#sch-date").val())))
|
||||
console.log("This toot will be posted at:" + scheduled)
|
||||
schedule();
|
||||
toot.scheduled_at=scheduled;
|
||||
toot.scheduled_at = scheduled;
|
||||
} else {
|
||||
var scheduled = "";
|
||||
}
|
||||
if ($("#poll-sel").val()=="mastodon-poll") {
|
||||
var options=[];
|
||||
$(".mastodon-choice").map(function() {
|
||||
var choice=$(this).val();
|
||||
if(choice!=""){
|
||||
if ($("#poll-sel").val() == "mastodon-poll") {
|
||||
var options = [];
|
||||
$(".mastodon-choice").map(function () {
|
||||
var choice = $(this).val();
|
||||
if (choice != "") {
|
||||
options.push(choice);
|
||||
}
|
||||
});
|
||||
if($("#poll-multiple:checked").val()=="1"){
|
||||
var mul=true;
|
||||
}else{
|
||||
var mul=false;
|
||||
if ($("#poll-multiple:checked").val() == "1") {
|
||||
var mul = true;
|
||||
} else {
|
||||
var mul = false;
|
||||
}
|
||||
if($("#poll-until:checked").val()=="1"){
|
||||
var htt=true;
|
||||
}else{
|
||||
var htt=false;
|
||||
if ($("#poll-until:checked").val() == "1") {
|
||||
var htt = true;
|
||||
} else {
|
||||
var htt = false;
|
||||
}
|
||||
var exin=pollCalc();
|
||||
if(!exin){
|
||||
var exin = pollCalc();
|
||||
if (!exin) {
|
||||
todc("Error: Poll expires_in param")
|
||||
}
|
||||
toot.poll={
|
||||
toot.poll = {
|
||||
options: options,
|
||||
expires_in: exin,
|
||||
multiple: mul,
|
||||
@@ -171,7 +171,7 @@ function post(mode,postvis) {
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send(JSON.stringify(toot));
|
||||
httpreq.onreadystatechange = function() {
|
||||
httpreq.onreadystatechange = function () {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
var box = localStorage.getItem("box");
|
||||
@@ -185,71 +185,71 @@ function post(mode,postvis) {
|
||||
}
|
||||
}
|
||||
}
|
||||
function misskeyPost(){
|
||||
function misskeyPost() {
|
||||
var str = $("#textarea").val();
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
localStorage.setItem("last-use", acct_id);
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
$(".toot-btn-group").prop("disabled", true);
|
||||
todo("Posting");
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/notes/create";
|
||||
var reply = $("#reply").val();
|
||||
var toot={
|
||||
var toot = {
|
||||
text: str
|
||||
}
|
||||
if(reply){
|
||||
if(reply.indexOf("renote")!== -1){
|
||||
toot.renoteId=reply.replace("renote_","")
|
||||
}else{
|
||||
toot.replyId=reply
|
||||
if (reply) {
|
||||
if (reply.indexOf("renote") !== -1) {
|
||||
toot.renoteId = reply.replace("renote_", "")
|
||||
} else {
|
||||
toot.replyId = reply
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var media = $("#media").val();
|
||||
if(media){
|
||||
toot.mediaIds=media.split(",");
|
||||
if (media) {
|
||||
toot.mediaIds = media.split(",");
|
||||
}
|
||||
if ($("#nsfw").hasClass("nsfw-avail")) {
|
||||
var nsfw = "true";
|
||||
toot.sensitive=nsfw;
|
||||
toot.sensitive = nsfw;
|
||||
} else {
|
||||
var nsfw = "false";
|
||||
}
|
||||
var vis = $("#vis").text();
|
||||
if(vis=="unlisted"){
|
||||
vis=="home"
|
||||
}else if(vis=="direct"){
|
||||
vis=="specified";
|
||||
toot.visibleUserIds=str.match(/@([a-zA-Z0-9_@.-]+)(\s|$)/g).join('').split("@");
|
||||
if (vis == "unlisted") {
|
||||
vis == "home"
|
||||
} else if (vis == "direct") {
|
||||
vis == "specified";
|
||||
toot.visibleUserIds = str.match(/@([a-zA-Z0-9_@.-]+)(\s|$)/g).join('').split("@");
|
||||
}
|
||||
if(vis!="inherit"){
|
||||
toot.visibility=vis;
|
||||
if (vis != "inherit") {
|
||||
toot.visibility = vis;
|
||||
}
|
||||
if ($("#cw").hasClass("cw-avail")) {
|
||||
var spo = $("#cw-text").val();
|
||||
cw();
|
||||
toot.cw=spo;
|
||||
toot.cw = spo;
|
||||
} else {
|
||||
var spo = "";
|
||||
}
|
||||
toot.i=at;
|
||||
toot.i = at;
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send(JSON.stringify(toot));
|
||||
httpreq.onreadystatechange = function() {
|
||||
httpreq.onreadystatechange = function () {
|
||||
if (httpreq.readyState === 4) {
|
||||
if(str.indexOf(localStorage.getItem("stable"))==-1){
|
||||
if (str.indexOf(localStorage.getItem("stable")) == -1) {
|
||||
localStorage.removeItem("stable")
|
||||
}
|
||||
var json = httpreq.response;
|
||||
console.log(["Success: toot",json]);
|
||||
console.log(["Success: toot", json]);
|
||||
var box = localStorage.getItem("box");
|
||||
if (box == "yes") {
|
||||
hide();
|
||||
}else if (box == "hide"){
|
||||
} else if (box == "hide") {
|
||||
$("body").addClass("mini-post");
|
||||
$(".mini-btn").text("expand_less");
|
||||
}
|
||||
@@ -263,8 +263,8 @@ function misskeyPost(){
|
||||
//クリア(Shift+C)
|
||||
function clear() {
|
||||
$("#textarea").val("");
|
||||
if(localStorage.getItem("stable")){
|
||||
$("#textarea").val("#"+localStorage.getItem("stable")+" ")
|
||||
if (localStorage.getItem("stable")) {
|
||||
$("#textarea").val("#" + localStorage.getItem("stable") + " ")
|
||||
}
|
||||
$("#textarea").attr("placeholder", lang.lang_toot);
|
||||
$("#reply").val("");
|
||||
@@ -280,7 +280,7 @@ function clear() {
|
||||
$("#cw").removeClass("yellow-text");
|
||||
$("#cw").removeClass("cw-avail");
|
||||
$("#cw-text").hide();
|
||||
}else{
|
||||
} else {
|
||||
$("#cw").addClass("yellow-text");
|
||||
$("#cw").addClass("cw-avail");
|
||||
$("#cw-text").show();
|
||||
@@ -297,13 +297,13 @@ function clear() {
|
||||
$(".toot-btn-group").prop("disabled", false);
|
||||
$("#post-acct-sel").prop("disabled", false);
|
||||
$("#days_poll").val(0);
|
||||
$("#hours_poll").val(0);
|
||||
$("#hours_poll").val(0);
|
||||
$("#mins_poll").val(6);
|
||||
$(".mastodon-choice").map(function() {
|
||||
$(".mastodon-choice").map(function () {
|
||||
$(this).val("");
|
||||
});
|
||||
localStorage.removeItem("image");
|
||||
if(localStorage.getItem("mainuse")=="main"){
|
||||
if (localStorage.getItem("mainuse") == "main") {
|
||||
$("#post-acct-sel").val(localStorage.getItem("main"));
|
||||
}
|
||||
$('select').material_select();
|
||||
|
@@ -1,11 +1,11 @@
|
||||
/*保護系*/
|
||||
//画像保護
|
||||
function nsfw(){
|
||||
if($("#nsfw").hasClass("nsfw-avail")){
|
||||
function nsfw() {
|
||||
if ($("#nsfw").hasClass("nsfw-avail")) {
|
||||
$("#nsfw").removeClass("yellow-text");
|
||||
$("#nsfw").html("visibility_off");
|
||||
$("#nsfw").removeClass("nsfw-avail");
|
||||
}else{
|
||||
} else {
|
||||
$("#nsfw").addClass("yellow-text");
|
||||
$("#nsfw").html("visibility");
|
||||
$("#nsfw").addClass("nsfw-avail");
|
||||
@@ -13,7 +13,7 @@ function nsfw(){
|
||||
}
|
||||
|
||||
//投稿公開範囲
|
||||
function vis(set){
|
||||
function vis(set) {
|
||||
$("#vis").text(set);
|
||||
$("#vis-icon").removeClass("red-text");
|
||||
$("#vis-icon").removeClass("orange-text");
|
||||
@@ -21,105 +21,105 @@ function vis(set){
|
||||
$("#vis-icon").removeClass("purple-text");
|
||||
$("#vis-icon").removeClass("light-blue-text");
|
||||
$("#vis-icon").removeClass("teal-text");
|
||||
if(set=="public"){
|
||||
if (set == "public") {
|
||||
$("#vis-icon").text("public");
|
||||
$("#vis-icon").addClass("purple-text");
|
||||
}else if(set=="unlisted"){
|
||||
} else if (set == "unlisted") {
|
||||
$("#vis-icon").text("lock_open");
|
||||
$("#vis-icon").addClass("blue-text");
|
||||
}else if(set=="private"){
|
||||
} else if (set == "private") {
|
||||
$("#vis-icon").text("lock");
|
||||
$("#vis-icon").addClass("orange-text");
|
||||
}else if(set=="direct"){
|
||||
} else if (set == "direct") {
|
||||
$("#vis-icon").text("mail");
|
||||
$("#vis-icon").addClass("red-text");
|
||||
}else if(set=="limited"){
|
||||
} else if (set == "limited") {
|
||||
$("#vis-icon").text("group");
|
||||
$("#vis-icon").addClass("teal-text");
|
||||
}else if(set=="local"){
|
||||
} else if (set == "local") {
|
||||
$("#vis-icon").text("visibility");
|
||||
$("#vis-icon").addClass("light-blue-text");
|
||||
}
|
||||
var vis=localStorage.getItem("vis");
|
||||
if(vis=="memory"){
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
localStorage.setItem("vis-memory-"+acct_id,set);
|
||||
}
|
||||
var vis = localStorage.getItem("vis");
|
||||
if (vis == "memory") {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
localStorage.setItem("vis-memory-" + acct_id, set);
|
||||
}
|
||||
$('.dropdown-button').dropdown('close');
|
||||
}
|
||||
function loadVis(){
|
||||
var vist = localStorage.getItem("vis");
|
||||
if (!vist) {
|
||||
vis("public");
|
||||
} else {
|
||||
if (vist == "memory") {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var memory = localStorage.getItem("vis-memory-"+acct_id);
|
||||
if (!memory) {
|
||||
memory = "public";
|
||||
}
|
||||
vis(memory);
|
||||
} else if(vist == "useapi") {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var multi = localStorage.getItem("multi");
|
||||
var obj = JSON.parse(multi);
|
||||
var memory = obj[acct_id]["vis"];
|
||||
if (!memory) {
|
||||
memory = "public";
|
||||
}
|
||||
vis(memory);
|
||||
} else {
|
||||
vis(vist);
|
||||
function loadVis() {
|
||||
var vist = localStorage.getItem("vis");
|
||||
if (!vist) {
|
||||
vis("public");
|
||||
} else {
|
||||
if (vist == "memory") {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var memory = localStorage.getItem("vis-memory-" + acct_id);
|
||||
if (!memory) {
|
||||
memory = "public";
|
||||
}
|
||||
vis(memory);
|
||||
} else if (vist == "useapi") {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var multi = localStorage.getItem("multi");
|
||||
var obj = JSON.parse(multi);
|
||||
var memory = obj[acct_id]["vis"];
|
||||
if (!memory) {
|
||||
memory = "public";
|
||||
}
|
||||
vis(memory);
|
||||
} else {
|
||||
vis(vist);
|
||||
}
|
||||
}
|
||||
}
|
||||
loadVis();
|
||||
|
||||
//コンテントワーニング
|
||||
function cw(){
|
||||
if($("#cw").hasClass("cw-avail")){
|
||||
function cw() {
|
||||
if ($("#cw").hasClass("cw-avail")) {
|
||||
$("#cw-text").val();
|
||||
$("#cw-text").hide();
|
||||
$("#cw").removeClass("yellow-text");
|
||||
$("#cw").removeClass("cw-avail");
|
||||
}else{
|
||||
} else {
|
||||
$("#cw-text").show();
|
||||
$("#cw").addClass("yellow-text");
|
||||
$("#cw").addClass("cw-avail");
|
||||
var cwt=localStorage.getItem("cw-text");
|
||||
if(cwt){
|
||||
var cwt = localStorage.getItem("cw-text");
|
||||
if (cwt) {
|
||||
$("#cw-text").val(cwt);
|
||||
}
|
||||
}
|
||||
}
|
||||
//TLでコンテントワーニングを表示トグル
|
||||
function cw_show(id){
|
||||
$(".cw_hide_"+id).toggleClass("cw");
|
||||
$(".cw-long-"+id).toggleClass("hide");
|
||||
function cw_show(id) {
|
||||
$(".cw_hide_" + id).toggleClass("cw");
|
||||
$(".cw-long-" + id).toggleClass("hide");
|
||||
}
|
||||
$(function() {
|
||||
$('#cw-text').on('change', function(event) {
|
||||
$(function () {
|
||||
$('#cw-text').on('change', function (event) {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var cwlen=$('#cw-text').val().length;
|
||||
var cwlen = $('#cw-text').val().length;
|
||||
|
||||
if(idata[domain+"_letters"]){
|
||||
$("#textarea").attr("data-length", idata[domain+"_letters"]-cwlen)
|
||||
}else{
|
||||
$("#textarea").attr("data-length", 500-cwlen)
|
||||
if (idata[domain + "_letters"]) {
|
||||
$("#textarea").attr("data-length", idata[domain + "_letters"] - cwlen)
|
||||
} else {
|
||||
$("#textarea").attr("data-length", 500 - cwlen)
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
//スケジュール
|
||||
function schedule(){
|
||||
if($("#sch-box").hasClass("sch-avail")){
|
||||
function schedule() {
|
||||
if ($("#sch-box").hasClass("sch-avail")) {
|
||||
$("#sch-box").hide();
|
||||
$("#sch-box").removeClass("sch-avail");
|
||||
}else{
|
||||
} else {
|
||||
var date = new Date();
|
||||
|
||||
|
||||
$("#sch-box").show();
|
||||
$("#sch-date").val(formattime(date));
|
||||
$("#sch-box").addClass("sch-avail");
|
||||
|
@@ -7,7 +7,7 @@ function fav(id, acct_id, remote) {
|
||||
var flag = "favourite";
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag;
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
@@ -15,19 +15,19 @@ function fav(id, acct_id, remote) {
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send();
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
if(remote!="remote"){
|
||||
httpreq.onreadystatechange = function () {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
if (remote != "remote") {
|
||||
//APIのふぁぼカウントがおかしい
|
||||
if ($("[toot-id=" + id + "] .fav_ct").text() == json.favourites_count){
|
||||
if(flag=="unfavourite"){
|
||||
var fav=json.favourites_count - 1;
|
||||
}else{
|
||||
var fav=json.favourites_count + 1;
|
||||
if ($("[toot-id=" + id + "] .fav_ct").text() == json.favourites_count) {
|
||||
if (flag == "unfavourite") {
|
||||
var fav = json.favourites_count - 1;
|
||||
} else {
|
||||
var fav = json.favourites_count + 1;
|
||||
//var fav = json.favourites_count;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
var fav = json.favourites_count;
|
||||
}
|
||||
$("[toot-id=" + id + "] .fav_ct").text(fav);
|
||||
@@ -35,17 +35,17 @@ function fav(id, acct_id, remote) {
|
||||
} else {
|
||||
$("[toot-id=" + id + "] .rt_ct").text(fav);
|
||||
}
|
||||
if ($("[toot-id=" + id +"]").hasClass("faved")) {
|
||||
$("[toot-id=" + id +"]").removeClass("faved");
|
||||
if ($("[toot-id=" + id + "]").hasClass("faved")) {
|
||||
$("[toot-id=" + id + "]").removeClass("faved");
|
||||
$(".fav_" + id).removeClass("yellow-text");
|
||||
} else {
|
||||
$("[toot-id=" + id +"]").addClass("faved");
|
||||
$("[toot-id=" + id + "]").addClass("faved");
|
||||
$(".fav_" + id).addClass("yellow-text");
|
||||
}
|
||||
}else{
|
||||
Materialize.toast(lang.lang_status_favWarn, 1000);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Materialize.toast(lang.lang_status_favWarn, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ function rt(id, acct_id, remote) {
|
||||
var flag = "reblog";
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag;
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
@@ -65,10 +65,10 @@ function rt(id, acct_id, remote) {
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send();
|
||||
httpreq.onreadystatechange = function() {
|
||||
httpreq.onreadystatechange = function () {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(["Success: boost",json]);
|
||||
console.log(["Success: boost", json]);
|
||||
if (remote != "remote") {
|
||||
$("[toot-id=" + id + "] .fav_ct").text(json.favourites_count);
|
||||
if (!json.reblog) {
|
||||
@@ -97,10 +97,10 @@ function rt(id, acct_id, remote) {
|
||||
}
|
||||
|
||||
//フォロー
|
||||
function follow(acct_id,remote) {
|
||||
if (!acct_id && acct_id!="selector") {
|
||||
function follow(acct_id, remote) {
|
||||
if (!acct_id && acct_id != "selector") {
|
||||
var acct_id = $('#his-data').attr("use-acct");
|
||||
}else if (acct_id=="selector") {
|
||||
} else if (acct_id == "selector") {
|
||||
var acct_id = $("#user-acct-sel").val();
|
||||
}
|
||||
if (!remote && $("#his-data").hasClass("following")) {
|
||||
@@ -111,22 +111,22 @@ function follow(acct_id,remote) {
|
||||
var flagm = "create";
|
||||
}
|
||||
var id = $("#his-data").attr("user-id");
|
||||
if(!remote){
|
||||
if (!remote) {
|
||||
var remote = $("#his-data").attr("remote");
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
if(localStorage.getItem("mode_" + domain)=="misskey"){
|
||||
var start = "https://" + domain + "/api/following/"+flagm;
|
||||
var user=$("#his-acct").text();
|
||||
var ent={"i":at,"userId":id}
|
||||
}else if(remote=="true" && flag=="follow"){
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var start = "https://" + domain + "/api/following/" + flagm;
|
||||
var user = $("#his-acct").text();
|
||||
var ent = { "i": at, "userId": id }
|
||||
} else if (remote == "true" && flag == "follow") {
|
||||
var start = "https://" + domain + "/api/v1/follows";
|
||||
var user=$("#his-acct").text();
|
||||
var ent={"uri":user}
|
||||
}else{
|
||||
var user = $("#his-acct").text();
|
||||
var ent = { "uri": user }
|
||||
} else {
|
||||
var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
|
||||
var ent={}
|
||||
var ent = {}
|
||||
}
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
@@ -134,10 +134,10 @@ function follow(acct_id,remote) {
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send(JSON.stringify(ent));
|
||||
httpreq.onreadystatechange = function() {
|
||||
httpreq.onreadystatechange = function () {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(["Success: folllow",json]);
|
||||
console.log(["Success: folllow", json]);
|
||||
if ($("#his-data").hasClass("following")) {
|
||||
$("#his-data").removeClass("following");
|
||||
$("#his-follow-btn").text(lang.lang_status_follow);
|
||||
@@ -161,7 +161,7 @@ function block(acct_id) {
|
||||
var flag = "block";
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
@@ -169,7 +169,7 @@ function block(acct_id) {
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send();
|
||||
httpreq.onreadystatechange = function() {
|
||||
httpreq.onreadystatechange = function () {
|
||||
if (httpreq.readyState === 4) {
|
||||
if ($("#his-data").hasClass("blocking")) {
|
||||
$("#his-data").removeClass("blocking");
|
||||
@@ -196,14 +196,14 @@ function mute(acct_id) {
|
||||
var flagm = "create";
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
if(localStorage.getItem("mode_" + domain)=="misskey"){
|
||||
var start = "https://" + domain + "/api/mute/"+flagm;
|
||||
var ent={"i":at,"userId":id}
|
||||
var rq=JSON.stringify(ent);
|
||||
}else{
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var start = "https://" + domain + "/api/mute/" + flagm;
|
||||
var ent = { "i": at, "userId": id }
|
||||
var rq = JSON.stringify(ent);
|
||||
} else {
|
||||
var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
|
||||
var rq="";
|
||||
var rq = "";
|
||||
}
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
@@ -211,7 +211,7 @@ function mute(acct_id) {
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send(rq);
|
||||
httpreq.onreadystatechange = function() {
|
||||
httpreq.onreadystatechange = function () {
|
||||
if (httpreq.readyState === 4) {
|
||||
if ($("#his-data").hasClass("muting")) {
|
||||
$("#his-data").removeClass("muting");
|
||||
@@ -227,17 +227,17 @@ function mute(acct_id) {
|
||||
//投稿削除
|
||||
function del(id, acct_id) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
if(localStorage.getItem("mode_" + domain)=="misskey"){
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
if (localStorage.getItem("mode_" + domain) == "misskey") {
|
||||
var start = "https://" + domain + "/api/notes/delete";
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send(JSON.stringify({i:at,noteId:id}));
|
||||
$("[toot-id=" + id+ "]").hide();
|
||||
$("[toot-id=" + id + "]").remove();
|
||||
}else{
|
||||
httpreq.send(JSON.stringify({ i: at, noteId: id }));
|
||||
$("[toot-id=" + id + "]").hide();
|
||||
$("[toot-id=" + id + "]").remove();
|
||||
} else {
|
||||
var start = "https://" + domain + "/api/v1/statuses/" + id;
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('DELETE', start, true);
|
||||
@@ -246,42 +246,42 @@ function del(id, acct_id) {
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send();
|
||||
}
|
||||
httpreq.onreadystatechange = function() {
|
||||
httpreq.onreadystatechange = function () {
|
||||
if (httpreq.readyState === 4) {
|
||||
}
|
||||
}
|
||||
}
|
||||
//redraft
|
||||
function redraft(id, acct_id){
|
||||
if(confirm(lang.lang_status_redraft)){
|
||||
function redraft(id, acct_id) {
|
||||
if (confirm(lang.lang_status_redraft)) {
|
||||
show();
|
||||
del(id, acct_id);
|
||||
$("#post-acct-sel").prop("disabled", true);
|
||||
var medias=$("[toot-id="+id+"]").attr("data-medias");
|
||||
var vismode=$("[toot-id="+id+"] .vis-data").attr("data-vis");
|
||||
var medias = $("[toot-id=" + id + "]").attr("data-medias");
|
||||
var vismode = $("[toot-id=" + id + "] .vis-data").attr("data-vis");
|
||||
vis(vismode);
|
||||
$("#media").val(medias);
|
||||
var ct=medias.split(",").length;
|
||||
$("[toot-id="+id+"] img.toot-img").each(function(i, elem) {
|
||||
if(i<ct){
|
||||
var url=$(elem).attr("src");
|
||||
console.log("Play back image data:"+url);
|
||||
var ct = medias.split(",").length;
|
||||
$("[toot-id=" + id + "] img.toot-img").each(function (i, elem) {
|
||||
if (i < ct) {
|
||||
var url = $(elem).attr("src");
|
||||
console.log("Play back image data:" + url);
|
||||
$('#preview').append('<img src="' + url + '" style="width:50px; max-height:100px;">');
|
||||
}
|
||||
});
|
||||
var html=$("[toot-id="+id+"] .toot").html();
|
||||
html = html.replace(/^<p>(.+)<\/p>$/,"$1");
|
||||
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);
|
||||
localStorage.setItem("nohide",true);
|
||||
html = $.strip_tags(html);
|
||||
localStorage.setItem("nohide", true);
|
||||
show();
|
||||
$("#textarea").val(html);
|
||||
var cwtxt=$("[toot-id="+id+"] .cw_text").html();
|
||||
if(cwtxt!=""){
|
||||
cwtxt=$.strip_tags(cwtxt);
|
||||
var cwtxt = $("[toot-id=" + id + "] .cw_text").html();
|
||||
if (cwtxt != "") {
|
||||
cwtxt = $.strip_tags(cwtxt);
|
||||
cw();
|
||||
$("#cw-text").val(cwtxt);
|
||||
}
|
||||
@@ -295,7 +295,7 @@ function pin(id, acct_id) {
|
||||
var flag = "pin";
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag;
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
@@ -303,10 +303,10 @@ function pin(id, acct_id) {
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send();
|
||||
httpreq.onreadystatechange = function() {
|
||||
httpreq.onreadystatechange = function () {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(["Success: pinned",json]);
|
||||
console.log(["Success: pinned", json]);
|
||||
if ($("[toot-id=" + id + "]").hasClass("pined")) {
|
||||
$("[toot-id=" + id + "]").removeClass("pined");
|
||||
$(".pin_" + id).removeClass("blue-text");
|
||||
@@ -321,7 +321,7 @@ function pin(id, acct_id) {
|
||||
//フォロリク
|
||||
function request(id, flag, acct_id) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/follow_requests/" + id + "/" + flag;
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
@@ -329,10 +329,10 @@ function request(id, flag, acct_id) {
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send();
|
||||
httpreq.onreadystatechange = function() {
|
||||
httpreq.onreadystatechange = function () {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(["Success: request","type:"+flag,json]);
|
||||
console.log(["Success: request", "type:" + flag, json]);
|
||||
showReq();
|
||||
}
|
||||
}
|
||||
@@ -344,7 +344,7 @@ function domainblock(add, flag, acct_id) {
|
||||
var acct_id = $('#his-data').attr("use-acct");
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/domain_blocks"
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
@@ -352,10 +352,10 @@ function domainblock(add, flag, acct_id) {
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send();
|
||||
httpreq.onreadystatechange = function() {
|
||||
httpreq.onreadystatechange = function () {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(["Success: domain block",json]);
|
||||
console.log(["Success: domain block", json]);
|
||||
showDom();
|
||||
}
|
||||
}
|
||||
@@ -366,24 +366,24 @@ function addDomainblock() {
|
||||
domainblock(domain, 'POST');
|
||||
}
|
||||
//ユーザー強調
|
||||
function empUser(){
|
||||
function empUser() {
|
||||
var usr = localStorage.getItem("user_emp");
|
||||
var obj = JSON.parse(usr);
|
||||
var id=$("#his-acct").attr("fullname");
|
||||
if(!obj){
|
||||
var obj=[];
|
||||
var id = $("#his-acct").attr("fullname");
|
||||
if (!obj) {
|
||||
var obj = [];
|
||||
obj.push(id);
|
||||
Materialize.toast(id+lang.lang_status_emphas, 4000);
|
||||
}else{
|
||||
Materialize.toast(id + lang.lang_status_emphas, 4000);
|
||||
} else {
|
||||
var can;
|
||||
Object.keys(obj).forEach(function(key) {
|
||||
Object.keys(obj).forEach(function (key) {
|
||||
var usT = obj[key];
|
||||
if(usT!=id && !can){
|
||||
can=false;
|
||||
}else{
|
||||
can=true;
|
||||
if (usT != id && !can) {
|
||||
can = false;
|
||||
} else {
|
||||
can = true;
|
||||
obj.splice(key, 1);
|
||||
Materialize.toast(id+lang.lang_status_unemphas, 4000);
|
||||
Materialize.toast(id + lang.lang_status_unemphas, 4000);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -391,16 +391,16 @@ function empUser(){
|
||||
localStorage.setItem("user_emp", json);
|
||||
}
|
||||
//Endorse
|
||||
function pinUser(){
|
||||
var id=$("#his-data").attr("user-id");
|
||||
var acct_id=$("#his-data").attr("use-acct");
|
||||
function pinUser() {
|
||||
var id = $("#his-data").attr("user-id");
|
||||
var acct_id = $("#his-data").attr("use-acct");
|
||||
if ($("#his-end-btn").hasClass("endorsed")) {
|
||||
var flag = "unpin";
|
||||
} else {
|
||||
var flag = "pin";
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
@@ -408,7 +408,7 @@ function pinUser(){
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreq.responseType = "json";
|
||||
httpreq.send();
|
||||
httpreq.onreadystatechange = function() {
|
||||
httpreq.onreadystatechange = function () {
|
||||
if (httpreq.readyState === 4) {
|
||||
var json = httpreq.response;
|
||||
if ($("#his-end-btn").hasClass("endorsed")) {
|
||||
@@ -417,63 +417,63 @@ function pinUser(){
|
||||
} else {
|
||||
$("#his-end-btn").addClass("endorsed")
|
||||
$("#his-end-btn").text(lang.lang_status_unendorse)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//URLコピー
|
||||
function tootUriCopy(url){
|
||||
function tootUriCopy(url) {
|
||||
execCopy(url);
|
||||
Materialize.toast(lang.lang_details_url, 1500);
|
||||
}
|
||||
|
||||
//他のアカウントで…
|
||||
function staEx(mode){
|
||||
var url=$("#tootmodal").attr("data-url");
|
||||
function staEx(mode) {
|
||||
var url = $("#tootmodal").attr("data-url");
|
||||
var acct_id = $("#status-acct-sel").val();
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/search?resolve=true&q="+url
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/search?resolve=true&q=" + url
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
}
|
||||
}).then(function(response) {
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
var id=json.statuses[0].id;
|
||||
if(mode=="rt"){
|
||||
}).then(function (json) {
|
||||
var id = json.statuses[0].id;
|
||||
if (mode == "rt") {
|
||||
rt(id, acct_id, 'remote')
|
||||
}else if(mode=="fav"){
|
||||
} else if (mode == "fav") {
|
||||
fav(id, acct_id, 'remote')
|
||||
}else if(mode=="reply"){
|
||||
} else if (mode == "reply") {
|
||||
reEx(id)
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
function toggleAction(id,tlid,acct_id){
|
||||
if(tlid=="notf"){
|
||||
var tlide="[data-notf="+acct_id+"]";
|
||||
}else{
|
||||
var tlide="[tlid="+tlid+"]";
|
||||
function toggleAction(id, tlid, acct_id) {
|
||||
if (tlid == "notf") {
|
||||
var tlide = "[data-notf=" + acct_id + "]";
|
||||
} else {
|
||||
var tlide = "[tlid=" + tlid + "]";
|
||||
}
|
||||
if(!$(tlide+" [toot-id="+id+"]").hasClass("ext-mode")){
|
||||
$(tlide+" [toot-id="+id+"] .type-a").hide();
|
||||
$(tlide+" [toot-id="+id+"] .type-b").show();
|
||||
$(tlide+" [toot-id="+id+"]").addClass("ext-mode")
|
||||
$(tlide+" [toot-id="+id+"] .act-icon").text("expand_less");
|
||||
}else{
|
||||
$(tlide+" [toot-id="+id+"] .type-b").hide();
|
||||
$(tlide+" [toot-id="+id+"] .type-a").show();
|
||||
$(tlide+" [toot-id="+id+"]").removeClass("ext-mode")
|
||||
$(tlide+" [toot-id="+id+"] .act-icon").text("expand_more");
|
||||
if (!$(tlide + " [toot-id=" + id + "]").hasClass("ext-mode")) {
|
||||
$(tlide + " [toot-id=" + id + "] .type-a").hide();
|
||||
$(tlide + " [toot-id=" + id + "] .type-b").show();
|
||||
$(tlide + " [toot-id=" + id + "]").addClass("ext-mode")
|
||||
$(tlide + " [toot-id=" + id + "] .act-icon").text("expand_less");
|
||||
} else {
|
||||
$(tlide + " [toot-id=" + id + "] .type-b").hide();
|
||||
$(tlide + " [toot-id=" + id + "] .type-a").show();
|
||||
$(tlide + " [toot-id=" + id + "]").removeClass("ext-mode")
|
||||
$(tlide + " [toot-id=" + id + "] .act-icon").text("expand_more");
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -7,102 +7,102 @@ var prev_val = input.value;
|
||||
var oldSuggest;
|
||||
var suggest;
|
||||
|
||||
input.addEventListener("focus", function() {
|
||||
input.addEventListener("focus", function () {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
$("#suggest").html("");
|
||||
window.clearInterval(timer);
|
||||
timer = window.setInterval(function() {
|
||||
timer = window.setInterval(function () {
|
||||
var new_val = input.value;
|
||||
if(new_val==""){
|
||||
if (new_val == "") {
|
||||
$("#suggest").html("");
|
||||
if($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")){
|
||||
if ($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")) {
|
||||
$("#right-side").hide()
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (prev_val != new_val) {
|
||||
var semoji = new_val.match(/:(\S{3,})/);
|
||||
if(semoji){
|
||||
if (semoji) {
|
||||
var obj = JSON.parse(localStorage.getItem("emoji_" + acct_id));
|
||||
if(!obj){
|
||||
var ehtml=lang.lang_suggest_nodata;
|
||||
}else{
|
||||
if (!obj) {
|
||||
var ehtml = lang.lang_suggest_nodata;
|
||||
} else {
|
||||
var num = obj.length;
|
||||
var ehtml="";
|
||||
var ehtml = "";
|
||||
for (i = 0; i < num; i++) {
|
||||
var emoji = obj[i];
|
||||
if ( ~emoji.shortcode.indexOf(semoji[1])) {
|
||||
if (~emoji.shortcode.indexOf(semoji[1])) {
|
||||
if (emoji) {
|
||||
ehtml = ehtml+'<a onclick="emojiInsert(\':' + emoji.shortcode +
|
||||
': \',\':'+semoji[1]+'\')" class="pointer"><img src="' + emoji.url + '" width="20"></a>';
|
||||
ehtml = ehtml + '<a onclick="emojiInsert(\':' + emoji.shortcode +
|
||||
': \',\':' + semoji[1] + '\')" class="pointer"><img src="' + emoji.url + '" width="20"></a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(ehtml!=""){
|
||||
if (ehtml != "") {
|
||||
$("#right-side").show()
|
||||
$("#poll").addClass("hide")
|
||||
$("#emoji").addClass("hide")
|
||||
}else{
|
||||
if($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")){
|
||||
} else {
|
||||
if ($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")) {
|
||||
$("#right-side").hide()
|
||||
}
|
||||
}
|
||||
$("#suggest").html(ehtml);
|
||||
}
|
||||
|
||||
|
||||
var tag = new_val.match(/#(\S{3,})/);
|
||||
var acct = new_val.match(/@(\S{3,})/);
|
||||
if (tag && tag[1]) {
|
||||
var q = tag[1];
|
||||
} else if (acct && acct[1]) {
|
||||
var q = acct[1];
|
||||
}else {
|
||||
} else {
|
||||
$("#suggest").html("");
|
||||
if($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")){
|
||||
if ($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")) {
|
||||
$("#right-side").hide()
|
||||
}
|
||||
return;
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var at = localStorage.getItem("acct_" + acct_id + "_at");
|
||||
suggest = "https://" + domain + "/api/v1/search?q=" + q
|
||||
if (suggest != oldSuggest) {
|
||||
console.log("Try to get suggest at "+suggest)
|
||||
console.log("Try to get suggest at " + suggest)
|
||||
fetch(suggest, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
}).then(function(response) {
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
}).then(function (json) {
|
||||
if (json.hashtags[0] && tag) {
|
||||
if(tag[1]){
|
||||
var tags = "";
|
||||
Object.keys(json.hashtags).forEach(function(key4) {
|
||||
var tag = json.hashtags[key4];
|
||||
if(tag!=q){
|
||||
tags = tags + '<a onclick="tagInsert(\'#' + tag + '\',\'#' + q +
|
||||
'\')" class="pointer">#' + tag + '</a><br>';
|
||||
}
|
||||
});
|
||||
$("#right-side").show()
|
||||
$("#suggest").html("Tags:<br>" + tags);
|
||||
$("#poll").addClass("hide")
|
||||
$("#emoji").addClass("hide")
|
||||
if (tag[1]) {
|
||||
var tags = "";
|
||||
Object.keys(json.hashtags).forEach(function (key4) {
|
||||
var tag = json.hashtags[key4];
|
||||
if (tag != q) {
|
||||
tags = tags + '<a onclick="tagInsert(\'#' + tag + '\',\'#' + q +
|
||||
'\')" class="pointer">#' + tag + '</a><br>';
|
||||
}
|
||||
});
|
||||
$("#right-side").show()
|
||||
$("#suggest").html("Tags:<br>" + tags);
|
||||
$("#poll").addClass("hide")
|
||||
$("#emoji").addClass("hide")
|
||||
}
|
||||
} else if (json.accounts[0] && acct[1]) {
|
||||
var accts = "";
|
||||
Object.keys(json.accounts).forEach(function(key3) {
|
||||
Object.keys(json.accounts).forEach(function (key3) {
|
||||
var acct = json.accounts[key3];
|
||||
if(acct.acct!=q){
|
||||
if (acct.acct != q) {
|
||||
accts = accts + '<a onclick="tagInsert(\'@' + acct.acct +
|
||||
'\',\'@' + q + '\')" class="pointer">@' + acct.acct + '</a><br>';
|
||||
'\',\'@' + q + '\')" class="pointer">@' + acct.acct + '</a><br>';
|
||||
}
|
||||
});
|
||||
$("#right-side").show()
|
||||
@@ -110,7 +110,7 @@ input.addEventListener("focus", function() {
|
||||
$("#poll").addClass("hide")
|
||||
$("#emoji").addClass("hide")
|
||||
} else {
|
||||
if($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")){
|
||||
if ($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")) {
|
||||
$("#right-side").hide()
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@ input.addEventListener("focus", function() {
|
||||
}, 1000);
|
||||
}, false);
|
||||
|
||||
input.addEventListener("blur", function() {
|
||||
input.addEventListener("blur", function () {
|
||||
window.clearInterval(timer);
|
||||
favTag();
|
||||
}, false);
|
||||
@@ -133,47 +133,47 @@ function tagInsert(code, del) {
|
||||
} else {
|
||||
var regExp = new RegExp(del, "g");
|
||||
var now = now.replace(regExp, "");
|
||||
selin=selin-del.length;
|
||||
selin = selin - del.length;
|
||||
}
|
||||
if(selin>0){
|
||||
var before = now.substr(0, selin);
|
||||
var after = now.substr(selin, now.length);
|
||||
newt = before + " "+ code+" " + after;
|
||||
}else{
|
||||
newt = code+" "+now;
|
||||
if (selin > 0) {
|
||||
var before = now.substr(0, selin);
|
||||
var after = now.substr(selin, now.length);
|
||||
newt = before + " " + code + " " + after;
|
||||
} else {
|
||||
newt = code + " " + now;
|
||||
}
|
||||
$("#textarea").val(newt);
|
||||
$("#textarea").focus();
|
||||
if($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")){
|
||||
if ($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")) {
|
||||
$("#right-side").hide()
|
||||
}
|
||||
$("#suggest").html("");
|
||||
}
|
||||
function cgNPs(q){
|
||||
function cgNPs(q) {
|
||||
suggest = "https://cg.toot.app/api/v1/search/light?q=" + q
|
||||
if (suggest != oldSuggest) {
|
||||
console.log("Try to get suggest at "+suggest)
|
||||
fetch(suggest, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
if (json[0]) {
|
||||
var tags = "";
|
||||
Object.keys(json).forEach(function(key4) {
|
||||
var tag = json[key4];
|
||||
tags = tags + '<a onclick="cgNP(\''+json[key4]+'\')" class="pointer">' + escapeHTML(json[key4]) + '</a> ';
|
||||
});
|
||||
$("#suggest").html("Cinderella NowPlaying:" + tags);
|
||||
}else{
|
||||
$("#suggest").html("Cinderella NowPlaying:Not Found");
|
||||
}
|
||||
if (suggest != oldSuggest) {
|
||||
console.log("Try to get suggest at " + suggest)
|
||||
fetch(suggest, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
}).then(function (response) {
|
||||
return response.json();
|
||||
}).catch(function (error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function (json) {
|
||||
if (json[0]) {
|
||||
var tags = "";
|
||||
Object.keys(json).forEach(function (key4) {
|
||||
var tag = json[key4];
|
||||
tags = tags + '<a onclick="cgNP(\'' + json[key4] + '\')" class="pointer">' + escapeHTML(json[key4]) + '</a> ';
|
||||
});
|
||||
$("#suggest").html("Cinderella NowPlaying:" + tags);
|
||||
} else {
|
||||
$("#suggest").html("Cinderella NowPlaying:Not Found");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@@ -1,62 +1,62 @@
|
||||
/*リプライ*/
|
||||
function re(id,ats_cm,acct_id,mode){
|
||||
function re(id, ats_cm, acct_id, mode) {
|
||||
clear();
|
||||
var ats=ats_cm.split(',');
|
||||
localStorage.setItem("nohide",true);
|
||||
var ats = ats_cm.split(',');
|
||||
localStorage.setItem("nohide", true);
|
||||
show();
|
||||
$("#reply").val(id);
|
||||
for(var i=0;i<ats.length;i++){
|
||||
var at=ats[i];
|
||||
var te=$("#textarea").val();
|
||||
if(at!=localStorage.getItem("user_"+acct_id)){
|
||||
$("#textarea").val("@"+at+" "+te);
|
||||
for (var i = 0; i < ats.length; i++) {
|
||||
var at = ats[i];
|
||||
var te = $("#textarea").val();
|
||||
if (at != localStorage.getItem("user_" + acct_id)) {
|
||||
$("#textarea").val("@" + at + " " + te);
|
||||
}
|
||||
}
|
||||
$("#rec").text(lang.lang_yesno);
|
||||
$("#post-acct-sel").val(acct_id);
|
||||
$("#post-acct-sel").prop("disabled", true);
|
||||
$('select').material_select();
|
||||
$("#textarea").attr("placeholder",lang.lang_usetxtbox_reply);
|
||||
$("#textarea").attr("placeholder", lang.lang_usetxtbox_reply);
|
||||
$("#textarea").focus();
|
||||
var profimg=localStorage.getItem("prof_"+acct_id);
|
||||
if(!profimg){
|
||||
profimg="../../img/missing.svg";
|
||||
var profimg = localStorage.getItem("prof_" + acct_id);
|
||||
if (!profimg) {
|
||||
profimg = "../../img/missing.svg";
|
||||
}
|
||||
$("#acct-sel-prof").attr("src",profimg);
|
||||
$("#acct-sel-prof").attr("src", profimg);
|
||||
vis(mode);
|
||||
}
|
||||
function reEx(id){
|
||||
function reEx(id) {
|
||||
$('#tootmodal').modal('close');
|
||||
var at=$("#tootmodal").attr("data-user");
|
||||
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);
|
||||
var mode = $("#tootmodal .vis-data").attr("data-vis");
|
||||
re(id, at, acct_id, mode);
|
||||
}
|
||||
//引用
|
||||
function qt(id,acct_id,at,url){
|
||||
localStorage.setItem("nohide",true);
|
||||
function qt(id, acct_id, at, url) {
|
||||
localStorage.setItem("nohide", true);
|
||||
var qt = localStorage.getItem("quote");
|
||||
if(!qt){
|
||||
var qt="simple";
|
||||
if (!qt) {
|
||||
var qt = "simple";
|
||||
}
|
||||
if(qt=="nothing"){
|
||||
if (qt == "nothing") {
|
||||
return false;
|
||||
}
|
||||
if(qt=="simple"){
|
||||
if (qt == "simple") {
|
||||
show();
|
||||
$("#textarea").val("\n"+url);
|
||||
}else if(qt=="mention"){
|
||||
$("#textarea").val("\n" + url);
|
||||
} else if (qt == "mention") {
|
||||
show();
|
||||
$("#textarea").val("\n"+url+" From:@"+at);
|
||||
}else if(qt=="full"){
|
||||
$("#textarea").val("\n" + url + " From:@" + at);
|
||||
} else if (qt == "full") {
|
||||
show();
|
||||
var html=$("[toot-id="+id+"] .toot").html();
|
||||
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);
|
||||
html = $.strip_tags(html);
|
||||
$("#textarea").val("\n" + "@" + at + " " + html + "\n" + url);
|
||||
}
|
||||
$("#textarea").focus();
|
||||
$("#post-acct-sel").val(acct_id);
|
||||
|
Reference in New Issue
Block a user