|
|
@ -61,18 +61,24 @@ function addAlwaysWinStyle(css) { |
|
|
|
head.appendChild(style); |
|
|
|
} |
|
|
|
|
|
|
|
function handleSaveSettings() { |
|
|
|
saveSettings(); |
|
|
|
location.reload(); |
|
|
|
} |
|
|
|
|
|
|
|
function saveSettings() { |
|
|
|
let isReloadEnabledValue = document.querySelector("[name='isReloadEnabled']").checked; |
|
|
|
let isAutoLoginEnabledValue = document.querySelector("[name='isAutoLoginEnabled']").checked; |
|
|
|
let minSecondsBetweenReloadsValue = document.querySelector("[name='minSecondsBetweenReloads']").value; |
|
|
|
let maxSecondsBetweenReloadsValue = document.querySelector("[name='maxSecondsBetweenReloads']").value; |
|
|
|
let bidCap = document.querySelector("[name='bidCap']").value; |
|
|
|
|
|
|
|
var latestSettings = alwaysWinSettings; |
|
|
|
latestSettings.isReloadEnabled = isReloadEnabledValue; |
|
|
|
latestSettings.isAutoLoginEnabled = isAutoLoginEnabledValue; |
|
|
|
latestSettings.minSecondsBetweenReloads = minSecondsBetweenReloadsValue; |
|
|
|
latestSettings.maxSecondsBetweenReloads = maxSecondsBetweenReloadsValue; |
|
|
|
|
|
|
|
latestSettings.bidCap = bidCap; |
|
|
|
//console.log("latestSettings");
|
|
|
|
//console.log(latestSettings);
|
|
|
|
|
|
|
@ -291,26 +297,37 @@ const sleep = ms => new Promise(res => setTimeout(res, ms)) |
|
|
|
jQuery(window).on('load',function() { |
|
|
|
console.log("Page loaded at: "+ new Date()); |
|
|
|
let minSecondsBetweenReloads = alwaysWinSettings.minSecondsBetweenReloads ?? 30; |
|
|
|
let maxSecondsBetweenReloads = alwaysWinSettings.maxSecondsBetweenReloads ?? 60; |
|
|
|
let maxSecondsBetweenReloads = alwaysWinSettings.maxSecondsBetweenReloads ?? 180; |
|
|
|
let isReloadEnabled = alwaysWinSettings.isReloadEnabled ?? false; |
|
|
|
let isAutoLoginEnabled = alwaysWinSettings.isAutoLoginEnabled ?? false; |
|
|
|
let bidCap = alwaysWinSettings.bidCap ?? 500; |
|
|
|
let secondsBetweenReloads = getRandomNumberBetween(minSecondsBetweenReloads, maxSecondsBetweenReloads); |
|
|
|
console.log("Next reload should occur in "+ secondsBetweenReloads +" seconds"); |
|
|
|
|
|
|
|
//Inject our controls
|
|
|
|
var newDiv = document.createElement ('div'); |
|
|
|
var newHtml = '<div id="alwaysWin-ntsmhf">'; |
|
|
|
var newHtml = '<div class="alwaysWin-ntsmhf" id="alwaysWin-ntsmhf">'; |
|
|
|
newHtml += '<input type="checkbox" name="isReloadEnabled" '+ getCheckedValue("isReloadEnabled") +'/><label for="isReloadEnabled">AlwaysWin</label> | '; |
|
|
|
newHtml += '<input type="checkbox" name="isAutoLoginEnabled" '+ getCheckedValue("isAutoLoginEnabled") +'/><label for="isAutoLoginEnabled">Auto Login</label><br/>'; |
|
|
|
newHtml += '<input type="checkbox" name="isAutoLoginEnabled" '+ getCheckedValue("isAutoLoginEnabled") +'/><label for="isAutoLoginEnabled">Auto Login</label> | '; |
|
|
|
newHtml += '<button class="alwaysWinButton" id="alwaysWin-ntsmhf-save" type="button">Save</button>'; |
|
|
|
newHtml += '<br />'; |
|
|
|
newHtml += '<label for="minSecondsBetweenReloads">Reload Every</label>:<input id="minSecondsBetweenReloads" type="text" size="3" name="minSecondsBetweenReloads" value="'+minSecondsBetweenReloads+'" /> to <input id="maxSecondsBetweenReloads" type="text" size="3" name="maxSecondsBetweenReloads" value="'+maxSecondsBetweenReloads+'" /> seconds <br/>'; |
|
|
|
newHtml += '<div id="reloaderData"><div id="countdown"></div><progress value="0" max="100" id="progressBar" style="width: 100%;"></progress></div><div id="awLog" style="width:100%; font-size: 0.75em; border-style:ridge; background-color:#FEFEFE;" ">Log:</div>'; |
|
|
|
newHtml += '<label for="bidCap">Don't bid more than</label>: <input id="bidCap" type="text" size="5" name="bidCap" value="'+ bidCap+'"/> per county<br />'; |
|
|
|
newHtml += '<div id="reloaderData"><div id="countdown"></div><progress value="0" max="100" id="progressBar" style="width: 100%;"></progress></div><div id="awLog" class="alwaysWinLog">Log:</div>'; |
|
|
|
newHtml += '</div>'; |
|
|
|
|
|
|
|
newDiv.innerHTML = newHtml; |
|
|
|
|
|
|
|
addAlwaysWinStyle('#alwaysWin-ntsmhf { position: fixed; top: 0px; left: 0px; background-color: #DDDDDD; border-radius: 5px; padding:2px; box-shadow: 5px 5px 3px #777777;}'); |
|
|
|
addAlwaysWinStyle('.alwaysWin-ntsmhf {position: fixed; top: 0px; left: 0px; background-color: #DDDDDD; border-radius: 5px; padding:2px; box-shadow: 5px 5px 3px #777777;}'); |
|
|
|
addAlwaysWinStyle('.alwaysWin-ntsmhf .alwaysWinLog {float:left; width:100%; overflow-y: auto; height: 100px; font-size: 0.75em; border-style:ridge; background-color:#FEFEFE;}'); |
|
|
|
addAlwaysWinStyle('.alwaysWin-ntsmhf .alwaysWinButton { border: none; color: #333333; padding: 1px 2px; text-align: center; text-decoration: none; display: inline-block; font-size: 8x; margin: 1px 1px; cursor: pointer;}'); |
|
|
|
addAlwaysWinStyle('.alwaysWin-ntsmhf .alwaysWinButton:hover {box-shadow: 0 2px 2px 0}'); |
|
|
|
addAlwaysWinStyle('.alwaysWin-ntsmhf .alwaysWinButton:active {position: relative; top: 1px;}'); |
|
|
|
document.body.appendChild (newDiv); |
|
|
|
|
|
|
|
const alwaysWinSave = document.getElementById("alwaysWin-ntsmhf-save"); |
|
|
|
alwaysWinSave.addEventListener("click", handleSaveSettings); |
|
|
|
|
|
|
|
//Only run our code on certain pages
|
|
|
|
//console.log(window.location.pathname);
|
|
|
|
switch (window.location.pathname) { |
|
|
|