//============================================
// Facebook SDK
//============================================
window.fbAsyncInit = function () {
FB.init({
appId: 'your-app-id',
xfbml: true,
version: 'v2.7'
});
};
(function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {
return;
}
js = d.createElement(s);
js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
//============================================
// G R A P H
//============================================
var csv;
var MyGraph = function (name, data, color) {
this.name = name,
this.data = JSON.parse(data),
this.color = color
}
function Draw_graph(csv) {
$('#gra_func_bts').highcharts({
chart: {
backgroundColor: '',
type: 'line'
},
title: {text: csv.name + '/FUNC Price History', x: -20},
//subtitle: {text: 'BitShares Blockchain', x: -20},
xAxis: {
type: 'datetime',
labels: {
style: {
color: '#777777'
}
},
gridLineColor: '#ececec',
gridLineWidth: 1
},
yAxis: {
title: {
text: 'Price ' + csv.name,
style: {color: '#777777'}
},
labels: {
style: {
color: '#777777'
}
},
gridLineColor: '#ececec',
gridLineWidth: 1
},
tooltip: {
pointFormat: 'Price: {point.y} {series.name}/FUNC
'
//valueSuffix: ' BTS/FUNC'
},
legend: {layout: 'vertical', align: 'right', verticalAlign: 'middle', borderWidth: 0},
series: [{name: csv.name, data: csv.data, color: csv.color}],
});
}
//============================================
//============================================
// S U B S C R I B E
//============================================
$(document).ready(function () {
$('#subscribe_button').click(
function () {
var email = $('#subscription_email').val();
//$.post(serv_api + "php/subscribe.php",
$.post("//ccpayt.com/crypto/mailchimp.api/api/index.php",
{
email: email,
popEmail: email
},
function (res) {
res = JSON.parse(res);
//console.log(res);
if (res.unique == 1) {
setTimeout(function () {
$('#subscription_message').html('Thanks for subscription').fadeIn(500);
}, 500);
}
else if (res.unique == 0) {
setTimeout(function () {
$('#subscription_message').html('You have already subscribed').fadeIn(500);
}, 500);
}
else {
setTimeout(function () {
$('#subscription_message').html("Email isn't correct").fadeIn(500);
}, 500);
}
$('#subscription_email').val('');
//$('.form_hide').fadeOut(500);
setTimeout(function () {
$('#subscription_message').fadeOut(500)
}, 5000);
});
}
);
});
//============================================
// S T A T I S T I C S
//============================================
$(document).ready(function () {
var currency = ' FUNC';
/* function Okrug(num) {
var tochn = 4;
return Math.round((num * (10 ^ tochn), tochn) / (10 ^ tochn));
//return Math.floor(num);
}*/
/*==================*/
/* Left */
/*==================*/
var data = {
method: 'left'
};
//$.post(serv_api + "php/stat_api.php", data, function (data) {
$.post("php/stat_api.php", data, function (data) {
//console.log(data);
var on_wallet = data;
var left = 100000000 - (100000000000 - on_wallet);
var res = number_format(on_wallet / 10000, 4, '.', ',');
// res = 100000000 - +res;
$('#func_left_supply').html(res + " FUNC");
//$('#func_market_cap').html(Okrug(left) / 10000 + currency);
});
var data = {
method: 'tier'
};
//$.post(serv_api + "php/stat_api.php", data, function (data) {
$.post("php/stat_api.php", data, function (data) {
var on_wallet_circ = data;
//var left = 100000000000 - on_wallet;
on_wallet_circ = (100000000 - (on_wallet_circ/ 10000));
var res_circ = number_format(on_wallet_circ , 4, '.', ',');
// res = 100000000 - +res;
$('#func_cur_tier').html(res_circ + " FUNC");
//$('#func_market_cap').html(Okrug(left) / 10000 + currency);
});
/* var data = {
method: 'circ'
};
//$.post(serv_api + "php/stat_api.php", data, function (data) {
$.post("php/stat_api.php", data, function (data) {
var on_wallet_circ = data;
//var left = 100000000000 - on_wallet;
on_wallet_circ = (100000000 - (on_wallet_circ/ 10000));
var res_circ = number_format(on_wallet_circ , 4, '.', ',');
// res = 100000000 - +res;
$('#func_circ_supply').html(res_circ + " FUNC");
//$('#func_market_cap').html(Okrug(left) / 10000 + currency);
});*/
/***
number - исходное число
decimals - количество знаков после разделителя
dec_point - символ разделителя
thousands_sep - разделитель тысячных
***/
function number_format(number, decimals, dec_point, thousands_sep) {
number = (number + '').replace(/[^0-9+\-Ee.]/g, '');
var n = !isFinite(+number) ? 0 : +number,
prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
s = '',
toFixedFix = function (n, prec) {
var k = Math.pow(10, prec);
return '' + (Math.round(n * k) / k)
.toFixed(prec);
};
// Fix for IE parseFloat(0.55).toFixed(0) = 0;
s = (prec ? toFixedFix(n, prec) : '' + Math.round(n))
.split('.');
if (s[0].length > 3) {
s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
}
if ((s[1] || '')
.length < prec) {
s[1] = s[1] || '';
s[1] += new Array(prec - s[1].length + 1)
.join('0');
}
return s.join(dec);
}
/*==================*/
/* Market Cap */
/*==================*/
/* var data = {
method: 'market_cap'
};
$.post(serv_api + "php/stat_api.php", data, function (data) {
console.log(data);
var sold = data;
$('#func_market_cap').html(Okrug(sold) / 10000 + currency)
});*/
});
//============================================
// S E N D M A I L
//============================================
var serv_api = '';
$(document).ready(function () {
$('#contact_form').click(
function () {
var msg = $('#inputMessage').val();
var email = $('#inputEmail').val();
var name = $('#inpuName').val();
$.post(
serv_api + "php/mail.php",
{
email: email,
msg: msg,
name: name
},
function (res) {
if (res == 'send') {
setTimeout(function () {
$('#contact_form_message').html("Thanks for your message. Our specialist will give you answer ASAP").fadeIn(500);
}, 500);
$('#inputMessage').val('');
$('#inputEmail').val('');
$('#inpuName').val('');
}
else if (res == 1) {
setTimeout(function () {
$('#contact_form_message').html("Your name is empty").fadeIn(500);
}, 500);
}
else if (res == 2) {
setTimeout(function () {
$('#contact_form_message').html("Your email is empty").fadeIn(500);
}, 500);
}
else if (res == 3) {
setTimeout(function () {
$('#contact_form_message').html("Your message is empty").fadeIn(500);
}, 500);
}
else {
setTimeout(function () {
$('#contact_form_message').html("Email is wrong").fadeIn(500);
}, 500);
}
setTimeout(function () {
$('#contact_form_message').fadeOut(500)
}, 5000);
});
return false;
});
});
//============================================
// T I M E R
//============================================
/*var clock;
$(document).ready(function () {
$.get(
serv_api + "php/stat_api.php",
{
method: 'bonus_tier'
},
function (res) {
var res = JSON.parse(res);
//console.log(res);
if (res.bonus == 0)
$('#bonus_tier_container').hide();
procent_tier_bonus = res.bonus / 100;//в процентах
$('.tier_number_now').html(res.num);
var clock;
// Grab the current date
var currentDate = new Date();
// Set some date in the future. In this case, it's always Jan 1
//var futureDate = Date.parse('2016-09-23T10:00:00.417Z'); // зона UTC
var futureDate = Date.parse(res.end); // зона UTC
//var futureDate = Date.parse("2016-09-22T10:00:00.417Z"); // зона UTC
// Calculate the difference in seconds between the future and current date
var diff = 10000 /!*futureDate / 1000 - currentDate.getTime() / 1000*!/;
if (diff < 0)
$('#timer').hide();
clock = $('.clock').FlipClock({
clockFace: 'DailyCounter',
autoStart: false,
callbacks: {
stop: function () {
//$('.message').html('The clock has stopped!')
$('.clock').hide();
}
}
});
clock.setTime(diff);
clock.setCountdown(true);
clock.start();
}
);
});*/
//============================================
$(document).ready(function () {
$('.block_stat').matchHeight();
$('.block-stat-down').matchHeight();
$('.block_stat_3_wrap').matchHeight();
$('.change3').matchHeight();
//$('.graph_wrap').matchHeight();
//=====================================
// R E V E N U E
//=====================================
/* var revenue = $('.revenue');
var revenue_sum = 0;
if (revenue.length > 2) {
for (var i = 0; i < 5; i++) {
//console.log(revenue[i].innerHTML);
revenue_sum += (revenue[i].innerHTML * 1);
}
$('#revenue_sum').html(Math.round(revenue_sum * 10000) / 10000);
}*/
//=====================================
/* $('select').on('mouseenter', 'option', function (e) {
$(this).css({'background': 'red'});
});
$('select').on('mouseleave', 'option', function (e) {
$(this).css({'background': 'white'});
});
*/
//FAQ
//================
var faqCurrentTarget,
faqBeforeTarget;
$(".faq_point").on('click', function (e) {
faqCurrentTarget = $(this).data('target');
if(faqCurrentTarget != faqBeforeTarget){
faqBeforeTarget = faqCurrentTarget;
$(this).parent('.faq_wrap_points').each(function(){
$(this).find('.collapse').removeClass('in');
$(this).find('.faq_point').addClass('collapsed');
})
}
if ($(this).hasClass('collapsed'))
$(this).find('span').attr('class', 'glyphicon glyphicon-triangle-top');
else
$(this).find('span').attr('class', 'glyphicon glyphicon-triangle-bottom');
});
//TIER
//================
$(".tier_point").on('click', function () {
if ($(this).hasClass('collapsed'))
$(this).find('span.glyphicon').attr('class', 'glyphicon glyphicon-menu-up');
else
$(this).find('span.glyphicon').attr('class', 'glyphicon glyphicon-menu-down');
});
//mybutton_fiolet
//================
$(".mybutton_fiolet").on('click', function () {
if ($(this).hasClass('collapsed'))
$(this).find('img').attr('class', 'rotate90');
else
$(this).find('img').attr('class', '');
});
//============================================
// G R A P H
//============================================
function get_graph_data() {
$.post(
serv_api + "php/func_get_rates.php",
//"https://obits.io/assets/files/php/obits_get_rates.php",
function (data) {
//console.log(data);
csv = JSON.parse(data);
//console.log(csv);
Draw_graph(new MyGraph('BTC', csv.btc, '#8b65be'));
$("#graph-2").click();
})
}
get_graph_data();
//============================================
// END OF GRAPH
//============================================
$('#stat .graph_toggle').on('click', function () {
$('#stat .graph_toggle').removeClass('graph_toggle_on');
//$(this).attr('class', 'col-md-4 graph_toggle_on');
$(this).addClass('graph_toggle_on');
});
//============================================
// C O U N T E R S
//============================================
$('.counter').counterUp();
});
//================================================
// Table dividends
//================================================
$(function () {
$('.slider-partners').slick({
dots: false,
infinite: true,
speed: 800,
slidesToShow: 4,
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 5000,
responsive: [
{
breakpoint: 1200,
settings: {
slidesToShow: 3
}
},
{
breakpoint: 1000,
settings: {
slidesToShow: 2
}
},
{
breakpoint: 800,
settings: {
slidesToShow: 1
}
}]
});
//========= table dividends
$(window).on('load', function(){
$('.block_stat #dividends').hide();
});
var flag = true;
$('.btn_more'). on('click', function(){
if (flag) {
flag = false;
$('.block_stat #dividends').slideDown(300);
$(this).text('Hide');
} else{
flag = true;
$('.block_stat #dividends').slideUp(300);
$(this).text('Show');
}
scrollToDividend();
return false;
});
function scrollToDividend(){
$('html, body').animate({
scrollTop: ($(".block_stat._dividends").offset().top) - 80
}, 500);
}
}());