Skip to content

Code for adding various effects to Squarespace v7.1 and v7.0 sites.

License

Notifications You must be signed in to change notification settings

zahorskywoods/twcsl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

325 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tom's Web Consulting Squarespace Library

This is a monorepo of code for adding various effects to Squarespace v7.1 and v7.0 sites.

Make a Donation

Please consider making a donation.

Your donations help me to continue to help you realize your website goals! The donation amounts are suggested amounts. Any donation amount is greatly appreciated!

Did my code help you build a site for your client and make you some dough? How about a slice of the bread for Tom?

Need Help Installing or Customizing the Code?

I'm available for consulting.

Layout Overview

twcsl contains over 85 effects. Each effect has it's own version number, code, read me, and etc. Each effect is independant. In other words all the effects are not necessarily designed to all work together.

  • v7.0 and v7.1 effects

  • v7.0 only effects

    • effects for all v7.0 templates

    • template specific effects

  • v7.1 only effects

  • twcsl

Effects


The rest of this document covers twcsl.js.

twcsl.js

twcsl.js is a Javascript library of common properties and methods useful for building effects in Squarespace sites.

Version 0.1d15

Quick Install

Add the following to Settings > Advanced > Code Injection > HEADER.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://d1j8mu9lowy9zf.cloudfront.net/twcsl/0.1d15/twcsl.js"></script>

Example

You want to build an effect that does something when you are on a store category product grid page. You can use twcsl to test if you are on such a page with the following.

if ( twcsl.storePage.hasCategory ) console.log ( 'has category' );

Methods

  • getFirstPageSection

    • getFirstPageSection ( )

      • Returns jQuery object.
  • getFormFieldLabel

    • getFormFieldLabel ( field )

      • Field is a jQuery object.
      • Returns form field label as entered in SS form editor interface.
  • getFormNth

    • getFormNth ( [nth form on page] )

      • Default is the first form on the page.
      • Returns jQuery object or undefined for no form.
  • getUrlParser

    • getUrlParser ( url )

      • Returns an anchor element.
  • scrollEffect

    • scrollEffect ( callback [, easingFunction, invertScale ] )

      • Calculates the scroll postion as a ratio that is passed to your callback.

        easingFunction ( string ), default is linear

        invertScale ( boolean ), default is false

Properties

  • blogPage ( object )

    • categories ( array, for detail page only )

    • category ( string )

    • categoryUrlSlug ( string )

    • categoryUrlSlugs ( array, for detail page only )

    • hasCategory ( boolean )

    • hasTag ( boolean )

    • isBlogPage ( boolean )

    • isList ( boolean )

    • isPost ( boolean )

    • tag ( string )

    • tags ( array, for detail page only )

    • tagUrlSlug ( string )

    • tagUrlSlugs ( array, for detail page only )

    • urlSlug ( string )

  • eventsPage ( object )

    • categories ( array, for detail page only )

    • category ( string )

    • categoryUrlSlug ( string )

    • categoryUrlSlugs ( array, for detail page only )

    • hasCategory ( boolean )

    • hasTag ( boolean )

    • isEvent ( boolean )

    • isEventPage ( boolean )

    • tag ( string )

    • tags ( array, for detail page only )

    • tagUrlSlug ( string )

    • tagUrlSlugs ( array, for detail page only )

    • urlSlug ( string )

  • is70 ( boolean )

  • is71 ( boolean )

  • isCart ( boolean )

  • isSearch ( boolean )

  • navigator ( object )

    • hasTouchScreen ( boolean )
  • ssVersion ( string )

  • storePage ( object )

    • category ( string )

    • categoryUrlSlug ( string )

    • classTags ( array, for detail page only )

    • hasCategory ( boolean )

    • hasTag ( boolean )

    • isDetail ( boolean )

    • isStorePage ( boolean )

    • tag ( string )

    • tagUrlSlug ( string )

    • urlSlug ( string )

  • version ( string, twcsl version )

Changes

  • 2021-09-03

    • fixed bad blogPage isList check
    • fixes for blogPage for various v7.0 templates
    • bumped version to 0.1d15
  • 2021-08-31

    • added blogPage.isList
    • added effects outline
    • changed eventPage.isDetail to eventsPage.isEvent
    • changed eventPage to eventsPage
    • checked Five and Montauk family template support
    • bumped version to 0.1d14
  • 2021-08-06

    • changed blogPage.isDetail to isPost
    • bumped version to 0.1d13
  • 2021-07-28

    • fix for getFormFieldLabel not being exposed
    • bumped version to 0.1d12
  • 2021-07-25

    • fix for firstPageSection, changed to method getFirstPageSection
    • bumped version to 0.1d11
  • 2021-07-25

    • fix for getUrlParser not defined
    • bumped version to 0.1d10
  • 2021-07-24

    • added getUrlParser method
    • added getFormFieldLabel method
    • checked Avenue template support
    • consolidated nearly identical code into _getClassEventlistFilterText function
    • bumped version to 0.1d9
  • 2021-06-27

    • added firstPageSection
    • added storePage.classCategories
    • added blogPage
    • bumped version to 0.1d8
  • 2021-06-07

    • fix for _urlSlug undefined error on non-collection pages
    • added isCart and isSearch properties
    • bumped version to 0.1d7
  • 2021-06-04

    • reworked what was being labeled as category and tag, in many cases what was being return was not what the user enters in SS but classes or url search parameters as generated by SS
    • fix for is70 check
    • bumped version to 0.1d6
  • 2021-06-02

    • fix storePage.category being erroneously populated
    • bumped version to 0.1d5
  • 2021-06-01

    • added eventPage property
    • bumped version to 0.1d4
  • 2021-05-31

    • fix for library not initializing
    • bumped version to 0.1d3
  • 2021-05-29

    • added tags property for storePage
    • bumped version to 0.1d2
  • 2021-05-26

    • added version property for twcsl
    • filled out the documentation a bit
    • added getFormNth method
    • changed order of parameters for scrollEffect method
    • bumped version to 0.1d1
  • 2021-05-22

    • initial version

About

Code for adding various effects to Squarespace v7.1 and v7.0 sites.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • HTML 86.6%
  • JavaScript 8.0%
  • Less 2.9%
  • CSS 2.5%