Skip to content

Instantly share code, notes, and snippets.

View alexiglesias93's full-sized avatar

Alex Iglesias alexiglesias93

View GitHub Profile
@alexiglesias93
alexiglesias93 / README.md
Last active June 29, 2022 19:39
FormLogic

Form Logic

Documentation about all Form Logic features.

MultiStepsForm

Handles all the logic for managing a multi step form that is implemented using the native Tabs component from Webflow.

Parameters

@alexiglesias93
alexiglesias93 / embed.html
Last active February 23, 2022 12:36
dynamic-meta-tags
<script>
document.head.insertAdjacentHTML(
'beforeend',
`<meta name="citation_author" content="REPLACE_THIS_WITH_AUTHOR_NAME">`
);
</script>
@alexiglesias93
alexiglesias93 / index.js
Last active January 27, 2022 12:46
fs-cc-consents
// Leer los consents existentes actualmente:
let currentConsents = window.FsCC.store.getConsents();
//Los consents están en el siguiente formato:
/*
currentConsents = {
analytics: false,
essential: true,
marketing: false,
personalization: false,
@alexiglesias93
alexiglesias93 / cmsload-api.js
Last active July 20, 2022 18:41
`cmsload` API
/**
* Interacting with list items in `cmsload`.
*/
window.fsAttributes = window.fsAttributes || [];
window.fsAttributes.push([
'cmsload',
(listInstances) => {
console.log('cmsload Successfully loaded!');
// `listInstances` holds an array with all the CMS Lists using `cmsload` on the page.
@alexiglesias93
alexiglesias93 / cmsfilter-api.js
Last active February 28, 2022 12:41
`cmsfilter` API
/**
* Listening for `renderitems` events on a `cmsfilter` setup.
*/
window.fsAttributes = window.fsAttributes || [];
window.fsAttributes.push([
'cmsfilter',
(filterInstances) => {
console.log('cmsfilter Successfully loaded!');
console.log(filterInstances);
@alexiglesias93
alexiglesias93 / loadMore.ts
Last active July 16, 2021 09:04
Simplified loadMore
/**
* Init
*/
document.addEventListener('DOMContentLoaded', () => loadMore({ collectionSelector: '#blog-posts' }));
/**
* Loads all the paginated items from a collection.
* @param params.collectionSelector The selector of the collection.
* @param params.targetSelector The selector of the target where all items will be appended.
*/
@alexiglesias93
alexiglesias93 / display-publish-date.ts
Last active May 3, 2021 17:53
Display the last published date of a Webflow site in an HTMLElement
/**
* Display the last published date of a Webflow site in an HTMLElement
* @constant targetSelector You should place the selector of the element that will display the publish date.
* If you want to modify the outputted Date format, you can pass an additional options object to the Date.toDateString() method.
*/
document.addEventListener('DOMContentLoaded', () => {
const targetSelector = 'YOUR_ELEMENT_SELECTOR_HERE';
const publishDate = extractPublishDate();
if (!publishDate) return;
@alexiglesias93
alexiglesias93 / cms-nest.ts
Last active October 7, 2021 06:41
CMS Nesting
document.addEventListener('DOMContentLoaded', async () => {
initNesting({
mainCollectionSelector: '#blog-posts',
nestedCollectionsSelectors: ['#categories', '#authors', '#tags'],
});
});
/**
* Init the nesting
* @param mainCollectionSelector The selector of the collection where the children will be nested
@alexiglesias93
alexiglesias93 / restart-webflow.js
Created February 22, 2021 16:06
Restart Webflow
/**
* Restart Webflow JS library
*/
const restartWebflow = () => {
window.Webflow.destroy();
window.Webflow.ready();
window.Webflow.require('ix2')?.init();
};