You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
211 lines
6.6 KiB
211 lines
6.6 KiB
/* TODO:
|
|
* Inject div
|
|
* start/stop buttons
|
|
* How often should the status check be performed? [] seconds (have interval use that value)
|
|
* show rowAction1[] //AlwaysWin
|
|
* show rowAction2[] //AlwaysTie
|
|
* show rowAction3[] //WatchTie
|
|
* PriceChangeOverTime Chart
|
|
* For each countyRow inject
|
|
* "rowAction" dropdown with options: [Ignore,1 - Ensure I am highest bidder, 2 - Make sure I am Tied, 3 - Only watch tied bid]
|
|
* save to analytics checkbox
|
|
* bidcap input
|
|
* Sell leads that don't fit your criteria but you can't return on the secondary market.
|
|
*/
|
|
|
|
//Win+Save
|
|
//https://leads.needtosellmyhousefast.com/app/subscription/84035
|
|
var currentLocation = window.location.href;
|
|
const destUrl = "https://leads.needtosellmyhousefast.com/app/subscriptions/";
|
|
if(currentLocation != destUrl) {
|
|
window.location.href = destUrl;
|
|
}
|
|
|
|
//location.reload()
|
|
const Status_Top = "Top Bid";
|
|
const Status_Tied = "Tied Bid";
|
|
const Status_Low = "Low Bid";
|
|
|
|
function getCountyInfoNew(countyId){
|
|
const counties = document.querySelectorAll('.subscription-status');
|
|
for (let county of counties) {
|
|
if(county.dataset.subscription_id == countyId) {
|
|
let bidController = getControllerForCounty(county);
|
|
return bidController;
|
|
}
|
|
}
|
|
}
|
|
|
|
function getCountyInfo(countyId){
|
|
const counties = document.querySelectorAll('.subscription-status');
|
|
for (let county of counties) {
|
|
if(county.dataset.subscription_id == countyId) {
|
|
let countyRow = county.closest("tr");
|
|
let bidController = {};
|
|
bidController.countyRow = countyRow;
|
|
|
|
bidController.isEnabled = county.checked;
|
|
bidController.id = county.dataset.subscription_id;
|
|
bidController.name = county.closest("div").getElementsByTagName('a')[0].innerText;
|
|
bidController.bid = countyRow.querySelector('.bid-controller--bid').value;
|
|
bidController.status = countyRow.querySelector(".bid-status").innerText.trim(); //countyRow.querySelector(".bid-status").dataset.bid_status;
|
|
bidController.isWinning = (bidController.status == Status_Top);
|
|
bidController.winningBid = "unknown";
|
|
bidController.tieBid = "unknown";
|
|
bidController.floorBid = "unknown";
|
|
bidController.btnSave = countyRow.querySelector('.bid-controller-btn--save');
|
|
bidController.btnBidUp = countyRow.querySelector('.bid-controller-btn--increment');
|
|
bidController.btnBidDown = countyRow.querySelector('.bid-controller-btn--decrement');
|
|
return bidController;
|
|
}
|
|
}
|
|
}
|
|
|
|
function findTieBid(bidController) {
|
|
let latestBidInfo = getCountyInfo(bidController.id);
|
|
|
|
//Perhaps we currently have a bid that is too high.
|
|
while(latestBidInfo.isWinning) {
|
|
bidController.winningBid = latestBidInfo.bid;
|
|
bidController.btnBidDown.click();
|
|
latestBidInfo = findTieBid(bidController);
|
|
}
|
|
|
|
//Are we currently tied?
|
|
if(latestBidInfo.status === Status_Tied) {
|
|
bidController.tieBid = latestBidInfo.bid;
|
|
return latestBidInfo;
|
|
}
|
|
|
|
//Deal with situations were we are too low.
|
|
while(!latestBidInfo.isWinning) {
|
|
if(latestBidInfo.status === Status_Tied) {
|
|
bidController.tieBid = latestBidInfo.bid;
|
|
return latestBidInfo;
|
|
}
|
|
|
|
bidController.floorBid = latestBidInfo.bid;
|
|
bidController.btnBidUp.click();
|
|
latestBidInfo = findTieBid(bidController);
|
|
}
|
|
//We should not make it to here but if we do return the latest info we have.
|
|
return latestBidInfo;
|
|
}
|
|
|
|
function findMaxBid(bidController) {
|
|
let latestBidInfo = getCountyInfo(bidController.id);
|
|
if(latestBidInfo.isWinning) {
|
|
bidController.winningBid = latestBidInfo.bid;
|
|
} else {
|
|
bidController.btnBidUp.click();
|
|
latestBidInfo = getCountyInfo(bidController.id);
|
|
while(!latestBidInfo.isWinning) {
|
|
latestBidInfo = findMaxBid(bidController);
|
|
}
|
|
bidController.winningBid = latestBidInfo.winningBid;
|
|
}
|
|
return latestBidInfo;
|
|
}
|
|
|
|
function getControllerForCounty(county) {
|
|
let countyRow = county.closest("tr");
|
|
let bidController = {};
|
|
bidController.countyRow = countyRow;
|
|
|
|
bidController.isEnabled = county.checked;
|
|
bidController.id = county.dataset.subscription_id;
|
|
bidController.name = county.closest("div").getElementsByTagName('a')[0].innerText;
|
|
bidController.bid = countyRow.querySelector('.bid-controller--bid').value;
|
|
bidController.status = countyRow.querySelector(".bid-status").innerText.trim(); //countyRow.querySelector(".bid-status").dataset.bid_status;
|
|
bidController.isWinning = (bidController.status == Status_Top);
|
|
bidController.winningBid = "unknown";
|
|
bidController.tieBid = "unknown";
|
|
bidController.floorBid = "unknown";
|
|
bidController.btnSave = countyRow.querySelector('.bid-controller-btn--save');
|
|
bidController.btnBidUp = countyRow.querySelector('.bid-controller-btn--increment');
|
|
bidController.btnBidDown = countyRow.querySelector('.bid-controller-btn--decrement');
|
|
return bidController;
|
|
}
|
|
|
|
function winCounty(countyInfo, saveChanges){
|
|
let tieData = findTieBid(countyInfo);
|
|
countyInfo.btnBidUp.click();
|
|
if(saveChanges) {
|
|
countyInfo.btnSave.click();
|
|
}
|
|
}
|
|
|
|
function winAll(includeActive, includeInactive, saveChanges){
|
|
const counties = document.querySelectorAll('.subscription-status');
|
|
for (let county of counties) {
|
|
let okToChange = false;
|
|
if(includeActive && county.checked) {
|
|
okToChange = true;
|
|
}
|
|
if(includeInactive && !county.checked) {
|
|
okToChange = true;
|
|
}
|
|
|
|
if(okToChange) {
|
|
let controller = getControllerForCounty(county);
|
|
let tieData = findTieBid(controller);
|
|
controller.btnBidUp.click();
|
|
if(saveChanges) {
|
|
controller.btnSave.click();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function tieCounty(countyInfo, saveChanges){
|
|
let tieData = findTieBid(countyInfo);
|
|
if(saveChanges) {
|
|
countyInfo.btnSave.click();
|
|
}
|
|
}
|
|
|
|
function tieAll(includeActive, includeInactive, saveChanges){
|
|
const counties = document.querySelectorAll('.subscription-status');
|
|
for (let county of counties) {
|
|
let okToChange = false;
|
|
if(includeActive && county.checked) {
|
|
okToChange = true;
|
|
}
|
|
if(includeInactive && !county.checked) {
|
|
okToChange = true;
|
|
}
|
|
|
|
if(okToChange) {
|
|
let controller = getControllerForCounty(county);
|
|
let tieData = findTieBid(controller);
|
|
if(saveChanges) {
|
|
controller.btnSave.click();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
const keepWinning = () => {
|
|
winCounty(washington, true);
|
|
winCounty(marion,true);
|
|
tieCounty(clackamas,false);
|
|
tieCounty(cascade,false);
|
|
console.log('Still winning at '+ new Date());
|
|
//TODO store tie values for statistical analysis over time.
|
|
};
|
|
|
|
let cascade = getCountyInfo("84034");
|
|
let marion = getCountyInfo("87833");
|
|
let washington = getCountyInfo("84035");
|
|
let clackamas = getCountyInfo("84037");
|
|
//var tieData = findTieBid(clackamas);
|
|
|
|
keepWinning();
|
|
const interval = setInterval(keepWinning, 300000); // Repeat every 300 seconds /5 minutes
|
|
//clearInterval(interval); // The interval will no longer run
|
|
//win(true,true,false);
|
|
//tie(true,true,false);
|
|
|
|
|
|
///BOOKMARKLET
|
|
//https://www.yourjs.com/bookmarklet/
|
|
|