prettier/website/static/landing.js

50 lines
1.7 KiB
JavaScript
Raw Normal View History

Revamp landing page (#3718) * Begin landing page revamp * Break the editor integrations onto their own lines * Add template string * Add editor line breaks * Make logo clickable * Add more docs links * Don’t split the editor list items into paragraphs * Break plugin onto its own line * Move the “Why” button to the bottom of the block * Use suggested font * Change font * Change footer color * Add assets from @orta * Fix fonts * Use new editor assets * Add npm/yarn button * Switch to npx * Minor mobile tweaks * Add dependants * Lots of zeros are cooler to look at than a “k” * Improve button sizes, respect prefers-reduced-motion * Fixup media breakpoints for Get Started section * Increase padding of editors * CSS fixes from code review * Prevent repeatedly clicking on the logo from selecting nearby text * dependant -> dependent * Various CSS tightening * Set flex-basis on editors * Add new languages panel * Improve layout of languages * Cleanup grouping code * Fix users layout * Fix language image widths * space-evenly -> space-between * Fix typo * Remove unused var * Various CSS fixes * Set overflow-x: auto on code * Improve languages layout * Add silly cursor * Make logo 'draggable' * [Site] Margins and paddings (#2) * [Site] Margins and paddings * [Site] Bring back the link to why, that's a good guide worth linking to * Improve logo mobile usage * Improve responsive layout of editors * Use static SVG for the moment (#3) * Use the static logo for the moment * Fix the broken JS, from going static, and make overscroll the right color * Fix padding
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
// so instead it is set on load. It's only really visible on a vertical overscroll
document.body.style.backgroundColor = "rgb(24, 32, 37)";
Revamp landing page (#3718) * Begin landing page revamp * Break the editor integrations onto their own lines * Add template string * Add editor line breaks * Make logo clickable * Add more docs links * Don’t split the editor list items into paragraphs * Break plugin onto its own line * Move the “Why” button to the bottom of the block * Use suggested font * Change font * Change footer color * Add assets from @orta * Fix fonts * Use new editor assets * Add npm/yarn button * Switch to npx * Minor mobile tweaks * Add dependants * Lots of zeros are cooler to look at than a “k” * Improve button sizes, respect prefers-reduced-motion * Fixup media breakpoints for Get Started section * Increase padding of editors * CSS fixes from code review * Prevent repeatedly clicking on the logo from selecting nearby text * dependant -> dependent * Various CSS tightening * Set flex-basis on editors * Add new languages panel * Improve layout of languages * Cleanup grouping code * Fix users layout * Fix language image widths * space-evenly -> space-between * Fix typo * Remove unused var * Various CSS fixes * Set overflow-x: auto on code * Improve languages layout * Add silly cursor * Make logo 'draggable' * [Site] Margins and paddings (#2) * [Site] Margins and paddings * [Site] Bring back the link to why, that's a good guide worth linking to * Improve logo mobile usage * Improve responsive layout of editors * Use static SVG for the moment (#3) * Use the static logo for the moment * Fix the broken JS, from going static, and make overscroll the right color * Fix padding
2018-02-06 12:52:39 +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");
Revamp landing page (#3718) * Begin landing page revamp * Break the editor integrations onto their own lines * Add template string * Add editor line breaks * Make logo clickable * Add more docs links * Don’t split the editor list items into paragraphs * Break plugin onto its own line * Move the “Why” button to the bottom of the block * Use suggested font * Change font * Change footer color * Add assets from @orta * Fix fonts * Use new editor assets * Add npm/yarn button * Switch to npx * Minor mobile tweaks * Add dependants * Lots of zeros are cooler to look at than a “k” * Improve button sizes, respect prefers-reduced-motion * Fixup media breakpoints for Get Started section * Increase padding of editors * CSS fixes from code review * Prevent repeatedly clicking on the logo from selecting nearby text * dependant -> dependent * Various CSS tightening * Set flex-basis on editors * Add new languages panel * Improve layout of languages * Cleanup grouping code * Fix users layout * Fix language image widths * space-evenly -> space-between * Fix typo * Remove unused var * Various CSS fixes * Set overflow-x: auto on code * Improve languages layout * Add silly cursor * Make logo 'draggable' * [Site] Margins and paddings (#2) * [Site] Margins and paddings * [Site] Bring back the link to why, that's a good guide worth linking to * Improve logo mobile usage * Improve responsive layout of editors * Use static SVG for the moment (#3) * Use the static logo for the moment * Fix the broken JS, from going static, and make overscroll the right color * Fix padding
2018-02-06 12:52:39 +03:00
function handleLogoDrag(event) {
logo.classList.add("rolling");
event.preventDefault();
}
Revamp landing page (#3718) * Begin landing page revamp * Break the editor integrations onto their own lines * Add template string * Add editor line breaks * Make logo clickable * Add more docs links * Don’t split the editor list items into paragraphs * Break plugin onto its own line * Move the “Why” button to the bottom of the block * Use suggested font * Change font * Change footer color * Add assets from @orta * Fix fonts * Use new editor assets * Add npm/yarn button * Switch to npx * Minor mobile tweaks * Add dependants * Lots of zeros are cooler to look at than a “k” * Improve button sizes, respect prefers-reduced-motion * Fixup media breakpoints for Get Started section * Increase padding of editors * CSS fixes from code review * Prevent repeatedly clicking on the logo from selecting nearby text * dependant -> dependent * Various CSS tightening * Set flex-basis on editors * Add new languages panel * Improve layout of languages * Cleanup grouping code * Fix users layout * Fix language image widths * space-evenly -> space-between * Fix typo * Remove unused var * Various CSS fixes * Set overflow-x: auto on code * Improve languages layout * Add silly cursor * Make logo 'draggable' * [Site] Margins and paddings (#2) * [Site] Margins and paddings * [Site] Bring back the link to why, that's a good guide worth linking to * Improve logo mobile usage * Improve responsive layout of editors * Use static SVG for the moment (#3) * Use the static logo for the moment * Fix the broken JS, from going static, and make overscroll the right color * Fix padding
2018-02-06 12:52:39 +03:00
logoWrapper.setAttribute("draggable", "true");
logoWrapper.addEventListener("touchstart", handleLogoDrag);
logoWrapper.addEventListener("dragstart", handleLogoDrag);
Revamp landing page (#3718) * Begin landing page revamp * Break the editor integrations onto their own lines * Add template string * Add editor line breaks * Make logo clickable * Add more docs links * Don’t split the editor list items into paragraphs * Break plugin onto its own line * Move the “Why” button to the bottom of the block * Use suggested font * Change font * Change footer color * Add assets from @orta * Fix fonts * Use new editor assets * Add npm/yarn button * Switch to npx * Minor mobile tweaks * Add dependants * Lots of zeros are cooler to look at than a “k” * Improve button sizes, respect prefers-reduced-motion * Fixup media breakpoints for Get Started section * Increase padding of editors * CSS fixes from code review * Prevent repeatedly clicking on the logo from selecting nearby text * dependant -> dependent * Various CSS tightening * Set flex-basis on editors * Add new languages panel * Improve layout of languages * Cleanup grouping code * Fix users layout * Fix language image widths * space-evenly -> space-between * Fix typo * Remove unused var * Various CSS fixes * Set overflow-x: auto on code * Improve languages layout * Add silly cursor * Make logo 'draggable' * [Site] Margins and paddings (#2) * [Site] Margins and paddings * [Site] Bring back the link to why, that's a good guide worth linking to * Improve logo mobile usage * Improve responsive layout of editors * Use static SVG for the moment (#3) * Use the static logo for the moment * Fix the broken JS, from going static, and make overscroll the right color * Fix padding
2018-02-06 12:52:39 +03:00
lastDash.addEventListener("animationend", function(event) {
if (event.animationName.match(/roll/)) {
logo.classList.remove("rolling");
}
});
Revamp landing page (#3718) * Begin landing page revamp * Break the editor integrations onto their own lines * Add template string * Add editor line breaks * Make logo clickable * Add more docs links * Don’t split the editor list items into paragraphs * Break plugin onto its own line * Move the “Why” button to the bottom of the block * Use suggested font * Change font * Change footer color * Add assets from @orta * Fix fonts * Use new editor assets * Add npm/yarn button * Switch to npx * Minor mobile tweaks * Add dependants * Lots of zeros are cooler to look at than a “k” * Improve button sizes, respect prefers-reduced-motion * Fixup media breakpoints for Get Started section * Increase padding of editors * CSS fixes from code review * Prevent repeatedly clicking on the logo from selecting nearby text * dependant -> dependent * Various CSS tightening * Set flex-basis on editors * Add new languages panel * Improve layout of languages * Cleanup grouping code * Fix users layout * Fix language image widths * space-evenly -> space-between * Fix typo * Remove unused var * Various CSS fixes * Set overflow-x: auto on code * Improve languages layout * Add silly cursor * Make logo 'draggable' * [Site] Margins and paddings (#2) * [Site] Margins and paddings * [Site] Bring back the link to why, that's a good guide worth linking to * Improve logo mobile usage * Improve responsive layout of editors * Use static SVG for the moment (#3) * Use the static logo for the moment * Fix the broken JS, from going static, and make overscroll the right color * Fix padding
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");
});
});