Update content of files

This commit is contained in:
GitHub Action 2024-06-15 00:50:47 +00:00
parent c10fb7fc1b
commit 7d65b9ac68

View file

@ -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({