TheDesk Akane (16.0.0) -phase 2

This commit is contained in:
cutls
2018-07-29 16:37:54 +09:00
parent 7f64bd6d2a
commit 5a920d63fd
37 changed files with 1220 additions and 474 deletions

View File

@@ -213,6 +213,8 @@ function addselCk(){
}
//カラム削除
function removeColumn(tlid) {
$("#sort-box").addClass("hide");
$("#sort-box").removeClass("show");
var multi = localStorage.getItem("column");
var obj = JSON.parse(multi);
//聞く

View File

@@ -40,6 +40,8 @@ function goTop(id){
$("#timeline_box_"+id+"_box .tl-box").animate({scrollTop:0});
}
function goColumn(key){
$("#sort-box").addClass("hide");
$("#sort-box").removeClass("show");
if($('[tlid='+key+']').length){
console.log($('[tlid='+key+']').offset().left);
$("#timeline-container").animate({scrollLeft:$("#timeline-container").scrollLeft()+$('[tlid='+key+']').offset().left});

View File

@@ -26,7 +26,7 @@ function sortload(){
}
var html='<li class="drag-content" data-id="'+key+'" data-flag="'+flag+'"'+insert+'><a onclick="goColumn(' + key +
')" class="setting nex"><i class="material-icons waves-effect nex" title="このカラムへ">forward</i></a> <a onclick="removeColumn(' + key +
')" class="setting nex"><i class="material-icons waves-effect nex" title="このカラムを削除">cancel</i></a><br>'+localStorage.getItem("user_" + acct.domain)+"@"+localStorage.getItem("domain_" + acct.domain)+" "+cap(acct.type, acct.data)+'</li>';
')" class="setting nex"><i class="material-icons waves-effect nex" title="このカラムを削除">cancel</i></a><br>'+localStorage.getItem("user_" + acct.domain)+"@"+localStorage.getItem("domain_" + acct.domain)+" "+cap(acct.type, acct.data,acct.domain)+'</li>';
$("#sort").append(html);
});
drag();
@@ -48,6 +48,8 @@ function Scap(type, data) {
return "Notification"
} else if (type == "mix") {
return "Integrated"
}else{
console.log(type);
}
}

View File

@@ -11,6 +11,7 @@ function tips(mode){
var ipc = electron.ipcRenderer;
ipc.send('endmem', "");
clearInterval(clockint);
clearInterval(spotStart);
if(mode=="ver"){
tipsToggle()
$("#tips-text").html('<img src="./img/desk.png" width="20"><span style="font-size:20px">TheDesk</span> '+localStorage.getItem("ver"))
@@ -27,6 +28,11 @@ function tips(mode){
tipsToggle()
localStorage.setItem("tips","trend")
trendTagonTip()
}else if(mode=="spotify"){
tipsToggle()
localStorage.setItem("tips","spotify")
var json=nowplaying("spotifytips")
spotifytips(json)
}
}
//メモリ
@@ -74,6 +80,78 @@ function trendTagonTip(){
});
}
//Spotify
function spotifytips(){
var start = "https://thedesk.top/now-playing?at="+localStorage.getItem("spotify")+"&rt="+localStorage.getItem("spotify-refresh");
var at = localStorage.getItem("spotify");
if(at){
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json'
}
}).then(function(response) {
return response.json();
}).catch(function(error) {
todo(error);
console.error(error);
}).then(function(json) {
console.log(json);
var ms=json.progress_ms;
var last=1000-ms%1000;
var item=json.item;
var img=item.album.images[0].url;
var artisttxt="";
for(i=0;i<item.artists.length;i++){
if(i>0){
artisttxt=artisttxt+","+item.artists[i].name;
}else{
artisttxt=item.artists[0].name;
}
}
sleep(last);
var tms=item.duration_ms;
var per=ms/item.duration_ms*100;
ms=ms/1000;
tms=tms/1000;
var s=Math.round(ms)%60;
if(s<10){
s="0"+s;
}
var m=(Math.round(ms)-Math.round(ms)%60)/60;
var ts=Math.round(tms)%60;
if(ts<10){
ts="0"+ts;
}
var tm=(Math.round(tms)-Math.round(tms)%60)/60;
$("#tips-text").html('<div id="spot-box"><i class="material-icons pointer" onclick="spotifytips()" style="font-size:12px">refresh</i><img src="'+img+'" width="20" id="spot-img">'+item.name+'<span class="gray sml" id="spot-art">'+artisttxt+'</span><span id="spot-m">'+m+'</span>:<span id="spot-s">'+s+'</span>/'+tm+":"+ts+'</span></div><div class="progress grey"><div class="determinate spotify-prog grey lighten-2" style="width: '+per+'%" data-s="'+Math.round(ms)+'" data-total="'+item.duration_ms+'"></div></div>');
spotint=setInterval(spotStart, 1000);
});
}else{
alert("アカウント連携設定をして下さい。");
}
}
function spotStart(){
var total=$(".spotify-prog").attr("data-total");
var s=$(".spotify-prog").attr("data-s");
var news=s*1+1;
var per=news*100000/total;
var ns=news%60;
var nm=(news-ns)/60;
if(ns<10){
ns="0"+ns;
}
if(per>=100){
clearInterval(spotStart);
spotifytips()
}else{
$("#spot-m").text(nm);
$("#spot-s").text(ns);
}
$(".spotify-prog").attr("data-s",news);
$(".spotify-prog").css("width",per+"%");
}
function trendTagonTipInterval(){
setTimeout(trendTagonTip, 6000000);