Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

negar/fix_japan_time #1524

Merged
merged 6 commits into from
Sep 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 6 additions & 29 deletions src/javascript/binary/base/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,12 @@ Client.prototype = {
is_ok = false;
}

// allowed markets
if(this.is_logged_in) {
if(
!this.get_storage_value('is_virtual') &&
!this.get_storage_value('allowed_markets') &&
Cookies.get('residence') &&
!this.get_storage_value('has_reality_check')
) {
$('#topMenuStartBetting').addClass('invisible');
BinarySocket.send({
'landing_company': Cookies.get('residence'),
'passthrough': {
Expand Down Expand Up @@ -300,15 +297,11 @@ Client.prototype = {
},
response_landing_company: function(response) {
if (!response.hasOwnProperty('error')) {
var allowed_markets = response.legal_allowed_markets;
var company = response.name;
var has_reality_check = response.has_reality_check;

this.set_storage_value('allowed_markets', allowed_markets.length === 0 ? '' : allowed_markets.join(','));
this.set_storage_value('landing_company_name', company);
this.set_storage_value('has_reality_check', has_reality_check);

page.header.menu.register_dynamic_links();
}
},
response_authorize: function(response) {
Expand All @@ -335,7 +328,7 @@ Client.prototype = {
},
clear_storage_values: function() {
var that = this;
var items = ['currencies', 'allowed_markets', 'landing_company_name', 'is_virtual',
var items = ['currencies', 'landing_company_name', 'is_virtual',
'has_reality_check', 'tnc_status', 'session_duration_limit', 'session_start'];
items.forEach(function(item) {
that.set_storage_value(item, '');
Expand Down Expand Up @@ -654,19 +647,6 @@ Menu.prototype = {

return { item: item, subitem: subitem };
},
register_dynamic_links: function() {
var stored_market = page.url.param('market') || LocalStore.get('bet_page.market') || 'forex';
var allowed_markets = page.client.get_storage_value('allowed_markets');
if(!allowed_markets && page.client.is_logged_in && !TUser.get().is_virtual) {
return;
}

var markets_array = allowed_markets ? allowed_markets.split(',') : [];
if(!TUser.get().is_virtual && markets_array.indexOf(stored_market) < 0) {
stored_market = markets_array[0];
LocalStore.set('bet_page.market', stored_market);
}
},
check_payment_agent: function(is_authenticated_payment_agent) {
if(is_authenticated_payment_agent) {
$('#topMenuPaymentAgent').removeClass('invisible');
Expand All @@ -683,7 +663,6 @@ var Header = function(params) {
Header.prototype = {
on_load: function() {
this.show_or_hide_login_form();
this.register_dynamic_links();
this.logout_handler();
this.check_risk_classification();
if (!$('body').hasClass('BlueTopBack')) {
Expand Down Expand Up @@ -746,10 +725,6 @@ Header.prototype = {
}
$(".login-id-list").html(loginid_select);
},
register_dynamic_links: function() {
$('#logo').attr('href', page.url.url_for(this.client.is_logged_in ? 'trading' : ''));
this.menu.register_dynamic_links();
},
start_clock_ws: function() {
function getTime() {
clock_started = true;
Expand Down Expand Up @@ -778,9 +753,8 @@ Header.prototype = {
that.server_time_at_response = ((start_timestamp * 1000) + (that.client_time_at_response - pass));
var update_time = function() {
window.time = moment(that.server_time_at_response + moment().valueOf() - that.client_time_at_response).utc();
var curr = localStorage.getItem('client.currencies');
var timeStr = window.time.format("YYYY-MM-DD HH:mm") + ' GMT';
if(curr === 'JPY'){
if(japanese_client()){
clock.html(toJapanTimeIfNeeded(timeStr, 1, '', 1));
} else {
clock.html(timeStr);
Expand Down Expand Up @@ -838,7 +812,7 @@ Header.prototype = {
LocalStore.remove('client.tokens');
LocalStore.set('reality_check.ack', 0);
sessionStorage.removeItem('client_status');
var cookies = ['login', 'loginid', 'loginid_list', 'email', 'settings', 'reality_check', 'affiliate_token', 'affiliate_tracking', 'residence', 'allowed_markets'];
var cookies = ['login', 'loginid', 'loginid_list', 'email', 'settings', 'reality_check', 'affiliate_token', 'affiliate_tracking', 'residence'];
var domains = [
'.' + document.domain.split('.').slice(-2).join('.'),
'.' + document.domain,
Expand Down Expand Up @@ -1014,6 +988,9 @@ var Page = function() {
this.header = new Header({ user: this.user, client: this.client, url: this.url});
this.contents = new Contents(this.client, this.user);
this._lang = null;
$('#logo').on('click', function() {
load_with_pjax(page.url.url_for(page.client.is_logged_in ? japanese_client() ? 'jptrading' : 'trading' : ''));
});
};

Page.prototype = {
Expand Down
5 changes: 3 additions & 2 deletions src/javascript/binary/base/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ function attach_tabs(element) {
}

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

var curr = localStorage.getItem('client.currencies'),
var jp_client = japanese_client(),
timeStr = gmtTimeStr,
time;

Expand All @@ -252,7 +253,7 @@ function toJapanTimeIfNeeded(gmtTimeStr, showTimeZone, longcode, hideSeconds){
return;
}

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' : ''));
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' : ''));

return (longcode ? longcode.replace(match[0], timeStr) : timeStr);
}
Expand Down
9 changes: 5 additions & 4 deletions src/javascript/binary/common_functions/frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,15 +411,16 @@ function handle_residence_state_ws(){
} else if (type === 'website_status') {
var status = response.website_status;
if (status && status.clients_country) {
if (status.clients_country === 'jp' || japanese_client()) {
$('#residence').replaceWith('<label>' + text.localize('Japan') + '</label>');
}
var clientCountry = $('#residence option[value="' + status.clients_country + '"]');
if (!clientCountry.attr('disabled')) {
clientCountry.prop('selected', true);
}
if (status.clients_country === 'jp' || japanese_client()) {
if (!document.getElementById('japan-label')) $('#residence').parent().append('<label id="japan-label">' + page.text.localize('Japan') + '</label>');
} else {
$('#residence').removeClass('invisible');
}
}
$('#residence').removeClass('invisible');
return;
} else if (type === 'get_financial_assessment' && objectNotEmpty(response.get_financial_assessment)) {
for (var key in response.get_financial_assessment) {
Expand Down
2 changes: 1 addition & 1 deletion src/javascript/binary/websocket_pages/trade/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ function setFormPlaceholderContent_Beta(name) {
}

function updatePurchaseStatus_Beta(final_price, pnl, contract_status){
$('#contract_purchase_heading').text(text.localize(contract_status));
$('#contract_purchase_heading').text(page.text.localize(contract_status));
var payout = document.getElementById('contract_purchase_payout'),
cost = document.getElementById('contract_purchase_cost'),
profit = document.getElementById('contract_purchase_profit'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ var ProfitTableUI = (function(){

var jpClient = japanese_client();

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 , ''];
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 , ''];
var $row = Table.createFlexTableRow(data, cols, "data");

$row.children(".buy-date").addClass("pre");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ var SettingsDetailsWS = (function() {
return $(s).val().trim();
}
setDetails(toJPSettings({
hedgeAssetAmount : data.hedge_asset_amount,
hedgeAssetAmount : trim('#HedgeAssetAmount'),
annualIncome : trim('#AnnualIncome'),
financialAsset : trim('#FinancialAsset'),
occupation : trim('#Occupation'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ var Statement = (function(){

var generateCSV = function(allData){
var columns = ['date', 'ref', 'payout', 'action', 'desc', 'amount', 'balance'],
header = ['Date', 'Reference ID', 'Potential Payout', 'Action', 'Description', 'Credit/Debit'].map(function(str){return text.localize(str);});
header.push(text.localize('Balance') + (TUser.get().currency ? ' (' + TUser.get().currency + ')' : ''));
header = ['Date', 'Reference ID', 'Potential Payout', 'Action', 'Description', 'Credit/Debit'].map(function(str){return page.text.localize(str);});
header.push(page.text.localize('Balance') + (TUser.get().currency ? ' (' + TUser.get().currency + ')' : ''));
var sep = ',',
csv = [header.join(sep)];
if (allData && allData.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ var StatementUI = (function(){

var jpClient = japanese_client();

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");
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");

$statementRow.children(".credit").addClass(creditDebitType);
$statementRow.children(".date").addClass("pre");
$statementRow.children(".desc").html(statement_data.desc + "<br>");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pjax_config_page("new_account/virtualws", function() {
var data = info.values;
VirtualAccOpeningData.newAccount({
password: data.password,
residence: data.residence,
residence: (japanese_client() ? 'jp' : data.residence),
verification_code: data['verification-code'],
});
},
Expand Down
3 changes: 0 additions & 3 deletions src/templates/about/contact.html.tt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
</h1>
</div>
<div class="gr-padding-10">
<span class="ja-hide no-para-margin">
[% l("You'll find answers to most of your questions on the <a href='' target='_blank' id='faq_url'>FAQ</a> page.") %]
</span>
<span class="hidden ja-show no-para-margin">
[% l("JAPAN ONLY CONTACT TEXT") %]
</span>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/global/header.html.tt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<div class='gr-12'>
<div class='gr-row gr-row-align-middle'>
<div class='gr-3 gr-2-m gr-2-p gr-padding-10'>
<a id="logo" class="pjaxload" href="[% request.url_for('/') %]">
<a id="logo" href="javascript:;">
<div class='gr-row'>
<div class='gr-3 gr-12-m gr-12-p gr-no-gutter'>
<img class='responsive' src="[% request.url_for('images/pages/binary-symbol-logo.svg') %]" />
Expand Down