PaydaySay Loan Amount Counter

Calculates the total loan amount displayed on a PaydaySay web interface

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         PaydaySay Loan Amount Counter
// @namespace    http://greasyfork.org/
// @version      1.0
// @description  Calculates the total loan amount displayed on a PaydaySay web interface
// @author       Andrew
// @match        *://*/*
// @grant        none
// @license        none
// ==/UserScript==

(function () {
    'use strict';

    // Function to extract dollar amounts from text
    function extractAmount(text) {
        const match = text.replace(/,/g, '').match(/\$?(\d+(\.\d{1,2})?)/);
        return match ? parseFloat(match[1]) : 0;
    }

    // Function to find and sum up all money amounts on the page
    function calculateTotalLoan() {
        const elements = document.querySelectorAll('*'); // You can refine this
        let total = 0;

        elements.forEach((el) => {
            const text = el.innerText || el.textContent;
            if (/\$\d+/.test(text)) {
                total += extractAmount(text);
            }
        });

        alert(`Total loan amount found on PaydaySay page: $${total.toFixed(2)}`);
    }

    // Run calculation 3 seconds after page load
    window.addEventListener('load', () => {
        setTimeout(calculateTotalLoan, 3000);
    });
})();