TheDesk Mizuki (ver.7)
This commit is contained in:
parent
223296a4cd
commit
b0c8c972e6
17
LATEST.md
17
LATEST.md
|
@ -1,18 +1,17 @@
|
|||
## For Astarte(kirishima.cloud), My Primary Instance
|
||||
|
||||
TheDesk :thedesk: Mizuki (ver.6)
|
||||
・リストに関するバグを修正
|
||||
・サポートインスタンスに関する修正
|
||||
・カラーテーマ追加
|
||||
ほか
|
||||
TheDesk :thedesk: Mizuki (ver.7)
|
||||
【重要】
|
||||
このアップデートは必ず適用して下さい。
|
||||
理由:インスタンスにログインできない、トゥートができない等の問題を修正しています。
|
||||
https://thedesk.top
|
||||
:github: https://github.com/cutls/TheDesk #Desk #DeskUpdate
|
||||
|
||||
## For Other Instances
|
||||
|
||||
PCクライアントTheDesk :thedesk: Mizuki (ver.6)
|
||||
・リストに関するバグを修正
|
||||
・サポートインスタンスに関する修正
|
||||
・カラーテーマ追加
|
||||
PCクライアントTheDesk :thedesk: Mizuki (ver.7)
|
||||
【重要】このトゥートは重要な事項を含むため他のインスタンスでもトゥートされます。
|
||||
このアップデートは必ず適用して下さい。
|
||||
理由:インスタンスにログインできない、トゥートができない等の問題を修正しています。
|
||||
TheDeskはマルチカラム,マルチアカウントはもちろんのこと,なにかとマストドンライフをシンプルに効率化するクライアントです。
|
||||
https://thedesk.top
|
|
@ -26,7 +26,7 @@
|
|||
<script type="text/javascript" src="./js/ui/jquery-ui.min.js"></script>
|
||||
<script>
|
||||
//必ずアプデ時のremove instance消して!
|
||||
var ver="Mizuki (ver.6)";
|
||||
var ver="Mizuki (ver.7)";
|
||||
//betaを入れるとバージョンチェックしない
|
||||
//var ver="beta";
|
||||
var acct_id=0;
|
||||
|
@ -336,7 +336,8 @@ var tlid=0;
|
|||
<input type="text" id="cw-text" placeholder="警告文" class="mize">
|
||||
</div>
|
||||
<div class="col s1 mize" style="padding:0;">
|
||||
<i class="material-icons pointer" onclick="fileselect()" title="ファイルを選択">photo_library</i>
|
||||
<span id="imgup"></span>
|
||||
<span id="imgsel"><i class="material-icons pointer" onclick="fileselect()" title="ファイルを選択">photo_library</i><span id="imgup"></span>
|
||||
</div>
|
||||
<div class="col s3 mize">
|
||||
<button class="btn waves-effect blue darken-3" style="width:100%; padding:0; margin-top:0;" id="cw" onclick="cw()" title="コンテンツワーニング(トゥートを表示する前にメッセージで隠す)(青:OFF)">CW</button>
|
||||
|
@ -448,18 +449,18 @@ var tlid=0;
|
|||
<ul class="collapsible" data-collapsible="accordion" id="det-col">
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<i class="material-icons">arrow_upward</i>これよりあとのコンテクスト
|
||||
</div>
|
||||
<div class="collapsible-body toot-reset" id="toot-after">
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<i class="material-icons">reply_all</i>このトゥートからのリプライ
|
||||
<i class="material-icons">arrow_upward</i>これより前の会話
|
||||
</div>
|
||||
<div class="collapsible-body toot-reset" id="toot-reply">
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="collapsible-header">
|
||||
<i class="material-icons">arrow_downward</i>これよりあとの会話
|
||||
</div>
|
||||
<div class="collapsible-body toot-reset" id="toot-after">
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class="collapsible-header" id="activator">
|
||||
<i class="material-icons">more_horiz</i>対象のトゥート
|
||||
|
@ -537,7 +538,7 @@ var tlid=0;
|
|||
<span class="cbadge">フォロワー:
|
||||
<span id="his-follower"></span>
|
||||
</span>
|
||||
<span class="cbadge">Since:
|
||||
<span class="cbadge" style="max-width:150px; width:150px; ">Since:
|
||||
<span id="his-since"></span>
|
||||
</div>
|
||||
<div class="his-float">
|
||||
|
|
|
@ -12,34 +12,36 @@ input.addEventListener("focus", function() {
|
|||
timer = window.setInterval(function() {
|
||||
var new_val = input.value;
|
||||
if (prev_val != new_val) {
|
||||
if(new_val.length > 3){
|
||||
var start = "https://instances.social/api/1.0/instances/search?q=" + new_val;
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer tC8F6xWGWBUwGScyNevYlx62iO6fdQ4oIK0ad68Oo7ZKB8GQdGpjW9TKxBnIh8grAhvd5rw3iyP9JPamoDpeLQdz62EToPJUW99hDx8rfuJfGdjQuimZPTbIOx0woA5M'
|
||||
},
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
console.log(json);
|
||||
if (!json.error) {
|
||||
|
||||
var urls="もしかして:";
|
||||
Object.keys(json.instances).forEach(function(key) {
|
||||
var url = json.instances[key];
|
||||
urls = urls + ' <a onclick="login(\'' + url.name + '\')" class="pointer">' + url.name + '</a> ';
|
||||
if (new_val.length > 3) {
|
||||
var start = "https://instances.social/api/1.0/instances/search?q=" +
|
||||
new_val;
|
||||
fetch(start, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer tC8F6xWGWBUwGScyNevYlx62iO6fdQ4oIK0ad68Oo7ZKB8GQdGpjW9TKxBnIh8grAhvd5rw3iyP9JPamoDpeLQdz62EToPJUW99hDx8rfuJfGdjQuimZPTbIOx0woA5M'
|
||||
},
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
console.log(json);
|
||||
if (!json.error) {
|
||||
|
||||
var urls = "もしかして:";
|
||||
Object.keys(json.instances).forEach(function(key) {
|
||||
var url = json.instances[key];
|
||||
urls = urls + ' <a onclick="login(\'' + url.name +
|
||||
'\')" class="pointer">' + url.name + '</a> ';
|
||||
});
|
||||
$("#ins-suggest").html(urls);
|
||||
}
|
||||
});
|
||||
$("#ins-suggest").html(urls);
|
||||
}
|
||||
});
|
||||
}
|
||||
oldSuggest = suggest;
|
||||
prev_value = new_val;
|
||||
oldSuggest = suggest;
|
||||
prev_value = new_val;
|
||||
}
|
||||
}, 1000);
|
||||
}, false);
|
||||
|
|
|
@ -106,24 +106,21 @@ function login(url) {
|
|||
}
|
||||
localStorage.setItem("redirect", red);
|
||||
var start = "https://" + url + "/api/v1/apps";
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
scopes: 'read write follow',
|
||||
client_name: "TheDesk(PC)",
|
||||
redirect_uris: red,
|
||||
website: "https://thedesk.top"
|
||||
})
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
var auth = "https://" + url + "/oauth/authorize?client_id=" + json[
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreq.responseType = 'json';
|
||||
httpreq.send(JSON.stringify({
|
||||
scopes: 'read write follow',
|
||||
client_name: "TheDesk(PC)",
|
||||
redirect_uris: red,
|
||||
website: "https://thedesk.top"
|
||||
}));
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState == 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(json);
|
||||
var auth = "https://" + url + "/oauth/authorize?client_id=" + json[
|
||||
"client_id"] + "&client_secret=" + json["client_secret"] +
|
||||
"&response_type=code&redirect_uri="+red+"&scope=read+write+follow";
|
||||
localStorage.setItem("domain_" + acct_id, url);
|
||||
|
@ -143,8 +140,8 @@ function login(url) {
|
|||
var ipc = electron.ipcRenderer;
|
||||
ipc.send('quit', 'go');
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//テキストボックスにURL入れた
|
||||
|
|
|
@ -153,45 +153,42 @@ function login(url) {
|
|||
}
|
||||
localStorage.setItem("redirect", red);
|
||||
var start = "https://" + url + "/api/v1/apps";
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
scopes: 'read write follow',
|
||||
client_name: "TheDesk(PC)",
|
||||
redirect_uris: red,
|
||||
website: "https://thedesk.top"
|
||||
})
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
console.log(json);
|
||||
var auth = "https://" + url + "/oauth/authorize?client_id=" + json[
|
||||
"client_id"] + "&client_secret=" + json["client_secret"] +
|
||||
"&response_type=code&scope=read+write+follow&redirect_uri="+red;
|
||||
localStorage.setItem("domain_tmp", url);
|
||||
localStorage.setItem("client_id", json["client_id"]);
|
||||
localStorage.setItem("client_secret", json["client_secret"]);
|
||||
$("#auth").show();
|
||||
$("#add").hide();
|
||||
const {
|
||||
shell
|
||||
} = require('electron');
|
||||
|
||||
shell.openExternal(auth);
|
||||
var electron = require("electron");
|
||||
var ipc = electron.ipcRenderer;
|
||||
if($('#linux:checked').val()=="on"){
|
||||
}else{
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreq.responseType = 'json';
|
||||
httpreq.send(JSON.stringify({
|
||||
scopes: 'read write follow',
|
||||
client_name: "TheDesk(PC)",
|
||||
redirect_uris: red,
|
||||
website: "https://thedesk.top"
|
||||
}));
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState == 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(json);
|
||||
var auth = "https://" + url + "/oauth/authorize?client_id=" + json[
|
||||
"client_id"] + "&client_secret=" + json["client_secret"] +
|
||||
"&response_type=code&scope=read+write+follow&redirect_uri=" + red;
|
||||
localStorage.setItem("domain_tmp", url);
|
||||
localStorage.setItem("client_id", json["client_id"]);
|
||||
localStorage.setItem("client_secret", json["client_secret"]);
|
||||
$("#auth").show();
|
||||
$("#add").hide();
|
||||
const {
|
||||
shell
|
||||
} = require('electron');
|
||||
|
||||
shell.openExternal(auth);
|
||||
var electron = require("electron");
|
||||
var ipc = electron.ipcRenderer;
|
||||
if ($('#linux:checked').val() == "on") {} else {
|
||||
ipc.send('quit', 'go');
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//テキストボックスにURL入れた
|
||||
|
@ -211,30 +208,28 @@ function code(code) {
|
|||
var start = "https://" + url + "/oauth/token";
|
||||
var id = localStorage.getItem("client_id");
|
||||
var secret = localStorage.getItem("client_secret");
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
grant_type: "authorization_code",
|
||||
redirect_uri: "urn:ietf:wg:oauth:2.0:oob",
|
||||
client_id: id,
|
||||
client_secret: secret,
|
||||
code: code
|
||||
})
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
if (json["access_token"]) {
|
||||
$("#auth").hide();
|
||||
$("#add").show();
|
||||
getdata(url, json["access_token"]);
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('POST', start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreq.responseType = 'json';
|
||||
httpreq.send(JSON.stringify({
|
||||
grant_type: "authorization_code",
|
||||
redirect_uri: "urn:ietf:wg:oauth:2.0:oob",
|
||||
client_id: id,
|
||||
client_secret: secret,
|
||||
code: code
|
||||
}));
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState == 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(json);
|
||||
if (json["access_token"]) {
|
||||
$("#auth").hide();
|
||||
$("#add").show();
|
||||
getdata(url, json["access_token"]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//ユーザーデータ取得
|
||||
|
|
|
@ -106,4 +106,16 @@ function nano(){
|
|||
var electron = require("electron");
|
||||
var ipc = electron.ipcRenderer;
|
||||
ipc.send('nano', "");
|
||||
}
|
||||
}
|
||||
function progshow(e) {
|
||||
if (e.lengthComputable) {
|
||||
var percent = e.loaded / e.total;
|
||||
console.log(percent * 100);
|
||||
$("#imgsel").hide();
|
||||
if(percent<1){
|
||||
$("#imgup").text(Math.floor(percent*100)+"%");
|
||||
}else{
|
||||
$("#imgup").text("処理中");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -101,48 +101,47 @@ function media(b64, type, no) {
|
|||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem(domain + "_at");
|
||||
var start = "https://" + domain + "/api/v1/media";
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
body: fd
|
||||
}).then(function(response) {
|
||||
console.log(response)
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
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;">';
|
||||
$('#preview').append(html);
|
||||
} else {
|
||||
$('#preview').append("プレビューできません");
|
||||
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);
|
||||
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;">';
|
||||
$('#preview').append(html);
|
||||
} else {
|
||||
$('#preview').append("プレビューできません");
|
||||
}
|
||||
if (!img) {
|
||||
var img = "no-act";
|
||||
}
|
||||
if (img != "inline") {
|
||||
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"])
|
||||
}
|
||||
todc();
|
||||
$("#toot-post-btn").prop("disabled", false);
|
||||
$("#post-acct-sel").prop("disabled", true);
|
||||
$('select').material_select();
|
||||
$("#mec").text("あり");
|
||||
Materialize.toast("ファイルアップロード後はアカウントを切り替えられません。", 1000);
|
||||
$("#imgup").text("");
|
||||
$("#imgsel").show();
|
||||
localStorage.removeItem("image");
|
||||
}
|
||||
if (!img) {
|
||||
var img = "no-act";
|
||||
}
|
||||
if (img != "inline") {
|
||||
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"])
|
||||
}
|
||||
todc();
|
||||
$("#toot-post-btn").prop("disabled", false);
|
||||
$("#post-acct-sel").prop("disabled", true);
|
||||
$('select').material_select();
|
||||
$("#mec").text("あり");
|
||||
Materialize.toast("ファイルアップロード後はアカウントを切り替えられません。", 1000);
|
||||
localStorage.removeItem("image");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//Base64からBlobへ
|
||||
|
@ -162,4 +161,38 @@ function toBlob(base64, type) {
|
|||
}
|
||||
|
||||
return blob;
|
||||
}
|
||||
}
|
||||
//画像を貼り付けたら…
|
||||
var element = document.querySelector("#textarea");
|
||||
element.addEventListener("paste", function(e){
|
||||
// 画像の場合
|
||||
// e.clipboardData.types.length == 0
|
||||
// かつ
|
||||
// e.clipboardData.types[0] == "Files"
|
||||
// となっているので、それ以外を弾く
|
||||
if (!e.clipboardData
|
||||
|| !e.clipboardData.types
|
||||
|| (e.clipboardData.types.length != 1)
|
||||
|| (e.clipboardData.types[0] != "Files")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ファイルとして得る
|
||||
// (なぜかgetAsStringでは上手くいかなかった)
|
||||
var imageFile = e.clipboardData.items[0].getAsFile();
|
||||
|
||||
// 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=media.split(",").length;
|
||||
}
|
||||
media(base64, "image/png", i)
|
||||
};
|
||||
fr.readAsDataURL(imageFile);
|
||||
|
||||
// 画像以外がペーストされたときのために、元に戻しておく
|
||||
});
|
|
@ -36,30 +36,27 @@ function post() {
|
|||
} else {
|
||||
var spo = "";
|
||||
}
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
body: JSON.stringify(toot)
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
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");
|
||||
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(JSON.stringify(toot));
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState == 4) {
|
||||
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");
|
||||
}
|
||||
todc();
|
||||
clear();
|
||||
}
|
||||
todc();
|
||||
clear();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//クリア(Shift+C)
|
||||
|
|
|
@ -9,48 +9,44 @@ function fav(id, acct_id, remote) {
|
|||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem(domain + "_at");
|
||||
var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag;
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
body: JSON.stringify({})
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
console.log(json);
|
||||
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;
|
||||
//var fav = json.favourites_count;
|
||||
}
|
||||
}else{
|
||||
var fav = json.favourites_count;
|
||||
}
|
||||
$("[toot-id=" + id + "] .fav_ct").text(fav);
|
||||
if (!json.reblog) {
|
||||
} else {
|
||||
$("[toot-id=" + id + "] .rt_ct").text(fav);
|
||||
}
|
||||
if ($("[toot-id=" + id +"]").hasClass("faved")) {
|
||||
$("[toot-id=" + id +"]").removeClass("faved");
|
||||
$(".fav_" + id).removeClass("yellow-text");
|
||||
} else {
|
||||
$("[toot-id=" + id +"]").addClass("faved");
|
||||
$(".fav_" + id).addClass("yellow-text");
|
||||
}
|
||||
}else{
|
||||
Materialize.toast("お気に入り登録しました。インスタンスが違うときは時間がかかる場合があります。", 1000);
|
||||
}
|
||||
});
|
||||
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.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;
|
||||
//var fav = json.favourites_count;
|
||||
}
|
||||
}else{
|
||||
var fav = json.favourites_count;
|
||||
}
|
||||
$("[toot-id=" + id + "] .fav_ct").text(fav);
|
||||
if (!json.reblog) {
|
||||
} else {
|
||||
$("[toot-id=" + id + "] .rt_ct").text(fav);
|
||||
}
|
||||
if ($("[toot-id=" + id +"]").hasClass("faved")) {
|
||||
$("[toot-id=" + id +"]").removeClass("faved");
|
||||
$(".fav_" + id).removeClass("yellow-text");
|
||||
} else {
|
||||
$("[toot-id=" + id +"]").addClass("faved");
|
||||
$(".fav_" + id).addClass("yellow-text");
|
||||
}
|
||||
}else{
|
||||
Materialize.toast("お気に入り登録しました。インスタンスが違うときは時間がかかる場合があります。", 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//ブースト
|
||||
|
@ -63,44 +59,41 @@ function rt(id, acct_id, remote) {
|
|||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem(domain + "_at");
|
||||
var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag;
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
body: JSON.stringify({})
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
console.log(json);
|
||||
if(remote!="remote"){
|
||||
$("[toot-id=" + id + "] .fav_ct").text(json.favourites_count);
|
||||
if (!json.reblog) {
|
||||
if(flag=="unreblog"){
|
||||
var rt=json.reblogs_count - 1;
|
||||
}else{
|
||||
var rt=json.reblogs_count + 1;
|
||||
}
|
||||
$("[toot-id=" + id + "] .rt_ct").text(rt);
|
||||
} else {
|
||||
$("[toot-id=" + id + "] .rt_ct").text(json.reblog.reblogs_count);
|
||||
}
|
||||
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.onreadystatechange = function() {
|
||||
if (httpreq.readyState == 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(json);
|
||||
if (remote != "remote") {
|
||||
$("[toot-id=" + id + "] .fav_ct").text(json.favourites_count);
|
||||
if (!json.reblog) {
|
||||
if (flag == "unreblog") {
|
||||
var rt = json.reblogs_count - 1;
|
||||
} else {
|
||||
var rt = json.reblogs_count + 1;
|
||||
}
|
||||
$("[toot-id=" + id + "] .rt_ct").text(rt);
|
||||
} else {
|
||||
$("[toot-id=" + id + "] .rt_ct").text(json.reblog.reblogs_count);
|
||||
}
|
||||
|
||||
if ($("[toot-id=" + id +"]").hasClass("rted")) {
|
||||
$("[toot-id=" + id +"]").removeClass("rted");
|
||||
$(".rt_" + id).removeClass("teal-text");
|
||||
} else {
|
||||
$("[toot-id=" + id +"]").addClass("rted");
|
||||
$(".rt_" + id).addClass("teal-text");
|
||||
if ($("[toot-id=" + id + "]").hasClass("rted")) {
|
||||
$("[toot-id=" + id + "]").removeClass("rted");
|
||||
$(".rt_" + id).removeClass("teal-text");
|
||||
} else {
|
||||
$("[toot-id=" + id + "]").addClass("rted");
|
||||
$(".rt_" + id).addClass("teal-text");
|
||||
}
|
||||
} else {
|
||||
Materialize.toast("ブーストしました。インスタンスが違うときは時間がかかる場合があります。", 1000);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
Materialize.toast("ブーストしました。インスタンスが違うときは時間がかかる場合があります。", 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//フォロー
|
||||
|
@ -129,27 +122,25 @@ function follow(acct_id,remote) {
|
|||
var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
|
||||
var ent={}
|
||||
}
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
body: JSON.stringify(ent)
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
if ($("#his-data").hasClass("following")) {
|
||||
$("#his-data").removeClass("following");
|
||||
$("#his-follow-btn").text("フォロー");
|
||||
} else {
|
||||
$("#his-data").addClass("following");
|
||||
$("#his-follow-btn").text("フォロー解除");
|
||||
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.onreadystatechange = function() {
|
||||
if (httpreq.readyState == 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(json);
|
||||
if ($("#his-data").hasClass("following")) {
|
||||
$("#his-data").removeClass("following");
|
||||
$("#his-follow-btn").text("フォロー");
|
||||
} else {
|
||||
$("#his-data").addClass("following");
|
||||
$("#his-follow-btn").text("フォロー解除");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//ブロック
|
||||
|
@ -166,27 +157,23 @@ function block(acct_id) {
|
|||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem(domain + "_at");
|
||||
var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
body: JSON.stringify({})
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
if ($("#his-data").hasClass("blocking")) {
|
||||
$("#his-data").removeClass("blocking");
|
||||
$("#his-block-btn").text("ブロック");
|
||||
} else {
|
||||
$("#his-data").addClass("blocking");
|
||||
$("#his-block-btn").text("ブロック解除");
|
||||
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.onreadystatechange = function() {
|
||||
if (httpreq.readyState == 4) {
|
||||
if ($("#his-data").hasClass("blocking")) {
|
||||
$("#his-data").removeClass("blocking");
|
||||
$("#his-block-btn").text("ブロック");
|
||||
} else {
|
||||
$("#his-data").addClass("blocking");
|
||||
$("#his-block-btn").text("ブロック解除");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//ミュート
|
||||
|
@ -203,27 +190,23 @@ function mute(acct_id) {
|
|||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem(domain + "_at");
|
||||
var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
body: JSON.stringify({})
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
if ($("#his-data").hasClass("muting")) {
|
||||
$("#his-data").removeClass("muting");
|
||||
$("#his-mute-btn").text("ミュート");
|
||||
} else {
|
||||
$("#his-data").addClass("muting");
|
||||
$("#his-mute-btn").text("ミュート解除");
|
||||
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.onreadystatechange = function() {
|
||||
if (httpreq.readyState == 4) {
|
||||
if ($("#his-data").hasClass("muting")) {
|
||||
$("#his-data").removeClass("muting");
|
||||
$("#his-mute-btn").text("ミュート");
|
||||
} else {
|
||||
$("#his-data").addClass("muting");
|
||||
$("#his-mute-btn").text("ミュート解除");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//投稿削除
|
||||
|
@ -231,21 +214,16 @@ function del(id, acct_id) {
|
|||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem(domain + "_at");
|
||||
var start = "https://" + domain + "/api/v1/statuses/" + id;
|
||||
fetch(start, {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
//ここで消さなくてもStreamingが消す
|
||||
//$("#pub_"+id).hide();
|
||||
});
|
||||
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) {
|
||||
}
|
||||
}
|
||||
}
|
||||
//ピン留め
|
||||
function pin(id, acct_id) {
|
||||
|
@ -257,28 +235,25 @@ function pin(id, acct_id) {
|
|||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem(domain + "_at");
|
||||
var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag;
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
body: JSON.stringify({})
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
console.log(json);
|
||||
if ($("[toot-id=" + id +"]").hasClass("pined")) {
|
||||
$("[toot-id=" + id +"]").removeClass("pined");
|
||||
$(".pin_" + id).removeClass("blue-text");
|
||||
} else {
|
||||
$("[toot-id=" + id +"]").addClass("pined");
|
||||
$(".pin_" + id).addClass("blue-text");
|
||||
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) {
|
||||
var json = httpreq.response;
|
||||
console.log(json);
|
||||
if ($("[toot-id=" + id + "]").hasClass("pined")) {
|
||||
$("[toot-id=" + id + "]").removeClass("pined");
|
||||
$(".pin_" + id).removeClass("blue-text");
|
||||
} else {
|
||||
$("[toot-id=" + id + "]").addClass("pined");
|
||||
$(".pin_" + id).addClass("blue-text");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//フォロリク
|
||||
|
@ -286,21 +261,19 @@ function request(id, flag, acct_id) {
|
|||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem(domain + "_at");
|
||||
var start = "https://" + domain + "/api/v1/follow_requests/" + id + "/" + flag;
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
body: JSON.stringify({})
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
showReq();
|
||||
});
|
||||
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.onreadystatechange = function() {
|
||||
if (httpreq.readyState == 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(json);
|
||||
showReq();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//ドメインブロック(未実装)
|
||||
|
@ -311,23 +284,19 @@ function domainblock(add, flag, acct_id) {
|
|||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem(domain + "_at");
|
||||
var start = "https://" + domain + "/api/v1/domain_blocks"
|
||||
fetch(start, {
|
||||
method: flag,
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
body: JSON.stringify({
|
||||
domain: add
|
||||
})
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
showDom();
|
||||
});
|
||||
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.onreadystatechange = function() {
|
||||
if (httpreq.readyState == 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(json);
|
||||
showDom();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addDomainblock() {
|
||||
|
|
|
@ -51,24 +51,21 @@ function makeNewList(){
|
|||
var at = localStorage.getItem(domain + "_at");
|
||||
var start = "https://" + domain + "/api/v1/lists"
|
||||
console.log(start)
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
body: JSON.stringify({
|
||||
title: text
|
||||
})
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
list();
|
||||
$("#list-add").val("")
|
||||
});
|
||||
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(JSON.stringify({
|
||||
title: text
|
||||
}));
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState == 4) {
|
||||
var json = httpreq.response;
|
||||
list();
|
||||
$("#list-add").val("")
|
||||
}
|
||||
}
|
||||
}
|
||||
function listShow(id,title,acct_id){
|
||||
localStorage.setItem("list_"+id+"_"+acct_id,title);
|
||||
|
@ -164,44 +161,38 @@ function listAdd(id,user,acct_id){
|
|||
var at = localStorage.getItem(domain + "_at");
|
||||
var start = "https://" + domain + "/api/v1/lists/"+id+"/accounts"
|
||||
console.log(start)
|
||||
fetch(start, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
body: JSON.stringify({
|
||||
account_ids: [user]
|
||||
})
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
hisList(user,acct_id)
|
||||
});
|
||||
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(JSON.stringify({
|
||||
account_ids: [user]
|
||||
}));
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState == 4) {
|
||||
var json = httpreq.response;
|
||||
hisList(user,acct_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
function listRemove(id,user,acct_id){
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem(domain + "_at");
|
||||
var start = "https://" + domain + "/api/v1/lists/"+id+"/accounts"
|
||||
console.log(start)
|
||||
fetch(start, {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
body: JSON.stringify({
|
||||
account_ids: [user]
|
||||
})
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
hisList(user,acct_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(JSON.stringify({
|
||||
account_ids: [user]
|
||||
}));
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState == 4) {
|
||||
var json = httpreq.response;
|
||||
hisList(user,acct_id)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -320,36 +320,7 @@ element.onmousewheel = function(e) {
|
|||
zoom(0.9)
|
||||
}
|
||||
}
|
||||
//画像を貼り付けたら…
|
||||
var element = document.querySelector("#textarea");
|
||||
element.addEventListener("paste", function(e){
|
||||
// 画像の場合
|
||||
// e.clipboardData.types.length == 0
|
||||
// かつ
|
||||
// e.clipboardData.types[0] == "Files"
|
||||
// となっているので、それ以外を弾く
|
||||
if (!e.clipboardData
|
||||
|| !e.clipboardData.types
|
||||
|| (e.clipboardData.types.length != 1)
|
||||
|| (e.clipboardData.types[0] != "Files")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ファイルとして得る
|
||||
// (なぜかgetAsStringでは上手くいかなかった)
|
||||
var imageFile = e.clipboardData.items[0].getAsFile();
|
||||
|
||||
// FileReaderで読み込む
|
||||
var fr = new FileReader();
|
||||
fr.onload = function(e) {
|
||||
// onload内ではe.target.resultにbase64が入っているのであとは煮るなり焼くなり
|
||||
var base64 = e.target.result;
|
||||
beforeMedia(base64,"image/png");
|
||||
};
|
||||
fr.readAsDataURL(imageFile);
|
||||
|
||||
// 画像以外がペーストされたときのために、元に戻しておく
|
||||
});
|
||||
//当該トゥート
|
||||
function detFromImg(){
|
||||
var id=$("#imagemodal").attr("data-id");
|
||||
|
|
|
@ -8,26 +8,21 @@ function profedit() {
|
|||
var start = "https://" + domain + "/api/v1/accounts/update_credentials";
|
||||
var name = $("#his-name-val").val();
|
||||
var des = $("#his-des-val").val();
|
||||
fetch(start, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
body: JSON.stringify({
|
||||
display_name: name,
|
||||
note: des
|
||||
})
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
console.log(json);
|
||||
$('#his-data').modal('close');
|
||||
todc();
|
||||
});
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('PATCH', start, true);
|
||||
httpreq.setRequestHeader('Content-Type', 'application/json');
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreq.responseType = 'json';
|
||||
httpreq.send(JSON.stringify({
|
||||
display_name: name,
|
||||
note: des
|
||||
}));
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState == 4) {
|
||||
$('#his-data').modal('close');
|
||||
todc();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//画像系
|
||||
|
@ -48,23 +43,21 @@ function imgChange(imgfile, target) {
|
|||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
var at = localStorage.getItem(domain + "_at");
|
||||
var start = "https://" + domain + "/api/v1/accounts/update_credentials";
|
||||
fetch(start, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + at
|
||||
},
|
||||
body: fd
|
||||
}).then(function(response) {
|
||||
console.log(response)
|
||||
return response.json();
|
||||
}).catch(function(error) {
|
||||
todo(error);
|
||||
console.error(error);
|
||||
}).then(function(json) {
|
||||
console.log(json);
|
||||
$('#his-data').modal('close');
|
||||
todc();
|
||||
});
|
||||
var httpreq = new XMLHttpRequest();
|
||||
httpreq.open('PATCH', start, true);
|
||||
httpreq.upload.addEventListener("progress", progshow, false);
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
|
||||
httpreq.responseType = 'json';
|
||||
httpreq.send(fd);
|
||||
httpreq.onreadystatechange = function() {
|
||||
if (httpreq.readyState == 4) {
|
||||
var json = httpreq.response;
|
||||
console.log(json);
|
||||
$('#his-data').modal('close');
|
||||
todc();
|
||||
localStorage.removeItem("image");
|
||||
}
|
||||
}
|
||||
}
|
||||
$("#prof-change").html($("#prof-change").html());
|
||||
$("#header-change").html($("#header-change").html());
|
||||
|
|
|
@ -96,7 +96,18 @@ function udg(user, acct_id) {
|
|||
$("#his-follow").text(json.following_count);
|
||||
$("#his-follower").text(json.followers_count);
|
||||
$("#his-since").text(crat(json.created_at));
|
||||
$("#his-des").html(json.note);
|
||||
if(json.fields){
|
||||
var note=json.note+'My Fields<br><table class="responsive-table">'
|
||||
for(var i=0;i<json.fields.length;i++){
|
||||
var fname=json.fields[i].name;
|
||||
var fval=json.fields[i].value;
|
||||
note=note+'<tr><td>'+fname+'</td><td>'+fval+'</td></tr>';
|
||||
}
|
||||
note=note+'</table>'
|
||||
$("#his-des").html(note);
|
||||
}else{
|
||||
$("#his-des").html(json.note);
|
||||
}
|
||||
$('#his-data').css('background-size', 'cover');
|
||||
localStorage.setItem("history" , user);
|
||||
//自分の時
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "TheDesk",
|
||||
"version": "14.6.0",
|
||||
"version": "14.7.0",
|
||||
"description": "TheDesk on Mastodonはシンプルと多機能を両立したデスクトップ向けクライアントです",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
2
ver.json
2
ver.json
|
@ -1 +1 @@
|
|||
{"warn":"これはGCPにアップして下さい!!","warn2":"これはGCPにアップして下さい!!","warn3":"これはGCPにアップして下さい!!","desk":"Mizuki (ver.5[fixed])","date":"2018-04-10","detail":"内部V:14.5.1|画像添付バグ・ユーザーデータ表示バグ等を修正"}
|
||||
{"warn":"これはGCPにアップして下さい!!","warn2":"これはGCPにアップして下さい!!","warn3":"これはGCPにアップして下さい!!","desk":"Mizuki (ver.7)","date":"2018-04-17","detail":"内部V:14.7.0|バグ修正・内部構成の変更"}
|
Loading…
Reference in New Issue
Block a user