/******* Do not edit this file ******* Simple Custom CSS and JS - by Silkypress.com Saved: Nov 06 2018 | 22:18:12 */ (function($){ var receiver = { BTC: '39LtT4uytZFLybzYu5pYcWdytGKuBWeM32', ETH: '0xf845cE7060c5b153C91Fbe35C51Ce84016e4e9fB', GO: '0xae7432882470198dB8e62D1a323E906aCD39cD25' }; var scanner = { BTC: 'https://www.blockchain.com/btc/tx/TXID', ETH: 'https://etherscan.io/tx/TXID', GO: 'https://explorer.gochain.io/tx/TXID' }; var formUrl = 'https://docs.google.com/forms/d/e/1FAIpQLSfCrTf91SrsNreD_1a-roTeUC5fP7nedkmzrMl6y9g_A9Ma-g/viewform?usp=pp_url&entry.1648792433=TXID&entry.200980042=TXLINK'; var paymentCurrency = null; var paymentAmount = 0.0; function getMewUrl() { return 'https://www.myetherwallet.com/?to=' + receiver[paymentCurrency] + '&value=' + paymentAmount + '#send-transaction'; } function getMyCryptoUrl() { return 'https://mycrypto.com/?to=' + receiver[paymentCurrency] + '&value=' + paymentAmount + '#send-transaction'; } function showBitcoinPayment() { $('#payment-BTC').show(); $('#amount-BTC').val(paymentAmount); $('#address-BTC').val(receiver.BTC); $('#tx-BTC').val(''); $('#continue-BTC').removeClass('button-loading').text('Continue').attr('disabled', true); } function showEthereumPayment() { $('#payment-ETH').show(); $('#amount-ETH').val(paymentAmount); $('#address-ETH').val(receiver.ETH); $('#tx-ETH').val(''); $('#continue-ETH').removeClass('button-loading').text('Continue').attr('disabled', true); } function showGoPayment() { $('#payment-GO').show(); $('#amount-GO').val(paymentAmount); $('#address-GO').val(receiver.GO); $('#tx-GO').val(''); $('#continue-GO').removeClass('button-loading').text('Continue').attr('disabled', true); } function continueTransform(btn) { var $btn = $(btn); $btn.html('
'); $btn.addClass('button-loading').attr('disabled', true); } function getTxUrl(tx) { switch (paymentCurrency) { case 'BTC': return scanner.BTC.replace('TXID', tx); case 'ETH': return scanner.ETH.replace('TXID', tx); case 'GO': return scanner.GO.replace('TXID', tx); } return ''; } function goToForm(tx) { var txUrl = getTxUrl(tx); var url = formUrl.replace('TXID', tx).replace('TXLINK', txUrl); location.href = url; } function updatePrices(prices) { paymentAmount = prices.total; $('#service-base-price') .html('(' + prices.base + ' ' + paymentCurrency + ')'); $('#service-1-price') .html('(+' + prices['service-1'] + ' ' + paymentCurrency + ')'); $('#service-2-price') .html('(+' + prices['service-2'] + ' ' + paymentCurrency + ')'); $('#service-3-price') .html('(+' + prices['service-3'] + ' ' + paymentCurrency + ')'); $('#total-price').html(prices.total + ' ' + paymentCurrency); $('#total-price-usd').html('$' + prices.total_usd); } function setCurrency(currency, callback) { paymentCurrency = currency; $('#loader-' + currency).show(); recalculatePrices(function() { $('#loader-' + currency).hide(); if (callback) callback(); }); } function recalculatePrices(callback) { var $btn = $('#pay-button'); $btn.html(''); $btn.addClass('button-loading').attr('disabled', true); $('#pay-button').show(); var services = []; $('.service-checkbox').each(function() { var $this = $(this); var id = $this.attr('id').replace('service-', ''); if ($this.is(':checked')) { services.push(id); } }); $.get('/rates.php?currency=' + paymentCurrency + '&services=' + services.join(','), function(result) { if (!result || result == "error") { alert('There was an error while recalculating the price. Please try reloading the page, or contact us.'); return; } var prices = jQuery.parseJSON(result); paymentAmount = prices.total; updatePrices(prices); $('#amount-' + paymentCurrency).val(paymentAmount); if (callback) callback(); $btn.html('Pay').removeClass('button-loading').attr('disabled', false); }); } $(function() { $('#pay-button').click(function(e) { var $this = $(this); e.preventDefault(); function proceed() { $('#payment-ct').show(); $('#payment-BTC').hide(); $('#payment-ETH').hide(); $('#payment-GO').hide(); if (paymentCurrency === 'BTC') { showBitcoinPayment(); } else if (paymentCurrency === 'ETH') { showEthereumPayment(); } else if (paymentCurrency === 'GO') { showGoPayment(); } $this.hide(); } if (!paymentCurrency) { var $button = $('#default-currency'); $button.addClass('selected'); setCurrency($button.data('currency'), proceed); } else { proceed(); } }); $('.service-checkbox').change(function(e) { /*var amount = baseprice; $('.service-checkbox').each(function() { var $this = $(this); if ($this.is(':checked')) { amount += $this.data('price'); } }); payamount = amount; $('#pay-amount').text(payamount);*/ $('#payment-ct').hide(); $('#payment-BTC').hide(); $('#payment-ETH').hide(); $('#payment-GO').hide(); setTimeout(recalculatePrices, 100); }); $('.currency').click(function(e) { e.preventDefault(); if ($(this).hasClass('selected')) { return; } $('#payment-ct').hide(); $('#payment-BTC').hide(); $('#payment-ETH').hide(); $('#payment-GO').hide(); $('#pay-button').show(); $('.currency').removeClass('selected'); $(this).addClass('selected'); var currency = $(this).data('currency'); setCurrency(currency); }); $('.continue-button').click(function(e) { e.preventDefault(); continueTransform(this); var tx = $('#tx-' + paymentCurrency).val(); goToForm(tx); }); $('.pay-mew').click(function(e) { e.preventDefault(); window.open(getMewUrl()); }); $('.pay-mycrypto').click(function(e) { e.preventDefault(); window.open(getMyCryptoUrl()); }); $('.payment-box .amount input, .payment-box .address input').focus(function() { this.setSelectionRange(0, this.value.length); }); $('#tx-BTC').keyup(function(e) { if ($(this).val()) { $('#continue-BTC').attr('disabled', false); if (e.which == 13) $('#continue-BTC').click(); } else { $('#continue-BTC').attr('disabled', true); } }); $('#tx-ETH').keyup(function(e) { if ($(this).val()) { $('#continue-ETH').attr('disabled', false); if (e.which == 13) $('#continue-ETH').click(); } else { $('#continue-ETH').attr('disabled', true); } }); $('#tx-GO').keyup(function(e) { if ($(this).val()) { $('#continue-GO').attr('disabled', false); if (e.which == 13) $('#continue-GO').click(); } else { $('#continue-GO').attr('disabled', true); } }); $('#default-currency').click(); $('.question').click(function(e) { e.stopImmediatePropagation(); e.preventDefault(); var $this = $(this); var state = $this.data('state'); var tooltip = $this.parents('.service-checkbox-ct').find('.tooltip'); console.log(tooltip); if (state !== 'open') { tooltip.css('height', tooltip.find(':first-child').outerHeight()); $this.data('state', 'open'); } else { tooltip.css('height', 0); $this.data('state', 'closed'); } return false; }); }); })(jQuery);