From b6fb015c37c135987fdc72878afced6372a0d75d Mon Sep 17 00:00:00 2001 From: Codex Bot Date: Tue, 24 Mar 2026 12:28:40 +0100 Subject: [PATCH] Embed payout settings in worker stats --- website_example/js/common.js | 30 +++++++++++++++---------- website_example/pages/worker_stats.html | 26 +++++++++++++++++++++ website_example/themes/custom.css | 14 ++++++++++++ 3 files changed, 58 insertions(+), 12 deletions(-) diff --git a/website_example/js/common.js b/website_example/js/common.js index 5eab3a3..61eaef5 100644 --- a/website_example/js/common.js +++ b/website_example/js/common.js @@ -805,38 +805,43 @@ settings methods */ function settings_Setup(api, stats) { - var address = getCurrentAddress(stats.config.coin); - if (address){ - $(`#yourAddress${stats.config.coin}`).val(address); + if (address) { + if ($(`#yourAddress${stats.config.coin}`).length) { + $(`#yourAddress${stats.config.coin}`).val(address); + } settings_GetPayoutLevel(api, address, stats); - settings_GetEmailAddress(api, address, stats); + if ($(`#yourEmail${stats.config.coin}`).length) { + settings_GetEmailAddress(api, address, stats); + } } // Handle click on Set button - $(`#payoutSetButton${stats.config.coin}`).click(function(){ - var address = $(`#yourAddress${stats.config.coin}`).val().trim(); + $(`#payoutSetButton${stats.config.coin}`).off('click').click(function(){ + var address = $(`#yourAddress${stats.config.coin}`).length + ? $(`#yourAddress${stats.config.coin}`).val().trim() + : getCurrentAddress(stats.config.coin); if (!address || address == '') { - settings_ShowError('noMinerAddress', 'No miner address specified', '', false); + settings_ShowError('noMinerAddress', 'No miner address specified', '', stats); return; } var ip = $(`#yourIP${stats.config.coin}`).val().trim(); if (!ip || ip == '') { - settings_ShowError('noMinerIP', 'No miner IP address specified', '', false); + settings_ShowError('noMinerIP', 'No miner IP address specified', '', stats); return; } var level = $(`#yourPayoutRate${stats.config.coin}`).val().trim(); if (!level || level < 0) { - settings_ShowError('noPayoutLevel', 'No payout level specified', '', false); + settings_ShowError('noPayoutLevel', 'No payout level specified', '', stats); return; } settings_SetPayoutLevel(api, address, ip, level, stats); }); // Handle click on Enable button - $(`#enableButton${stats.config.coin}`).click(function(){ + $(`#enableButton${stats.config.coin}`).off('click').click(function(){ var address = $(`#yourAddress${stats.config.coin}`).val().trim(); var ip = $(`#yourIP${stats.config.coin}`).val().trim(); var email = $(`#yourEmail${stats.config.coin}`).val(); @@ -844,7 +849,7 @@ function settings_Setup(api, stats) { }); // Handle click on Disable button - $(`#disableButton${stats.config.coin}`).click(function(){ + $(`#disableButton${stats.config.coin}`).off('click').click(function(){ var address = $(`#yourAddress${stats.config.coin}`).val().trim(); var ip = $(`#yourIP${stats.config.coin}`).val().trim(); var email = $(`#yourEmail${stats.config.coin}`).val(); @@ -2054,7 +2059,8 @@ function workerstats_InitTemplate(ranOnce, addressTimeout, xhrAddressPoll, xhrGe Mustache.parse(template) rendered = Mustache.render(template, {coin:coin, active: 'active'}) $('#tab-content').append(rendered) - workerstats_Setup(lastStats, api, addressTimeout, xhrAddressPoll, xhrGetPayments) + workerstats_Setup(lastStats, api, addressTimeout, xhrAddressPoll, xhrGetPayments) + settings_Setup(api, lastStats) } if (!ranOnce) diff --git a/website_example/pages/worker_stats.html b/website_example/pages/worker_stats.html index 6f0a2d9..9871456 100644 --- a/website_example/pages/worker_stats.html +++ b/website_example/pages/worker_stats.html @@ -92,6 +92,32 @@ + +
+

  Miner Settings

+
+
+

These settings apply to the wallet address currently loaded in worker statistics.

+ +
+
+ + +
+
+ + +
+
+
+ +
+
+
+
+

  Workers Statistics

diff --git a/website_example/themes/custom.css b/website_example/themes/custom.css index 95ebc73..0c3b775 100644 --- a/website_example/themes/custom.css +++ b/website_example/themes/custom.css @@ -256,6 +256,20 @@ footer a { height: 100%; } +.settings-card label { + display: block; + margin-bottom: 8px; + color: var(--text-dim); + font-size: 11px; + font-weight: 700; + letter-spacing: 0.14em; + text-transform: uppercase; +} + +.settings-card #action_update_message { + margin-bottom: 14px; +} + .getting-started-inner { padding: 22px; }