Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
hydejack-starter-kit/_includes/my-body.html
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
107 lines (92 sloc)
3.02 KB
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> | |
document.querySelector('hy-push-state').setAttribute('prefetch', ''); | |
document.querySelectorAll('.sidebar a[href^="/"]').forEach(function (el) { | |
el.addEventListener('click', function (e) { | |
if (el.pathname === window.location.pathname) { | |
e.preventDefault(); | |
e.stopPropagation(); | |
document.querySelector('hy-drawer').close(); | |
} | |
}); | |
}); | |
</script> --> | |
<!-- | |
Code for integrating CloudFlare's email protection with Hydejack's single page app loading. | |
--> | |
<script> | |
document.getElementById('_pushState').addEventListener('hy-push-state-after', function (e) { | |
function e(e){ | |
(console.error?console.error:console.log).call(console,e) | |
} | |
function t(e){ | |
return l.innerHTML='<a href="'+e.replace(/"/g,""")+'"></a>',l.childNodes[0].getAttribute("href") | |
} | |
function r(e,t){ | |
var r=e.substr(t,2);return parseInt(r,16) | |
} | |
function n(e,n){ | |
for(var o="",c=r(e,n),a=n+2;a<e.length;a+=2){ | |
var l=r(e,a)^c; | |
o+=String.fromCharCode(l) | |
} | |
return t(o) | |
} | |
var o="/cdn-cgi/l/email-protection#", | |
c=".__cf_email__", | |
a="data-cfemail", | |
l=document.createElement("div"); | |
!function(){ | |
for(var t=document.getElementsByTagName("a"),r=0;r<t.length;r++) | |
try{ | |
var c=t[r],a=c.href.indexOf(o); | |
a>-1&&(c.href="mailto:"+n(c.href,a+o.length)) | |
}catch(t){ | |
e(t) | |
} | |
}(), | |
function(){ | |
for(var t=document.querySelectorAll(c),r=0;r<t.length;r++) | |
try{ | |
var o=t[r],l=n(o.getAttribute(a),0),i=document.createTextNode(l); | |
o.parentNode.replaceChild(i,o) | |
}catch(t){ | |
e(t) | |
} | |
}() | |
}); | |
</script> | |
{% comment %} | |
<!-- | |
Example code for using Matamo as alternative analytics solution. | |
--> | |
{% if site.matomo_analytics %} | |
<script> | |
var _paq = _paq || []; | |
/*{% if site.matomo_analytics.no_cookies %}*/ | |
_paq.push(['disableCookies']); | |
/*{% endif %}*/ | |
_paq.push(['trackPageView']); | |
_paq.push(['enableLinkTracking']); | |
_paq.push(['setTrackerUrl', u+'piwik.php']); | |
_paq.push(['setSiteId', '{{site.matomo_analytics.site_id}}']); | |
var pushStateEl = document.getElementById('_pushState'); | |
var timeStartLoadPage, referer, timeItTookToLoadPage; | |
pushStateEl.addEventListener('hy-push-state-start', function() { | |
timeStartLoadPage = new Date().getTime(); | |
referer = window.location.toString(); | |
}); | |
pushStateEl.addEventListener('hy-push-state-ready', function() { | |
timeItTookToLoadPage = new Date().getTime() - timeStartLoadPage; | |
}); | |
pushStateEl.addEventListener('hy-push-state-after', function() { | |
_paq.push(['setReferrerUrl', referer]); | |
_paq.push(['setCustomUrl', window.location.toString()]); | |
_paq.push(['setDocumentTitle', document.title]); | |
_paq.push(['deleteCustomVariables', 'page']); | |
_paq.push(['setGenerationTimeMs', timeItTookToLoadPage]); | |
_paq.push(['trackPageView']); | |
}); | |
window.loadJSDeferred('{{site.matomo_analytics.root}}piwik.js'); | |
</script> | |
{% endif %} | |
{% endcomment %} |