(function($) { 'use strict'; if ($("#cmc_coinslist").hasClass("cmc_live_updates")) { var $liveUpdates = $(".cmc_live_updates"); var all_per =$("#cmc_coinslist thead tr").find('th.cmc-future-price-head').data('percentage'); var socket = io.connect('https://socket.coincap.io', {transports: ['websocket']}); socket.on('trades', function(response) { var $row = $liveUpdates.find('tr[data-coin-symbol="' + response.coin + '"]'); var currency_rate = $('#cmc_usd_conversion_box option:selected').data('currency-rate'); var currency_name = $('#cmc_usd_conversion_box option:selected').val(); var currency_symbol = $('#cmc_usd_conversion_box option:selected').data('currency-symbol'); if ($row.length) { var cssClass = (response.msg.price > $row.attr('data-coin-price')) ? 'price-plus' : 'price-minus'; var changesCls = (response.msg.price > $row.attr('data-coin-price')) ? 'up' : 'down'; var changes_html = ''; if (response.msg.cap24hrChange > 0) { changes_html = '' + response.msg.perc + '%' } else { changes_html = '' + response.msg.perc + '%' } if (currency_name == "USD") { var formatted_price = response.msg.price } else if (currency_name == "BTC") { if (response.coin != "BTC") { var formatted_price = response.msg.price / currency_rate } else { formatted_price = '1.00' } } else { var formatted_price = response.msg.price * currency_rate } var coinId= $row.data('coin-id'); var coin_per=''; if(all_per[coinId]){ coin_per=all_per[coinId]; }else{ coin_per=all_per['all']; } var futurePrice=formatted_price+(formatted_price*coin_per/100); $row.addClass(cssClass); $row.attr('data-coin-price', formatted_price); if (formatted_price >= 25) { var priceHtml = numeral(formatted_price).format('0,0.00'); } else if (formatted_price >= 0.50 && formatted_price < 25) { var priceHtml = numeral(formatted_price).format('0,0.000'); } else if (formatted_price >= 0.01 && formatted_price < 0.50) { var priceHtml = numeral(formatted_price).format('0,0.0000'); } else if (formatted_price >= 0.0001 && formatted_price < 0.01) { var priceHtml = numeral(formatted_price).format('0,0.00000'); } else { var priceHtml = numeral(formatted_price).format('0,0.00000000'); } if (futurePrice >= 25) { var futurePriceHtml = numeral(futurePrice).format('0,0.00'); } else if (futurePrice >= 0.50 && futurePrice < 25) { var futurePriceHtml = numeral(futurePrice).format('0,0.000'); } else if (futurePrice >= 0.01 && futurePrice < 0.50) { var futurePriceHtml = numeral(futurePrice).format('0,0.0000'); } else if (futurePrice >= 0.0001 && futurePrice < 0.01) { var futurePriceHtml = numeral(futurePrice).format('0,0.00000'); } else { var futurePriceHtml = numeral(futurePrice).format('0,0.00000000'); } $row.find('.cmc-price').html(currency_symbol + '' + priceHtml + ''); $row.find('.cmc_live_ch').html(changes_html); $row.find('.cmc-future-price').html(currency_symbol + '' + futurePriceHtml + ''); setTimeout(function() { $row.removeClass('price-plus price-minus'); }, 1500) } }) } })(jQuery); /* Do not modify this file directly. It is compiled from other files. */ /*global google:true*/ /*global _wp_google_translate_widget:true*/ /*exported googleTranslateElementInit*/ function googleTranslateElementInit(){var e,a="en",t=/[?&#]lang=([a-zA-Z\-_]+)/;"object"==typeof _wp_google_translate_widget&&"string"==typeof _wp_google_translate_widget.lang&&(a=_wp_google_translate_widget.lang),(e=window.location.href.match(t))&&(window.location.href=window.location.href.replace(t,"").replace(/#googtrans\([a-zA-Z\-_|]+\)/,"")+"#googtrans("+a+"|"+e[1]+")"),new google.translate.TranslateElement({pageLanguage:a,layout:_wp_google_translate_widget.layout,autoDisplay:!1},"google_translate_element")};