From 91aeda3a35bf75449dcf1701f97e7ff446d1ea5f Mon Sep 17 00:00:00 2001 From: Steven Date: Mon, 27 Nov 2023 17:03:50 -0800 Subject: [PATCH] Added Oversight divs to each row --- README.md | 9 +++-- tampermonkey.js | 88 +++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 91 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index fb8cfc2..7387c38 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ To load the Tampermonkey script: ## Wishlist / Todo [] Bidcap for any row (only bid up to X for this county) - [] Sitewide bidcap (if any county bid exceeds X only bid up to X) + [] Sitewide bidcap (if any county bid exceeds X only bid up to X for that county) [x] Save button to persist changes (instead of waiting for refresh code to run) [x] Save settings to local storage [x] Retrieve settings from local storage @@ -23,19 +23,22 @@ To load the Tampermonkey script: [] Download Stats [] Clear Stats [] For each countyRow inject - [] "rowAction" dropdown with options: + [x] "rowAction" dropdown with options: 0 - Ignore 1 - Ensure I am highest bidder 2 - Make sure I am Tied 3 - Only watch tied bid [] save to analytics checkbox - [] county bidcap + [x] expose countyId, tie, margin/clicksToWin data + [x] county bidcap + [] enable apply, enableBidcap, bidCap, action inputs and persist values the values at a row level [] Option to sell leads that don't fit your criteria but you can't return on the secondary market. [x] Store tie values for statistical analysis over time. [] Implement tieCounty code [x] Auto login if on signin page [x] Add verticle scroll overflow to awLog div [] Figure out session timout/no longer refreshing/ not loaded issue (screensaver?, tab no focus?, os?, browser?) + [] Refactor injection and alwayswin array code in main diff --git a/tampermonkey.js b/tampermonkey.js index 880b23b..c787ee6 100644 --- a/tampermonkey.js +++ b/tampermonkey.js @@ -1,6 +1,6 @@ // ==UserScript== // @name AlwaysWin-ntsmhf -// @namespace http://tampermonkey.net/ +// @namespace https://git.qhrei.com/steven/alwayswin-ntsmhf/ // @version 0.1 // @description Make sure you are positioned where you want to be in the bidding for each county. // @author Steven Allen @@ -132,6 +132,11 @@ function autoLoginIsEnabled(){ return retVal; } +function getBidCap(countyId) { + //Get the default bidcap from settings + var bidCap = alwaysWinSettings.bidCap; + return bidCap; +} //////////////////////////////////////////////////////////////////////////////////// // Always win code to find and take the highest/tie bid @@ -148,8 +153,11 @@ function getCountyInfo(countyId){ // // // - - var county = document.querySelector('[data-subscription_id="'+ countyId +'"].subscription-status') + var county = document.querySelector('[data-subscription_id="'+ countyId +'"].subscription-status'); + if(county === null) { + console.log("county "+ countyId +" row not found"); + return; + } let countyRow = county.closest("tr"); let bidController = {}; bidController.countyRow = countyRow; @@ -167,6 +175,11 @@ function getCountyInfo(countyId){ num_clicksToMinWin = (winGap + bidIncriment) / bidIncriment; } + let num_bidCap = getBidCap(countyId); + let num_clicksToBidCap = num_clicksToMinWin; + + let oversightAction = "win"; //TODO: implement oversight actions per county and persist + bidController.readTimestamp = new Date(); bidController.isEnabled = county.checked; bidController.id = county.dataset.subscription_id; @@ -179,6 +192,9 @@ function getCountyInfo(countyId){ bidController.isWinning = (num_bid > num_tieBid); bidController.isWinningByTooMuch = (num_bid > num_winningBid); bidController.clicksToMinWin = num_clicksToMinWin; + bidController.bidCap = num_bidCap; + bidController.clicksToBidCap = num_clicksToBidCap; + bidController.oversightAction = oversightAction; bidController.btnSave = countyRow.querySelector('.bid-controller-btn--save'); bidController.btnBidUp = countyRow.querySelector('.bid-controller-btn--increment'); bidController.btnBidDown = countyRow.querySelector('.bid-controller-btn--decrement'); @@ -292,6 +308,65 @@ function loginIfNeeded(){ return loginIsNeeded; } +function renderOption(value, selectedValue) { + var optionHtml = '