Skip to content

Commit 675b18c

Browse files
authored
Merge pull request binary-com#1529 from binary-hamedanchi/mohammad/beta_trading_fixes
mohammad/beta_trading_fixes
2 parents 355f77d + 2edaee9 commit 675b18c

File tree

16 files changed

+114
-72
lines changed

16 files changed

+114
-72
lines changed

src/javascript/binary/common_functions/frontend.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,4 +628,6 @@ module.exports = {
628628
japanese_client: japanese_client,
629629
change_blog_link: change_blog_link,
630630
detect_hedging: detect_hedging,
631+
jqueryuiTabsToDropdown: jqueryuiTabsToDropdown,
632+
handle_account_opening_settings: handle_account_opening_settings,
631633
};

src/javascript/binary/websocket_pages/trade/beta/charts/digit_infows.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,19 +103,19 @@ TradingAnalysis_Beta.DigitInfoWS.prototype = {
103103
underlyings = underlyings.sort();
104104
var elem = '<select class="smallfont" name="underlying">';
105105
for(i=0;i<underlyings.length;i++){
106-
elem = elem + '<option value="'+underlyings[i]+'">'+text.localize(symbols[underlyings[i]])+'</option>';
106+
elem = elem + '<option value="' + underlyings[i] + '">' + page.text.localize(symbols[underlyings[i]]) + '</option>';
107107
}
108108
elem = elem + '</select>';
109109
var contentId = document.getElementById('tab_last_digit-content'),
110110
content = '<div class="gr-parent">'+
111111
'<div id="last_digit_histo_form" class="gr-12 gr-12-m gr-centered">'+
112112
'<form class="smallfont gr-row" action="#" method="post">'+
113-
'<div class="gr-6 gr-12-m center-text"><div class="gr-padding-10">'+ text.localize('Select market')+':</div>' + elem +' </div>'+
114-
'<div class="gr-6 gr-12-m center-text"><div class="gr-padding-10">'+ text.localize('Number of ticks')+':</div><select class="smallfont" name="tick_count"><option value="25">25</option><option value="50">50</option><option selected="selected" value="100">100</option><option value="500">500</option><option value="1000">1000</option></select></div>'+
113+
'<div class="gr-6 gr-12-m center-text"><div class="gr-padding-10">'+ page.text.localize('Select market')+':</div>' + elem +' </div>'+
114+
'<div class="gr-6 gr-12-m center-text"><div class="gr-padding-10">'+ page.text.localize('Number of ticks')+':</div><select class="smallfont" name="tick_count"><option value="25">25</option><option value="50">50</option><option selected="selected" value="100">100</option><option value="500">500</option><option value="1000">1000</option></select></div>'+
115115
'</form>'+
116116
'</div>'+
117117
'<div id="last_digit_histo" class="gr-12 gr-12-m gr-centered"></div>'+
118-
'<div id="last_digit_title" class="gr-hide">'+ (domain.charAt(0).toUpperCase() + domain.slice(1)) + ' - ' + text.localize('Last digit stats for the latest [_1] ticks on [_2]') +'</div>'+
118+
'<div id="last_digit_title" class="gr-hide">'+ (domain.charAt(0).toUpperCase() + domain.slice(1)) + ' - ' + page.text.localize('Last digit stats for the latest [_1] ticks on [_2]') +'</div>'+
119119
'</div>';
120120
contentId.innerHTML = content;
121121
$('[name=underlying]').val(underlying);

src/javascript/binary/websocket_pages/trade/beta/contract.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ var Contract_Beta = (function() {
107107
}
108108

109109
if (!contractType[contractCategory].hasOwnProperty(currentObj['contract_type'])) {
110-
contractType[contractCategory][currentObj['contract_type']] = text.localize(currentObj['contract_display']);
110+
contractType[contractCategory][currentObj['contract_type']] = page.text.localize(currentObj['contract_display']);
111111
}
112112
}
113113
});
@@ -139,7 +139,7 @@ var Contract_Beta = (function() {
139139
tradeContractForms['higherlower'] = Content.localize().textFormHigherLower;
140140
}
141141
} else {
142-
tradeContractForms[contractCategory] = text.localize(currentObj['contract_category_display']);
142+
tradeContractForms[contractCategory] = page.text.localize(currentObj['contract_category_display']);
143143
if (contractCategory === 'digits') {
144144
tradeContractForms['matchdiff'] = Content.localize().textFormMatchesDiffers;
145145
if (page.language() !== 'ID') {

src/javascript/binary/websocket_pages/trade/beta/price.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ var Price_Beta = (function() {
198198
amount.textContent = data['display_value'];
199199
} else {
200200
$('.stake:hidden').show();
201-
stake.textContent = text.localize('Stake') + ': ';
201+
stake.textContent = page.text.localize('Stake') + ': ';
202202
amount.textContent = format_money(currency.value, (data['display_value']*1).toFixed(2));
203203
}
204204
$('.stake_wrapper:hidden').show();
@@ -207,7 +207,7 @@ var Price_Beta = (function() {
207207
}
208208

209209
if (data['payout']) {
210-
payout.textContent = (is_spread ? text.localize('Payout/point') : text.localize('Payout')) + ': ';
210+
payout.textContent = (is_spread ? page.text.localize('Payout/point') : page.text.localize('Payout')) + ': ';
211211
payoutAmount.textContent = format_money(currency.value, (data['payout']*1).toFixed(2));
212212
$('.payout_wrapper:hidden').show();
213213
} else {

src/javascript/binary/websocket_pages/trade/beta/process.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function processContract_Beta(contracts) {
101101
contracts_list.style.display = 'none';
102102
message_container.hide();
103103
confirmation_error.show();
104-
confirmation_error_contents.innerHTML = contracts.error.message + ' <a href="javascript:;" onclick="TradePage_Beta.reload();">' + text.localize('Please reload the page') + '</a>';
104+
confirmation_error_contents.innerHTML = contracts.error.message + ' <a href="javascript:;" onclick="TradePage_Beta.reload();">' + page.text.localize('Please reload the page') + '</a>';
105105
return;
106106
}
107107

src/javascript/binary/websocket_pages/trade/beta/purchase.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var Purchase_Beta = (function () {
3939
container.style.display = 'block';
4040
message_container.hide();
4141
confirmation_error.show();
42-
confirmation_error_contents.innerHTML = (/ClientUnwelcome/.test(error.code) ? error['message'] + '<a class="pjaxload" href="' + page.url.url_for('user/authenticatews') + '"> ' + text.localize('Authorise your account.' + '</a>') : error['message']);
42+
confirmation_error_contents.innerHTML = (/ClientUnwelcome/.test(error.code) ? error['message'] + '<a class="pjaxload" href="' + page.url.url_for('user/authenticatews') + '"> ' + page.text.localize('Authorise your account.' + '</a>') : error['message']);
4343
} else {
4444
var guideBtn = document.getElementById('guideBtn');
4545
if(guideBtn) {
@@ -49,7 +49,7 @@ var Purchase_Beta = (function () {
4949
message_container.show();
5050
confirmation_error.hide();
5151

52-
$('#contract-values > div > div').each(function() {
52+
$('#contract-values td').each(function() {
5353
$(this).text('').removeAttr('class', '');
5454
});
5555
brief.textContent = $('#underlying option:selected').text() + ' / ' +

src/javascript/binary/websocket_pages/trade/beta/tick_trade.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ var TickDisplay_Beta = function() {
106106
zIndex: 1
107107
},
108108
title: {
109-
text: text.localize('Tick')
109+
text: page.text.localize('Tick')
110110
}
111111
},
112112
yAxis: {
@@ -126,10 +126,11 @@ var TickDisplay_Beta = function() {
126126
};
127127
// Trading page's chart
128128
function show_values(tick, time, price) {
129-
$('#contract_purchase_profit_list .chart-values').css('display', 'flex');
129+
$('#contract_purchase_profit_list #chart-values').css('display', 'flex');
130+
$('#contract_purchase_profit_list #contract-values').css('display', 'none');
130131
$('#chart_values_tick_value').text(tick);
131132
$('#chart_values_time_value').text(time);
132-
$('#chart_values_price_value').text(addComma(price));
133+
$('#chart_values_price_value').text(price);
133134
}
134135
if($self.is_trading_page) {
135136
$.extend(true, chart_options, {
@@ -141,11 +142,12 @@ var TickDisplay_Beta = function() {
141142
formatter: function () {
142143
var that = this;
143144
var time = moment.utc($self.applicable_ticks[that.x].epoch*1000).format('HH:mm:ss');
144-
show_values(+that.x + (is_start_on_first_tick ? 1 : 0), time, that.y);
145+
show_values(+that.x + (is_start_on_first_tick ? 1 : 0), time, addComma(that.y, $self.display_decimals));
145146
},
146147
events: {
147148
hide: function () {
148-
$('#contract_purchase_profit_list .chart-values').hide();
149+
$('#contract_purchase_profit_list #chart-values').hide();
150+
$('#contract_purchase_profit_list #contract-values').show();
149151
}
150152
}
151153
},
@@ -261,7 +263,7 @@ var TickDisplay_Beta = function() {
261263
}
262264
var barrier = document.getElementById('contract_purchase_barrier');
263265
if ($self.contract_barrier && barrier) {
264-
label_value(barrier, Content.localize().textBarrier, addComma($self.contract_barrier), true);
266+
label_value(barrier, Content.localize().textBarrier, addComma($self.contract_barrier, $self.display_decimals), true);
265267
}
266268
},
267269
add: function(indicator) {
@@ -304,11 +306,11 @@ var TickDisplay_Beta = function() {
304306
var $self = this;
305307

306308
var profit = $self.payout - $self.price;
307-
$self.update_ui($self.payout, profit, text.localize('This contract won'));
309+
$self.update_ui($self.payout, profit, page.text.localize('This contract won'));
308310
},
309311
lose: function() {
310312
var $self = this;
311-
$self.update_ui(0, -$self.price, text.localize('This contract lost'));
313+
$self.update_ui(0, -$self.price, page.text.localize('This contract lost'));
312314
},
313315
to_monetary_format: function(number) {
314316
return number.toFixed(2);

src/javascript/binary/websocket_pages/trade/common.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -882,9 +882,9 @@ function reloadPage(){
882882
location.reload();
883883
}
884884

885-
function addComma(num){
886-
num = (num || 0) * 1;
887-
return num.toFixed(2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
885+
function addComma(num, decimal_points){
886+
num = String(num || 0).replace(/,/g, '') * 1;
887+
return num.toFixed(decimal_points || 2).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
888888
}
889889

890890
function showHighchart(){
@@ -958,12 +958,13 @@ function updatePurchaseStatus_Beta(final_price, pnl, contract_status){
958958
profit = document.getElementById('contract_purchase_profit'),
959959
currency = TUser.get().currency;
960960

961-
label_value(cost , Content.localize().textStake , Math.abs(pnl));
961+
label_value(cost , Content.localize().textStake , addComma(Math.abs(pnl)));
962962
label_value(payout, Content.localize().textPayout, addComma(final_price));
963963

964964
var isWin = (+final_price > 0);
965965
$('#contract_purchase_profit_value').attr('class', (isWin ? 'profit' : 'loss'));
966-
label_value(profit, isWin ? Content.localize().textProfit : Content.localize().textLoss, addComma(Math.round((final_price - pnl) * 100) / 100));
966+
label_value(profit, isWin ? Content.localize().textProfit : Content.localize().textLoss,
967+
addComma(isWin ? Math.round((final_price - pnl) * 100) / 100 : - Math.abs(pnl)));
967968
}
968969

969970
function displayTooltip_Beta(market, symbol){

src/javascript/binary/websocket_pages/user/account/statement/statement.ui.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,17 @@ var StatementUI = (function(){
4747

4848
var jpClient = japanese_client();
4949

50-
var $statementRow = Table.createFlexTableRow([(jpClient ? toJapanTimeIfNeeded(transaction.transaction_time) : statement_data.date), '<span' + showTooltip(statement_data.app_id, oauth_apps[statement_data.app_id]) + '>' + statement_data.ref + '</span>', isNaN(statement_data.payout) ? '-' : (jpClient ? format_money_jp(TUser.get().currency, statement_data.payout) : statement_data.payout ), page.text.localize(statement_data.action), '', jpClient ? format_money_jp(TUser.get().currency, statement_data.amount) : statement_data.amount, jpClient ? format_money_jp(TUser.get().currency, statement_data.balance) : statement_data.balance, ''], columns, "data");
51-
50+
var $statementRow = Table.createFlexTableRow([
51+
(jpClient ? toJapanTimeIfNeeded(transaction.transaction_time) : statement_data.date),
52+
'<span' + showTooltip(statement_data.app_id, oauth_apps[statement_data.app_id]) + '>' + statement_data.ref + '</span>',
53+
isNaN(statement_data.payout) ? '-' : (jpClient ? format_money_jp(TUser.get().currency, statement_data.payout) : statement_data.payout ),
54+
page.text.localize(statement_data.action),
55+
'',
56+
jpClient ? format_money_jp(TUser.get().currency, statement_data.amount) : statement_data.amount,
57+
jpClient ? format_money_jp(TUser.get().currency, statement_data.balance) : statement_data.balance,
58+
''
59+
], columns, "data");
60+
5261
$statementRow.children(".credit").addClass(creditDebitType);
5362
$statementRow.children(".date").addClass("pre");
5463
$statementRow.children(".desc").html(statement_data.desc + "<br>");

src/javascript/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ window.Cookies = require('./lib/js-cookie.js');
2525
require('./lib/loadCSS.js');
2626
require('./lib/loadJS.js');
2727
window.pjax = require('./lib/pjax-lib.js');
28-
require('./lib/resize-sensor.js');
28+
window.ResizeSensor = require('./lib/resize-sensor.js');
2929
window.dv = require('./lib/validation.js');
3030

3131
require('./binary/components/trackjs_onerror');

src/sass/common/header.scss

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#language_select {
2222
select {
2323
padding: 0px;
24+
@include BIDIR_VALUE(float, right, left);
2425
}
2526
}
2627
a {
@@ -99,14 +100,23 @@
99100
}
100101
}
101102
}
102-
.main-nav > li > ul {
103-
margin: -20px -1px;
103+
.main-nav {
104+
> li > ul {
105+
margin: -20px -1px;
106+
}
107+
.nav-caret {
108+
@include BIDIR_PROP(right, left, -68px);
109+
@include BIDIR_PROP(left, right, initial);
110+
}
104111
}
105112
.topMenuBalance {
106113
visibility: hidden;
107114
}
108-
.main-account > .account-type {
109-
white-space: nowrap;
115+
#main-logout {
116+
@include BIDIR_VALUE(float, right, left);
117+
.main-account > .account-type {
118+
white-space: nowrap;
119+
}
110120
}
111121
#all-accounts {
112122
z-index: 99;

src/sass/language_base.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ body.VI {
7575
#trading_socket_container #contract_form_name_nav {
7676
font-size: 80%;
7777
}
78+
#trading_socket_container_beta #contract_symbol_container {
79+
font-size: 90%;
80+
}
7881
}
7982

8083
/*French Language */

src/sass/static/trade_beta.scss

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -402,11 +402,17 @@
402402
display: flex;
403403
font-size: 0.75rem;
404404
position: relative;
405-
.values {
405+
table td {
406+
border: 0;
407+
@include BIDIR_VALUE(padding, 0 10px 4px 0, 0 0 4px 10px);
408+
}
409+
.values, table td:last-child {
410+
direction: ltr;
411+
@include BIDIR_VALUE(text-align, left, right);
406412
font-weight: bold;
407413
@include BIDIR_PROP(padding-left, padding-right, 0);
408414
}
409-
.chart-values {
415+
#chart-values {
410416
position: absolute;
411417
background: $COLOR_WHITE;
412418
color: $COLOR_ORANGE;
@@ -442,6 +448,7 @@
442448
}
443449
#tick_chart {
444450
border: 1px solid $COLOR_LIGHT_GRAY;
451+
direction: ltr;
445452
}
446453
.contract_error {
447454
margin-top: auto;
@@ -679,9 +686,6 @@
679686
}
680687
@media all and (max-width: 640px) {
681688
#trading_socket_container_beta {
682-
#analysis_tabs {
683-
white-space: nowrap;
684-
}
685689
div#contract_market_form_container {
686690
ul#contract_form_name_nav {
687691
white-space: nowrap !important;
@@ -717,7 +721,7 @@
717721
a.tm-a {
718722
padding: 0 5px;
719723
width: auto;
720-
font-size: 85%;
724+
font-size: 80%;
721725
line-height: 28px;
722726
}
723727
.tm-ul-2 {
@@ -817,6 +821,9 @@
817821
#trading_analysis_content {
818822
height: 100%;
819823
font-size: 1rem;
824+
#analysis_tabs {
825+
white-space: nowrap;
826+
}
820827
.tab-menu {
821828
background: transparent !important;
822829
border: 0 !important;
@@ -835,7 +842,7 @@
835842
height: 100%;
836843
}
837844
#trade_live_chart table {
838-
width: 100%;
845+
width: 98%;
839846
height: 100%;
840847
td {
841848
height: 100%;

src/templates/bet/beta/analysis.html.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<p class="error-msg" id="chart-error"></p>
3131
<div id="trade_live_chart">
3232
<table><tr><td>
33-
<iframe src="" width="100%" height="100%" id="chart_frame" style="overflow-y : hidden;" scrolling="no"></iframe>
33+
<iframe src="" width="100%" height="99%" id="chart_frame" style="overflow-y : hidden;" scrolling="no"></iframe>
3434
</td></tr></table>
3535
</div>
3636
</div>

0 commit comments

Comments
 (0)