diff --git a/data/web/fragment.com/css/auction.css b/data/web/fragment.com/css/auction.css index 34c7b5b7b7..d89babd0e3 100644 --- a/data/web/fragment.com/css/auction.css +++ b/data/web/fragment.com/css/auction.css @@ -215,6 +215,7 @@ i.icon { font-size: 15px; line-height: 20px; padding: 11px 22px; + word-break: break-word; box-shadow: none !important; border: none; background: var(--field-bg-color); @@ -3221,6 +3222,14 @@ a.tm-table-action-link:hover { .tm-main-box-processing-error .tm-main-box-processing-head { color: var(--unavail-color); } +.tm-main-box-icon-expired { + margin: 0 auto 20px; +} +.tm-main-box-processing-expired .icon-expired:before { + width: 50px; + height: 50px; + background-image: var(--image-url-main-search-expired); +} .tm-main-box-processing-head { font-size: 17px; line-height: 24px; @@ -4153,6 +4162,8 @@ a.tm-table-action-link:hover { --image-url-main-search-error: url('data:image/svg+xml,%3Csvg%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20width%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20fill%3D%22%23fff%22%20r%3D%229%22%2F%3E%3Cpath%20d%3D%22m10%200c5.52%200%2010%204.48%2010%2010s-4.48%2010-10%2010-10-4.48-10-10%204.48-10%2010-10zm0%2012.75c-.69%200-1.25.56-1.25%201.25s.56%201.25%201.25%201.25%201.25-.56%201.25-1.25-.56-1.25-1.25-1.25zm0-7.75c-.55%200-1%20.45-1%201v5c0%20.55.45%201%201%201s1-.45%201-1v-5c0-.55-.45-1-1-1z%22%20fill%3D%22%23ff5863%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E'); + --image-url-main-search-expired: url('data:image/svg+xml,%3Csvg%20height%3D%2220%22%20viewBox%3D%220%200%2020%2020%22%20width%3D%2220%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ccircle%20cx%3D%2210%22%20cy%3D%2210%22%20fill%3D%22%23fff%22%20r%3D%229%22%2F%3E%3Cpath%20d%3D%22m10%200c5.52%200%2010%204.48%2010%2010s-4.48%2010-10%2010-10-4.48-10-10%204.48-10%2010-10zm0%2012.75c-.69%200-1.25.56-1.25%201.25s.56%201.25%201.25%201.25%201.25-.56%201.25-1.25-.56-1.25-1.25-1.25zm0-7.75c-.55%200-1%20.45-1%201v5c0%20.55.45%201%201%201s1-.45%201-1v-5c0-.55-.45-1-1-1z%22%20fill%3D%22%23ff9953%22%20fill-rule%3D%22evenodd%22%2F%3E%3C%2Fsvg%3E'); + --image-url-dropdown-caret: url('data:image/svg+xml,%3Csvg%20height%3D%2218%22%20viewBox%3D%220%200%2015%2018%22%20width%3D%2215%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22m2%207.5%205.11%205.15c.2.19.52.19.71%200l5.18-5.15%22%20fill%3D%22none%22%20stroke%3D%22%23677a8c%22%20stroke-linecap%3D%22round%22%20stroke-width%3D%222%22%2F%3E%3C%2Fsvg%3E'); --image-url-dropdown-caret-active: url('data:image/svg+xml,%3Csvg%20height%3D%2218%22%20viewBox%3D%220%200%2015%2018%22%20width%3D%2215%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22m2%207.5%205.11%205.15c.2.19.52.19.71%200l5.18-5.15%22%20fill%3D%22none%22%20stroke%3D%22%23fff%22%20stroke-linecap%3D%22round%22%20stroke-width%3D%222%22%2F%3E%3C%2Fsvg%3E'); diff --git a/data/web/fragment.com/js/auction.js b/data/web/fragment.com/js/auction.js index 7d045eaa66..3ede583ca7 100644 --- a/data/web/fragment.com/js/auction.js +++ b/data/web/fragment.com/js/auction.js @@ -1820,9 +1820,9 @@ var Premium = { }); }); }, - updateState: function() { + updateState: function(force) { var now = +Date.now(); - if (document.hasFocus() || + if (document.hasFocus() || force || Aj.state.updLastReq && (now - Aj.state.updLastReq) > Main.FORCE_UPDATE_PERIOD) { Aj.state.updLastReq = now; Aj.apiRequest('updatePremiumState', { @@ -2039,7 +2039,10 @@ var Premium = { }), qr_label: item_title, tk_label: l('WEB_POPUP_QR_PREMIUM_TK_BUTTON'), - terms_label: l('WEB_POPUP_QR_PROCEED_TERMS') + terms_label: l('WEB_POPUP_QR_PROCEED_TERMS'), + onConfirm: function(by_server) { + Premium.updateState(true); + } }); Aj.state.needUpdate = true; }, @@ -2103,9 +2106,9 @@ var PremiumGiveaway = { }); }); }, - updateState: function() { + updateState: function(force) { var now = +Date.now(); - if (document.hasFocus() || + if (document.hasFocus() || force || Aj.state.updLastReq && (now - Aj.state.updLastReq) > Main.FORCE_UPDATE_PERIOD) { Aj.state.updLastReq = now; Aj.apiRequest('updatePremiumGiveawayState', { @@ -2358,7 +2361,10 @@ var PremiumGiveaway = { }), qr_label: item_title, tk_label: l('WEB_POPUP_QR_GIVEAWAY_TK_BUTTON'), - terms_label: l('WEB_POPUP_QR_PROCEED_TERMS') + terms_label: l('WEB_POPUP_QR_PROCEED_TERMS'), + onConfirm: function(by_server) { + PremiumGiveaway.updateState(true); + } }); Aj.state.needUpdate = true; }, @@ -2384,6 +2390,13 @@ var Ads = { state.$payForAdsPopup = $('.js-pay-for-ads-popup'); state.$howToPayTonPopup = $('.js-how-to-pay-ton-popup'); state.$howToGetRewardsPopup = $('.js-how-to-get-rewards-popup'); + }); + }, + initPay: function() { + Aj.onLoad(function(state) { + var cont = Aj.ajContainer; + $(cont).on('click.curPage', '.js-howtopay-ton', Ads.eHowToPayTon); + state.$howToPayTonPopup = $('.js-how-to-pay-ton-popup'); $(cont).on('click.curPage', '.js-more-funds-btn', Ads.eAddMoreFunds); $(cont).on('click.curPage', '.js-recharge-btn', Ads.eRechargeAccount); @@ -2391,16 +2404,39 @@ var Ads = { Main.initForm(state.$rechargeForm); state.$rechargeBtn = $('.js-recharge-btn', cont); state.updLastReq = +Date.now(); + state.canUpdate = true; if (state.needUpdate) { state.updStateTo = setTimeout(Ads.updateState, Main.UPDATE_PERIOD); } }); Aj.onUnload(function(state) { clearTimeout(state.updStateTo); - state.needUpdate = false; + state.canUpdate = false; Main.destroyForm(state.$rechargeForm); }); }, + initWithdraw: function() { + Aj.onLoad(function(state) { + var cont = Aj.ajContainer; + $(cont).on('click.curPage', '.js-howtopay-ton', Ads.eHowToPayTon); + state.$howToPayTonPopup = $('.js-how-to-pay-ton-popup'); + + $(cont).on('click.curPage', '.js-withdraw-btn', Ads.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(Ads.updateWithdrawState, Main.UPDATE_PERIOD); + } + }); + Aj.onUnload(function(state) { + clearTimeout(state.updStateTo); + state.canUpdate = false; + Main.destroyForm(state.$withdrawForm); + }); + }, ePayForAds: function(e) { e.preventDefault(); e.stopImmediatePropagation(); @@ -2416,9 +2452,9 @@ var Ads = { e.stopImmediatePropagation(); Main.openSimplePopup(Aj.state.$howToGetRewardsPopup); }, - updateState: function() { + updateState: function(force) { var now = +Date.now(); - if (document.hasFocus() || + if (document.hasFocus() || force || Aj.state.updLastReq && (now - Aj.state.updLastReq) > Main.FORCE_UPDATE_PERIOD) { Aj.state.updLastReq = now; Aj.apiRequest('updateAdsState', { @@ -2440,16 +2476,43 @@ var Ads = { closePopup(Aj.state.$sentPopup); } } - if (Aj.state.needUpdate && result.need_update) { + Aj.state.needUpdate = result.need_update; + if (Aj.state.canUpdate && Aj.state.needUpdate) { Aj.state.updStateTo = setTimeout(Ads.updateState, Main.UPDATE_PERIOD); } }); } else { - if (Aj.state.needUpdate) { + if (Aj.state.canUpdate && Aj.state.needUpdate) { Aj.state.updStateTo = setTimeout(Ads.updateState, Main.CHECK_PERIOD); } } }, + 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('updateAdsRevenueWithdrawalState', { + transaction: Aj.state.transaction, + mode: Aj.state.mode + }, function(result) { + if (result.mode) { + Aj.state.mode = result.mode; + } + if (result.html) { + Ads.updateContent(result.html); + } + Aj.state.needUpdate = result.need_update; + if (Aj.state.canUpdate && Aj.state.needUpdate) { + Aj.state.updStateTo = setTimeout(Ads.updateWithdrawState, Main.UPDATE_PERIOD); + } + }); + } else { + if (Aj.state.canUpdate && Aj.state.needUpdate) { + Aj.state.updStateTo = setTimeout(Ads.updateWithdrawState, Main.CHECK_PERIOD); + } + } + }, updateHistory: function(html) { $('.js-premium-history').replaceWith(html); }, @@ -2488,7 +2551,10 @@ var Ads = { }), qr_label: result.item_title, tk_label: l('WEB_POPUP_QR_ADS_RECHARGE_TK_BUTTON'), - terms_label: l('WEB_POPUP_QR_PROCEED_TERMS') + terms_label: l('WEB_POPUP_QR_PROCEED_TERMS'), + onConfirm: function(by_server) { + Ads.updateState(true); + } }); Aj.state.needUpdate = true; }); @@ -2506,6 +2572,46 @@ var Ads = { } }); + }, + 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 params = { + transaction: transaction, + wallet_address: wallet_address + }; + 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('initAdsRevenueWithdrawalRequest', params, onSuccess); + }, result.confirm_button); + } else { + if (result.mode) { + Aj.state.mode = result.mode; + } + if (result.html) { + Ads.updateContent(result.html); + } + Aj.state.needUpdate = result.need_update; + if (Aj.state.canUpdate && Aj.state.needUpdate) { + Aj.state.updStateTo = setTimeout(Ads.updateWithdrawState, Main.UPDATE_PERIOD); + } + } + }; + $form.data('disabled', true); + Aj.apiRequest('initAdsRevenueWithdrawalRequest', params, onSuccess); } };