Trasnfers ekranına total download speed alanı eklendi
This commit is contained in:
@@ -5,6 +5,8 @@
|
|||||||
let torrents = [];
|
let torrents = [];
|
||||||
let ws;
|
let ws;
|
||||||
let isAllPaused = false;
|
let isAllPaused = false;
|
||||||
|
let totalDownloaded = 0;
|
||||||
|
let totalDownloadSpeed = 0;
|
||||||
|
|
||||||
// Modal / player state
|
// Modal / player state
|
||||||
let showModal = false;
|
let showModal = false;
|
||||||
@@ -31,6 +33,8 @@
|
|||||||
torrents = d.torrents || [];
|
torrents = d.torrents || [];
|
||||||
// Tüm torrentlerin pause durumunu kontrol et
|
// Tüm torrentlerin pause durumunu kontrol et
|
||||||
updateAllPausedState();
|
updateAllPausedState();
|
||||||
|
// Toplam download miktarını ve hızını güncelle
|
||||||
|
updateTransferStats();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -40,6 +44,7 @@
|
|||||||
if (!r.ok) return;
|
if (!r.ok) return;
|
||||||
torrents = await r.json();
|
torrents = await r.json();
|
||||||
updateAllPausedState();
|
updateAllPausedState();
|
||||||
|
updateTransferStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function upload(e) {
|
async function upload(e) {
|
||||||
@@ -121,6 +126,11 @@
|
|||||||
isAllPaused = allPaused;
|
isAllPaused = allPaused;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateTransferStats() {
|
||||||
|
totalDownloaded = torrents.reduce((sum, t) => sum + (t.downloaded || 0), 0);
|
||||||
|
totalDownloadSpeed = torrents.reduce((sum, t) => sum + (t.downloadSpeed || 0), 0);
|
||||||
|
}
|
||||||
|
|
||||||
async function toggleSingleTorrent(hash) {
|
async function toggleSingleTorrent(hash) {
|
||||||
const torrent = torrents.find(t => t.infoHash === hash);
|
const torrent = torrents.find(t => t.infoHash === hash);
|
||||||
if (!torrent) return;
|
if (!torrent) return;
|
||||||
@@ -397,7 +407,15 @@
|
|||||||
<i class="fa-solid fa-magnet btn-icon"></i> MAGNET
|
<i class="fa-solid fa-magnet btn-icon"></i> MAGNET
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div style="display:flex; gap:10px;">
|
<div style="display:flex; gap:10px;" title="Total Transfer Speed">
|
||||||
|
<div class="transfer-info-box">
|
||||||
|
<div class="transfer-speed">
|
||||||
|
<i class="fa-solid fa-down-long"></i>
|
||||||
|
<span>
|
||||||
|
{formatSpeed(totalDownloadSpeed)}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<button
|
<button
|
||||||
class="btn-toggle-all"
|
class="btn-toggle-all"
|
||||||
on:click={toggleAllTorrents}
|
on:click={toggleAllTorrents}
|
||||||
@@ -1005,4 +1023,55 @@
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --- Transfer Info Box --- */
|
||||||
|
.transfer-info-box {
|
||||||
|
background: #f8f9fa;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 8px 8px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-width: 100px;
|
||||||
|
height: 36px;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.transfer-speed {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 5px;
|
||||||
|
font-size: 11px;
|
||||||
|
color: #666;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
|
.transfer-speed i {
|
||||||
|
color: #4caf50;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Responsive adjustments for transfer info box */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.transfer-info-box {
|
||||||
|
min-width: 85px;
|
||||||
|
padding: 6px 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.transfer-speed {
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
.transfer-info-box {
|
||||||
|
min-width: 75px;
|
||||||
|
padding: 5px 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.transfer-speed {
|
||||||
|
font-size: 9px;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user