TheDesk Akane (16.0.0)
This commit is contained in:
@@ -32,6 +32,9 @@ function mdCheck(){
|
||||
}else{
|
||||
$("#trendtag").html("");
|
||||
}
|
||||
if(domain=="misskey.xyz"){
|
||||
Materialize.toast(lang_bbmd_misskey[lang], 5000);
|
||||
}
|
||||
if(idata[domain+"_letters"]){
|
||||
$("#textarea").attr("data-length", idata[domain+"_letters"])
|
||||
}else{
|
||||
@@ -104,8 +107,11 @@ if(localStorage.getItem("md")=="hide"){
|
||||
}
|
||||
//PHPのnl2brと同様
|
||||
function nl2br(str) {
|
||||
if(!str){
|
||||
return "";
|
||||
}
|
||||
str = str.replace(/\r\n/g, "<br />");
|
||||
str = str.replace(/(\n|\r)/g, "<br />");
|
||||
str = str.replace(/(\n|\r)/g, "<br />");
|
||||
return str;
|
||||
}
|
||||
//テキストボックスで選択したやつをタグで囲む(BB版)
|
||||
|
@@ -101,20 +101,37 @@ function media(b64, type, no) {
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/media";
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.upload.addEventListener("progress", progshow, false);
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreq.responseType = 'json';
|
||||
httpreq.send(fd);
|
||||
if(domain=="misskey.xyz"){
|
||||
var start = "https://" + domain + "/api/drive/files/create";
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.upload.addEventListener("progress", progshow, false);
|
||||
httpreq.responseType = 'json';
|
||||
if ($("#nsfw").hasClass("nsfw-avail")) {
|
||||
var nsfw = true;
|
||||
} else {
|
||||
var nsfw = false;
|
||||
}
|
||||
var previewer="url"
|
||||
fd.append('i', at);
|
||||
//fd.append('isSensitive', nsfw);
|
||||
httpreq.send(fd);
|
||||
}else{
|
||||
var previewer="preview_url"
|
||||
var start = "https://" + domain + "/api/v1/media";
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.upload.addEventListener("progress", progshow, false);
|
||||
httpreq.responseType = 'json';
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreq.send(fd);
|
||||
}
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState == 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(json);
|
||||
var img = localStorage.getItem("img");
|
||||
if (json.type=="image") {
|
||||
var html = '<img src="' + json.preview_url + '" style="width:50px; max-height:100px;">';
|
||||
if (json.type.indexOf("image")!=-1) {
|
||||
var html = '<img src="' + json[previewer] + '" style="width:50px; max-height:100px;">';
|
||||
$('#preview').append(html);
|
||||
} else {
|
||||
$('#preview').append(lang_postimg_previewdis[lang]);
|
||||
|
120
app/js/post/misskeystatus.js
Normal file
120
app/js/post/misskeystatus.js
Normal file
@@ -0,0 +1,120 @@
|
||||
//Renpost
|
||||
function renote(id, acct_id, remote) {
|
||||
if ($("#pub_" + id).hasClass("rted")) {
|
||||
return
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/notes/create";
|
||||
if(domain!="misskey.xyz"){
|
||||
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) {
|
||||
var json = httpreq.response;
|
||||
console.log(json);
|
||||
$("[toot-id=" + id + "]").addClass("rted");
|
||||
$(".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_misskeyparse_qt[lang]);
|
||||
$("#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_misskeyparse_qt[lang]);
|
||||
$("#textarea").focus();
|
||||
}
|
||||
//Reaction
|
||||
function reactiontoggle(id,acct_id,tlid){
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/notes/show";
|
||||
if(domain!="misskey.xyz"){
|
||||
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,noteId:id}));
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState == 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(json);
|
||||
if(json.reactionCounts){
|
||||
var reactions=["like","love","laugh","hmm","surprise","congrats","angry","confused","pudding"];
|
||||
for(var i=0;i<reactions.length;i++){
|
||||
if(json.reactionCounts[reactions[i]]){
|
||||
$("#pub_" + id +" .re-"+reactions[i]+"ct").text(json.reactionCounts[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.reactionCounts[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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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 start = "https://" + domain + "/api/notes/reactions/"+flag;
|
||||
if(domain!="misskey.xyz"){
|
||||
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,noteId:id,reaction:mode}));
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState == 4) {
|
||||
$(".fav_"+id).toggleClass("yellow-text");
|
||||
}
|
||||
}
|
||||
}
|
@@ -26,6 +26,10 @@ function post() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if(domain=="misskey.xyz"){
|
||||
misskeyPost();
|
||||
return;
|
||||
}
|
||||
$("#toot-post-btn").prop("disabled", true);
|
||||
todo("Posting");
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
@@ -84,6 +88,80 @@ function post() {
|
||||
}
|
||||
}
|
||||
}
|
||||
function misskeyPost(){
|
||||
var str = $("#textarea").val();
|
||||
var acct_id = $("#post-acct-sel").val();
|
||||
localStorage.setItem("last-use", acct_id);
|
||||
var domain = "misskey.xyz"
|
||||
$("#toot-post-btn").prop("disabled", true);
|
||||
todo("Posting");
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/notes/create";
|
||||
var reply = $("#reply").val();
|
||||
var toot={
|
||||
text: str
|
||||
}
|
||||
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 ($("#nsfw").hasClass("nsfw-avail")) {
|
||||
var nsfw = "true";
|
||||
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!="inherit"){
|
||||
toot.visibility=vis;
|
||||
}
|
||||
if ($("#cw").hasClass("cw-avail")) {
|
||||
var spo = $("#cw-text").val();
|
||||
cw();
|
||||
toot.cw=spo;
|
||||
} else {
|
||||
var spo = "";
|
||||
}
|
||||
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() {
|
||||
if (httpreq.readyState == 4) {
|
||||
if(str.indexOf(localStorage.getItem("stable"))==-1){
|
||||
localStorage.removeItem("stable")
|
||||
}
|
||||
var json = httpreq.response;
|
||||
console.log(json);
|
||||
var box = localStorage.getItem("box");
|
||||
if (box == "yes") {
|
||||
hide();
|
||||
}else if (box == "hide"){
|
||||
$("body").addClass("mini-post");
|
||||
$(".mini-btn").text("expand_less");
|
||||
}
|
||||
$("#toot-post-btn").prop("disabled", false);
|
||||
todc();
|
||||
clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//クリア(Shift+C)
|
||||
function clear() {
|
||||
@@ -113,9 +191,9 @@ function clear() {
|
||||
$("#preview").html("");
|
||||
$("#toot-post-btn").prop("disabled", false);
|
||||
$("#post-acct-sel").prop("disabled", false);
|
||||
$('select').material_select();
|
||||
localStorage.removeItem("image");
|
||||
if(localStorage.getItem("mainuse")=="main"){
|
||||
multi();
|
||||
$("#post-acct-sel").val(localStorage.getItem("main"));
|
||||
}
|
||||
$('select').material_select();
|
||||
}
|
@@ -105,8 +105,10 @@ function follow(acct_id,remote) {
|
||||
}
|
||||
if (!remote && $("#his-data").hasClass("following")) {
|
||||
var flag = "unfollow";
|
||||
var flagm = "delete";
|
||||
} else {
|
||||
var flag = "follow";
|
||||
var flagm = "create";
|
||||
}
|
||||
var id = $("#his-data").attr("user-id");
|
||||
if(!remote){
|
||||
@@ -114,7 +116,11 @@ function follow(acct_id,remote) {
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
if(remote=="true" && flag=="follow"){
|
||||
if(domain=="misskey.xyz"){
|
||||
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}
|
||||
@@ -185,18 +191,27 @@ function mute(acct_id) {
|
||||
var id = $("#his-data").attr("user-id");
|
||||
if ($("#his-data").hasClass("muting")) {
|
||||
var flag = "unmute";
|
||||
var flagm = "delete";
|
||||
} else {
|
||||
var flag = "mute";
|
||||
var flagm = "create";
|
||||
}
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
|
||||
if(domain=="misskey.xyz"){
|
||||
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 httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreq.responseType = 'json';
|
||||
httpreq.send();
|
||||
httpreq.send(rq);
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState == 4) {
|
||||
if ($("#his-data").hasClass("muting")) {
|
||||
@@ -214,13 +229,22 @@ function mute(acct_id) {
|
||||
function del(id, acct_id) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem("acct_"+ acct_id + "_at");
|
||||
var start = "https://" + domain + "/api/v1/statuses/" + id;
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('DELETE', start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreq.responseType = 'json';
|
||||
httpreq.send();
|
||||
if(domain=="misskey.xyz"){
|
||||
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}));
|
||||
}else{
|
||||
var start = "https://" + domain + "/api/v1/statuses/" + id;
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('DELETE', start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreq.responseType = 'json';
|
||||
httpreq.send();
|
||||
}
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState == 4) {
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ function re(id,at,acct_id,mode){
|
||||
$("#reply").val(id);
|
||||
var te=$("#textarea").val();
|
||||
$("#textarea").val("@"+at+" "+te);
|
||||
$("#rec").text("はい");
|
||||
$("#rec").text(lang_yesno[lang]);
|
||||
$("#post-acct-sel").val(acct_id);
|
||||
$("#post-acct-sel").prop("disabled", true);
|
||||
$('select').material_select();
|
||||
|
Reference in New Issue
Block a user