2018-02-06 12:52:39 +03:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
/* eslint-disable */
|
|
|
|
|
|
|
|
if (location.hash.substring(1).startsWith(encodeURIComponent("{"))) {
|
|
|
|
location.pathname = "/playground/";
|
|
|
|
}
|
|
|
|
|
|
|
|
window.addEventListener("load", function() {
|
|
|
|
// We don't have access to a unique body css attribute for just the homepage
|
2018-02-07 01:47:14 +03:00
|
|
|
// so instead it is set on load. It's only really visible on a vertical overscroll
|
|
|
|
document.body.style.backgroundColor = "rgb(24, 32, 37)";
|
2018-02-06 12:52:39 +03:00
|
|
|
|
2018-02-07 01:47:14 +03:00
|
|
|
var logoWrapper = document.querySelector(".animatedLogoWrapper");
|
|
|
|
var logo = document.querySelector(".prettier-logo-wide");
|
|
|
|
var lastDash = logo.querySelector("g:last-of-type path:last-of-type");
|
2018-02-06 12:52:39 +03:00
|
|
|
|
2018-02-07 01:47:14 +03:00
|
|
|
function handleLogoDrag(event) {
|
|
|
|
logo.classList.add("rolling");
|
|
|
|
event.preventDefault();
|
|
|
|
}
|
2018-02-06 12:52:39 +03:00
|
|
|
|
2018-02-07 01:47:14 +03:00
|
|
|
logoWrapper.setAttribute("draggable", "true");
|
|
|
|
logoWrapper.addEventListener("touchstart", handleLogoDrag);
|
|
|
|
logoWrapper.addEventListener("dragstart", handleLogoDrag);
|
2018-02-06 12:52:39 +03:00
|
|
|
|
2018-02-07 01:47:14 +03:00
|
|
|
lastDash.addEventListener("animationend", function(event) {
|
|
|
|
if (event.animationName.match(/roll/)) {
|
|
|
|
logo.classList.remove("rolling");
|
|
|
|
}
|
|
|
|
});
|
2018-02-06 12:52:39 +03:00
|
|
|
|
|
|
|
var yarnButton = document.querySelector(".showYarnButton");
|
|
|
|
var npmButton = document.querySelector(".showNpmButton");
|
|
|
|
var getStartedSection = document.querySelector(".getStartedSection");
|
|
|
|
|
|
|
|
npmButton.addEventListener("click", function(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
npmButton.classList.add("active");
|
|
|
|
yarnButton.classList.remove("active");
|
|
|
|
getStartedSection.classList.add("getStartedSection--npm");
|
|
|
|
});
|
|
|
|
yarnButton.addEventListener("click", function(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
yarnButton.classList.add("active");
|
|
|
|
npmButton.classList.remove("active");
|
|
|
|
getStartedSection.classList.remove("getStartedSection--npm");
|
|
|
|
});
|
|
|
|
});
|