Skip to content

Commit c874938

Browse files
authored
Merge pull request binary-com#1524 from negar-binary/negar/fix_japan_time
negar/fix_japan_time
2 parents 5e0e49d + f6d858a commit c874938

File tree

11 files changed

+23
-47
lines changed

11 files changed

+23
-47
lines changed

src/javascript/binary/base/page.js

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,12 @@ Client.prototype = {
263263
is_ok = false;
264264
}
265265

266-
// allowed markets
267266
if(this.is_logged_in) {
268267
if(
269268
!this.get_storage_value('is_virtual') &&
270-
!this.get_storage_value('allowed_markets') &&
271269
Cookies.get('residence') &&
272270
!this.get_storage_value('has_reality_check')
273271
) {
274-
$('#topMenuStartBetting').addClass('invisible');
275272
BinarySocket.send({
276273
'landing_company': Cookies.get('residence'),
277274
'passthrough': {
@@ -300,15 +297,11 @@ Client.prototype = {
300297
},
301298
response_landing_company: function(response) {
302299
if (!response.hasOwnProperty('error')) {
303-
var allowed_markets = response.legal_allowed_markets;
304300
var company = response.name;
305301
var has_reality_check = response.has_reality_check;
306302

307-
this.set_storage_value('allowed_markets', allowed_markets.length === 0 ? '' : allowed_markets.join(','));
308303
this.set_storage_value('landing_company_name', company);
309304
this.set_storage_value('has_reality_check', has_reality_check);
310-
311-
page.header.menu.register_dynamic_links();
312305
}
313306
},
314307
response_authorize: function(response) {
@@ -335,7 +328,7 @@ Client.prototype = {
335328
},
336329
clear_storage_values: function() {
337330
var that = this;
338-
var items = ['currencies', 'allowed_markets', 'landing_company_name', 'is_virtual',
331+
var items = ['currencies', 'landing_company_name', 'is_virtual',
339332
'has_reality_check', 'tnc_status', 'session_duration_limit', 'session_start'];
340333
items.forEach(function(item) {
341334
that.set_storage_value(item, '');
@@ -654,19 +647,6 @@ Menu.prototype = {
654647

655648
return { item: item, subitem: subitem };
656649
},
657-
register_dynamic_links: function() {
658-
var stored_market = page.url.param('market') || LocalStore.get('bet_page.market') || 'forex';
659-
var allowed_markets = page.client.get_storage_value('allowed_markets');
660-
if(!allowed_markets && page.client.is_logged_in && !TUser.get().is_virtual) {
661-
return;
662-
}
663-
664-
var markets_array = allowed_markets ? allowed_markets.split(',') : [];
665-
if(!TUser.get().is_virtual && markets_array.indexOf(stored_market) < 0) {
666-
stored_market = markets_array[0];
667-
LocalStore.set('bet_page.market', stored_market);
668-
}
669-
},
670650
check_payment_agent: function(is_authenticated_payment_agent) {
671651
if(is_authenticated_payment_agent) {
672652
$('#topMenuPaymentAgent').removeClass('invisible');
@@ -683,7 +663,6 @@ var Header = function(params) {
683663
Header.prototype = {
684664
on_load: function() {
685665
this.show_or_hide_login_form();
686-
this.register_dynamic_links();
687666
this.logout_handler();
688667
this.check_risk_classification();
689668
if (!$('body').hasClass('BlueTopBack')) {
@@ -746,10 +725,6 @@ Header.prototype = {
746725
}
747726
$(".login-id-list").html(loginid_select);
748727
},
749-
register_dynamic_links: function() {
750-
$('#logo').attr('href', page.url.url_for(this.client.is_logged_in ? 'trading' : ''));
751-
this.menu.register_dynamic_links();
752-
},
753728
start_clock_ws: function() {
754729
function getTime() {
755730
clock_started = true;
@@ -778,9 +753,8 @@ Header.prototype = {
778753
that.server_time_at_response = ((start_timestamp * 1000) + (that.client_time_at_response - pass));
779754
var update_time = function() {
780755
window.time = moment(that.server_time_at_response + moment().valueOf() - that.client_time_at_response).utc();
781-
var curr = localStorage.getItem('client.currencies');
782756
var timeStr = window.time.format("YYYY-MM-DD HH:mm") + ' GMT';
783-
if(curr === 'JPY'){
757+
if(japanese_client()){
784758
clock.html(toJapanTimeIfNeeded(timeStr, 1, '', 1));
785759
} else {
786760
clock.html(timeStr);
@@ -838,7 +812,7 @@ Header.prototype = {
838812
LocalStore.remove('client.tokens');
839813
LocalStore.set('reality_check.ack', 0);
840814
sessionStorage.removeItem('client_status');
841-
var cookies = ['login', 'loginid', 'loginid_list', 'email', 'settings', 'reality_check', 'affiliate_token', 'affiliate_tracking', 'residence', 'allowed_markets'];
815+
var cookies = ['login', 'loginid', 'loginid_list', 'email', 'settings', 'reality_check', 'affiliate_token', 'affiliate_tracking', 'residence'];
842816
var domains = [
843817
'.' + document.domain.split('.').slice(-2).join('.'),
844818
'.' + document.domain,
@@ -1014,6 +988,9 @@ var Page = function() {
1014988
this.header = new Header({ user: this.user, client: this.client, url: this.url});
1015989
this.contents = new Contents(this.client, this.user);
1016990
this._lang = null;
991+
$('#logo').on('click', function() {
992+
load_with_pjax(page.url.url_for(page.client.is_logged_in ? japanese_client() ? 'jptrading' : 'trading' : ''));
993+
});
1017994
};
1018995

1019996
Page.prototype = {

src/javascript/binary/base/utility.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ function attach_tabs(element) {
217217
}
218218

219219
function showLocalTimeOnHover(s) {
220+
if (japanese_client()) return;
220221
$(s || '.date').each(function(idx, ele) {
221222
var gmtTimeStr = ele.textContent.replace('\n', ' ');
222223
var localTime = moment.utc(gmtTimeStr, 'YYYY-MM-DD HH:mm:ss').local();
@@ -236,7 +237,7 @@ function toJapanTimeIfNeeded(gmtTimeStr, showTimeZone, longcode, hideSeconds){
236237
if (!match) return longcode;
237238
}
238239

239-
var curr = localStorage.getItem('client.currencies'),
240+
var jp_client = japanese_client(),
240241
timeStr = gmtTimeStr,
241242
time;
242243

@@ -252,7 +253,7 @@ function toJapanTimeIfNeeded(gmtTimeStr, showTimeZone, longcode, hideSeconds){
252253
return;
253254
}
254255

255-
timeStr = time.zone(curr === 'JPY' ? '+09:00' : '+00:00').format((hideSeconds ? 'YYYY-MM-DD HH:mm' : 'YYYY-MM-DD HH:mm:ss' ) + (showTimeZone && showTimeZone !== '' ? curr === 'JPY' ? ' zZ' : ' Z' : ''));
256+
timeStr = time.zone(jp_client ? '+09:00' : '+00:00').format((hideSeconds ? 'YYYY-MM-DD HH:mm' : 'YYYY-MM-DD HH:mm:ss' ) + (showTimeZone && showTimeZone !== '' ? jp_client ? ' zZ' : ' Z' : ''));
256257

257258
return (longcode ? longcode.replace(match[0], timeStr) : timeStr);
258259
}

src/javascript/binary/common_functions/frontend.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,15 +411,16 @@ function handle_residence_state_ws(){
411411
} else if (type === 'website_status') {
412412
var status = response.website_status;
413413
if (status && status.clients_country) {
414-
if (status.clients_country === 'jp' || japanese_client()) {
415-
$('#residence').replaceWith('<label>' + text.localize('Japan') + '</label>');
416-
}
417414
var clientCountry = $('#residence option[value="' + status.clients_country + '"]');
418415
if (!clientCountry.attr('disabled')) {
419416
clientCountry.prop('selected', true);
420417
}
418+
if (status.clients_country === 'jp' || japanese_client()) {
419+
if (!document.getElementById('japan-label')) $('#residence').parent().append('<label id="japan-label">' + page.text.localize('Japan') + '</label>');
420+
} else {
421+
$('#residence').removeClass('invisible');
422+
}
421423
}
422-
$('#residence').removeClass('invisible');
423424
return;
424425
} else if (type === 'get_financial_assessment' && objectNotEmpty(response.get_financial_assessment)) {
425426
for (var key in response.get_financial_assessment) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ function setFormPlaceholderContent_Beta(name) {
952952
}
953953

954954
function updatePurchaseStatus_Beta(final_price, pnl, contract_status){
955-
$('#contract_purchase_heading').text(text.localize(contract_status));
955+
$('#contract_purchase_heading').text(page.text.localize(contract_status));
956956
var payout = document.getElementById('contract_purchase_payout'),
957957
cost = document.getElementById('contract_purchase_cost'),
958958
profit = document.getElementById('contract_purchase_profit'),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ var ProfitTableUI = (function(){
7676

7777
var jpClient = japanese_client();
7878

79-
var data = [profit_table_data.buyDate, '<span' + showTooltip(profit_table_data.app_id, oauth_apps[profit_table_data.app_id]) + '>' + profit_table_data.ref + '</span>', jpClient ? format_money_jp(TUser.get().currency, profit_table_data.payout) : profit_table_data.payout , '', jpClient ? format_money_jp(TUser.get().currency, profit_table_data.buyPrice) : profit_table_data.buyPrice , profit_table_data.sellDate, jpClient ? format_money_jp(TUser.get().currency, profit_table_data.sellPrice) : profit_table_data.sellPrice , jpClient ? format_money_jp(TUser.get().currency, profit_table_data.pl) : profit_table_data.pl , ''];
79+
var data = [jpClient ? toJapanTimeIfNeeded(transaction.purchase_time) : profit_table_data.buyDate, '<span' + showTooltip(profit_table_data.app_id, oauth_apps[profit_table_data.app_id]) + '>' + profit_table_data.ref + '</span>', jpClient ? format_money_jp(TUser.get().currency, profit_table_data.payout) : profit_table_data.payout , '', jpClient ? format_money_jp(TUser.get().currency, profit_table_data.buyPrice) : profit_table_data.buyPrice , profit_table_data.sellDate, jpClient ? format_money_jp(TUser.get().currency, profit_table_data.sellPrice) : profit_table_data.sellPrice , jpClient ? format_money_jp(TUser.get().currency, profit_table_data.pl) : profit_table_data.pl , ''];
8080
var $row = Table.createFlexTableRow(data, cols, "data");
8181

8282
$row.children(".buy-date").addClass("pre");

src/javascript/binary/websocket_pages/user/account/settings/settings_detailsws.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ var SettingsDetailsWS = (function() {
157157
return $(s).val().trim();
158158
}
159159
setDetails(toJPSettings({
160-
hedgeAssetAmount : data.hedge_asset_amount,
160+
hedgeAssetAmount : trim('#HedgeAssetAmount'),
161161
annualIncome : trim('#AnnualIncome'),
162162
financialAsset : trim('#FinancialAsset'),
163163
occupation : trim('#Occupation'),

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ var Statement = (function(){
2626

2727
var generateCSV = function(allData){
2828
var columns = ['date', 'ref', 'payout', 'action', 'desc', 'amount', 'balance'],
29-
header = ['Date', 'Reference ID', 'Potential Payout', 'Action', 'Description', 'Credit/Debit'].map(function(str){return text.localize(str);});
30-
header.push(text.localize('Balance') + (TUser.get().currency ? ' (' + TUser.get().currency + ')' : ''));
29+
header = ['Date', 'Reference ID', 'Potential Payout', 'Action', 'Description', 'Credit/Debit'].map(function(str){return page.text.localize(str);});
30+
header.push(page.text.localize('Balance') + (TUser.get().currency ? ' (' + TUser.get().currency + ')' : ''));
3131
var sep = ',',
3232
csv = [header.join(sep)];
3333
if (allData && allData.length > 0) {

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

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

4848
var jpClient = japanese_client();
4949

50-
var $statementRow = Table.createFlexTableRow([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 ), 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([(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+
5252
$statementRow.children(".credit").addClass(creditDebitType);
5353
$statementRow.children(".date").addClass("pre");
5454
$statementRow.children(".desc").html(statement_data.desc + "<br>");

src/javascript/binary/websocket_pages/user/new_account/virtual_acc_opening.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pjax_config_page("new_account/virtualws", function() {
7070
var data = info.values;
7171
VirtualAccOpeningData.newAccount({
7272
password: data.password,
73-
residence: data.residence,
73+
residence: (japanese_client() ? 'jp' : data.residence),
7474
verification_code: data['verification-code'],
7575
});
7676
},

src/templates/about/contact.html.tt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
</h1>
1111
</div>
1212
<div class="gr-padding-10">
13-
<span class="ja-hide no-para-margin">
14-
[% l("You'll find answers to most of your questions on the <a href='' target='_blank' id='faq_url'>FAQ</a> page.") %]
15-
</span>
1613
<span class="hidden ja-show no-para-margin">
1714
[% l("JAPAN ONLY CONTACT TEXT") %]
1815
</span>

src/templates/global/header.html.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<div class='gr-12'>
3131
<div class='gr-row gr-row-align-middle'>
3232
<div class='gr-3 gr-2-m gr-2-p gr-padding-10'>
33-
<a id="logo" class="pjaxload" href="[% request.url_for('/') %]">
33+
<a id="logo" href="javascript:;">
3434
<div class='gr-row'>
3535
<div class='gr-3 gr-12-m gr-12-p gr-no-gutter'>
3636
<img class='responsive' src="[% request.url_for('images/pages/binary-symbol-logo.svg') %]" />

0 commit comments

Comments
 (0)