mirror of
https://github.com/MarshalX/telegram-crawler.git
synced 2024-11-30 04:03:06 +01:00
Update content of files
This commit is contained in:
parent
bec71c6879
commit
499b8e9197
1 changed files with 147 additions and 59 deletions
|
@ -237,26 +237,6 @@ var Main = {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
closePopup(Aj.state.$headerMenu);
|
closePopup(Aj.state.$headerMenu);
|
||||||
},
|
},
|
||||||
openSimplePopup: function($popup) {
|
|
||||||
var onEnterPress = function(e) {
|
|
||||||
if (e.keyCode == Keys.RETURN) {
|
|
||||||
e.stopImmediatePropagation();
|
|
||||||
closePopup($popup);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var onClose = function(e) {
|
|
||||||
e.stopImmediatePropagation();
|
|
||||||
closePopup($popup);
|
|
||||||
};
|
|
||||||
openPopup($popup, {
|
|
||||||
onOpen: function() {
|
|
||||||
$(document).on('keydown', onEnterPress);
|
|
||||||
},
|
|
||||||
onClose: function() {
|
|
||||||
$(document).off('keydown', onEnterPress);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
eAuctionUnavailable: function(e) {
|
eAuctionUnavailable: function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var username = $(this).attr('data-username');
|
var username = $(this).attr('data-username');
|
||||||
|
@ -282,17 +262,56 @@ var Main = {
|
||||||
eHowitworks: function(e) {
|
eHowitworks: function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopImmediatePropagation();
|
e.stopImmediatePropagation();
|
||||||
Main.openSimplePopup(Aj.state.$howitworksPopup);
|
var onEnterPress = function(e) {
|
||||||
|
if (e.keyCode == Keys.RETURN) {
|
||||||
|
e.stopImmediatePropagation();
|
||||||
|
closePopup(Aj.state.$howitworksPopup);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
openPopup(Aj.state.$howitworksPopup, {
|
||||||
|
onOpen: function() {
|
||||||
|
$(document).on('keydown', onEnterPress);
|
||||||
|
},
|
||||||
|
onClose: function() {
|
||||||
|
$(document).off('keydown', onEnterPress);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
eHowofferworks: function(e) {
|
eHowofferworks: function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopImmediatePropagation();
|
e.stopImmediatePropagation();
|
||||||
Main.openSimplePopup(Aj.state.$howofferworksPopup);
|
var onEnterPress = function(e) {
|
||||||
|
if (e.keyCode == Keys.RETURN) {
|
||||||
|
e.stopImmediatePropagation();
|
||||||
|
closePopup(Aj.state.$howofferworksPopup);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
openPopup(Aj.state.$howofferworksPopup, {
|
||||||
|
onOpen: function() {
|
||||||
|
$(document).on('keydown', onEnterPress);
|
||||||
|
},
|
||||||
|
onClose: function() {
|
||||||
|
$(document).off('keydown', onEnterPress);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
eBotsAbout: function(e) {
|
eBotsAbout: function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopImmediatePropagation();
|
e.stopImmediatePropagation();
|
||||||
Main.openSimplePopup(Aj.state.$botsaboutPopup);
|
var onEnterPress = function(e) {
|
||||||
|
if (e.keyCode == Keys.RETURN) {
|
||||||
|
e.stopImmediatePropagation();
|
||||||
|
closePopup(Aj.state.$botsaboutPopup);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
openPopup(Aj.state.$botsaboutPopup, {
|
||||||
|
onOpen: function() {
|
||||||
|
$(document).on('keydown', onEnterPress);
|
||||||
|
},
|
||||||
|
onClose: function() {
|
||||||
|
$(document).off('keydown', onEnterPress);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
amountFieldValue: function($form, field) {
|
amountFieldValue: function($form, field) {
|
||||||
var $fieldEl = field ? $form.field(field) : $form;
|
var $fieldEl = field ? $form.field(field) : $form;
|
||||||
|
@ -665,14 +684,9 @@ var Wallet = {
|
||||||
sendTransaction: function(options) {
|
sendTransaction: function(options) {
|
||||||
if (Aj.globalState.tonConnectVersion == 2) {
|
if (Aj.globalState.tonConnectVersion == 2) {
|
||||||
var tonConnectUI = Aj.globalState.tonConnectUI;
|
var tonConnectUI = Aj.globalState.tonConnectUI;
|
||||||
var sendTransaction = function(data) {
|
var sendTransaction = function(transaction) {
|
||||||
var transaction = data.transaction;
|
|
||||||
tonConnectUI.sendTransaction(transaction).then(function(transaction) {
|
tonConnectUI.sendTransaction(transaction).then(function(transaction) {
|
||||||
options.onConfirm && options.onConfirm(true);
|
options.onConfirm && options.onConfirm(true);
|
||||||
if (data.confirm_method) {
|
|
||||||
var params = $.extend({boc: transaction.boc}, data.confirm_params);
|
|
||||||
Aj.apiRequest(data.confirm_method, params);
|
|
||||||
}
|
|
||||||
}).catch(function(){});
|
}).catch(function(){});
|
||||||
};
|
};
|
||||||
if (!tonConnectUI.connected) {
|
if (!tonConnectUI.connected) {
|
||||||
|
@ -683,10 +697,10 @@ var Wallet = {
|
||||||
if (result.error) {
|
if (result.error) {
|
||||||
return showAlert(result.error);
|
return showAlert(result.error);
|
||||||
}
|
}
|
||||||
sendTransaction(result);
|
sendTransaction(result.transaction);
|
||||||
});
|
});
|
||||||
} else if (options.transaction) {
|
} else if (options.transaction) {
|
||||||
sendTransaction(options);
|
sendTransaction(options.transaction);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QR.showPopup(options);
|
QR.showPopup(options);
|
||||||
|
@ -2378,17 +2392,15 @@ var Ads = {
|
||||||
init: function() {
|
init: function() {
|
||||||
Aj.onLoad(function(state) {
|
Aj.onLoad(function(state) {
|
||||||
var cont = Aj.ajContainer;
|
var cont = Aj.ajContainer;
|
||||||
$(cont).on('click.curPage', '.js-pay-for-ads', Ads.ePayForAds);
|
|
||||||
$(cont).on('click.curPage', '.js-howtopay-ton', Ads.eHowToPayTon);
|
|
||||||
$(cont).on('click.curPage', '.js-get-ad-rewards', Ads.eGetAdRewards);
|
|
||||||
state.$payForAdsPopup = $('.js-pay-for-ads-popup');
|
|
||||||
state.$howToPayTonPopup = $('.js-how-to-pay-ton-popup');
|
|
||||||
state.$howToGetRewardsPopup = $('.js-how-to-get-rewards-popup');
|
|
||||||
|
|
||||||
$(cont).on('click.curPage', '.js-more-funds-btn', Ads.eAddMoreFunds);
|
$(cont).on('click.curPage', '.js-more-funds-btn', Ads.eAddMoreFunds);
|
||||||
$(cont).on('click.curPage', '.js-recharge-btn', Ads.eRechargeAccount);
|
$(cont).on('click.curPage', '.js-recharge-btn', Ads.eRechargeAccount);
|
||||||
state.$rechargeForm = $('.js-recharge-form', cont);
|
state.$rechargeForm = $('.js-recharge-form', cont);
|
||||||
|
state.$searchField = $('.js-account-search-field', cont);
|
||||||
Main.initForm(state.$rechargeForm);
|
Main.initForm(state.$rechargeForm);
|
||||||
|
state.$rechargeForm.on('submit', Ads.eSearchSubmit);
|
||||||
|
state.$rechargeForm.field('query').on('input', Ads.eSearchInput);
|
||||||
|
state.$rechargeForm.field('query').on('change', Ads.eSearchChange);
|
||||||
|
$('.js-form-clear', state.$rechargeForm).on('click', Ads.eSearchClear);
|
||||||
state.$rechargeBtn = $('.js-recharge-btn', cont);
|
state.$rechargeBtn = $('.js-recharge-btn', cont);
|
||||||
state.updLastReq = +Date.now();
|
state.updLastReq = +Date.now();
|
||||||
if (state.needUpdate) {
|
if (state.needUpdate) {
|
||||||
|
@ -2398,24 +2410,13 @@ var Ads = {
|
||||||
Aj.onUnload(function(state) {
|
Aj.onUnload(function(state) {
|
||||||
clearTimeout(state.updStateTo);
|
clearTimeout(state.updStateTo);
|
||||||
state.needUpdate = false;
|
state.needUpdate = false;
|
||||||
Main.destroyForm(state.$rechargeForm);
|
Main.destroyForm(state.$giftPremiumForm);
|
||||||
|
state.$rechargeForm.off('submit', Ads.eSearchSubmit);
|
||||||
|
state.$rechargeForm.field('query').off('input', Ads.eSearchInput);
|
||||||
|
state.$rechargeForm.field('query').off('change', Ads.eSearchChange);
|
||||||
|
$('.js-form-clear', state.$rechargeForm).off('click', Ads.eSearchClear);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
ePayForAds: function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopImmediatePropagation();
|
|
||||||
Main.openSimplePopup(Aj.state.$payForAdsPopup);
|
|
||||||
},
|
|
||||||
eHowToPayTon: function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopImmediatePropagation();
|
|
||||||
Main.openSimplePopup(Aj.state.$howToPayTonPopup);
|
|
||||||
},
|
|
||||||
eGetAdRewards: function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopImmediatePropagation();
|
|
||||||
Main.openSimplePopup(Aj.state.$howToGetRewardsPopup);
|
|
||||||
},
|
|
||||||
updateState: function() {
|
updateState: function() {
|
||||||
var now = +Date.now();
|
var now = +Date.now();
|
||||||
if (document.hasFocus() ||
|
if (document.hasFocus() ||
|
||||||
|
@ -2450,6 +2451,97 @@ var Ads = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
eSearchInput: function(e) {
|
||||||
|
var $field = Aj.state.$searchField;
|
||||||
|
$('.js-search-field-error').html('');
|
||||||
|
$field.removeClass('error');
|
||||||
|
},
|
||||||
|
eSearchChange: function(e) {
|
||||||
|
Ads.searchSubmit();
|
||||||
|
},
|
||||||
|
eSearchClear: function(e) {
|
||||||
|
var $form = Aj.state.$rechargeForm;
|
||||||
|
var $field = Aj.state.$searchField;
|
||||||
|
var $btn = Aj.state.$rechargeBtn;
|
||||||
|
$form.field('account').value('');
|
||||||
|
$form.field('query').value('').prop('disabled', false);
|
||||||
|
$btn.prop('disabled', true);
|
||||||
|
$field.removeClass('found');
|
||||||
|
$('.js-search-field-error').html('');
|
||||||
|
$field.removeClass('error');
|
||||||
|
Ads.updateUrl();
|
||||||
|
$form.field('query').focus();
|
||||||
|
},
|
||||||
|
eSearchSubmit: function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
Ads.searchSubmit();
|
||||||
|
},
|
||||||
|
searchSubmit: function() {
|
||||||
|
var $form = Aj.state.$rechargeForm;
|
||||||
|
var account = $form.field('account').value();
|
||||||
|
var query = $form.field('query').value();
|
||||||
|
if (!query.length) {
|
||||||
|
$form.field('query').focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Aj.state.$searchField.addClass('loading').removeClass('play').redraw().addClass('play');
|
||||||
|
Aj.showProgress();
|
||||||
|
Aj.apiRequest('searchAdsAccount', {
|
||||||
|
query: account || query
|
||||||
|
}, function(result) {
|
||||||
|
Aj.hideProgress();
|
||||||
|
Ads.updateResult(result);
|
||||||
|
Aj.state.$searchField.removeClass('loading');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
updateResult: function(result) {
|
||||||
|
var $form = Aj.state.$rechargeForm;
|
||||||
|
var $field = Aj.state.$searchField;
|
||||||
|
var $btn = Aj.state.$rechargeBtn;
|
||||||
|
if (result.error) {
|
||||||
|
$('.js-search-field-error').html(result.error);
|
||||||
|
$field.addClass('error').removeClass('found');
|
||||||
|
$form.field('query').prop('disabled', false);
|
||||||
|
} else {
|
||||||
|
$('.js-search-field-error').html('');
|
||||||
|
$field.removeClass('error');
|
||||||
|
if (result.found) {
|
||||||
|
if (result.found.photo) {
|
||||||
|
$('.js-account-search-photo', $field).html(result.found.photo);
|
||||||
|
}
|
||||||
|
if (result.found.name) {
|
||||||
|
var $form = Aj.state.$rechargeForm;
|
||||||
|
$form.field('query').value(uncleanHTML(result.found.name));
|
||||||
|
}
|
||||||
|
$form.field('account').value(result.found.account);
|
||||||
|
$field.addClass('found');
|
||||||
|
$form.field('query').prop('disabled', true);
|
||||||
|
$btn.prop('disabled', false);
|
||||||
|
} else {
|
||||||
|
$form.field('account').value('');
|
||||||
|
$field.removeClass('found');
|
||||||
|
$form.field('query').prop('disabled', false);
|
||||||
|
$btn.prop('disabled', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ads.updateUrl();
|
||||||
|
},
|
||||||
|
updateUrl: function() {
|
||||||
|
var new_url = '';
|
||||||
|
var $form = Aj.state.$rechargeForm;
|
||||||
|
var account = $form.field('account').value();
|
||||||
|
if (account) {
|
||||||
|
new_url += '&account=' + encodeURIComponent(account);
|
||||||
|
}
|
||||||
|
if (new_url) {
|
||||||
|
new_url = '?' + new_url.substr(1);
|
||||||
|
}
|
||||||
|
var loc = Aj.location(), path = loc.pathname + loc.search;
|
||||||
|
if (!new_url) {
|
||||||
|
new_url = loc.pathname;
|
||||||
|
}
|
||||||
|
Aj.setLocation(new_url, path != '/ads');
|
||||||
|
},
|
||||||
updateHistory: function(html) {
|
updateHistory: function(html) {
|
||||||
$('.js-premium-history').replaceWith(html);
|
$('.js-premium-history').replaceWith(html);
|
||||||
},
|
},
|
||||||
|
@ -2500,11 +2592,7 @@ var Ads = {
|
||||||
if (result.error) {
|
if (result.error) {
|
||||||
return showAlert(result.error);
|
return showAlert(result.error);
|
||||||
}
|
}
|
||||||
if (result.redirect_to) {
|
Aj.location('/ads');
|
||||||
Aj.reload();
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue