TheDesk Akane (16.0.3) !unsolved!:av/BT countor bugs

This commit is contained in:
cutls 2018-08-06 01:24:17 +09:00
parent 131c4ae35e
commit c21cacf180
10 changed files with 204 additions and 18 deletions

View File

@ -81,6 +81,38 @@ option {
opacity: 0;
}
}
@keyframes shake {
from,
to {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
10%,
30%,
50%,
70%,
90% {
-webkit-transform: translate3d(-10px, 0, 0);
transform: translate3d(-10px, 0, 0);
}
20%,
40%,
60%,
80% {
-webkit-transform: translate3d(10px, 0, 0);
transform: translate3d(10px, 0, 0);
}
}
.shake {
display: inline-block;
animation-duration: 1s;
animation-fill-mode: both;
animation-iteration-count: infinite;
animation-name: shake;
}
code:before, .pre:before {
content: "Code";
font-size: 1.8rem;

View File

@ -392,3 +392,10 @@ p:not(:last-child){
.tl-box .via-hide{
display:none;
}
.vote{
width: 100%;
border: 1px solid;
margin-top: 3px;
padding: 1px;
border-radius: 3px;
}

View File

@ -26,6 +26,7 @@
<script type="text/javascript" src="./js/common/modal.js"></script>
<script type="text/javascript" src="./js/ui/jquery-ui.min.js"></script>
<script>
//Fav/BT数直せ
var ver="Akane (16.0.2)";
//betaを入れるとバージョンチェックしない
//GitHubに上げるときはindex.htmlをちゃんとする。(index.start.html)

View File

@ -163,6 +163,14 @@ var lang_misskeyparse_home={
"ja":"ホーム",
"en":"Home"
}
var lang_misskeyparse_followers={
"ja":"フォロワー",
"en":"Follower"
}
var lang_misskeyparse_specified={
"ja":"ユーザー指定",
"en":"Specified User"
}
var lang_misskeyparse_qt={
"ja":"MisskeyのRenote(引用モード)中:Ctrl+Shift+Cでクリア",
"en":"Misskey renote(quote) mode:Ctrl+Shift+Enter to clear"

View File

@ -130,6 +130,9 @@
});
};
function escapeHTML(str) {
if(!str){
return "";
}
return str.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')

View File

@ -118,3 +118,52 @@ function reaction(mode,id,acct_id,tlid){
}
}
}
//Vote
function vote(acct_id,id,to){
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_"+ acct_id + "_at");
var start = "https://" + domain + "/api/notes/polls/vote";
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,choice:to}));
httpreq.onreadystatechange = 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 start = "https://" + domain + "/api/notes/show";
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) {
var json = httpreqd.response;
if(!json){
return false;
}
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="";
}
poll=poll+'<div class="pointer vote" onclick="vote(\''+acct_id+'\',\''+json.id+'\','+choice.id+')">'+choice.text+'('+choice.votes+''+myvote+')</div>';
});
$(".vote_"+json.id).html(poll)
}
}
}
}

View File

@ -164,13 +164,19 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
var memory = localStorage.getItem("notice-mem");
if (popup >= 0 && obj.length < 5 && noticetext != memory) {
if (toot.type == "reply") {
$(".notf-reply_" + acct_id).text($(".notf-reply_" + acct_id+":eq(0)").text()*1+1);
var replyct=localStorage.getItem("notf-reply_" + acct_id)
$(".notf-reply_" + acct_id).text(replyct*1+1);
localStorage.setItem("notf-reply_" + acct_id,replyct*1+1)
$(".notf-reply_" + acct_id).removeClass("hide")
}else if (toot.type == "renote" || toot.type=="quote") {
$(".notf-bt_" + acct_id).text($(".notf-bt_" + acct_id+":eq(0)").text()*1+1);
var btct=localStorage.getItem("notf-bt_" + acct_id)
$(".notf-bt_" + acct_id).text(btct*1+1);
localStorage.setItem("notf-bt_" + acct_id,btct*1+1)
$(".notf-bt_" + acct_id).removeClass("hide")
}else if (toot.type == "reaction") {
$(".notf-fav_" + acct_id).text($(".notf-fav_" + acct_id+":eq(0)").text()*1+1);
var favct=localStorage.getItem("notf-fav_" + acct_id)
$(".notf-fav_" + acct_id).text(favct*1+1);
localStorage.setItem("notf-fav_" + acct_id,favct*1+1)
$(".notf-fav_" + acct_id).removeClass("hide")
}
var domain = localStorage.getItem("domain_" + acct_id);
@ -188,7 +194,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
if(os=="darwin"){
var n = new Notification('TheDesk:'+domain, options);
}else{
ipc.send('native-notf', ['TheDesk:'+domain,toot.user.name+"(" + toot.account.acct +")"+what+"\n\n"+$.strip_tags(toot.note.text),toot.user.avatarUrl]);
ipc.send('native-notf', ['TheDesk:'+domain,toot.user.name+"(" + toot.user.acct +")"+what+"\n\n"+$.strip_tags(toot.note.text),toot.user.avatarUrl]);
}
}
$(".notf-icon_" + acct_id).addClass("red-text");
@ -312,7 +318,17 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
}
//デフォ絵文字
if(content){
content=content.replace(/(http(s)?:\/\/[\x21-\x7e]+)/gi, "<a href='$1' target='_blank'>$1</a>")
//MFM
content=content.replace(/^"([^"]+)"$/gmi, '<blockquote>$1</blockquote>')
content=content.replace(/`(.+)`/gi, '<code>$1</code>')
content=content.replace(/(http(s)?:\/\/[\x21-\x7e]+)/gi, '<a href="$1" target="_blank">$1</a>')
content=content.replace(/\(\(\((.+)\)\)\)/gi, '<span class="shake">$1</span>')
content=content.replace(/<motion>(.+)<\/motion>/gi, '<span class="shake">$1</span>')
content=content.replace(/\*\*\*([^*]+)\*\*\*/gi, '<span class="shake" style="font-size:200%">$1</span>')
content=content.replace(/\*\*([^*]+)\*\*/gi, '<b>$1</b>')
content=content.replace(/^(.+)\s検索$/gmi, '<div class="input-field"><i class="material-icons prefix">search</i><input type="text" style="width:calc( 60% - 80px);" name="q" value="$1" id="srcbox_'+toot.id+'"><label for="src" data-trans="src" class="">検索</label><button class="btn waves-effect indigo" style="width:40%;" data-trans-i="src" onclick="goGoogle(\''+toot.id+'\')">検索</button></div>')
content=content.replace(/\[(.+)\]\(<a href="(http(s)?:\/\/[\x21-\x7e]+)".+\)/gi,'<a href="$2" target="_blank">$1</a>');
content=twemoji.parse(content);
}else{
content="";
@ -346,11 +362,20 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
} else {
var sense = ""
}
if(media.type.indexOf("video") !== -1){
viewer = viewer + '<a onclick="imgv(\'' + id + '\',\'' + key2 + '\',' +
acct_id + ')" id="' + id + '-image-' + key2 + '" data-url="' + url +
'" data-type="video" class="img-parsed"><video src="' +
purl + '" class="' + sense +
' toot-img pointer" style="max-width:100%; height:'+imh+'px;"></a></span>';
}else{
viewer = viewer + '<a onclick="imgv(\'' + id + '\',\'' + key2 + '\',' +
acct_id + ')" id="' + id + '-image-' + key2 + '" data-url="' + url +
'" data-type="image" class="img-parsed"><img src="' +
purl + '" class="' + sense +
' toot-img pointer" style="width:' + cwdt + '%; height:'+imh+'px;"></a></span>';
}
});
media_ids = media_ids.slice(0, -1) ;
} else {
@ -456,6 +481,21 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
}
});
}
//Poll
var poll="";
if(toot.poll){
var choices=toot.poll.choices;
Object.keys(choices).forEach(function(keyc) {
var choice = choices[keyc];
if(choice.isVoted){
var myvote=twemoji.parse("✅");
}else{
var myvote="";
}
poll=poll+'<div class="pointer vote" onclick="vote(\''+acct_id+'\',\''+toot.id+'\','+choice.id+')">'+choice.text+'('+choice.votes+''+myvote+')</div>';
});
poll='<div class="vote_'+toot.id+'">'+poll+'</div>';
}
//Reactions
if(toot.reactionCounts){
if(toot.reactionCounts.like){
@ -533,6 +573,9 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
var reacted="";
}
content=nl2br(content);
if(!content || content==""){
content='<span class="gray">This post has no content. It may be media-only, private or deleted.</span>';
}
var trans="";
templete = templete + '<div id="pub_' + toot.id + '" class="cvo ' +
boostback + ' ' + fav_app + ' ' + rt_app + ' ' + hasmedia + '" toot-id="' + id + '" unique-id="' + uniqueid + '" data-medias="'+media_ids+' " unixtime="' + date(obj[
@ -577,7 +620,7 @@ function misskeyParse(obj, mix, acct_id, tlid, popup, mutefilter) {
',\'' + tlid +'\')" class="waves-effect waves-dark btn-flat pointer" style="padding:0">'+twemoji.parse("😥")+'</a><span class="re-confusedct">'+confused+
'</span></span><span class="'+pudhide+' reaction re-pudding"><a onclick="reaction(\'pudding\',\'' + toot.id + '\',' + acct_id +
',\'' + tlid +'\')" class="waves-effect waves-dark btn-flat pointer" style="padding:0">'+twemoji.parse("🍮")+'</a><span class="re-puddingct">'+pudding+
'</span></div>' + mentions + tags + '</div>' +
'</span></div>'+poll + mentions + tags + '</div>' +
'<div class="area-vis"></div>'+
'<div class="area-actions '+mouseover+'">' +
'<div class="action">'+vis+'</div>'+
@ -658,7 +701,6 @@ function misskeyUserparse(obj, auth, acct_id, tlid, popup) {
}else{
var dis_name=toot.name;
}
console.log(dis_name)
templete = templete +
'<div class="cvo" style="padding-top:5px;" user-id="' + toot.id + '"><div class="area-notice">' +
notftext +
@ -683,3 +725,12 @@ function misskeyUserparse(obj, auth, acct_id, tlid, popup) {
});
return templete;
}
function goGoogle(id){
var val=$("#srcbox_"+id).val();
var url="https://google.com/search?q="+val;
const {
shell
} = require('electron');
shell.openExternal(url);
}

View File

@ -245,12 +245,16 @@ function notfToggle(acct, tlid) {
}
function notfCanceler(acct){
$(".notf-reply_" + acct).text(0);
localStorage.removeItem("notf-reply_" + acct_id)
$(".notf-reply_" + acct).addClass("hide");
$(".notf-fav_" + acct).text(0);
localStorage.removeItem("notf-fav_" + acct_id)
$(".notf-fav_" + acct).addClass("hide");
$(".notf-bt_" + acct).text(0);
localStorage.removeItem("notf-bt_" + acct_id)
$(".notf-bt_" + acct).addClass("hide");
$(".notf-follow_" + acct).text(0);
localStorage.removeItem("notf-follow_" + acct_id)
$(".notf-follow_" + acct).addClass("hide");
$(".notf-icon_" + acct).removeClass("red-text");
}
@ -275,3 +279,4 @@ function allNotfRead(){
notfCanceler(key)
});
}
allNotfRead()

View File

@ -182,13 +182,19 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) {
var memory = localStorage.getItem("notice-mem");
if (popup >= 0 && obj.length < 5 && noticetext != memory) {
if (toot.type == "mention") {
$(".notf-reply_" + acct_id).text($(".notf-reply_" + acct_id).text()*1+1);
var replyct=localStorage.getItem("notf-reply_" + acct_id)
$(".notf-reply_" + acct_id).text(replyct*1+1);
localStorage.setItem("notf-reply_" + acct_id,replyct*1+1)
$(".notf-reply_" + acct_id).removeClass("hide")
}else if (toot.type == "reblog") {
$(".notf-bt_" + acct_id).text($(".notf-bt_" + acct_id).text()*1+1);
var btct=localStorage.getItem("notf-bt_" + acct_id)
$(".notf-bt_" + acct_id).text(btct*1+1);
localStorage.setItem("notf-bt_" + acct_id,btct*1+1)
$(".notf-bt_" + acct_id).removeClass("hide")
}else if (toot.type == "favourite") {
$(".notf-fav_" + acct_id).text($(".notf-fav_" + acct_id).text()*1+1);
var favct=localStorage.getItem("notf-fav_" + acct_id)
$(".notf-fav_" + acct_id).text(favct*1+1);
localStorage.setItem("notf-fav_" + acct_id,favct*1+1)
$(".notf-fav_" + acct_id).removeClass("hide")
}
var domain = localStorage.getItem("domain_" + acct_id);
@ -603,6 +609,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) {
//オブジェクトパーサー(ユーザーデータ)
function userparse(obj, auth, acct_id, tlid, popup) {
console.log("notf-get")
//独自ロケール
var locale = localStorage.getItem("locale");
if(locale=="yes"){
@ -612,6 +619,12 @@ function userparse(obj, auth, acct_id, tlid, popup) {
var datetype = localStorage.getItem("datetype");
Object.keys(obj).forEach(function(key) {
var toot = obj[key];
if(!toot.username){
toot=toot.account;
var notf=true;
}else{
var notf=false;
}
if (toot.locked) {
var locked = ' <i class="fa fa-lock red-text"></i>';
} else {
@ -629,8 +642,8 @@ function userparse(obj, auth, acct_id, tlid, popup) {
}else if(localStorage.getItem("domain_" + acct_id)=="mstdn.osaka" && !locale){
ftxt = "ツルまれました";
}
if(popup > 0 || popup==-1){
var notftext='<span class="cbadge"title="' + date(toot.created_at,
if(popup > 0 || popup==-1 || notf){
var notftext='<span class="cbadge" title="' + date(toot.created_at,
'absolute') + '('+lang_parse_notftime[lang]+')"><i class="fa fa-clock-o"></i>' + date(toot.created_at,
datetype) +
'</span>'+ftxt+'<br>';
@ -644,7 +657,12 @@ function userparse(obj, auth, acct_id, tlid, popup) {
localStorage.setItem("notice-mem", notftext);
notftext = "";
}
if(toot.display_name){
var dis_name=escapeHTML(toot.display_name);
}else{
var dis_name=toot.username;
}
if(toot.emojis){
var actemojick = toot.emojis[0];
}else{
@ -661,13 +679,21 @@ function userparse(obj, auth, acct_id, tlid, popup) {
dis_name = dis_name.replace(regExp, emoji_url);
});
}
if(dis_name){
dis_name=twemoji.parse(dis_name);
}
if(toot.avatar){
var avatar=toot.avatar;
}else{
var avatar="./img/missing.svg";
}
templete = templete +
'<div class="cvo" style="padding-top:5px;" user-id="' + toot.id + '"><div class="area-notice">' +
notftext +
'</div><div class="area-icon"><a onclick="udg(\'' + toot.id + '\',' +
acct_id + ');" user="' + toot.acct + '" class="udg">' +
'<img src="' + toot.avatar + '" width="40" class="prof-img" user="' + toot
'<img src="' + avatar + '" width="40" class="prof-img" user="' + toot
.acct + '"></a></div>' +
'<div class="area-display_name"><div class="flex-name"><span class="user">' +
dis_name + '</span>' +

View File

@ -143,6 +143,7 @@ function flw(user, more, acct_id) {
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
}
}
}
@ -208,6 +209,7 @@ function fer(user, more, acct_id) {
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
}
}
}
@ -329,6 +331,7 @@ function showMut(more, acct_id) {
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
}
}
}
@ -429,6 +432,7 @@ function showReq(more, acct_id) {
method: 'GET',
headers: {
'content-type': 'application/json',
'Authorization': 'Bearer ' + at
}
}
}