您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Mark all offers with regular point/EUR ratio yellow, all with a high ratio orange!
// ==UserScript== // @name Highlight Amex Membership Reward points value // @namespace http://sisyphus.de/ // @version 1.0 // @description Mark all offers with regular point/EUR ratio yellow, all with a high ratio orange! // @author Tobias Henöckl <[email protected]> // @match https://global.americanexpress.com/rewards/points-for-charges/* // @icon https://www.google.com/s2/favicons?sz=64&domain=americanexpress.com // @grant none // @license MIT // ==/UserScript== var threshold = 250; var maxAttempts = 50; var waitBetweenAttempts = 500; var waitAfterClickMillis = 2000; (function() { 'use strict'; var attempts = 0; var interval = setInterval(function() { attempts++; var table = document.querySelector("#roc-table"); if (table || attempts > maxAttempts) { clearInterval(interval); highlightRows(); setupButtonListener(); } }, waitBetweenAttempts); })(); function highlightRows() { var table = document.querySelector("table"); if (!table) return; table.querySelectorAll("tr").forEach(function(row) { var cells = row.querySelectorAll("td"); if (cells.length < 6) { return; } var valueCents = parseFloat(cells[5].textContent.replace(/\./g, '').replace(/,/g, '.'), 10); if(isNaN(valueCents)) { return; } var points = parseFloat(cells[6].textContent.replace(/\./g, ''), 10); if(isNaN(points)) { return; } if (Math.round(points / valueCents) >= threshold) { row.style.backgroundColor = "yellow"; } else { row.style.backgroundColor = "orange"; } }); } function setupButtonListener() { var viewAllButton = document.getElementById("view-all-button"); if (viewAllButton) { viewAllButton.addEventListener('click', function() { console.log('klickediklick'); setTimeout(highlightRows, waitAfterClickMillis); }); } }