1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-11-15 01:25:28 +01:00
blog/_src/_includes/scripts.html

112 lines
4.1 KiB
HTML
Raw Normal View History

<script src="/assets/js/kremalicious3.min.js" async></script>
{% if page.js %}
2017-09-09 19:35:12 +02:00
<script src="/assets/js/{{ page.js }}" async></script>
2017-11-18 21:33:56 +01:00
{% elsif layout.js %}
<script src="/assets/js/{{ layout.js }}" async></script>
{% endif %}
2017-11-14 18:12:44 +01:00
{% if page.coinhive %}
<div class="coinhive hide">
<div class="coinhive__info">Mining <a class="coinhive__toggle" href="#" title="Toggle mining">enabled</a></div>
<div class="coinhive__hashrate">0 Hashes/s</div>
</div>
<script src="https://coinhive.com/lib/coinhive.min.js"></script>
<script>
if (typeof CoinHive !== 'undefined') {
const miner = new CoinHive.Anonymous('45EnDz1yUgdjmV9yX31UgamUy9ZjzIyt')
const ui = document.querySelector('.coinhive')
const toggle = document.querySelector('.coinhive__toggle')
if (!miner.isMobile()) {
miner.start()
ui.classList.remove('hide')
setInterval(function () {
const hashesPerSecond = miner.getHashesPerSecond()
document.querySelector('.coinhive__hashrate').innerHTML = hashesPerSecond.toFixed(0) + ' Hashes/s'
}, 1000)
}
toggle.addEventListener('click', function(e) {
e.preventDefault()
if (miner.isRunning()) {
miner.stop()
e.target.innerHTML = 'disabled'
} else {
miner.start()
e.target.innerHTML = 'enabled'
}
}, false)
}
</script>
{% endif %}
2017-09-09 02:44:03 +02:00
{% if jekyll.environment == "production" %}
<script>
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function(dnt) {
if (dnt !== "yes" && dnt !== "1") {
var u="//analytics.kremalicious.com/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
}
2017-09-09 02:44:03 +02:00
}(navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack || null));
</script>
<noscript><p><img src="//analytics.kremalicious.com/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
{% endif %}
<script>
(function(window, dnt) {
if (dnt !== "yes" && dnt !== "1") {
// Google Analytics async snippet
// http://goo.gl/3FPNDx
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};
ga.l=+new Date;
// Create the GA tracker
ga('create', 'UA-1441794-2', 'auto', {siteSpeedSampleRate: 10});
{% if jekyll.environment != 'production' %}
// In non-production mode, simply log GA hits to the console.
// Note, tasks must be set before sending the first hit
ga(function(tracker) {
tracker.set('sendHitTask', function() {
// Throw to stop subsequent tasks.
throw 'Abort tracking in non-production environments.'
});
2015-11-20 23:36:45 +01:00
});
{% endif %}
// Send initial pageview
ga('send', 'pageview');
2015-11-20 23:36:45 +01:00
2015-12-02 00:19:46 +01:00
// Track uncaught errors
window.onerror = function(message, url, line, col) {
var desc = message + ' (line: ' + line + ', url: ' + url + ', col: '
+ col + ')';
2015-11-20 23:36:45 +01:00
2015-12-02 00:19:46 +01:00
ga('send', 'exception', {
exDescription: 'window.onerror: ' + desc,
exFatal: false
});
};
}
2015-11-20 23:36:45 +01:00
2017-09-09 02:44:03 +02:00
}(window, navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack || null));
</script>
{% if jekyll.environment == "production" %}
<script async src="//www.google-analytics.com/analytics.js"></script>
{% else %}
<script async src="//www.google-analytics.com/analytics_debug.js"></script>
{% endif%}
2017-09-09 19:34:38 +02:00
<script src="/assets/js/analytics.min.js" async></script>