Lending Club

Auto expand things on lending club

当前为 2015-08-28 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name       Lending Club
// @namespace  http://geekminute.com/
// @version    0.5
// @description  Auto expand things on lending club
// @match      https://www.lendingclub.com/*
// @copyright  2015+, Jon Heizer
// ==/UserScript==

setTimeout(function() {  
    //If there are any errors on the screen, jump out
    if (document.querySelectorAll("#master_message-list > *").length > 0 && document.documentElement.innerHTML.indexOf('There was no activity during this period') > -1 )
    {
        return;
    }
    
    //Expand loan performance
    if (document.getElementById("showLoanPerf") !== null)
    {
        document.getElementById("showLoanPerf").getElementsByTagName("a")[0].click();
    }

    //Expand payment history
    if (document.getElementById("showPayments") !== null)
    {
        document.getElementById("showPayments").getElementsByTagName("a")[0].click();
    }

    //Account Activity
    if (document.getElementById("submitAccountDates") !== null && document.getElementById("lender-activity-div") === null)
    {
        var yest = new Date();
        yest.setDate(yest.getDate()-1);

        document.getElementById("start-date").value = (yest.getMonth() + 1).toString() + "/" + yest.getDate().toString() + "/" + yest.getFullYear().toString();
        document.getElementById("submitAccountDates").click();

    }

    setTimeout(function (){
        //If there are any errors on the screen, jump out
        if (document.querySelectorAll("#master_message-list > *").length > 0 && document.documentElement.innerHTML.indexOf('There was no activity during this period') > -1)
        {
            return;
        }
        
        //Any resizing combo
        var sel = document.querySelector("select[id^='yui-pg0-0']");

        if (sel !== null)
        {
            sel.value = 10000;

            if ('fireEvent' in sel)
                sel.fireEvent("onchange");
            else {
                var evt = document.createEvent("HTMLEvents");
                evt.initEvent("change", false, true);
                sel.dispatchEvent(evt);
            }
        }
    },200);

    //Add totals to detail tables
    
    setTimeout(function (){
        TableTotals();
    },1000);

},500);

function TableTotals(){
    
    if (document.querySelectorAll("#detailPanel-div").length > 0)
    {
        //Give the table a moment to fill before calculating
        setTimeout(function (){
            //Principal
            var prin = document.querySelectorAll("td.yui-dt-col-principal div");
            var ptotal = 0;
            for (i = 0; i < prin.length; ++i) {
                ptotal += parseFloat(prin[i].title.substr(1));
            }

            document.querySelectorAll("div.bd div")[0].innerHTML+= "&nbsp;&nbsp;&nbsp;&nbsp;<em>Principal:</em>&nbsp;<strong>$" + ptotal.toFixed(2) + "</strong>";
        
            //Interest
            var prin = document.querySelectorAll("td.yui-dt-col-interest div");
            var ptotal = 0;
            for (i = 0; i < prin.length; ++i) {
                ptotal += parseFloat(prin[i].title.substr(1));
            }

            document.querySelectorAll("div.bd div")[0].innerHTML+= "&nbsp;&nbsp;&nbsp;&nbsp;<em>Interest:</em>&nbsp;<strong>$" + ptotal.toFixed(2) + "</strong>";
        },1000);
    }else{
        setTimeout(function (){
            TableTotals();
        },1000);
        
    }
    
}