From ff021ca5b9c2a0e776ed119e84230625aae4c83a Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 17 Jun 2024 03:43:49 +0000 Subject: [PATCH] Update content of files --- data/web/fragment.com/js/auction.js | 107 ++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/data/web/fragment.com/js/auction.js b/data/web/fragment.com/js/auction.js index 3a133e8158..ff18605a58 100644 --- a/data/web/fragment.com/js/auction.js +++ b/data/web/fragment.com/js/auction.js @@ -2646,6 +2646,113 @@ var Ads = { } }; +var Stars = { + initWithdraw: function() { + Aj.onLoad(function(state) { + var cont = Aj.ajContainer; + $(cont).on('click.curPage', '.js-withdraw-btn', Stars.eWithdrawRevenue); + state.$withdrawForm = $('.js-withdraw-form', cont); + Main.initForm(state.$withdrawForm); + state.$withdrawBtn = $('.js-withdraw-btn', cont); + state.updLastReq = +Date.now(); + state.canUpdate = true; + if (state.needUpdate) { + state.updStateTo = setTimeout(Stars.updateWithdrawState, Main.UPDATE_PERIOD); + } + }); + Aj.onUnload(function(state) { + clearTimeout(state.updStateTo); + state.canUpdate = false; + Main.destroyForm(state.$withdrawForm); + }); + }, + updateWithdrawState: function(force) { + var now = +Date.now(); + if (document.hasFocus() || force || + Aj.state.updLastReq && (now - Aj.state.updLastReq) > Main.FORCE_UPDATE_PERIOD) { + Aj.state.updLastReq = now; + Aj.apiRequest('updateStarsRevenueWithdrawalState', { + transaction: Aj.state.transaction, + withdrawal_data: Aj.state.withdrawalData, + mode: Aj.state.mode + }, function(result) { + if (result.mode) { + Aj.state.mode = result.mode; + } + if (result.withdrawal_data) { + Aj.state.withdrawalData = result.withdrawal_data; + Aj.state.$withdrawForm.field('withdrawal_data').value(result.withdrawal_data); + } + if (result.html) { + Stars.updateContent(result.html); + } + Aj.state.needUpdate = result.need_update; + if (Aj.state.canUpdate && Aj.state.needUpdate) { + Aj.state.updStateTo = setTimeout(Stars.updateWithdrawState, Main.UPDATE_PERIOD); + } + }); + } else { + if (Aj.state.canUpdate && Aj.state.needUpdate) { + Aj.state.updStateTo = setTimeout(Stars.updateWithdrawState, Main.CHECK_PERIOD); + } + } + }, + updateContent: function(html) { + $('.js-main-content').html(html).find('.js-preview-sticker').each(function() { + RLottie.init(this, {playUntilEnd: true}); + }); + }, + eWithdrawRevenue: function(e) { + e.stopImmediatePropagation(); + e.preventDefault(); + var $form = Aj.state.$withdrawForm; + var transaction = $form.field('transaction').value(); + var wallet_address = $form.field('wallet_address').value(); + var withdrawal_data = $form.field('withdrawal_data').value(); + var params = { + transaction: transaction, + wallet_address: wallet_address, + withdrawal_data: withdrawal_data + }; + if ($form.data('disabled')) { + return false; + } + var onSuccess = function(result) { + $form.data('disabled', false); + if (result.error) { + return showAlert(result.error); + } + if (result.confirm_message && result.confirm_hash) { + showConfirm(result.confirm_message, function() { + params.confirm_hash = result.confirm_hash; + $form.data('disabled', true); + Aj.apiRequest('initStarsRevenueWithdrawalRequest', params, onSuccess); + }, result.confirm_button, function() { + Aj.state.needUpdate = true; + if (Aj.state.canUpdate && Aj.state.needUpdate) { + Aj.state.updStateTo = setTimeout(Stars.updateWithdrawState, Main.CHECK_PERIOD); + } + }); + } else { + if (result.mode) { + Aj.state.mode = result.mode; + } + if (result.html) { + Stars.updateContent(result.html); + } + Aj.state.needUpdate = result.need_update; + if (Aj.state.canUpdate && Aj.state.needUpdate) { + Aj.state.updStateTo = setTimeout(Stars.updateWithdrawState, Main.UPDATE_PERIOD); + } + } + }; + $form.data('disabled', true); + Aj.state.needUpdate = false; + clearTimeout(Aj.state.updStateTo); + Aj.apiRequest('initStarsRevenueWithdrawalRequest', params, onSuccess); + } +}; + var QR = { showPopup: function(options) { options = $.extend({