This repository was archived by the owner on Feb 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 227
Expand file tree
/
Copy pathmt5_signals.js
More file actions
52 lines (48 loc) · 1.63 KB
/
mt5_signals.js
File metadata and controls
52 lines (48 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const BinarySocket = require('../../app/base/socket');
const isIndonesia = require('../../app/common/country_base').isIndonesia;
const getElementById = require('../../_common/common_functions').getElementById;
const TabSelector = require('../../_common/tab_selector');
const isBinaryApp = require('../../config').isBinaryApp;
const os_list = [
{
name : 'mac',
url_test: /\.dmg$/,
},
{
name : 'windows',
url_test: /\.exe$/,
},
// {
// name : 'linux',
// url_test: /x86_64\.AppImage$/,
// }
];
const Mt5Signals = (() => {
const onLoad = () => {
BinarySocket.wait('website_status').then(() => {
$('.desktop-app').setVisibility(isIndonesia() && !isBinaryApp());
});
TabSelector.onLoad();
$.getJSON('https://api.github.com/repos/binary-com/binary-desktop-installers/releases/latest', (data = { assets: [] }) => {
data.assets.some((asset) => {
if (os_list.every(os => os.download_url)) {
return true;
}
os_list.forEach(os => {
if (!os.download_url && os.url_test.test(asset.browser_download_url)) {
os.download_url = asset.browser_download_url;
}
});
return false;
});
os_list.forEach(os => {
const el_button = getElementById(`app_${os.name}`);
el_button.setAttribute('href', os.download_url);
});
});
};
return {
onLoad,
};
})();
module.exports = Mt5Signals;