add homebutton script to main site
This commit is contained in:
parent
df7de5a6d7
commit
947efb4f45
|
@ -0,0 +1,20 @@
|
|||
document.addEventListener("DOMContentLoaded", function(e) {
|
||||
var homeButton = document.createElement("sheep-btn");
|
||||
homeButton.setAttribute('tabindex', 0);
|
||||
homeButton.setAttribute('aria-label', 'Go to SheepTester directory');
|
||||
homeButton.setAttribute('role', 'button');
|
||||
homeButton.addEventListener('click', function(e) {
|
||||
document.body.classList.add('sheep-blockscreen');
|
||||
homeButton.addEventListener('transitionend', function(e) {
|
||||
window.requestAnimationFrame(function() {
|
||||
// Try forcing repaint
|
||||
homeButton.getBoundingClientRect();
|
||||
window.location = 'https://andrewsapps.netlify.app/?from=sheep3';
|
||||
});
|
||||
});
|
||||
});
|
||||
homeButton.addEventListener('keydown', function(e) {
|
||||
if (e.keyCode === 13) homeButton.click();
|
||||
});
|
||||
document.body.appendChild(homeButton);
|
||||
}, {once: true});
|
Loading…
Reference in New Issue