TheDesk Airi (ver.8)

This commit is contained in:
cutls
2018-03-21 14:36:02 +09:00
parent d6acb0bebc
commit a84a1da29b
20 changed files with 214 additions and 84 deletions

View File

@@ -42,6 +42,20 @@ $(function($) {
}
}
}
//Ctrl+Sift+C:全消し
if (event.ctrlKey && event.shiftKey) {
if (e.keyCode === 67) {
clear();
return false;
}
}
//Ctrl+Sift+N:NowPlaying
if (event.ctrlKey && event.shiftKey) {
if (e.keyCode === 78) {
nowplaying()
return false;
}
}
//input/textareaにフォーカスなし時
if (!hasFocus && !hasFocus2) {
//X:開閉
@@ -74,10 +88,24 @@ $(function($) {
return false;
}
}
//Sift+C:全消し
if (event.shiftKey) {
if (e.keyCode === 67) {
clear();
//Ctrl+Sift+S:設定
if (event.ctrlKey && event.shiftKey) {
if (e.keyCode === 83) {
location.href = "setting.html";
return false;
}
}
//Ctrl+Sift+M:アカマネ
if (event.ctrlKey && event.shiftKey) {
if (e.keyCode === 77) {
location.href = "acct.html";
return false;
}
}
//Ctrl+Sift+P:プロフ
if (event.ctrlKey && event.shiftKey) {
if (e.keyCode === 80) {
profShow()
return false;
}
}

View File

@@ -377,9 +377,10 @@ function multi() {
'" class="left circle" ' + sel + '>' + acct.user + '@' + acct.domain +
'</option>';
$(".acct-sel").append(templete);
$("#src-acct-sel").append('<option value="tootsearch">Tootsearch</option>');
$('select').material_select('update');
});
$("#src-acct-sel").append('<option value="tootsearch">Tootsearch</option>');
$('select').material_select('update');
}
//バージョンエンコ

View File

@@ -93,4 +93,4 @@ function nano(){
var electron = require("electron");
var ipc = electron.ipcRenderer;
ipc.send('nano', "");
}
}

View File

@@ -16,9 +16,9 @@ function mdCheck(){
}
var domain = localStorage.getItem("domain_" + acct_id);
if(domain=="mstdn.y-zu.org"){
//$("#private-button").text("限定公開(Yづドン!)");
$("#private-button").text("限定公開(Yづドン!)");
}else{
//$("#private-button").text("非公開(Private)");
$("#private-button").text("非公開(Private)");
}
}
//BOXのトグルボタン

View File

@@ -26,7 +26,7 @@ function post() {
var nsfw = "false";
}
var vis = $("#vis").text();
if(vis!="public"){
if(vis!="inherit"){
toot.visibility=vis;
}
if ($("#cw").hasClass("cw-avail")) {

View File

@@ -9,4 +9,11 @@ function re(id,at,acct_id,mode){
$('select').material_select();
$("#textarea").attr("placeholder","返信モードです。クリアするときはShift+Cを押してください。");
vis(mode);
}
function reEx(id){
$('#tootmodal').modal('close');
var at=$("#tootmodal").attr("data-user");
var acct_id = $("#status-acct-sel").val();
var mode=$("#tootmodal .vis-data").attr("data-vis");
re(id,at,acct_id,mode);
}

View File

@@ -1,6 +1,6 @@
//お気に入り登録やブースト等、フォローやブロック等
//お気に入り登録
function fav(id, acct_id) {
function fav(id, acct_id, remote) {
if ($("#pub_" + id).hasClass("faved")) {
var flag = "unfavourite";
} else {
@@ -23,6 +23,7 @@ function fav(id, acct_id) {
console.error(error);
}).then(function(json) {
console.log(json);
if(!remote){
//APIのふぁぼカウントがおかしい
if ($("[toot-id=" + id + "] .fav_ct").text() == json.favourites_count){
if(flag=="unfavourite"){
@@ -46,11 +47,14 @@ function fav(id, acct_id) {
$("[toot-id=" + id +"]").addClass("faved");
$(".fav_" + id).addClass("yellow-text");
}
}else{
Materialize.toast("お気に入り登録しました。インスタンスが違うときは時間がかかる場合があります。", 1000);
}
});
}
//ブースト
function rt(id, acct_id) {
function rt(id, acct_id, remote) {
if ($("#pub_" + id).hasClass("rted")) {
var flag = "unreblog";
} else {
@@ -73,6 +77,7 @@ function rt(id, acct_id) {
console.error(error);
}).then(function(json) {
console.log(json);
if(!remote){
$("[toot-id=" + id + "] .fav_ct").text(json.favourites_count);
if (!json.reblog) {
if(flag=="unreblog"){
@@ -92,21 +97,28 @@ function rt(id, acct_id) {
$("[toot-id=" + id +"]").addClass("rted");
$(".rt_" + id).addClass("teal-text");
}
}else{
Materialize.toast("ブーストしました。インスタンスが違うときは時間がかかる場合があります。", 1000);
}
});
}
//フォロー
function follow(acct_id) {
if (!acct_id) {
function follow(acct_id,remote) {
if (!acct_id && acct_id!="selector") {
var acct_id = $('#his-data').attr("use-acct");
}else if (acct_id=="selector") {
var acct_id = $("#user-acct-sel").val();
}
var id = $("#his-data").attr("user-id");
var remote = $("#his-data").attr("remote");
if ($("#his-data").hasClass("following")) {
if (!remote && $("#his-data").hasClass("following")) {
var flag = "unfollow";
} else {
var flag = "follow";
}
var id = $("#his-data").attr("user-id");
if(!remote){
var remote = $("#his-data").attr("remote");
}
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem(domain + "_at");
if(remote=="true" && flag=="follow"){
@@ -352,4 +364,35 @@ function empUser(){
function tootUriCopy(url){
execCopy(url);
Materialize.toast("トゥートURLをコピーしました", 1500);
}
//他のアカウントで…
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(domain + "_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) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
var id=json.statuses[0].id;
if(mode=="rt"){
rt(id, acct_id, 'remote')
}else if(mode=="fav"){
fav(id, acct_id, 'remote')
}else if(mode=="reply"){
reEx(id)
}
});
return;
}

View File

@@ -3,28 +3,6 @@ function details(id, acct_id, tlid) {
$(".toot-reset").html("データなし");
var html = $("#timeline_"+tlid+" #pub_" + id).html();
$("#toot-this").html(html);
if(!$("#timeline_"+tlid+" #pub_" + id).length){
console.log("API Using");
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem(domain + "_at");
var start = "https://" + domain + "/api/v1/statuses/" + id;
fetch(start, {
method: 'GET',
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) {
var html = parse([json]);
$("#toot-this").html(html);
jQuery("time.timeago").timeago();
});
}
$('#tootmodal').modal('open');
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem(domain + "_at");
@@ -41,10 +19,20 @@ function details(id, acct_id, tlid) {
todo(error);
console.error(error);
}).then(function(json) {
if(!$("#timeline_"+tlid+" #pub_" + id).length){
var html = parse([json]);
$("#toot-this").html(html);
jQuery("time.timeago").timeago();
}
$("#toot-this .fav_ct").text(json.favourites_count);
$("#toot-this .rt_ct").text(json.reblogs_count);
$("#tootmodal").attr("data-url",json.url);
$("#tootmodal").attr("data-id",json.id);
if(json.account.acct==json.account.username){
$("#tootmodal").attr("data-user",json.account.acct+"@"+domain);
}else{
$("#tootmodal").attr("data-user",json.account.acct);
}
if (json.in_reply_to_id) {
replyTL(json.in_reply_to_id, acct_id);
}

View File

@@ -306,19 +306,19 @@ function parse(obj, mix, acct_id, tlid, popup) {
var visen = toot.visibility;
if (visen == "public") {
var vis =
'<i class="text-darken-3 material-icons gray sml" title="公開">public</i>';
'<i class="text-darken-3 material-icons gray sml vis-data" title="公開" data-vis="public">public</i>';
var can_rt = "";
} else if (visen == "unlisted") {
var vis =
'<i class="text-darken-3 material-icons blue-text" title="未収載">lock_open</i>';
'<i class="text-darken-3 material-icons blue-text vis-data" title="未収載" data-vis="unlisted">lock_open</i>';
var can_rt = "";
} else if (visen == "plivate") {
var vis =
'<i class="text-darken-3 material-icons orange-text" title="非公開">lock</i>';
'<i class="text-darken-3 material-icons orange-text vis-data" title="非公開" data-vis="private">lock</i>';
var can_rt = "hide";
} else if (visen == "direct") {
var vis =
'<i class="text-darken-3 material-icons red-text" title="ダイレクト">mail</i>';
'<i class="text-darken-3 material-icons red-text vis-data" title="ダイレクト" data-vis="direct">mail</i>';
var can_rt = "hide";
}
if (toot.account.acct == localStorage.getItem("user_" + acct_id)) {

View File

@@ -1,3 +1,12 @@
//タグ表示
if(location.search){
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/);
var mode=m[1];
var codex=m[2];
if(mode=="tag"){
tl('tag',decodeURI(codex),0,'add');
}
}
//よく使うタグ
function tagShow(tag){
$("[data-tag="+tag+"]").toggleClass("hide");

View File

@@ -87,7 +87,7 @@
')" class="setting nex" title="このアカウントの'+unique_notf+'"><i class="material-icons waves-effect nex notf-icon_' +
acct.domain + '">notifications</i></a></div>'+
'<div class="area-a2"><a onclick="removeColumn(' + key +
')" class="setting nex"><i class="material-icons waves-effect nex" title="このカラムを削除">remove_circle</i></a></div>'+
')" class="setting nex"><i class="material-icons waves-effect nex" title="このカラムを削除">cancel</i></a></div>'+
'<div class="area-a3"><a onclick="mediaToggle(' + key +
')" class="setting nex"><i class="material-icons waves-effect nex" title="メディアフィルター">perm_media</i><span id="sta-media-' +
key + '">On</span></div>'+
@@ -157,6 +157,7 @@
var json = JSON.stringify(obj);
localStorage.setItem("column", json);
parseColumn();
sortload()
}
})
}

View File

@@ -190,7 +190,7 @@ function load() {
var size = localStorage.getItem("size");
if (!size) {
var size = "15";
var size = "13";
}
$("#size").val(size);

View File

@@ -10,7 +10,8 @@ function sortload(){
if(localStorage.getItem("card_" + key)=="true"){
flag="true"
}
var html='<li class="drag-content" data-id="'+key+'" data-flag="'+flag+'">'+localStorage.getItem("domain_" + acct.domain)+" "+cap(acct.type, acct.data)+' TL</li>';
var html='<li class="drag-content" data-id="'+key+'" data-flag="'+flag+'">'+localStorage.getItem("domain_" + acct.type)+localStorage.getItem("domain_" + acct.domain)+" "+cap(acct.type, acct.data)+' TL <a onclick="removeColumn(' + key +
')" class="setting nex"><i class="material-icons waves-effect nex" title="このカラムを削除">cancel</i></a></li>';
$("#sort").append(html);
});
drag();

View File

@@ -6,9 +6,30 @@ if(location.search){
var mode=m[1];
var codex=m[2];
if(mode=="user"){
udg(codex,0);
udgEx(codex,0);
}
}
function udgEx(user,acct_id){
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem(domain + "_at");
var start = "https://" + domain + "/api/v1/search?resolve=true&q="+user
fetch(start, {
method: 'GET',
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) {
var id=json.accounts[0].id;
udg(id,0);
});
return;
}
function udg(user, acct_id) {
reset();
if (!user) {
@@ -90,9 +111,11 @@ function udg(user, acct_id) {
$("#his-domain-btn").hide();
$("#his-emp-btn").hide();
$(".only-my-data").show();
$(".only-his-data").hide();
} else {
relations(user, acct_id);
$(".only-my-data").hide();
$(".only-his-data").show();
}
}
todc();