TheDesk Tips redesign
This commit is contained in:
parent
1cbd6992e3
commit
0f75972616
|
@ -93,7 +93,7 @@
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 3rem 2.3rem 2.5fr 1fr 4.6rem;
|
grid-template-columns: 3rem 2.3rem 2.5fr 1fr 4.6rem;
|
||||||
grid-template-rows: 1.7rem 1.5rem;
|
grid-template-rows: 1.7rem 1.5rem;
|
||||||
grid-template-areas: 'cover name name artist refresh' 'cover progress progress progress time';
|
grid-template-areas: 'cover name name name refresh' 'cover progress progress progress time';
|
||||||
}
|
}
|
||||||
#spot-refresh {
|
#spot-refresh {
|
||||||
grid-area: refresh;
|
grid-area: refresh;
|
||||||
|
@ -108,18 +108,12 @@
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
line-height: 1.92rem;
|
line-height: 1.92rem;
|
||||||
}
|
}
|
||||||
#spot-artist {
|
|
||||||
grid-area: artist;
|
|
||||||
white-space: nowrap;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
overflow: hidden;
|
|
||||||
line-height: 1.92rem;
|
|
||||||
}
|
|
||||||
#spot-img {
|
#spot-img {
|
||||||
width: 90%;
|
width: 90%;
|
||||||
}
|
}
|
||||||
#spot-time {
|
#spot-time {
|
||||||
grid-area: time;
|
grid-area: time;
|
||||||
|
line-height: 0.5rem;
|
||||||
}
|
}
|
||||||
.progress {
|
.progress {
|
||||||
grid-area: progress;
|
grid-area: progress;
|
||||||
|
|
|
@ -170,7 +170,7 @@ onmessage = function(e) {
|
||||||
} else if (e.data[0] == 'npCore') {
|
} else if (e.data[0] == 'npCore') {
|
||||||
npCore(e.data[1])
|
npCore(e.data[1])
|
||||||
} else if (e.data[0] == 'renderMem') {
|
} else if (e.data[0] == 'renderMem') {
|
||||||
renderMem(e.data[1][0], e.data[1][1], e.data[1][2])
|
renderMem(e.data[1][0], e.data[1][1], e.data[1][2], e.data[1][3], e.data[1][4])
|
||||||
} else if (e.data[0] == 'updateProg') {
|
} else if (e.data[0] == 'updateProg') {
|
||||||
updateProg(e.data[1])
|
updateProg(e.data[1])
|
||||||
} else if (e.data[0] == 'updateMess') {
|
} else if (e.data[0] == 'updateMess') {
|
||||||
|
|
|
@ -204,7 +204,7 @@ ipc.on('memory', function(event, arg) {
|
||||||
var use = arg[0]
|
var use = arg[0]
|
||||||
var cpu = arg[1]
|
var cpu = arg[1]
|
||||||
var total = arg[2]
|
var total = arg[2]
|
||||||
postMessage(['renderMem', [use, cpu, total]], '*')
|
postMessage(['renderMem', [use, cpu, total, arg[3], arg[4]]], '*')
|
||||||
})
|
})
|
||||||
//log
|
//log
|
||||||
ipc.on('logData', function(event, args) {
|
ipc.on('logData', function(event, args) {
|
||||||
|
|
|
@ -63,16 +63,21 @@ function tips(mode) {
|
||||||
function startmem() {
|
function startmem() {
|
||||||
postMessage(['sendSinmpleIpc', 'startmem'], '*')
|
postMessage(['sendSinmpleIpc', 'startmem'], '*')
|
||||||
}
|
}
|
||||||
function renderMem(use, cpu, total) {
|
function renderMem(use, cpu, total, core, uptime) {
|
||||||
|
let day = Math.floor(uptime / 60 / 60 / 24)
|
||||||
|
let hour = Math.floor(uptime / 60 /60 % 24)
|
||||||
|
if(hour < 10) hour = '0' + hour
|
||||||
|
let min = Math.floor(uptime / 60 % 60)
|
||||||
|
if(min < 10) min = '0' + min
|
||||||
|
let sec = Math.floor(uptime % 60)
|
||||||
|
if(sec < 10) sec = '0' + sec
|
||||||
|
let time = `${day ? day + ' days ' : ''}${hour ? hour + ':' : ''}${min}:${sec}`
|
||||||
|
//Intel
|
||||||
|
cpu = cpu.replace('Intel(R)', '').replace('(TM)', '').replace(' CPU', '')
|
||||||
|
//AMD
|
||||||
|
cpu = cpu.replace('AMD ', '').replace(/\s[0-9]{1,3}-Core\sProcessor/, '')
|
||||||
$('#tips-text').html(
|
$('#tips-text').html(
|
||||||
escapeHTML(cpu) +
|
`${escapeHTML(cpu)} x ${core}<br />RAM: ${Math.floor(use / 1024 / 1024 / 102.4) / 10}/${Math.floor(total / 1024 / 1024 / 102.4) / 10}GB(${Math.floor((use / total) * 100)}%) UP:${time}`
|
||||||
'<br>Memory:' +
|
|
||||||
Math.floor(use / 1024 / 1024 / 102.4) / 10 +
|
|
||||||
'/' +
|
|
||||||
Math.floor(total / 1024 / 1024 / 102.4) / 10 +
|
|
||||||
'GB(' +
|
|
||||||
Math.floor((use / total) * 100) +
|
|
||||||
'%)'
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
//トレンドタグ
|
//トレンドタグ
|
||||||
|
@ -196,12 +201,10 @@ function spotifytips() {
|
||||||
<i class="material-icons pointer" onclick="nowplaying('spotify');show()" style="font-size:20px">send</i>
|
<i class="material-icons pointer" onclick="nowplaying('spotify');show()" style="font-size:20px">send</i>
|
||||||
</div>
|
</div>
|
||||||
<div id="spot-cover">
|
<div id="spot-cover">
|
||||||
<img src="${img}" id="spot-img">
|
<img src="${img}" id="spot-img" draggable="false">
|
||||||
</div>
|
</div>
|
||||||
<div id="spot-name">
|
<div id="spot-name">
|
||||||
${escapeHTML(item.name)}
|
${escapeHTML(item.name)}
|
||||||
</div>
|
|
||||||
<div id="spot-artist">
|
|
||||||
<span class="gray sml" id="spot-art">${artisttxt}</span>
|
<span class="gray sml" id="spot-art">${artisttxt}</span>
|
||||||
</div>
|
</div>
|
||||||
<div id="spot-time">
|
<div id="spot-time">
|
||||||
|
|
|
@ -188,8 +188,8 @@ function system(mainWindow, dir, lang, dirname) {
|
||||||
})
|
})
|
||||||
function mems() {
|
function mems() {
|
||||||
var mem = os.totalmem() - os.freemem()
|
var mem = os.totalmem() - os.freemem()
|
||||||
if (mainWindow) {
|
if (mainWindow && event.webContents) {
|
||||||
event.webContents.send('memory', [mem, os.cpus()[0].model, os.totalmem()])
|
event.webContents.send('memory', [mem, os.cpus()[0].model, os.totalmem(), os.cpus().length, os.uptime()])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ipc.on('endmem', (e, arg) => {
|
ipc.on('endmem', (e, arg) => {
|
||||||
|
|
|
@ -1149,7 +1149,7 @@
|
||||||
<a onclick="tipsToggle()" class="nex waves-effect">
|
<a onclick="tipsToggle()" class="nex waves-effect">
|
||||||
<i class="material-icons nex" title="@@changeTips@@" data-trans-title="tips">bubble_chart</i>
|
<i class="material-icons nex" title="@@changeTips@@" data-trans-title="tips">bubble_chart</i>
|
||||||
</a>
|
</a>
|
||||||
<div id="tips-text" style="width:23rem;"></div>
|
<div id="tips-text" style="width:23rem;line-height: 1rem;"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user