Greasy Fork is available in English.
This extension simply calculates the required seeding time and displays it in the hours seeded box. Colors Ratio accordingly. Many other QOL features to come. - This is not affiliated with Avistaz. At all. -
当前为
// ==UserScript==
// @name Avistaz Plus
// @version 1.3
// @description This extension simply calculates the required seeding time and displays it in the hours seeded box. Colors Ratio accordingly. Many other QOL features to come. - This is not affiliated with Avistaz. At all. -
// @author Improved Avistaz
// @match https://avistaz.to/profile/*/history*
// @grant none
// @run-at document-end
// @namespace http://your-namespace.com
// ==/UserScript==
function AddedSeeding() {
document.querySelectorAll('tbody > tr').forEach(el =>
{
const cells = el.querySelectorAll('td');
const rawDownload = cells[6].querySelector('.text-red').textContent;
const Seededtimeraw = cells[10].querySelector('span').getAttribute('data-original-title');
const Seedingtimeraw = Seededtimeraw.match(/(\d+(\.\d+)?)/g);
const Seedingtime = Math.ceil(parseInt(Seedingtimeraw) / 60);
const Ratio = cells[7].querySelector('.text-bold').textContent;
var Match = rawDownload.match(/(\d+(\.\d+)?)\s*(GB|MB|KB|TB|B)\b/i);
if (Match)
{
var DownloadedGB = parseFloat(Match[1]);
var unit = Match[3];
if (unit === "TB") DownloadedGB *= 1024;
if (unit === "GB") DownloadedGB = DownloadedGB;
if (unit === "MB") DownloadedGB /= 1024;
if (unit === "KB") DownloadedGB /= 1024 **2 ;
}
else Match = "0";
if (DownloadedGB === 0) var result = "0";
if (DownloadedGB <= 1) result = 72;
if (DownloadedGB > 1 && DownloadedGB < 50) result = 72 + 2 * DownloadedGB;
if (DownloadedGB > 50) result = 100 * Math.log(DownloadedGB) - 219.2023;
result = Math.ceil(result);
var difference = result - Seedingtime;
const appendedValue = Seedingtime;
const seedingCell = cells[10];
const textToDisplay = Seedingtime + 'h / ' + result + 'h';
seedingCell.textContent = textToDisplay;
Seedingtime > result ? seedingCell.style.color = 'green' : seedingCell.style.color = 'red';
const ratioCell = cells[7];
ratioCell.textContent = Ratio;
ratioCell.classList.add('badge-extra'); // Add the classes
ratioCell.style.marginLeft = '5px'; // Adjust the left spacing as needed
ratioCell.style.marginTop = '5px'; // Adjust the top spacing as needed
Ratio > 1 ? ratioCell.style.color = 'green' : ratioCell.style.color = 'lightcoral';
});
}
AddedSeeding();
// Many thanks to the kind person that showed interest in this code!