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
/*------------------------ | |
Libraries | |
------------------------*/ | |
const axios = require("axios"); | |
const fs = require("fs"); | |
const FormData = require("form-data"); | |
/*------------------------ | |
Download the file. | |
Good article on how to download a file and send with form data - https://maximorlov.com/send-a-file-with-axios-in-nodejs/ |
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
import gsap from 'gsap'; | |
import { ScrollTrigger } from 'gsap/ScrollTrigger'; | |
function initScrollDirectionIndicator() { | |
// GSAP Plugins | |
gsap.registerPlugin(ScrollTrigger); | |
/*---------------------------- | |
Elements | |
----------------------------*/ |
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
{%- comment -%} | |
Otto Metafield Data | |
--- | |
Reference for integrating Otto into a theme. | |
{%- endcomment -%} | |
{% comment %} | |
Placement Name | |
--- | |
The placement name is the name provided in the app. Given a placement name, you can reference all of it's data in metafields. |
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
{% comment %} | |
Data | |
--- | |
otto_placement_name: Pass this to the snippet. The name is provided in the Otto app. | |
{% endcomment %} | |
{% liquid | |
assign otto_image_metafield = shop.metafields.otto-components[otto_placement_name].value | |
assign otto_image_file = shop.metafields.otto-files[otto_placement_name].value | |
assign otto_mobile_image_file_name = otto_placement_name | append: "-mobile" |
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
<a class="modal-trigger" data-modal="recap-video-modal">Recap Video</a> | |
<div class="modal recap-video-modal"> | |
<div class="modal__transparent-layer modal-close"></div> | |
<div class="modal__content"> | |
<p>Some content to go in the modal.</p> | |
</div> | |
<span class="close-icon modal-close"></span> | |
</div> |
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
export default function getElemCoords(elem) { | |
var box = elem.getBoundingClientRect(); | |
var body = document.body; | |
var docEl = document.documentElement; | |
var scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop; | |
var scrollLeft = window.pageXOffset || docEl.scrollLeft || body.scrollLeft; | |
var clientTop = docEl.clientTop || body.clientTop || 0; |
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
export default function randomIntFromInterval(min, max) { | |
return Math.floor(Math.random() * (max - min + 1) + min) | |
} |
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
const delay = (ms) => new Promise((r) => setTimeout(r, ms)); | |
export default delay; |
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
{% comment %} | |
Template used sitewide for each time a product is displayed. | |
This template handles the product/variant images, showing product information and variants. | |
At the bottom of the html is a script that dynamically show price and updates the selected variant ID. | |
The script for adding the product to the cart is in scripts.js. | |
{% endcomment %} |
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
/*----------------------- | |
Imports | |
-----------------------*/ | |
import fs from "fs"; | |
import csv from "csvtojson"; | |
import path from "path"; | |
import { fileURLToPath } from "url"; | |
import { stringify } from "csv"; | |
/*----------------------- |
NewerOlder