Lending Club

Auto expand things on lending club

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

  1. // ==UserScript==
  2. // @name Lending Club
  3. // @namespace http://geekminute.com/
  4. // @version 0.6
  5. // @description Auto expand things on lending club
  6. // @match https://www.lendingclub.com/*
  7. // @copyright 2015+, Jon Heizer
  8. // ==/UserScript==
  9.  
  10. setTimeout(function() {
  11. //If there are any errors on the screen, jump out
  12. if (document.querySelectorAll("#master_message-list > *").length > 0 && document.documentElement.innerHTML.indexOf('There was no activity during this period') > -1 )
  13. {
  14. return;
  15. }
  16. //Expand loan performance
  17. if (document.getElementById("showLoanPerf") !== null)
  18. {
  19. document.getElementById("showLoanPerf").getElementsByTagName("a")[0].click();
  20. }
  21.  
  22. //Expand payment history
  23. if (document.getElementById("showPayments") !== null)
  24. {
  25. document.getElementById("showPayments").getElementsByTagName("a")[0].click();
  26. }
  27.  
  28. //Account Activity
  29. if (document.getElementById("submitAccountDates") !== null && document.getElementById("lender-activity-div") === null)
  30. {
  31. var yest = new Date();
  32. yest.setDate(yest.getDate()-1);
  33.  
  34. document.getElementById("start-date").value = (yest.getMonth() + 1).toString() + "/" + yest.getDate().toString() + "/" + yest.getFullYear().toString();
  35. document.getElementById("submitAccountDates").click();
  36.  
  37. }
  38.  
  39. setTimeout(function (){
  40. //If there are any errors on the screen, jump out
  41. if (document.querySelectorAll("#master_message-list > *").length > 0 && document.documentElement.innerHTML.indexOf('There was no activity during this period') > -1)
  42. {
  43. return;
  44. }
  45. //Any resizing combo
  46. var sel = document.querySelector("select[id^='yui-pg0-0']");
  47.  
  48. if (sel !== null)
  49. {
  50. sel.value = 10000;
  51.  
  52. if ('fireEvent' in sel)
  53. sel.fireEvent("onchange");
  54. else {
  55. var evt = document.createEvent("HTMLEvents");
  56. evt.initEvent("change", false, true);
  57. sel.dispatchEvent(evt);
  58. }
  59. }
  60. },200);
  61.  
  62. //Add totals to detail tables
  63. setTimeout(function (){
  64. TableTotals();
  65. },1000);
  66.  
  67. },500);
  68.  
  69. function TableTotals(){
  70. if (document.querySelectorAll("#detailPanel-div").length > 0)
  71. {
  72. //Give the table a moment to fill before calculating
  73. setTimeout(function (){
  74. var totalLine = document.querySelectorAll("div.bd div")[0];
  75. //Principal
  76. var prin = document.querySelectorAll("td.yui-dt-col-principal div");
  77. var ptotal = 0;
  78. for (i = 0; i < prin.length; ++i) {
  79. ptotal += parseFloat(prin[i].title.substr(1));
  80. }
  81.  
  82. totalLine.innerHTML+= "&nbsp;&nbsp;&nbsp;&nbsp;<em>Principal:</em>&nbsp;<strong>$" + ptotal.toFixed(2).toString() + "</strong>";
  83. //Interest
  84. prin = document.querySelectorAll("td.yui-dt-col-interest div");
  85. ptotal = 0;
  86. for (i = 0; i < prin.length; ++i) {
  87. ptotal += parseFloat(prin[i].title.substr(1));
  88. }
  89.  
  90. totalLine.innerHTML+= "&nbsp;&nbsp;&nbsp;&nbsp;<em>Interest:</em>&nbsp;<strong>$" + ptotal.toFixed(2).toString() + "</strong>";
  91. totalLine.innerHTML+= "&nbsp;&nbsp;&nbsp;&nbsp;<em>Count:</em>&nbsp;<strong>" + (prin.length).toString() + "</strong>";
  92. },1000);
  93. }else{
  94. setTimeout(function (){
  95. TableTotals();
  96. },1000);
  97. }
  98. }