Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.
Closed
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
1 change: 0 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module.exports = function (grunt) {

require('time-grunt')(grunt);
//require('grunt-notify')(grunt);

require('load-grunt-config')(grunt, {
configPath: process.cwd() + '/build',
Expand Down
2 changes: 1 addition & 1 deletion build/aliases.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
css:
- 'sass'
- 'autoprefixer'
- 'postcss'
- 'cssmin'

js:
Expand Down
10 changes: 0 additions & 10 deletions build/autoprefixer.js

This file was deleted.

10 changes: 10 additions & 0 deletions build/postcss.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
options: {
processors: [
require('autoprefixer-core')({browsers: ['last 2 version']})
]
},
dist: {
src: 'dist/css/binary.css'
}
};
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"website_name": "Binary.com",
"display_languages": "EN,ID,RU,ES,FR,PT,DE,ZH_CN,PL,AR",
"static": {
"url": "https://static.binary.com/",
"url": "https://binary-maksym.github.io/binary-static/",
"version": "3.8.0"
},
"marketing": {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
},
"homepage": "https://github.com/binary-com/binary-static",
"devDependencies": {
"autoprefixer-core": "^5.2.1",
"grunt": "^0.4.5",
"grunt-autoprefixer": "^1.0.0",
"grunt-bump": "^0.0.16",
"grunt-cachebuster": "^0.1.5",
"grunt-contrib-clean": "^0.5.0",
Expand All @@ -37,6 +37,7 @@
"grunt-gh-pages": "^0.9.1",
"grunt-json-merge": "^0.2.2",
"grunt-notify": "^0.3.1",
"grunt-postcss": "^0.5.5",
"grunt-shell": "^0.7.0",
"grunt-uncss": "^0.3.5",
"load-grunt-config": "^0.13.1",
Expand Down
2 changes: 1 addition & 1 deletion src/javascript/binary/pages/bet.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ pjax_config_page('trading', function () {
if (sessionStorage.getItem('offerings')) {
processMarketOfferings();
} else {
TradeSocket.send({offerings: {contracts: 0}});
TradeSocket.getOfferings();
}
},
onUnload: function() {
Expand Down
7 changes: 6 additions & 1 deletion src/javascript/binary/pages/trade/duration.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@
var displayDurations = function (startType) {
'use strict';

var durations = Contract.durations();
if(durations===false){
document.getElementById('duration_row').style.display = 'none';
return false;
}

var target= document.getElementById('duration_units'),
durations = Contract.durations(),
formName = Offerings.form(),
barrierCategory = Offerings.barrier(),
fragment = document.createDocumentFragment(), durationContainer = {};
Expand Down
4 changes: 2 additions & 2 deletions src/javascript/binary/pages/trade/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ var contractFormEventChange = function (formName) {
sessionStorage.setItem('underlying', underlying);

// get the contract details based on underlying as formName has changed
TradeSocket.send({ contracts_for: underlying });
TradeSocket.getContracts(underlying);
};

/*
Expand All @@ -79,7 +79,7 @@ if (underlyingElement) {

var underlyingEventChange = function (underlying) {
'use strict';
TradeSocket.send({ contracts_for: underlying });
TradeSocket.getContracts(underlying);
};

/*
Expand Down
2 changes: 1 addition & 1 deletion src/javascript/binary/pages/trade/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ var Message = (function () {
processMarketOfferings();
} else if (type === 'contracts_for') {
processContractFormOfferings(response);
hideOverlayContainer();
} else if (type === 'payout_currencies') {
sessionStorage.setItem('currencies', msg.data);
displayCurrencies();
} else if (type === 'proposal') {
hideOverlayContainer();
Price.display(response, Contract.contractType()[Offerings.form()]);
hidePriceLoadingIcon();
} else if (type === 'open_receipt') {
Expand Down
4 changes: 2 additions & 2 deletions src/javascript/binary/pages/trade/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ var processMarketOfferings = function () {
var underlying = document.getElementById('underlying').value;
sessionStorage.setItem('underlying', underlying);

// get the contract details based on underlying as market has changed
TradeSocket.send({ contracts_for: underlying });
// get the contract details based on underlying as market has changed
TradeSocket.getContracts(underlying);
};

/*
Expand Down
15 changes: 14 additions & 1 deletion src/javascript/binary/pages/trade/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ var TradeSocket = (function () {
'use strict';

var tradeSocket,
socketUrl = "wss://ws.binary.com/websockets/contracts",
// socketUrl = "wss://ws.binary.com/websockets/contracts",
socketUrl = "wss://www.binaryqa09.com/websockets/contracts",
bufferedSends = [];

var status = function () {
Expand Down Expand Up @@ -78,10 +79,22 @@ var TradeSocket = (function () {
}
};

var getContracts = function(underlying){
var params = { contracts_for: { symbol: underlying } }
send(params);
}

var getOfferings = function(){
var params = {offerings: {contracts: 0}}
send(params);
}

return {
init: init,
send: send,
close: close,
getContracts: getContracts,
getOfferings: getOfferings,
socket: function () { return tradeSocket; }
};

Expand Down
73 changes: 73 additions & 0 deletions src/javascript/binary/pages/trade/zjapan/contract.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
var Contract = (function(){
'use strict';
var open, close, contractDetails = [], periods={}, contractType = {};

var populate_periods = function (currentContract){
if(!periods[currentContract.contract_category]){
periods[currentContract.contract_category] = {};
}

if(!periods[currentContract.contract_category][currentContract.underlying_symbol]){
periods[currentContract.contract_category][currentContract.underlying_symbol] = {};
}

var period = currentContract.trading_period.date_start.epoch+'_'+currentContract.trading_period.date_expiry.epoch;

// console.log(period, currentContract.expiry_type,currentContract);

periods[currentContract.contract_category][currentContract.underlying_symbol][period] = {
available_barriers: currentContract.available_barriers,
barrier: currentContract.barrier,
high_barrier: currentContract.high_barrier,
low_barrier: currentContract.low_barrier,
barriers: currentContract.barriers,
// expiry_type: currentContract.expiry_type,
date_start: currentContract.trading_period.date_start,
date_expiry: currentContract.trading_period.date_expiry,
duration: currentContract.trading_period.duration
}
}

var details = function (contractObject) {
var contracts = contractObject['contracts_for'],
contractsArray = [];

open = contracts['open'];
close = contracts['close'];

var formName = Offerings.form(),
barrierCategory = Offerings.barrier();

if (formName) {
contracts.available.forEach(function (currentObj) {
if (formName === currentObj['contract_category']) {

populate_periods(currentObj)
contractsArray.push(currentObj);

if (!contractType[currentObj['contract_category']]) {
contractType[currentObj['contract_category']] = {};
}

if (!contractType[currentObj['contract_category']].hasOwnProperty(currentObj['contract_type'])) {
contractType[currentObj['contract_category']][currentObj['contract_type']] = currentObj['contract_display'];
}
}
})
}
contractDetails = contractsArray;
}

return {
details: details,
open: function () { return open },
close: function () { return close },
contracts: function () { return contractDetails },
durations: function(){ return false },
startDates: function(){ return false },
barriers: function () { return false },
periods: function(){ return periods },
contractType: function () { return contractType }
};

})()
63 changes: 63 additions & 0 deletions src/javascript/binary/pages/trade/zjapan/event.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
var lowBarrierElement = document.getElementById('barrier_low');
if (lowBarrierElement) {
lowBarrierElement.addEventListener('change', function (e) {
processPriceRequest();
});
}

var jhighBarrierElement = document.getElementById('jbarrier_high');
if (jhighBarrierElement) {
jhighBarrierElement.addEventListener('change', function (e) {
processPriceRequest();
});
}


var jlowBarrierElement = document.getElementById('jbarrier_low');
if (jlowBarrierElement) {
jlowBarrierElement.addEventListener('change', function (e) {
var options = jhighBarrierElement.getElementsByTagName('option');
var f = 0;
if(jhighBarrierElement.value > jlowBarrierElement.value){
f = 1;
}
for(var i=0; i<options.length; i++){
option = options[i];

if(option.value <= jlowBarrierElement.value){
option.setAttribute('disabled', true);
}
else{
if(!f){
jhighBarrierElement.value = option.value;
f=1;
}
option.removeAttribute('disabled');
}
}
processPriceRequest();
});
}

var barrierElement = document.getElementById('jbarrier');
if (barrierElement) {
barrierElement.addEventListener('change', function (e) {
processPriceRequest();
});
}

var period = document.getElementById('period');
if(period){
period.addEventListener('change', function (e) {
Periods.displayBarriers();
processPriceRequest();
})
}

var amount_type = document.getElementById('amount_type');
var options = amount_type.getElementsByTagName('option');
for(var i=0; i<options.length; i++){
if(options[i].value!='payout'){
options[i].setAttribute('disabled', true);
}
}
11 changes: 11 additions & 0 deletions src/javascript/binary/pages/trade/zjapan/offerings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var Offerings = Object.create(Offerings);
Object.defineProperties(Offerings,{
contractForms:{
value:function(){
parent = Object.getPrototypeOf(this);
var forms = parent.contractForms();
delete forms['risefall']
return forms
}
}
})
Loading