Skip to content

~ $ cat work/jinterest.md

Jinterest

A mood board built with vanilla JavaScript.

Full-stack · 2026BCIT course assignment, built on my own.

Source code
OUTCOME
Undo, redo and picks up where you left off, built without a framework
SCOPE
Course project

Built with

  • HTML5
  • CSS3
  • JavaScript
  • localStorage

What it is

Jinterest is a mood board you build in your web browser. You add pictures, make them bigger or smaller, drag them around, and when you come back later the board is exactly as you left it. The page itself calls the board “Mood Jorts”.

I built it without any helper libraries, using only plain HTML, CSS, and JavaScript, to understand how a web page really works underneath.

What it can do

  • Add pictures

    Paste a picture’s web address, or press the seed button to fill the board with random demo images.

  • Look and edit modes

    A card normally shows only its picture. In edit mode it shows buttons to resize, move, and delete it. Only one card can be edited at a time.

  • Resize and reorder

    Make a card bigger or smaller, and move it earlier or later on the board.

  • Pop-out cards

    Lift a card out of the board so it floats, then drag it anywhere.

  • Undo and redo

    Changed your mind? Step backwards and forwards through your changes.

  • Remembers your board

    Everything, including sizes, order, and positions, is saved in your browser, so a refresh changes nothing.

How a request flows

  1. DOM eventsOne delegated handler
  2. Board stateCards, order, positions
  3. HistoryUndo and redo stacks
  4. localStorageRestore on load

How it works

  1. 01

    Before every change, the app takes a snapshot of the whole board for undo.

  2. 02

    It then makes your change, such as resizing a card.

  3. 03

    It redraws the cards on the page.

  4. 04

    It saves the new board in your browser.

  5. 05

    Pressing undo brings back the last snapshot, and keeps the current board so redo can bring it back.

Screenshots

A seeded board

Why

I wanted to understand DOM updates, UI state, and events without a framework doing the work.

What I built

  1. 01

    Built a card system with display and edit modes, where only one card can be edited at a time.

  2. 02

    Used one delegated event handler instead of a listener on every card and button.

  3. 03

    Saved order, size, image URLs, pop-out state, and positions to localStorage, with undo, redo, and keyboard shortcuts.

The code

static/spa.js
// saving a snapshot of the cards before making any changes
function saveHistory() {
  history.push(JSON.stringify(cards));
  // clearing the future since a new action was taken
  future = [];
}

// going back to the previous state
function undo() {
  if (history.length === 0) return;
  // saving current state, to be able to redo it
  future.push(JSON.stringify(cards));
  // restores the last saved state
  cards = JSON.parse(history.pop());
  render();
}

// going forward to a state that was undone
function redo() {
  if (future.length === 0) return;
  history.push(JSON.stringify(cards));
  cards = JSON.parse(future.pop());
  render();
}
How undo and redo work. Before every change the board is saved as a snapshot. Undo brings back the last snapshot, and keeps the current board so redo can bring it back.

Outcome

A framework-free app that restores your exact previous board on refresh.

The trade-off

Snapshots of the whole board for undo instead of recording individual changes. Simple and reliable, but memory grows with every step.

What I learned

Keeping UI and stored state in sync is much easier when every event flows through one handler.

What I'd fix next

Add image uploads, multiple boards, and automated tests for the undo and redo history.