👀 Project Access Controls


You may recall that the original Slater had access controls for projects and files. We didn't want just anyone going in there and rewriting our Javascript. However, managing access for teammates became cumbersome (I even added a "god mode" to give myself access to any project or file). Since we generally trusted each other and never had issues, we decided to leave it out of the latest version of Slater.

That said, we understand that some teams work differently, and maintaining control can be important. Workspaces can get cluttered, and access control can help. So, we’ve brought back project access controls, but only if you need them.

Here’s a brief demo of the new functionality and instructions on how to turn it on. This functionality is live so go check it out if you need to control access.

video preview

Community library scripts

👣 Track User
Tracks user navigation and populates a form field with the history.

🥅 Filter Out Selection
Filter array elements matching button text on button click.

👱🏼‍♂️ Wes Pagination
A script for handling pagination by fetching and displaying content from the next or previous page without reloading the page.

Have you added a useful script to your library? Share it with us!

--

Javascript 101: Localstorage

Do you use localstorage? It's a tool that we find ourselves turning to more and more as we work on complex Webflow builds. For example, we used localstorage a lot on ask.edgarallan.com.

Localstorage is simple to leverage. Let's hit the key concepts:

What is localStorage? localStorage is a web storage object that allows you to store data in the browser. Unlike sessionStorage, which is cleared when the session ends (e.g., when the browser is closed), localStorage persists even after the browser is closed.

Basic Methods:

  • localStorage.setItem(key, value): Saves data under a specific key.
  • localStorage.getItem(key): Retrieves the value of a specific key.
  • localStorage.removeItem(key): Removes a specific key-value pair.
  • localStorage.clear(): Clears all data stored in localStorage.

Examples:

1. Storing Data
You can store a string as a value in localStorage:

// Store a string
localStorage.setItem('username', 'JohnDoe');

2. Retrieving Data
To retrieve the stored data:

// Get the stored item
const username = localStorage.getItem('username');
console.log(username);  // Output: 'JohnDoe'

3. Removing Data
You can remove a specific key-value pair:

// Remove 'username' from localStorage
localStorage.removeItem('username');

4. Clearing All Data
If you want to clear all stored data:

// Clear everything in localStorage
localStorage.clear();

To finish, let's show a solution to storing and using a user's theme performance:

// Save the theme preference
localStorage.setItem('theme', 'dark');

// Retrieve and apply the theme
const theme = localStorage.getItem('theme');
if (theme) {
  document.body.classList.add(theme);
}

Do you have any localstorage solutions that you want to share? The Community Library has some localstorage scripts that you may find helpful.

--

Your projects, supported by Slater

Our friend at Renflow Designs built a beautifully smooth site for saltmarshcounselling.ca. Go check it out!

🤙 the Slater Team

If Slater helps you create better websites, please support the team behind it.

Welcome To Slater!

Slater resources, updates and community activity

Read more from Welcome To Slater!

Do you use Slater for CSS? CSS support in Slater has always been somewhat of an afterthought—JavaScript is our love language! But sometimes, you need a simple way to add CSS to your project. Maybe you want to write a complex grid or use a CSS property that Webflow doesn't support. That's why we've decided to make CSS a first-class citizen. We considered launching the new CSS functionality today, but we want to test it a bit more. Expect it early next week. To prepare for the launch, let's...

video

We're going to take a brief break from the regular newsletter format to celebrate the release of ask.edgarallan.com. Today, let's hear from Mason Poe, the Founder of Edgar Allan and Slater. I'm thrilled to announce the launch of ask.edgarallan.com and the start of a new conversation. We can all feel it: the web is changing in ways that seem both dramatic and, in a weird way, imperceptible. At times, it’s hard to know where to start exploring what could be next. Sometimes, when you think...

Our new Edgar Allan website, which we're launching next week 🤫, uses over 3,000 lines of code. It’s a bit unwieldy! To better support the new EA website and similar JavaScript-heavy projects, we’ve added slater_import. This feature allows you to write a function once and then reuse it across all the files in your project. You can see how to use it here. ⬇️ Not ready to watch the video? No problem. To import a file, simply start typing the name of the file you want to import and click on the...