PayPal_OVERRIDE

try to take over the world!

当前为 2018-10-29 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name PayPal_OVERRIDE
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://www.paypal.com/*
  8. // @grant none
  9. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js
  10. // @require https://unpkg.com/xhook@latest/dist/xhook.min.js
  11. // ==/UserScript==
  12. String.prototype.replaceAll = function(search, replacement) {
  13. var target = this;
  14. return target.replace(new RegExp(search, 'g'), replacement);
  15. };
  16. (function() {
  17. $('#js_transactionCollection').hide();
  18. var newRule = ".transactionRow, #js_transactionCollection, .btn-group.splitButtonHoverOut{display:none !important;}";
  19. $("style").prepend(newRule);
  20. xhook.after(function(request, response) {
  21. console.log(request.url);
  22. if(request.url.match(/get\-invoices/)) {
  23. response.text = response.text.replaceAll('52,000','42,000');
  24. response.text = response.text.replaceAll('77,000','67,000');
  25. response.text = response.text.replaceAll('45,000','30,000');
  26. response.text = response.text.replaceAll('500.00','200.00');
  27. }
  28. });
  29. xhook.after(function(request, response) {
  30. console.log(request.url);
  31. if(request.url.match(/transactions\/details\/inline/)) {
  32. response.text = response.text.replaceAll('52,000','42,000.00');
  33. response.text = response.text.replaceAll('2,303.00','1,848.00');
  34. response.text = response.text.replaceAll('49,697.00','40,152.00');
  35. response.text = response.text.replaceAll('500.00','200.00');
  36. }
  37. });
  38. xhook.after(function(request, response) {
  39. console.log(request.url);
  40. if(request.url.match(/transactions\/filter/)) {
  41. response.text = response.text.replaceAll('52,000','42,000.00');
  42. response.text = response.text.replaceAll('2,303.00','1,848.00');
  43. response.text = response.text.replaceAll('49,697.00','40,152.00');
  44. response.text = response.text.replaceAll('500.00','200.00');
  45. }
  46. });
  47. /**
  48. * 1848 = 40152
  49. */
  50. $(document).ready(function(){
  51. $.each($('.transactionDescription'), function(i, ele){
  52. var parent = $(ele).parents('.transactionRow');
  53. if ($(ele).text().indexOf('Infopay') !== -1 || $(ele).text().indexOf('Accucom') !== -1) {
  54. var amountObj = $(parent).find('.transactionAmount .isPositive.vx_h4');
  55. amountObj.text('₱40,152.00');
  56. }
  57. if ($(ele).text().indexOf('Bank account') !== -1 || $(ele).text().indexOf('China') !== -1 || $(ele).text().indexOf('Metrobank') !== -1 || $(ele).text().indexOf('eBay') !== -1 || $(ele).text().indexOf('NBA') !== -1) {
  58. parent.hide();
  59. }
  60. });
  61. $('#js_transactionCollection').show();
  62. $('#itemPrice_0').val('42000.00');
  63. $('#itemAmount_0').val('42,000.00');
  64. $('td.invoiceFinalTotal').text('42,000.00 PHP');
  65. });
  66. $.each($('.itemprice, .itemamount'), function(i, ele){
  67. if ($(ele).text().indexOf('52,000') !== -1) {
  68. $(ele).text('₱42,000.00');
  69. }
  70. if ($(ele).text().indexOf('25,000') !== -1) {
  71. $(ele).text('₱25,000.00');
  72. }
  73. if ($(ele).text().indexOf('45,000') !== -1) {
  74. $(ele).text('₱30,000.00');
  75. }
  76. if ($(ele).text().indexOf('$500.00') !== -1) {
  77. $(ele).text('$200.00');
  78. }
  79. });
  80.  
  81. $.each($('#invoiceTotals td.text-right'), function(i, td){
  82. var text = $(td).text();
  83. if (text === '₱52,000.00') {
  84. $(td).text('₱42,000.00');
  85. }
  86. if (text === '-₱52,000.00') {
  87. $(td).text('-₱42,000.00');
  88. }
  89. if (text === '₱45,000.00') {
  90. $(td).text('₱30,000.00');
  91. }
  92. if (text === '-₱45,000.00') {
  93. $(td).text('-₱30,000.00');
  94. }
  95. if (text === '-₱77,000.00') {
  96. $(td).text('-₱67,000.00');
  97. }
  98. if (text === '₱77,000.00') {
  99. $(td).text('₱67,000.00');
  100. }
  101. if (text === '-$500.00') {
  102. $(td).text('-$200.00');
  103. }
  104. if (text === '$500.00') {
  105. $(td).text('$200.00');
  106. }
  107. });
  108. $('#copyButton, #printInvoiceButton, .moreInvAction, .transactionHistory').hide();
  109. })();