TheDesk Miho (ver.5)

This commit is contained in:
cutls 2018-01-31 01:43:01 +09:00
parent afc5721ffe
commit 3dcc1d7581
18 changed files with 234 additions and 154 deletions

View File

@ -1,5 +1,5 @@
/*共通CSS*/
body{overflow:hidden;}
.btn {
margin: 5px;
text-transform: none;
@ -161,7 +161,7 @@ blockquote:before, .quote:before {
/*スクロールバー*/
::-webkit-scrollbar {
width: 5px;
height: 10px;
height: 5px;
background: rgba(0, 0, 0, 0.05);
}
::-webkit-scrollbar-track {

View File

@ -1,6 +1,6 @@
/*トゥートボックス向けCSS*/
#post-box {
position: absolute;
position: fixed;
right: 3px;
bottom: 3px;
background-color: white;

View File

@ -8,12 +8,12 @@ iframe {
max-width:100%;
}
.box {
overflow-y: scroll;
overflow-x: hidden;
overflow-y: hidden;
min-width: 300px;
height: 100vh;
flex: 1;
}
.tl-box{ height:calc(100% - 40px); overflow-y:scroll; overflow-x:hidden }
@media screen and (max-width: 600px) {
#timeline-container {
display: block;
@ -77,12 +77,16 @@ p {
.udg {
cursor: pointer;
}
.notice {
top: -7px;
.notice-box {
top: 0;
background-color:white;
display: inline-block;
position: relative;
font-family: Open Sans;
margin-right: 10px;
width:100%;
z-index:1000;
height:60px;
}
#tools {
position: fixed;
@ -143,3 +147,6 @@ p {
.blacktheme .mention {
color: white;
}
.blacktheme .notice-box {
background-color: #333333;
}

View File

@ -23,7 +23,7 @@
<script type="text/javascript" src="./js/common/keyshortcut.js"></script>
<script type="text/javascript" src="./js/common/modal.js"></script>
<script>
var ver="Miho (ver.4[fixed])";
var ver="Miho (ver.5)";
//betaを入れるとバージョンチェックしない
//var ver="beta";
var acct_id=0;
@ -323,7 +323,7 @@ var tlid=0;
</div>
</div>
<!-- Modal Structure Image-->
<div id="imagemodal" class="modal modal-fixed-footer" style="margin-top:-10%">
<div id="imagemodal" class="modal modal-fixed-footer">
<div class="modal-content">
<div id="imagewrap">
<img src="" id="imgmodal">

View File

@ -1,5 +1,5 @@
$(function($) {
//キーボードショートカット
//キーボードショートカット
$(window).keydown(function(e) {
var hasFocus = $('input').is(':focus');
var hasFocus2 = $('textarea').is(':focus');
@ -10,6 +10,16 @@ $(function($) {
return false;
}
}
//Esc:消す
if (e.keyCode === 27) {
hide();
return false;
}
//Esc:消す
if (e.keyCode === 116) {
location.href = "index.html";
return false;
}
//input/textareaにフォーカスなし時
if (!hasFocus && !hasFocus2) {
//X:開閉
@ -74,21 +84,16 @@ $(function($) {
return false;
}
}
//F5:スーパーリロード?
if (e.keyCode === 116) {
location.href = "index.html"
return false;
}
}
//37,39
if (e.keyCode === 37) {
if($("#imagemodal").hasClass("open")){
if ($("#imagemodal").hasClass("open")) {
imgCont('prev');
return false;
}
}
if (e.keyCode === 39) {
if($("#imagemodal").hasClass("open")){
if ($("#imagemodal").hasClass("open")) {
imgCont('next');
return false;
}

View File

@ -1,3 +1,4 @@
//Warning!!: This is edited by CutlsP. It's not raw file.
/*!
* Materialize v0.100.2 (http://materializecss.com)
* Copyright 2014-2017 Materialize
@ -1863,7 +1864,7 @@ if (Vel) {
complete: undefined,
dismissible: true,
startingTop: '4%',
endingTop: '10%'
endingTop: '0%'
};
/**

View File

@ -44,7 +44,11 @@ function login(url) {
localStorage.setItem("client_secret", json["client_secret"]);
$("#auth").show();
$("#masara").hide();
window.open(auth);
const {
shell
} = require('electron');
shell.openExternal(auth);
});
}

View File

@ -171,7 +171,11 @@ function login(url) {
localStorage.setItem("client_secret", json["client_secret"]);
$("#auth").show();
$("#add").hide();
window.open(auth);
const {
shell
} = require('electron');
shell.openExternal(auth);
});
}

View File

@ -23,11 +23,10 @@ function fav(id, acct_id) {
console.error(error);
}).then(function(json) {
console.log(json);
$("#pub_" + id + " .fav_ct").text(json.favourites_count);
$("[toot-id=" + id + "] .fav_ct").text(json.favourites_count);
if (!json.reblog) {
$("#pub_" + id + " .rt_ct").text(json.reblogs_count - 1);
} else {
$("#pub_" + id + " .rt_ct").text(json.reblog.reblogs_count);
$("[toot-id=" + id + "] .rt_ct").text(json.reblog.reblogs_count);
}
if ($("#pub_" + id).hasClass("faved")) {
$("#pub_" + id).removeClass("faved");
@ -63,11 +62,16 @@ function rt(id, acct_id) {
console.error(error);
}).then(function(json) {
console.log(json);
$("#pub_" + id + " .fav_ct").text(json.favourites_count);
$("[toot-id=" + id + "] .fav_ct").text(json.favourites_count);
if (!json.reblog) {
$("#pub_" + id + " .rt_ct").text(json.reblogs_count - 1);
if(flag=="unreblog"){
var rt=json.reblogs_count - 1;
}else{
var rt=json.reblogs_count + 1;
}
$("[toot-id=" + id + "] .rt_ct").text(rt);
} else {
$("#pub_" + id + " .rt_ct").text(json.reblog.reblogs_count);
$("[toot-id=" + id + "] .rt_ct").text(json.reblog.reblogs_count);
}
if ($("#pub_" + id).hasClass("rted")) {
@ -86,6 +90,7 @@ function follow(acct_id) {
var acct_id = $('#his-data').attr("use-acct");
}
var id = $("#his-data").attr("user-id");
var remote = $("#his-data").attr("remote");
if ($("#his-data").hasClass("following")) {
var flag = "unfollow";
} else {
@ -93,14 +98,21 @@ function follow(acct_id) {
}
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem(domain + "_at");
if(remote=="true" && flag=="follow"){
var start = "https://" + domain + "/api/v1/follows";
var user=$("#his-acct").text();
var ent={"uri":user}
}else{
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({})
body: JSON.stringify(ent)
}).then(function(response) {
return response.json();
}).catch(function(error) {

View File

@ -48,6 +48,17 @@ function additional(acct_id, tlid) {
});
}
});
//Markdownイメージビューワー
$("#timeline_" + tlid + " .toot a:not(.img-parsed):has(img)").each(function(i, elem) {
var ilink=$(this).attr("href");
var id = $(this).parents('.cvo').attr("toot-id");
$(this).attr("href","#");
$(this).attr("onclick","imgv('"+id+"','"+i+"')");
$(this).attr("data-type","image");
$(this).attr("id",id+"-image-"+i);
$(this).attr("data-url",ilink);
$(this).addClass("img-parsed");
});
}
//各TL上方のLink[On/Off]

View File

@ -2,7 +2,6 @@
function mixtl(acct_id, tlid) {
var type = "mix";
localStorage.removeItem("morelock")
$("#notice_" + tlid).text("Integrated TL");
localStorage.setItem("now", type);
todo("Integrated TL Loading...(Local)");
var domain = localStorage.getItem("domain_" + acct_id);
@ -169,6 +168,7 @@ function mixmore(tlid) {
var sid = $("#timeline_" + tlid + " .cvo").last().attr("toot-id");
var start = "https://" + domain +
"/api/v1/timelines/public?local=true&max_id=" + sid;
console.log(start);
fetch(start, {
method: 'GET',
headers: {

View File

@ -133,8 +133,23 @@ function parseNotf(obj, popup, tlid, acct_id) {
}
var viewer = "";
var youtube = "";
var emojick = toot.emojis[0];
//絵文字があれば
var content=toot.content
if (emojick) {
Object.keys(toot.emojis).forEach(function(key5) {
var emoji = toot.emojis[key5];
var shortcode = emoji.shortcode;
var emoji_url = '<img src="' + emoji.url +
'" style="width:2em" class="emoji-img">';
var regExp = new RegExp(":" + shortcode + ":", "g");
content = content.replace(regExp, emoji_url);
});
}
var mediack = toot.media_attachments[0];
//メディアがあれば
if (mediack) {
var cwdt=100/toot.media_attachments.length
Object.keys(toot.media_attachments).forEach(function(key2) {
var media = toot.media_attachments[key2];
var purl = media.preview_url;
@ -144,10 +159,8 @@ function parseNotf(obj, popup, tlid, acct_id) {
} else {
var sense = ""
}
viewer = viewer + '<a onclick="imgv(\'' + url + '\',\'' + toot.account
.acct + '\',\'' + media.type + '\')"><img src="' + purl + '" class="' +
sense +
'" width="250" style="object-fit: cover; width: 100%; height: 200px;"></a></span>';
viewer = viewer + '<a onclick="imgv(\''+id+'\',\''+key2+'\')" id="'+id+'-image-'+key2+'" data-url="'+url+'" data-type="'+media.type+'" class="img-parsed"><img src="' + purl + '" class="' + sense +
' toot-img pointer" style="width:'+cwdt+'%"></a></span>';
});
} else {
viewer = "";
@ -224,7 +237,7 @@ function parseNotf(obj, popup, tlid, acct_id) {
'<div class="sml gray" style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;"> @' +
toot.account.acct + locked + '</div>' +
'</div>' +
'<span class="toot ' + spoiler + '">' + toot.content +
'<span class="toot ' + spoiler + '">' + content +
'</span><span class="gray cw_text_' + toot.id + '">' + toot.spoiler_text +
spoiler_show + '</span>' +
'' + viewer + '' +
@ -236,11 +249,11 @@ function parseNotf(obj, popup, tlid, acct_id) {
acct_id +
')" class="waves-effect waves-dark btn-flat" style="padding:0"><i class="fa fa-share"></i><help>返信</help></a></div>' +
'<div><a onclick="rt(\'' + toot.id + '\',' + acct_id +
')" class="waves-effect waves-dark btn-flat" style="padding:0"><i class="text-darken-3 fa fa-retweet ' +
',\''+tlid+'\')" class="waves-effect waves-dark btn-flat" style="padding:0"><i class="text-darken-3 fa fa-retweet ' +
if_rt + '" id="rt_' + toot.id + '"></i><span class="rt_ct">' + toot.reblogs_count +
'</span><help>ブースト</help></a></div>' +
'<div><a onclick="fav(\'' + toot.id + '\',' + acct_id +
')" class="waves-effect waves-dark btn-flat" style="padding:0"><i class="fa text-darken-3 fa-star' +
',\''+tlid+'\')" class="waves-effect waves-dark btn-flat" style="padding:0"><i class="fa text-darken-3 fa-star' +
if_fav + '" id="fav_' + toot.id + '"></i><span class="fav_ct">' + toot.favourites_count +
'<help>お気に入り</help></a></span></div>' +
'<div class=' + if_mine + '><a onclick="del(\'' + toot.id + '\',' +

View File

@ -94,6 +94,7 @@ function parse(obj, mix, acct_id) {
var mediack = toot.media_attachments[0];
//メディアがあれば
if (mediack) {
var cwdt=100/toot.media_attachments.length
Object.keys(toot.media_attachments).forEach(function(key2) {
var media = toot.media_attachments[key2];
var purl = media.preview_url;
@ -103,8 +104,8 @@ function parse(obj, mix, acct_id) {
} else {
var sense = ""
}
viewer = viewer + '<a onclick="imgv(\''+id+'\',\''+key2+'\')" id="'+id+'-image-'+key2+'" data-url="'+url+'" data-type="'+media.type+'"><img src="' + purl + '" class="' + sense +
' toot-img" style=""></a></span>';
viewer = viewer + '<a onclick="imgv(\''+id+'\',\''+key2+'\')" id="'+id+'-image-'+key2+'" data-url="'+url+'" data-type="'+media.type+'" class="img-parsed"><img src="' + purl + '" class="' + sense +
' toot-img pointer" style="width:'+cwdt+'%"></a></span>';
});
} else {
viewer = "";
@ -185,11 +186,11 @@ function parse(obj, mix, acct_id) {
acct_id +
')" class="waves-effect waves-dark btn-flat" style="padding:0"><i class="fa fa-share"></i></a></div>' +
'<div><a onclick="rt(\'' + toot.id + '\',' + acct_id +
')" class="waves-effect waves-dark btn-flat" style="padding:0"><i class="text-darken-3 fa fa-retweet ' +
',\''+tlid+'\')" class="waves-effect waves-dark btn-flat" style="padding:0"><i class="text-darken-3 fa fa-retweet ' +
if_rt + '" id="rt_' + toot.id + '"></i><span class="rt_ct">' + toot.reblogs_count +
'</span></a></div>' +
'<div><a onclick="fav(\'' + toot.id + '\',' + acct_id +
')" class="waves-effect waves-dark btn-flat" style="padding:0"><i class="fa text-darken-3 fa-star' +
',\''+tlid+'\')" class="waves-effect waves-dark btn-flat" style="padding:0"><i class="fa text-darken-3 fa-star' +
if_fav + '" id="fav_' + toot.id + '"></i><span class="fav_ct">' + toot.favourites_count +
'</a></span></div>' +
'<div class=' + if_mine + '><a onclick="del(\'' + toot.id + '\',' +

View File

@ -3,6 +3,7 @@ function tl(type, data, acct_id, tlid) {
scrollevent();
localStorage.removeItem("morelock");
localStorage.removeItem("pool");
var domain = localStorage.getItem("domain_" + acct_id);
//タグの場合はカラム追加して描画
if (tlid == "add") {
console.log("add");
@ -30,6 +31,8 @@ function tl(type, data, acct_id, tlid) {
}
if (type == "mix") {
//Integratedなら飛ばす
$("#notice_" + tlid).text("Integrated TL(" + localStorage.getItem(
"user_" + acct_id) + "@" + domain + ")");
mixtl(acct_id, tlid);
return;
} else if (type == "notf") {
@ -41,7 +44,6 @@ function tl(type, data, acct_id, tlid) {
}
localStorage.setItem("now", type);
todo(cap(type) + " TL Loading...");
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem(domain + "_at");
$("#notice_" + tlid).text(cap(type, data) + " TL(" + localStorage.getItem(
"user_" + acct_id) + "@" + domain + ")");
@ -136,14 +138,14 @@ function moreload(type, tlid) {
var obj = JSON.parse(multi);
var acct_id = obj[tlid].domain;
if (!type) {
var type = localStorage.getItem("now");
var type = obj[tlid].type;
}
var sid = $("#timeline_" + tlid + " .cvo").last().attr("toot-id");
console.log(localStorage.getItem("morelock") + ":" + sid)
if (localStorage.getItem("morelock") != sid) {
localStorage.setItem("morelock", sid);
if (type == "mix") {
mixmore();
mixmore(tlid);
return;
}
localStorage.setItem("now", type);

View File

@ -54,7 +54,7 @@
Object.keys(obj).forEach(function(key) {
var acct = obj[key];
var html = '<div class="box" id="timeline_' + key + '_box" tlid="' + key +
'"><div><span id="notice_' + key + '" class="notice"></span>' +
'"><div class="notice-box"><span id="notice_' + key + '"></span><br>' +
'<a onclick="notfToggle(' + acct.domain + ',' + key +
')" class="setting nex" title="このアカウントの通知"><i class="material-icons nex notf-icon_' +
key + '">notifications</i></a>' +
@ -62,11 +62,11 @@
')" class="setting nex"><i class="material-icons nex" title="このカラムを削除">remove_circle</i></a>' +
'<a onclick="cardToggle(' + key +
')" class="setting nex"><i class="material-icons nex" title="リンクの解析を切り替え(OFFで制限を回避出来る場合があります)">link</i><span id="sta-card-' +
key + '">On</span></a>' +
key + '">On</span></a><a onclick="goTop(' + key + ')" class="setting nex"><i class="material-icons nex" title="一番上へ">vertical_align_top</i></a>' +
'<div class="hide notf-indv-box" id="notf-box_' + key +
'"><div id="notifications_' + key +
'"></div></div></div><div id="timeline_' + key +
'" class="tl"></div></div>';
'"></div></div></div><div class="tl-box"><div id="timeline_' + key +
'" class="tl"></div></div></div>';
$("#timeline-container").append(html);
if (acct.data) {
var data = acct.data;

View File

@ -26,3 +26,7 @@ function scrollck() {
}
});
}
function goTop(id){
$("#timeline_"+id+"_box").scrollTop(0)
}

View File

@ -27,6 +27,12 @@ function udg(user, acct_id) {
} else {
$('#his-data').attr("user-id", user);
$('#his-data').attr("use-acct", acct_id);
if(json.username!=json.acct){
//Remote
$('#his-data').attr("remote", "true");
}else{
$('#his-data').attr("remote", "false");
}
$("#his-name").text(json.display_name);
$("#his-acct").text(json.acct);
$("#his-prof").attr("src", json.avatar);
@ -89,6 +95,8 @@ function relations(user, acct_id) {
//自分がフォローしている
$("#his-data").addClass("following");
$("#his-follow-btn").text("フォロー解除");
}else{
$("#his-follow-btn").text("フォロー");
}
if (json.followed_by) {
//フォローされてる
@ -97,18 +105,26 @@ function relations(user, acct_id) {
if (json.blocking) {
$("#his-data").addClass("blocking");
$("#his-block-btn").text("ブロック解除");
}else{
$("#his-block-btn").text("ブロック");
}
if (json.muting) {
$("#his-data").addClass("muting");
$("#his-mute-btn").text("ミュート解除");
}else{
$("#his-mute-btn").text("ミュート");
}
if (json.muting_notifications) {
$("#his-data").addClass("mutingNotf");
$("#his-notf-btn").text("通知ミュート解除");
}else{
$("#his-notf-btn").text("通知ミュート");
}
if (json.domain_blocking) {
$("#his-data").addClass("blockingDom");
$("#his-domain-btn").text("ドメインブロック解除");
}else{
$("#his-domain-btn").text("ドメインブロック");
}
});

View File

@ -1,6 +1,6 @@
{
"name": "TheDesk",
"version": "11.4.1",
"version": "11.5.0",
"description": "TheDesk on Mastodonはシンプルと多機能を両立したデスクトップ向けクライアントです",
"main": "main.js",
"scripts": {