您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Описание имеет неверное значение
// ==UserScript== // @name Автоподсчёт суммы донатов // @namespace http://tampermonkey.net/ // @version 0.1 // @description Описание имеет неверное значение // @author Весточка // @match https://lzt.market/user/* // @icon https://www.google.com/s2/favicons?sz=64&domain=lzt.market // @grant none // ==/UserScript== (function () { const container = document.querySelector('div.line:nth-child(1)'); if (!container) return alert('Не найден div.line:nth-child(1)'); const existingButton = container.querySelector('.button.rightButton.overlayTriggerCalc'); if (existingButton) return; // чтобы не дублировать кнопку const calcButton = document.createElement('a'); calcButton.className = 'button rightButton overlayTriggerCalc'; calcButton.textContent = 'Подсчитать'; calcButton.href = '#'; calcButton.style.marginLeft = '10px'; container.appendChild(calcButton); calcButton.addEventListener('click', function (e) { e.preventDefault(); const blocks = document.querySelectorAll('.payment_main_block'); const incoming = {}; const outgoing = {}; function parseAmount(text) { const clean = text.replace(/[^\d.,]/g, '').replace(/\s/g, '').replace(',', '.'); return parseFloat(clean); } blocks.forEach(block => { const isIn = !!block.querySelector('.amountChange .in'); const userEl = block.querySelector('.titleAction a.username span'); const amountEl = block.querySelector('.amountChange span.in, .amountChange span.out'); if (!userEl || !amountEl) return; const username = userEl.textContent.trim(); const amount = parseAmount(amountEl.textContent); if (isNaN(amount)) return; const storage = isIn ? incoming : outgoing; storage[username] = (storage[username] || 0) + amount; }); function saveFile(filename, dataObj) { // Преобразуем в массив, сортируем по убыванию суммы const entries = Object.entries(dataObj) .sort((a, b) => b[1] - a[1]); const text = entries .map(([user, amount]) => `@${user} - ${amount.toFixed(2)} ₽`) .join('\n'); const blob = new Blob([text], { type: 'text/plain;charset=utf-8' }); const link = document.createElement('a'); link.href = URL.createObjectURL(blob); link.download = filename; link.click(); } saveFile('Входящие переводы.txt', incoming); saveFile('Исходящие переводы.txt', outgoing); }); })();