mirror of
https://github.com/MarshalX/telegram-crawler.git
synced 2024-11-25 00:38:33 +01:00
Update content of files
This commit is contained in:
parent
3424a666d7
commit
fd3188a2a6
1 changed files with 107 additions and 0 deletions
|
@ -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 = {
|
var QR = {
|
||||||
showPopup: function(options) {
|
showPopup: function(options) {
|
||||||
options = $.extend({
|
options = $.extend({
|
||||||
|
|
Loading…
Reference in a new issue