Stories and reel covers
Confirmed1080 by 1920 stories and reel covers with the platform safe areas drawn in.
Primary render. Select it to open full size.
Every render from the champion round








































Showing 40 of 63 renders. The rest are in build/social-story-reel/v/best/renders/.
How to use it, from the piece README
Instagram and TikTok stories and reel covers for Marathon's own accounts. One template file, one fill file, five templates. You pick the photo and type the words. The engine handles the layout, the sizes, and the cuts, and it tells you everything it changed.
The five templates
t in the fill | What it is for | Layout |
|---|---|---|
photo | Just shot. A client shoot, a listing, a flight. Headline, up to three facts, a credit. | Portrait photo: full bleed with the copy on the navy scrim. Landscape photo: photo above, solid navy panel below. The engine decides, not you. |
service | One Marathon service. Up to three service icons, eyebrow, headline, two line sub, and a link sticker slot. | Photo above, solid panel below. |
stat | A client result. One number, what moved, and where the number came from. | Photo above, solid panel below. |
reel-photo | Reel cover with a photo. Eyebrow and a title of up to 44 characters. | Photo full bleed, title on a solid navy plate inside the 1:1 centre crop. |
reel-series | Reel cover for a running series, for example Marketing tips. Series name, episode number, title. | Solid navy, no photo. |
Make one
- Open
stories.json. Copy the entry closest to what you need and give it a new key, for examplephoto-rosehill-oct. - Set
phototo a file inphotos/. These are the real Marathon shoots frombrief/real-photos/. Never use stock, a screenshot, or a gray box. - Type the copy. The limits are below. Going over is safe, but you will lose words, so write to the limit.
- Run
python3 build_stories.pyin this folder. It rebuildsstories.jsso the template opens straight from the disk. - Open
story.html?id=photo-rosehill-oct&check=1in Chrome. Read the copy check on the right. Fix anything it cut that you care about. - Press S, or add
&safe=1, to see the platform UI zones. Nothing you typed may sit in a red zone. The engine already keeps it out, this is so you can see it. - Export at exact size from the repo root:
node build/_shared/render.mjs png "build/social-story-reel/v/best/story.html?id=photo-rosehill-oct" out.png 1080 1920 0 1 - Post it. For a service story, add the Instagram link sticker in the slot above the reply bar and type the
ctatext on the sticker. To preview it first, add&sticker=1. - If the copy check shows a pink "Confirm with Jacob" line, it does not post until Jacob confirms the number.
You can also type any field straight into the URL for a quick one-off, for example story.html?t=photo&photo=photos/mc_rosehill_18.jpg&headline=Rosehill%20Reserve%20from%20the%20air&facts=400%20ft|Altitude;4K|Video.
Limits
They are written once, in LIMITS at the top of story.js. Change them there and nowhere else.
| Field | Most characters | Most lines | Notes |
|---|---|---|---|
| eyebrow | 36 | 1 | Uppercase label. Photo stories write it for you from kind if you leave it out. |
| headline | 64 | 3 | Sentence case, no full stop. |
| sub | 130, service 110 | 3, service 2 | Not shown on photo stories. Put that copy in the caption. |
| facts | 3 facts, 11 and 18 | 1 each | Value and label, for example 1.9 and Acres. Never beds and baths as the default. Land gets acreage and frontage, a showroom gets square feet. |
| stat | 7 | 1 | The number only. It is never cut, a cut number is a wrong number. Too long, it shrinks and the check tells you to shorten it, for example $148K. |
| stat_label | 64 | 3 | What moved, and over what time. |
| cta | 30 | 1 | The link sticker text, a verb first. |
| reel title | 44 | 3 | Reel covers are read at 123px wide on a profile grid. |
| series | 24 | 1 | Series name. |
| ep | 3 digits | 1 | Episodes under 10 get a leading zero. |
When the copy still does not fit, the engine drops the optional line first, then takes the headline to two lines, then drops the third fact. On a photo story it moves everything to the solid panel rather than let the scrim cover the photo.
Long words, street names, and community names
A single word can be wider than the line, for example a street like Pfluegerville-Kleinschmidtsweilerstrassenparkway. The engine never lets it run off the canvas:
- It steps the size down to the field's smallest size.
- It breaks at any hyphen already in the name.
- A piece still wider than the line gets a visible hyphen at a syllable break (Klein-schmidtsweiler-strassenparkway).
- If syllable breaks would cost a line, it breaks the long word wherever the line fills, before it drops any of your words.
- Over the character cap, a name is cut at its hyphen or a space, never mid-word unless there is nothing else to cut at.
Every one of these is listed in the copy check. Last, an edge check measures every line on the finished canvas. Anything still past its box or the 80px side margin is outlined in red on the canvas and listed in red as "Did not fit". Do not post a story with a red line in the check. If the hyphenation reads badly, use the common name ("Kleinschmidt Pkwy") and the check goes quiet. See renders/longword.png and renders/longword-check.png.
Rules the engine enforces for you
- Landscape photos never go full bleed on a photo story. A 4:3 aerial at 9:16 would show 42% of its width, so the photo sits above the panel and shows 80 to 95% of it.
- The logo is always on its navy tab, 48px tall with 21px of padding, on the 250px line for stories. Never on raw photo.
- Every red element is Red Bright on solid navy or on the 82% scrim, never on the photo. That is what keeps it apart from the red boundary lines burned into the lot aerials (
mc_fullres_10to15). - Story UI zones: top 250px, bottom 340px, sides 80px. Reel UI zones: top 240px, bottom 420px, from the token layer. Reel titles stay inside the 1:1 crop, so the 3:4 profile grid, the 4:5 preview, and a square grid all show the whole title. The reel logo tab hangs from the 4:5 crop line at 285px, so no crop ever cuts the mark.
- Every colour, size, and space comes from
../../../tokens/v/best/tokens.css. No colour is typed into this piece.
Focus
Each photo in photos/ has a default focus point in _focus at the top of stories.json. Set focus on an entry, for example "focus": "30% 50%", only if the subject is being cut. The copy check prints how much of the photo is showing.
Files
| File | What it is |
|---|---|
story.html | The one template file. |
story.js | The engine: limits, layout choice, fitting, overlay, copy check. |
story.css | The layouts, tokens only. |
stories.json | The fill file. Edit this. |
stories.js | Generated from stories.json by build_stories.py. |
icons-inline.js | Generated from the icon set by build_icons.py. |
photos/ | Copies of brief/real-photos/. Copied, never hotlinked. |
sheet.html, grid.html, sheet.css | Review sheets and the reel grid preview. Never posted. |
render_all.sh | Re-renders everything in renders/. |
For Jacob to confirm
Every figure in the sample stories is a working number: shoot counts, turnaround times, lot acreage and frontage, and every result stat. Each one is listed in that entry's _confirm and shows in pink in the copy check. Platform UI zones reflect Instagram and TikTok in October 2026.
Files to download and code to copy
- Whole piece, source files31 files, zip, 17.6 MB. Paths inside follow the repo layout, so put tokens.css beside them as the README says.Download
Copy-paste code
sheet.css31 lines, 3.0 KB
/* Contact sheets and the reel grid preview. Review pages only, never posted. Tokens only. */
html, body { margin: 0; background: var(--mc-surface-page); }
body { font-family: var(--mc-font); color: var(--mc-text-primary); -webkit-font-smoothing: antialiased; padding: var(--mc-space-12); }
.eyebrow { margin: 0; font-size: 18px; font-weight: var(--mc-type-eyebrow-weight); letter-spacing: var(--mc-type-eyebrow-tracking); text-transform: uppercase; color: var(--mc-text-label); }
h1 { margin: var(--mc-space-04) 0 0; font-size: 56px; font-weight: var(--mc-type-h1-weight); letter-spacing: var(--mc-type-h1-tracking); line-height: 1.1; color: var(--mc-text-heading); }
.rule { width: var(--mc-border-width-divider-length); height: var(--mc-border-width-bar); background: var(--mc-accent); margin: var(--mc-space-07) 0; }
.lede { margin: 0 0 var(--mc-space-10); max-width: 1500px; font-size: 26px; font-weight: var(--mc-weight-light); line-height: 1.45; color: var(--mc-text-secondary); }
.grid { display: grid; gap: var(--mc-space-10) var(--mc-space-08); align-items: start; }
figure { margin: 0; }
figure img { display: block; width: 100%; height: auto; border: var(--mc-border-width-hairline) solid var(--mc-border-subtle); }
figcaption { margin-top: var(--mc-space-04); font-size: 20px; font-weight: var(--mc-weight-semibold); line-height: 1.35; color: var(--mc-text-secondary); }
figcaption b { display: block; font-weight: var(--mc-weight-bold); color: var(--mc-text-heading); }
.foot { margin-top: var(--mc-space-11); padding-top: var(--mc-space-05); border-top: var(--mc-border-width-hairline) solid var(--mc-border-subtle); display: flex; justify-content: space-between; font-size: 18px; color: var(--mc-text-tertiary); }
/* Reel grid preview. */
.crops { display: flex; gap: var(--mc-space-09); align-items: flex-end; }
.crop { width: 405px; overflow: hidden; background-size: 100% auto; background-position: center; background-repeat: no-repeat; border: var(--mc-border-width-hairline) solid var(--mc-border-strong); }
.crop--916 { height: 720px; }
.crop--34 { height: 540px; }
.crop--45 { height: 506px; }
.crop--11 { height: 405px; }
.phone { margin-top: var(--mc-space-11); display: flex; gap: var(--mc-space-11); align-items: flex-start; }
.screen { width: 375px; flex: none; background: var(--mc-surface-page); border: var(--mc-border-width-strong) solid var(--mc-text-heading); border-radius: var(--mc-radius-lg); padding: var(--mc-space-05) 0; }
.screen p { margin: 0 var(--mc-space-05) var(--mc-space-04); font-size: 14px; font-weight: var(--mc-weight-bold); color: var(--mc-text-heading); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.tile { background-size: 100% auto; background-position: center; background-repeat: no-repeat; }
.tiles--34 .tile { aspect-ratio: 3 / 4; }
.tiles--11 .tile { aspect-ratio: 1 / 1; }
.phone-note { max-width: 560px; font-size: 22px; line-height: 1.5; color: var(--mc-text-secondary); }
.phone-note b { color: var(--mc-text-heading); }
story.css163 lines, 13.6 KB
/* Marathon stories and reel covers, 1080 x 1920. Tokens only, every colour, size, and space comes from tokens.css.
Four layouts, picked by story.js, never by hand.
scrim: portrait photo full bleed, copy on scrim recipe A, logo tab on the 250px line.
panel: photo above, solid navy panel below with a hard edge. Landscape photos and long copy land here.
plate: reel cover, photo full bleed, title on a solid navy plate inside the 1080 x 1080 centre crop.
solid: reel series cover, navy, no photo. */
html, body { margin: 0; padding: 0; background: var(--mc-surface-muted); }
body { font-family: var(--mc-font); color: var(--mc-text-inverse); -webkit-font-smoothing: antialiased; }
p, h1 { margin: 0; padding: 0; }
.stage { display: flex; align-items: flex-start; }
.canvas {
position: relative; overflow: hidden; flex: none;
width: var(--mc-social-story-w); height: var(--mc-social-story-h);
background: var(--mc-surface-inverse);
--safe-t: var(--mc-social-story-safe-top);
--safe-b: var(--mc-social-story-safe-bottom);
--safe-s: var(--mc-social-story-safe-side);
--fade-a: calc(var(--mc-social-story-w) * 0.2); /* scrim recipe A, 20% of width above the type */
--fade-c: calc(var(--mc-social-story-w) * 0.3); /* scrim recipe C, 30% of width down from the top */
--logo-h: 48px; /* story and reel tab, photography direction page 10 */
--logo-pad: 21px; /* the M height, 0.432 of the lockup height */
--sticker-w: calc(var(--mc-social-story-w) - 2 * var(--mc-social-story-safe-side)); --sticker-h: 120px; /* link sticker row, full live width, sticker grows with its text */
/* Centre crops for reel covers, all measured from the canvas centre. */
--crop-1080: calc((var(--mc-social-reel-h) - var(--mc-social-square-h)) / 2);
--crop-1350: calc((var(--mc-social-reel-h) - var(--mc-social-portrait-h)) / 2);
--crop-1440: calc((var(--mc-social-reel-h) - var(--mc-social-reel-grid-crop-h)) / 2);
}
.canvas--reel {
width: var(--mc-social-reel-w); height: var(--mc-social-reel-h);
--safe-t: var(--mc-social-reel-safe-top);
--safe-b: var(--mc-social-reel-safe-bottom);
--safe-s: var(--mc-social-reel-safe-side);
}
/* Photo, always the hero. */
.photo { position: absolute; inset: 0; overflow: hidden; background: var(--mc-surface-inverse-raised); }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.layout--panel { display: flex; flex-direction: column; }
.layout--panel .photo { position: relative; inset: auto; flex: 1 1 auto; min-height: 0; }
/* Scrim recipe C behind the platform UI and the logo tab. */
.fade-top { position: absolute; top: 0; left: 0; right: 0; height: var(--fade-c); z-index: var(--mc-z-raised); background: linear-gradient(to bottom, var(--mc-scrim-photo), var(--mc-scrim-photo-clear)); pointer-events: none; }
/* Logo tab, on the safe line, left aligned to the side margin. */
.tab { position: absolute; top: var(--safe-t); left: var(--safe-s); z-index: var(--mc-z-raised); background: var(--mc-surface-inverse); padding: var(--logo-pad); line-height: 0; }
.tab img { height: var(--logo-h); width: auto; display: block; }
.tab--flat { padding: 0; }
/* Reel covers hang the tab from the 4:5 crop line, so the mark is never cut by any grid crop:
whole in 9:16, 3:4, and 4:5, and fully outside 1:1. */
.canvas--reel .tab { top: var(--crop-1350); }
.canvas--reel .tab--flat { top: calc(var(--crop-1350) + var(--logo-pad)); }
/* Scrim recipe A. One element, copy inside, so longer copy pulls the scrim up with it. */
.scrim {
position: absolute; left: 0; right: 0; bottom: 0; z-index: var(--mc-z-raised);
padding: calc(var(--fade-a) + var(--mc-space-07)) var(--safe-s) var(--safe-b);
background: linear-gradient(to top,
var(--mc-scrim-photo-strong) 0%,
var(--mc-scrim-photo-strong) var(--safe-b),
var(--mc-scrim-photo) calc(100% - var(--fade-a)),
var(--mc-scrim-photo-clear) 100%);
}
/* Solid panel, hard edge against the photo. */
.panel { position: relative; flex: none; background: var(--mc-surface-inverse); padding: var(--mc-space-11) var(--safe-s) var(--safe-b); }
.t--service .panel { padding-bottom: calc(var(--safe-b) + var(--sticker-h) + var(--mc-space-09)); }
.sticker-slot { position: absolute; left: var(--safe-s); bottom: calc(var(--safe-b) + var(--mc-space-05)); width: var(--sticker-w); height: var(--sticker-h); }
/* Reel cover plate, solid navy, held inside the square crop so every grid shows the whole title. */
.plate {
position: absolute; z-index: var(--mc-z-raised);
left: var(--safe-s); right: var(--safe-s); bottom: calc(var(--crop-1080) + var(--mc-space-11));
background: var(--mc-surface-inverse); padding: var(--mc-space-10) var(--mc-space-10) var(--mc-space-11);
}
/* Reel series cover, the type block starts inside the square crop. */
.solid { position: absolute; inset: 0; padding: calc(var(--crop-1080) + var(--mc-space-12)) var(--safe-s) 0; }
.solid-foot { position: absolute; left: var(--safe-s); right: var(--safe-s); bottom: calc(var(--crop-1080) + var(--mc-space-12)); padding-top: var(--mc-space-07); border-top: var(--mc-border-width-hairline) solid var(--mc-border-inverse); }
/* Copy. Sizes are starting points, story.js steps them down inside the LIMITS range. */
.bar { width: 88px; height: 10px; background: var(--mc-accent-on-inverse); margin-bottom: var(--mc-space-07); }
.eyebrow {
font-size: 28px; font-weight: var(--mc-type-eyebrow-weight); letter-spacing: var(--mc-type-eyebrow-tracking);
text-transform: var(--mc-type-eyebrow-case); line-height: var(--mc-type-eyebrow-leading);
color: var(--mc-text-inverse); white-space: nowrap; overflow: hidden;
}
.headline {
margin-top: var(--mc-space-05); font-size: 88px; font-weight: var(--mc-type-h1-weight);
line-height: 1.04; letter-spacing: var(--mc-type-h1-tracking); color: var(--mc-text-inverse); text-wrap: balance;
}
.reel-title { margin-top: var(--mc-space-06); font-size: 118px; line-height: 1.0; letter-spacing: var(--mc-type-cover-tracking); }
.sub { margin-top: var(--mc-space-07); font-size: 34px; font-weight: var(--mc-weight-regular); line-height: 1.4; color: var(--mc-text-inverse-secondary); text-wrap: pretty; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: var(--mc-space-09); padding-top: var(--mc-space-07); border-top: var(--mc-border-width-hairline) solid var(--mc-border-inverse); }
.facts--1 { grid-template-columns: minmax(0, 1fr); }
.facts--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fact { min-width: 0; padding: 0 var(--mc-space-07); border-left: var(--mc-border-width-hairline) solid var(--mc-border-inverse); }
.fact:first-child { padding-left: 0; border-left: 0; }
.fact-v { font-size: 60px; font-weight: var(--mc-weight-extrabold); line-height: 1.05; letter-spacing: var(--mc-type-stat-tracking); font-variant-numeric: var(--mc-numeric-tabular); white-space: nowrap; overflow: hidden; }
.fact-l { margin-top: var(--mc-space-03); font-size: 22px; font-weight: var(--mc-weight-bold); letter-spacing: 0.14em; text-transform: uppercase; line-height: 1.2; color: var(--mc-text-inverse-secondary); white-space: nowrap; overflow: hidden; }
.icons { display: flex; gap: var(--mc-space-10); margin-bottom: var(--mc-space-09); }
.icon-cell { display: flex; align-items: center; gap: var(--mc-space-04); }
.icon-cell .mc-icon { --mc-icon-display-size: 56px; color: var(--mc-text-inverse); }
.icon-l { font-size: 22px; font-weight: var(--mc-weight-bold); letter-spacing: 0.14em; text-transform: uppercase; color: var(--mc-text-inverse-secondary); white-space: nowrap; }
.stat { margin-top: var(--mc-space-04); font-size: 300px; font-weight: var(--mc-weight-extrabold); line-height: 0.92; letter-spacing: -0.035em; font-variant-numeric: var(--mc-numeric-tabular); color: var(--mc-text-inverse); white-space: nowrap; overflow: hidden; margin-left: -0.04em; }
.stat-label { margin-top: var(--mc-space-06); font-size: 54px; font-weight: var(--mc-weight-bold); line-height: 1.16; letter-spacing: var(--mc-type-h2-tracking); color: var(--mc-text-inverse); text-wrap: balance; }
.ep { margin-top: var(--mc-space-05); font-size: 380px; font-weight: var(--mc-weight-extrabold); line-height: 0.86; letter-spacing: -0.04em; font-variant-numeric: var(--mc-numeric-tabular); color: var(--mc-text-inverse); white-space: nowrap; overflow: hidden; margin-left: -0.05em; }
.t--reel-series .reel-title { margin-top: var(--mc-space-08); font-size: 96px; line-height: 1.04; }
.t--reel-series .url { color: var(--mc-text-inverse-secondary); }
.foot { display: flex; align-items: center; justify-content: space-between; gap: var(--mc-space-08); margin-top: var(--mc-space-09); padding-top: var(--mc-space-07); border-top: var(--mc-border-width-hairline) solid var(--mc-border-inverse); }
.credit { flex: 1 1 auto; min-width: 0; font-size: 26px; font-weight: var(--mc-weight-semibold); color: var(--mc-text-inverse-secondary); white-space: nowrap; overflow: hidden; }
.url { flex: none; font-size: 26px; font-weight: var(--mc-weight-bold); letter-spacing: 0.02em; color: var(--mc-text-inverse); white-space: nowrap; }
/* No photo. Loud on purpose, a photo story never ships without one. */
.photo--missing::after { content: "Add a photo from photos/"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 36px; font-weight: var(--mc-weight-bold); color: var(--mc-text-inverse-secondary); }
/* Safe area overlay, ?safe=1 or press S. Never in a posted file. */
.guides { position: absolute; inset: 0; z-index: var(--mc-z-overlay); pointer-events: none; }
.g-zone { position: absolute; left: 0; right: 0; display: flex; padding: var(--mc-space-05) var(--safe-s);
background: repeating-linear-gradient(135deg, rgb(var(--mc-red-100-rgb) / 0.62) 0 18px, rgb(var(--mc-red-100-rgb) / 0.34) 18px 36px); }
.g-top { top: 0; height: var(--safe-t); box-sizing: border-box; align-items: flex-end; border-bottom: var(--mc-border-width-bar) solid var(--mc-text-inverse); }
.g-bot { bottom: 0; height: var(--safe-b); box-sizing: border-box; align-items: flex-start; border-top: var(--mc-border-width-bar) solid var(--mc-text-inverse); }
.g-side { position: absolute; top: var(--safe-t); bottom: var(--safe-b); width: 0; border-left: var(--mc-border-width-strong) dashed var(--mc-text-inverse); }
.g-side--l { left: var(--safe-s); }
.g-side--r { right: var(--safe-s); }
.g-tag { display: inline-block; padding: var(--mc-space-03) var(--mc-space-04); background: var(--mc-surface-inverse); color: var(--mc-text-inverse);
font-size: 22px; font-weight: var(--mc-weight-bold); letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.2; white-space: nowrap; }
.g-crop { position: absolute; left: 0; right: 0; box-sizing: border-box; border: 6px dashed var(--mc-text-inverse); }
.g-crop--1440 { top: var(--crop-1440); bottom: var(--crop-1440); border-style: dotted; }
.g-crop--1350 { top: var(--crop-1350); bottom: var(--crop-1350); border-left: 0; border-right: 0; }
.g-crop--1080 { top: var(--crop-1080); bottom: var(--crop-1080); border-color: var(--mc-accent-on-inverse); }
.g-tag--crop { position: absolute; right: var(--mc-space-05); top: var(--mc-space-03); font-size: 20px; }
.g-crop--1350 .g-tag--crop { right: auto; left: var(--mc-space-05); top: var(--mc-space-03); }
.g-crop--1080 .g-tag--crop { background: var(--mc-accent-on-inverse); top: auto; bottom: var(--mc-space-03); }
.has-guides .sticker-slot { border: 4px dashed var(--mc-text-inverse); box-sizing: border-box; display: grid; place-items: center; }
.g-tag--slot { font-size: 18px; background: transparent; }
.sticker-mock { position: absolute; left: 0; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; gap: var(--mc-space-04);
max-width: 100%; box-sizing: border-box; overflow: hidden; padding: var(--mc-space-06) var(--mc-space-08); border-radius: var(--mc-radius-lg);
background: var(--mc-action-inverse); color: var(--mc-action-inverse-text); font-size: 30px; font-weight: var(--mc-weight-bold);
letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; box-shadow: var(--mc-shadow-3); }
.sticker-mock .mc-icon { --mc-icon-display-size: 32px; }
/* Copy check panel, ?check=1. Sits beside the canvas, never on it. */
.report { width: 400px; box-sizing: border-box; padding: var(--mc-space-08); color: var(--mc-text-primary); font-size: 18px; line-height: var(--mc-type-small-leading); }
.report h2 { margin: 0 0 var(--mc-space-05); font-size: 28px; font-weight: var(--mc-type-h3-weight); color: var(--mc-text-heading); }
.report p { margin: 0 0 var(--mc-space-03); padding: var(--mc-space-03) var(--mc-space-04); background: var(--mc-surface-raised); border-left: var(--mc-border-width-bar) solid var(--mc-border-strong); }
.report .warn { border-left-color: var(--mc-status-warning); }
.report .confirm { border-left-color: var(--mc-border-accent); background: var(--mc-surface-highlight); }
.report .ok { border-left-color: var(--mc-status-success); }
.report .share { border-left-color: var(--mc-border-focus); font-weight: var(--mc-weight-semibold); }
/* Copy check only. Type that still runs past its space after every fitting step is outlined on the
canvas and listed in red in the check. Never shown in an exported file without &check=1. */
.checking .is-overflow { outline: 6px dashed var(--mc-status-error); outline-offset: 4px; }
.report .fail { border-left-color: var(--mc-status-error); background: var(--mc-status-error-surface); font-weight: var(--mc-weight-semibold); }
grid.html41 lines, 2.7 KB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Marathon reel cover, grid crop preview</title>
<link rel="stylesheet" href="../../../tokens/v/best/tokens.css">
<link rel="stylesheet" href="sheet.css">
</head>
<body>
<!-- Reel cover grid preview. ?cover=renders/templates/reel-interior.png&tiles=a.png;b.png;... (six tiles) -->
<p class="eyebrow">Reel covers, grid crop</p>
<h1>One cover, four places it gets cut</h1>
<div class="rule"></div>
<p class="lede">The cover is posted at 1080 x 1920. Instagram and TikTok crop it to 3:4 on the profile grid, the feed preview crops to 4:5, and square grids crop to 1:1. The title plate sits inside the 1:1 crop, so every one of these shows the whole title. The logo tab hangs from the 4:5 crop line, 285px down, so it is whole in the full cover, the 3:4 grid, and the 4:5 preview, and it is never cut. In the 1:1 crop it drops out cleanly.</p>
<div class="crops" id="crops"></div>
<div class="phone">
<div class="screen"><p>Profile grid, 3:4, actual phone size</p><div class="tiles tiles--34" id="t34"></div></div>
<div class="screen"><p>Square grid, 1:1, actual phone size</p><div class="tiles tiles--11" id="t11"></div></div>
<div class="phone-note"><b>Read it at this size before posting.</b> Each tile is 123px wide on a phone, one ninth of the cover's width. Titles are capped at 44 characters and three lines so they still read here. Series covers and photo covers alternate, so the grid reads as Marathon from across the room.</div>
</div>
<div class="foot"><span>Marathon Creative, stories and reel covers v1.0</span><span>Crops measured from the canvas centre</span></div>
<script>
(function () {
var q = new URLSearchParams(location.search), cover = q.get('cover');
var crops = document.getElementById('crops');
[['crop--916', '9:16, full cover, 1080 x 1920'], ['crop--34', '3:4, profile grid, 1080 x 1440'], ['crop--45', '4:5, feed preview, 1080 x 1350'], ['crop--11', '1:1, square grid, 1080 x 1080']].forEach(function (c) {
var f = document.createElement('figure'), d = document.createElement('div'), cap = document.createElement('figcaption'), b = document.createElement('b');
d.className = 'crop ' + c[0]; d.style.backgroundImage = 'url(' + cover + ')';
b.textContent = c[1]; cap.appendChild(b); f.appendChild(d); f.appendChild(cap); crops.appendChild(f);
});
['t34', 't11'].forEach(function (id) {
var box = document.getElementById(id);
(q.get('tiles') || '').split(';').filter(Boolean).forEach(function (src) {
var t = document.createElement('div'); t.className = 'tile'; t.style.backgroundImage = 'url(' + src + ')'; box.appendChild(t);
});
});
})();
</script>
</body>
</html>
sheet.html34 lines, 1.5 KB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Marathon stories and reel covers, contact sheet</title>
<link rel="stylesheet" href="../../../tokens/v/best/tokens.css">
<link rel="stylesheet" href="sheet.css">
</head>
<body>
<!-- Review sheet. ?title=..&eyebrow=..&lede=..&cols=5&imgs=renders/a.png|Label|Note;renders/b.png|Label|Note -->
<p class="eyebrow" id="eb"></p>
<h1 id="ti"></h1>
<div class="rule"></div>
<p class="lede" id="le"></p>
<div class="grid" id="g"></div>
<div class="foot"><span>Marathon Creative, stories and reel covers v1.0</span><span>1080 x 1920, rendered at exact size</span></div>
<script>
(function () {
var q = new URLSearchParams(location.search);
document.getElementById('eb').textContent = q.get('eyebrow') || 'Stories and reel covers';
document.getElementById('ti').textContent = q.get('title') || '';
document.getElementById('le').textContent = q.get('lede') || '';
var g = document.getElementById('g');
g.style.gridTemplateColumns = 'repeat(' + (q.get('cols') || 5) + ', minmax(0, 1fr))';
(q.get('imgs') || '').split(';').filter(Boolean).forEach(function (s) {
var a = s.split('|'), f = document.createElement('figure'), i = document.createElement('img'), c = document.createElement('figcaption'), b = document.createElement('b');
i.src = a[0]; i.alt = a[1] || ''; b.textContent = a[1] || ''; c.appendChild(b); c.appendChild(document.createTextNode(a[2] || ''));
f.appendChild(i); f.appendChild(c); g.appendChild(f);
});
})();
</script>
</body>
</html>
story.html24 lines, 895 bytes
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=1080">
<title>Marathon story and reel cover, 1080 x 1920</title>
<link rel="stylesheet" href="../../../tokens/v/best/tokens.css">
<link rel="stylesheet" href="../../../icons/v/best/icons.css">
<link rel="stylesheet" href="story.css">
</head>
<body>
<!-- One template file for every story and reel cover. Pick one with ?id=<key in stories.json>.
Add &safe=1 (or press S) for the safe area overlay, &check=1 for the copy check beside the canvas.
Any field can be typed in the URL, for example &photo=photos/mc_rosehill_18.jpg&headline=... -->
<div class="stage">
<div id="canvas" class="canvas"></div>
<aside id="report" class="report" hidden></aside>
</div>
<script src="icons-inline.js"></script>
<script src="stories.js"></script>
<script src="story.js"></script>
</body>
</html>
icons-inline.js40 lines, 3.5 KB
/* GENERATED by build_icons.py from ../../../icons/v/best/svg. Do not edit by hand. */
window.MC_ICONS = {
"photography": "<path d=\"M3 9a2 2 0 0 1 2-2h3l1.5-3h5L16 7h3a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\"/><circle cx=\"12\" cy=\"13.5\" r=\"3.5\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M17.5 10.5h1\"/>",
"video": "<rect x=\"2\" y=\"6\" width=\"13\" height=\"12\" rx=\"2\"/><path d=\"M15 10l6-3v10l-6-3\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M5.5 9.5h2\"/>",
"drone": "<path d=\"M2 6h7M15 6h7\"/><path d=\"M5.5 6v3h13V6\"/><path d=\"M8.5 9v3a2 2 0 0 0 2 2h3a2 2 0 0 0 2-2V9\"/><circle cx=\"12\" cy=\"19\" r=\"2\"/>",
"tour-3d": "<path d=\"M12 3l8.5 4.5v9.5L12 21.5 3.5 17V7.5z\"/><path d=\"M3.5 7.5L12 12l8.5-4.5M12 12v9.5\"/>",
"floorplan": "<rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><path d=\"M3 12h5M12 12h9M12 3v5M12 12v9\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M8 12a4 4 0 0 1 4-4\"/>",
"headshots": "<path d=\"M3 8V3h5M16 3h5v5M21 16v5h-5M8 21H3v-5\"/><circle cx=\"12\" cy=\"10\" r=\"3\"/><path d=\"M7 18a5 4 0 0 1 10 0\"/>",
"strategy": "<circle cx=\"5.5\" cy=\"18\" r=\"2.5\"/><path d=\"M8 18h7a3 3 0 0 0 0-6H9a3 3 0 0 1 0-6h7\"/><circle cx=\"18.5\" cy=\"6\" r=\"2.5\"/>",
"social": "<path d=\"M6 3h12a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-7l-5 4.5V16a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M12 12.5L9.2 9.8a1.75 1.75 0 0 1 2.8-2.1 1.75 1.75 0 0 1 2.8 2.1z\"/>",
"paid-ads": "<path d=\"M3 9h5l9-5v16l-9-5H3z\"/><path d=\"M7 15l1.5 5.5h3L10 15.5\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M20.5 9.5v5\"/>",
"email-sms": "<path d=\"M12 15H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h13a2 2 0 0 1 2 2v2\"/><path d=\"M2.8 4.2L10.5 10l7.7-5.8\"/><rect x=\"14\" y=\"9\" width=\"7\" height=\"12\" rx=\"2\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M17 18h1\"/>",
"crm": "<rect x=\"3\" y=\"3\" width=\"6\" height=\"6\" rx=\"1\"/><circle cx=\"18\" cy=\"6\" r=\"3\"/><rect x=\"15\" y=\"15\" width=\"6\" height=\"6\" rx=\"1\"/><path d=\"M9 6h6M18 9v6M6 9v9h9\"/>",
"branding": "<path d=\"M12 4l6.5 7L15 18H9l-3.5-7z\"/><path d=\"M12 4v8\"/><circle cx=\"12\" cy=\"13.5\" r=\"1.5\"/><path d=\"M8.5 21h7\"/>",
"web": "<rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\"/><path d=\"M3 9h18\"/><path d=\"M10 12.5l-2.5 2.5 2.5 2.5M14 12.5l2.5 2.5-2.5 2.5\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M6 6.5h1M8.5 6.5h1\"/>",
"print-signage": "<path d=\"M4 3v18M2 21h5M4 5h16\"/><path d=\"M8 5v3M16 5v3\"/><rect x=\"6\" y=\"8\" width=\"12\" height=\"8\" rx=\"2\"/><path style=\"display:var(--mc-icon-detail,inline)\" d=\"M9 12h6\"/>",
"arrow-right": "<path d=\"M4 12h15M13 5l7 7-7 7\"/>",
"external-link": "<path d=\"M19 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h6\"/><path d=\"M14 3h7v7M21 3L11 13\"/>",
"check": "<path d=\"M4 12.5l5.5 5.5L20 6.5\"/>"
};
window.MC_ICON_LABELS = {
"photography": "Photography",
"video": "Videography and post",
"drone": "Drone and aerial",
"tour-3d": "3D tours",
"floorplan": "Floorplans",
"headshots": "Headshots",
"strategy": "Marketing strategy",
"social": "Social management",
"paid-ads": "Paid advertising",
"email-sms": "Email and SMS",
"crm": "CRM and automation",
"branding": "Branding and design",
"web": "Web",
"print-signage": "Print and signage",
"check": "Done",
"arrow-right": "Next",
"external-link": "Opens in new tab"
};
stories.js369 lines, 10.3 KB
/* GENERATED by build_stories.py from stories.json. Do not edit by hand. */
window.MC_STORIES = {
"_readme": "One entry per story or cover. t picks the template: photo, service, stat, reel-photo, reel-series. Anything here can be overridden in the URL. Every number in _confirm is a working figure for Jacob to confirm before it posts.",
"_focus": {
"mc_fullres_10.jpg": "50% 50%",
"mc_fullres_11.jpg": "48% 55%",
"mc_fullres_12.jpg": "42% 48%",
"mc_fullres_13.jpg": "50% 50%",
"mc_fullres_14.jpg": "50% 50%",
"mc_fullres_15.jpg": "50% 50%",
"mc_retouched_01.jpg": "50% 40%",
"mc_retouched_02.jpg": "50% 50%",
"mc_retouched_03.jpg": "38% 55%",
"mc_retouched_04.jpg": "50% 50%",
"mc_retouched_05.jpg": "36% 55%",
"mc_retouched_06.jpg": "50% 50%",
"mc_retouched_07.jpg": "50% 45%",
"mc_retouched_08.jpg": "45% 40%",
"mc_retouched_09.jpg": "55% 40%",
"mc_rosehill_16.jpg": "42% 55%",
"mc_rosehill_17.jpg": "40% 60%",
"mc_rosehill_18.jpg": "50% 60%"
},
"photo-interior": {
"t": "photo",
"photo": "photos/mc_retouched_05.jpg",
"kind": "commercial",
"headline": "Cangelosi's Houston showroom, shot for the new site",
"facts": [
{
"v": "64",
"l": "Edited photos"
},
{
"v": "1 day",
"l": "On site"
},
{
"v": "48 hr",
"l": "Turnaround"
}
],
"credit": "Shot for Cangelosi, Houston",
"_confirm": [
"64 edited photos and 48 hour turnaround for the Cangelosi shoot"
]
},
"photo-aerial": {
"t": "photo",
"photo": "photos/mc_rosehill_16.jpg",
"kind": "community",
"headline": "Rosehill Reserve from 400 ft, the whole plan in one frame",
"facts": [
{
"v": "400 ft",
"l": "Altitude"
},
{
"v": "38",
"l": "Aerial stills"
},
{
"v": "4K",
"l": "Drone video"
}
],
"credit": "Flown for Rosehill Reserve",
"_confirm": [
"38 aerial stills delivered to Rosehill Reserve"
]
},
"photo-portrait": {
"t": "photo",
"photo": "photos/mc_retouched_08.jpg",
"kind": "product",
"headline": "Every slab on the wall, lit so the veining reads",
"facts": [
{
"v": "120",
"l": "Slab close-ups"
},
{
"v": "3 hr",
"l": "On site"
}
],
"credit": "Shot for Cangelosi, Houston",
"_confirm": [
"120 slab close-ups in a 3 hour session"
]
},
"photo-boundary": {
"t": "photo",
"photo": "photos/mc_fullres_12.jpg",
"kind": "land",
"headline": "Wooded lot on the golf course, boundary drawn on every frame",
"facts": [
{
"v": "1.9",
"l": "Acres"
},
{
"v": "240 ft",
"l": "Road frontage"
},
{
"v": "22",
"l": "Aerial stills"
}
],
"credit": "Drone and boundary overlay by Marathon",
"_confirm": [
"1.9 acres and 240 ft of frontage, from the listing broker"
]
},
"service-interior": {
"t": "service",
"photo": "photos/mc_retouched_05.jpg",
"icons": [
"photography",
"video",
"web"
],
"eyebrow": "Commercial photography",
"headline": "Your showroom, shot to sell what is on the wall",
"sub": "Interiors, product detail, and team portraits in one shoot day. Edited in house, delivered in 48 hours.",
"cta": "Book a shoot, link below",
"_confirm": [
"48 hour delivery on commercial shoots"
]
},
"service-aerial": {
"t": "service",
"photo": "photos/mc_rosehill_16.jpg",
"icons": [
"drone",
"video",
"tour-3d"
],
"eyebrow": "Drone and aerial",
"headline": "Show buyers the whole community, not one roofline",
"sub": "Licensed drone pilots, stills and 4K video, and a lot line drawn on every frame that needs one.",
"cta": "See drone packages"
},
"service-portrait": {
"t": "service",
"photo": "photos/mc_retouched_08.jpg",
"icons": [
"photography",
"social",
"paid-ads"
],
"eyebrow": "Product photography",
"headline": "Close-ups that make a slab look like the real thing",
"sub": "Lit for veining and colour, cropped for your site, your feed, and your ads.",
"cta": "Book a product day"
},
"service-boundary": {
"t": "service",
"photo": "photos/mc_fullres_12.jpg",
"icons": [
"drone",
"print-signage",
"web"
],
"eyebrow": "Land listings",
"headline": "Lot lines buyers can see before they drive out",
"sub": "We fly it, draw the boundary, and put the same frame on the sign, the flyer, and the listing.",
"cta": "Get a land quote"
},
"stat-interior": {
"t": "stat",
"photo": "photos/mc_retouched_05.jpg",
"eyebrow": "Result, Cangelosi",
"stat": "41%",
"stat_label": "more showroom visit requests in 60 days",
"sub": "New photo set on their site and Google profile, Aug 1 to Sep 30.",
"_confirm": [
"41% lift in showroom visit requests, Aug 1 to Sep 30"
]
},
"stat-aerial": {
"t": "stat",
"photo": "photos/mc_rosehill_16.jpg",
"eyebrow": "Result, Rosehill Reserve",
"stat": "3.1x",
"stat_label": "more lot tour bookings after the aerial reel",
"sub": "Reel plus paid ads, 30 days against the 30 days before.",
"_confirm": [
"3.1x lot tour bookings, 30 day comparison"
]
},
"stat-portrait": {
"t": "stat",
"photo": "photos/mc_retouched_08.jpg",
"eyebrow": "Result, Cangelosi",
"stat": "12.4K",
"stat_label": "accounts reached by one slab carousel in seven days",
"sub": "Organic Instagram, no paid boost.",
"_confirm": [
"12.4K accounts reached, Instagram insights"
]
},
"stat-boundary": {
"t": "stat",
"photo": "photos/mc_fullres_12.jpg",
"eyebrow": "Result, land listing",
"stat": "19",
"stat_label": "days to contract on a 1.9 acre wooded lot",
"sub": "Drone set with the boundary drawn, plus a yard sign we printed.",
"_confirm": [
"19 days to contract, from the listing broker"
]
},
"reel-interior": {
"t": "reel-photo",
"photo": "photos/mc_retouched_05.jpg",
"eyebrow": "Behind the shoot",
"headline": "How we light a stone showroom"
},
"reel-aerial": {
"t": "reel-photo",
"photo": "photos/mc_rosehill_16.jpg",
"eyebrow": "Drone, start to finish",
"headline": "One flight, a whole community"
},
"reel-portrait": {
"t": "reel-photo",
"photo": "photos/mc_retouched_08.jpg",
"eyebrow": "Product photography",
"headline": "Shooting slabs so the veining reads"
},
"reel-boundary": {
"t": "reel-photo",
"photo": "photos/mc_fullres_12.jpg",
"eyebrow": "Land listings",
"headline": "Drawing a lot line buyers trust"
},
"series-04": {
"t": "reel-series",
"series": "Marketing tips",
"ep": "4",
"headline": "Post the listing in the first 48 hours"
},
"series-12": {
"t": "reel-series",
"series": "Marketing tips",
"ep": "12",
"headline": "Why your yard sign needs a QR code"
},
"stress-photo": {
"t": "photo",
"photo": "photos/mc_retouched_04.jpg",
"kind": "commercial",
"eyebrow": "Just shot for our friends over at the Cangelosi showroom in Houston",
"headline": "We spent the whole day inside the Cangelosi showroom shooting every single slab, every display tower, and the full team portrait for their brand new website launch",
"sub": "This is a sub line that nobody asked for on a photo story, and it keeps going for a while to see what happens.",
"facts": [
{
"v": "8,400 sq ft",
"l": "Showroom floor space total"
},
{
"v": "64",
"l": "Edited photos"
},
{
"v": "1 day",
"l": "On site"
},
{
"v": "48 hr",
"l": "Turnaround"
},
{
"v": "3",
"l": "Videos"
}
],
"credit": "Shot for Cangelosi, Houston, with thanks to the whole showroom team"
},
"stress-service": {
"t": "service",
"photo": "photos/mc_rosehill_17.jpg",
"icons": [
"drone",
"video",
"tour-3d",
"photography",
"web"
],
"eyebrow": "Drone, aerial, video, and 3D tours for communities and builders",
"headline": "Show buyers the entire master-planned community, the retail, the entry monument, and every amenity, not just one roofline",
"sub": "Licensed drone pilots, stills, 4K video, 3D tours, floor plans, and a lot line drawn on every single frame that needs one, all edited in house by our own team in Houston and delivered fast.",
"cta": "Tap the link below to book your drone package today"
},
"stress-stat": {
"t": "stat",
"photo": "photos/mc_fullres_12.jpg",
"eyebrow": "Result for a land broker in north Houston",
"stat": "$147,800",
"stat_label": "in closed land sales across three wooded lots on the golf course in a single quarter of this year",
"sub": "Drone set with the boundary drawn on every frame, plus yard signs and a postcard drop we printed in house."
},
"stress-reel": {
"t": "reel-photo",
"photo": "photos/mc_rosehill_16.jpg",
"eyebrow": "Drone, start to finish, at Rosehill Reserve",
"headline": "One flight, a whole master-planned community, and how we plan every pass before takeoff"
},
"stress-series": {
"t": "reel-series",
"series": "Marketing tips for real estate agents",
"ep": "104",
"headline": "Why your yard sign needs a QR code, a short URL, and a phone number that a human answers"
},
"longword-photo": {
"t": "photo",
"photo": "photos/mc_rosehill_18.jpg",
"kind": "community",
"headline": "New entry on Pfluegerville-Kleinschmidtsweilerstrassenparkway",
"facts": [
{
"v": "18",
"l": "Entry stills"
},
{
"v": "4K",
"l": "Drone video"
}
],
"credit": "Shot for Rosehill Reserve",
"_confirm": [
"18 entry stills delivered to Rosehill Reserve"
]
},
"longword-reel": {
"t": "reel-photo",
"photo": "photos/mc_rosehill_16.jpg",
"eyebrow": "Drone, start to finish",
"headline": "Flying Kleinschmidtsweilerstrassenparkway"
},
"longword-reel-cap": {
"t": "reel-photo",
"photo": "photos/mc_rosehill_16.jpg",
"eyebrow": "Drone, start to finish",
"headline": "Pfluegerville-Kleinschmidtsweilerstrassenparkway"
},
"longword-series": {
"t": "reel-series",
"series": "Marketing tips",
"ep": "9",
"headline": "Signs on Kleinschmidtsweilerstrassenparkway"
},
"longword-service": {
"t": "service",
"photo": "photos/mc_retouched_05.jpg",
"icons": [
"photography",
"video",
"web"
],
"eyebrow": "Commercial photography",
"headline": "Showroom shoots on Kleinschmidtsweilerstrassenparkway",
"sub": "Stills, video, and a site gallery from one shoot day, edited in house in Houston.",
"cta": "Book a shoot"
}
};
story.js485 lines, 27.7 KB
/* Marathon story and reel cover engine, 1080 x 1920. Builds one canvas from stories.json (or stories.js on
file://) plus URL params, picks the layout from the photo itself, then enforces the copy limits so
overlong copy cannot break the layout. Same fill mechanism and limit rules as the feed post engine.
LIMITS is the only place a limit is written. */
(function () {
'use strict';
/* chars: hard cap, cut at a word with an ellipsis. lines: most lines the field may take.
max and min: font size range in px. The engine steps down from max until the copy fits,
then clamps by whole words if it still does not. */
var LIMITS = {
eyebrow: { chars: 36, lines: 1, max: 28, min: 22, note: 'Uppercase label above the headline' },
headline: { chars: 64, lines: 3, max: 88, min: 66, note: 'Sentence case, no full stop' },
sub: { chars: 130, lines: 3, max: 34, min: 29, note: 'One or two plain sentences' },
credit: { chars: 44, lines: 1, max: 26, min: 22, note: 'Who it was shot for, or where' },
url: { chars: 28, lines: 1, max: 26, min: 22, note: 'marathoncreative.co unless Jacob says otherwise' },
factValue: { chars: 11, lines: 1, max: 60, min: 40, note: 'Number plus unit, for example 1.9 or 240 ft' },
factLabel: { chars: 18, lines: 1, max: 22, min: 18, note: 'What the number is, for example Acres' },
stat: { chars: 7, lines: 1, max: 300, min: 150, note: 'The number only, for example 41% or 3.1x. Never cut, only shrunk' },
stat_label: { chars: 64, lines: 3, max: 54, min: 44, note: 'What moved, and over what time' },
serviceSub: { chars: 110, lines: 2, max: 32, min: 28, note: 'Service story sub, two lines' },
cta: { chars: 30, lines: 1, max: 32, min: 26, note: 'Text for the link sticker, a verb first, for example Book a shoot' },
reelTitle: { chars: 44, lines: 3, max: 118, min: 92, note: 'Reel cover title, read at grid size' },
series: { chars: 24, lines: 1, max: 30, min: 24, note: 'Series name, for example Marketing tips' },
ep: { chars: 3, lines: 1, max: 380, min: 250, note: 'Episode number, 1 to 999, shown with a leading zero under 10' }
};
var COUNTS = { facts: 3, icons: 3 };
/* Share of the canvas the copy may take, per layout. Past it the engine drops optional copy,
then shortens the headline, then (photo story only) moves the copy to the solid panel. */
var BUDGET = { scrim: 0.36, panel: 0.56, 'panel-service': 0.61, plate: 0.33 };
/* Photo layout rule. Wider than this (width / height) and a full bleed 9:16 crop would throw away
more than half the photo, so the photo story goes to the panel layout on its own. */
var SCRIM_MAX_ASPECT = 0.8;
var WORDS_MAX_SCRIM = 40;
var TEMPLATES = { photo: 'story', service: 'story', stat: 'story', 'reel-photo': 'reel', 'reel-series': 'reel' };
var DEFAULT_EYEBROW = { photo: 'Just shot', service: 'New from Marathon', stat: 'Result', 'reel-photo': 'Marathon Creative' };
var KIND_LABEL = { residential: 'residential', land: 'land listing', commercial: 'commercial', industrial: 'industrial', community: 'community', product: 'product detail' };
var ICON_SHORT = { photography: 'Photo', video: 'Video', drone: 'Drone', 'tour-3d': '3D tour', floorplan: 'Floor plan',
headshots: 'Headshots', strategy: 'Strategy', social: 'Social', 'paid-ads': 'Paid ads', 'email-sms': 'Email, SMS',
crm: 'CRM', branding: 'Branding', web: 'Web', 'print-signage': 'Print' };
var LOGO = '../../../tokens/v/best/logos/marathon-logo-white.svg';
window.MC_STORY_LIMITS = { LIMITS: LIMITS, COUNTS: COUNTS, BUDGET: BUDGET, SCRIM_MAX_ASPECT: SCRIM_MAX_ASPECT };
var report = [];
function note(msg) { report.push(msg); }
function params() {
var q = new URLSearchParams(location.search), o = {};
q.forEach(function (v, k) { o[k] = v; });
return o;
}
function loadData(p) {
if (p.data) return fetch(p.data).then(function (r) { return r.json(); }).catch(function () { return window.MC_STORIES || {}; });
return Promise.resolve(window.MC_STORIES || {});
}
function merge(base, p) {
var d = {}, k;
for (k in base) d[k] = base[k];
['t', 'photo', 'focus', 'layout', 'eyebrow', 'headline', 'sub', 'credit', 'url', 'stat', 'stat_label', 'cta', 'kind', 'series', 'ep'].forEach(function (f) {
if (p[f] !== undefined) d[f] = p[f];
});
/* Lists in the URL: facts=1.9|Acres;240 ft|Frontage icons=drone;video */
if (p.facts !== undefined) d.facts = p.facts ? p.facts.split(';').map(function (s) { var a = s.split('|'); return { v: a[0] || '', l: a[1] || '' }; }) : [];
if (p.icons !== undefined) d.icons = p.icons ? p.icons.split(';') : [];
return d;
}
function capChars(s, n, field) {
s = String(s || '').replace(/\s+/g, ' ').trim();
if (s.length <= n) return s;
var cut = s.slice(0, n + 1), sp = cut.lastIndexOf(' '), hy = cut.lastIndexOf('-');
note(field + ' was ' + s.length + ' characters, cut to ' + n);
if (sp > n * 0.5) return cut.slice(0, sp).replace(/[\s,.;:-]+$/, '') + '…';
if (hy > n * 0.25) return cut.slice(0, hy).replace(/[\s,.;:-]+$/, '') + '…';
note(field + ' has no space to cut at, so it was cut mid-word. Rewrite it');
return s.slice(0, n).replace(/[\s,.;:]+$/, '') + '…';
}
function el(tag, cls, text) {
var e = document.createElement(tag);
if (cls) e.className = cls;
if (text !== undefined) e.textContent = text;
return e;
}
function icon(name, cls) {
var s = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
s.setAttribute('viewBox', '0 0 24 24'); s.setAttribute('class', 'mc-icon ' + (cls || ''));
s.setAttribute('aria-hidden', 'true');
s.innerHTML = (window.MC_ICONS || {})[name] || '';
return s;
}
function logo(cls) { var i = el('img', cls); i.src = LOGO; i.alt = 'Marathon Creative'; return i; }
function words(s) { return String(s || '').trim().split(/\s+/).filter(Boolean).length; }
function lineCount(e) {
var lh = parseFloat(getComputedStyle(e).lineHeight);
return Math.round(e.getBoundingClientRect().height / lh);
}
function widthOver(e) { return e.scrollWidth > e.clientWidth + 1; }
/* Width of one run of text in the element's own type, on one line. A wrapping block never
reports a single overlong word as more lines, it just paints it past the edge, so every
word is measured on its own. */
var SHY = '';
function textWidth(e, s) {
var m = e.cloneNode(false);
m.removeAttribute('id');
m.style.cssText += ';position:absolute;visibility:hidden;white-space:nowrap;width:auto;max-width:none;left:0;top:0;';
m.textContent = s;
e.parentNode.appendChild(m);
var w = m.getBoundingClientRect().width;
m.remove();
return w;
}
/* Pieces a line may break between: words, and the halves of a hyphenated word. */
function pieces(s) { return s.replace(new RegExp(SHY, 'g'), '').split(/\s+/).join('-').split('-').filter(Boolean); }
function longPieces(e) {
var room = e.clientWidth;
return pieces(e.textContent).filter(function (w) { return textWidth(e, w + '-') > room + 1; });
}
/* A word wider than the line at the smallest size is hyphenated with soft hyphens, which
Chrome only uses when it has to and draws as a real hyphen. Break points follow a simple
syllable rule: between two consonants after a vowel, where the right side starts the way an
English or German syllable can (a consonant and a vowel, or sch, st, str, pr, and so on), or
before a lone consonant between two vowels, with at least three letters each side. Any stretch
still too wide falls back to a break between every letter, and so does the whole word if
syllable breaks would cost a line. Short words and numbers are never touched. */
var VOWEL = /[aeiouyäöü]/i;
var ONSET = /^(sch|str|spr|scr|thr|chr|st|sp|sk|sc|sw|sl|sm|sn|pr|pl|br|bl|cr|cl|dr|fr|fl|gr|gl|tr|ch|sh|th|ph|wh|kn|wr|[b-df-hj-np-tv-z][aeiouyäöü])/i;
function syllableBreaks(w) {
var at = [];
for (var i = 3; i <= w.length - 3; i++) {
var a = w[i - 2], b = w[i - 1], c = w[i];
var vccv = VOWEL.test(a) && !VOWEL.test(b) && !VOWEL.test(c) && c.toLowerCase() !== 'h' && ONSET.test(w.slice(i));
var vcv = VOWEL.test(b) && !VOWEL.test(c) && c.toLowerCase() !== 'h' && VOWEL.test(w[i + 1] || '');
if (vccv || vcv) at.push(i);
}
return at;
}
function hyphenate(e, field, fine) {
var room = e.clientWidth, hit = [];
var fits = function (s) { return textWidth(e, s + '-') <= room + 1; };
var out = visible(e.textContent).split(' ').map(function (word) {
return word.split('-').map(function (part) {
if (fits(part) || part.length < 7 || /^[\d$%.,x]+$/.test(part)) return part;
hit.push(part);
var cuts = [0].concat(syllableBreaks(part), [part.length]), chunks = [];
for (var k = 1; k < cuts.length; k++) {
var ch = part.slice(cuts[k - 1], cuts[k]);
chunks.push(fits(ch) && !fine ? ch : ch.split('').join(SHY));
}
return chunks.join(SHY);
}).join('-');
}).join(' ');
if (!hit.length) return false;
e.textContent = out;
if (fine) { note(field + ': syllable breaks still ran past ' + (e.__lines || 'the line limit') + ', so the long word breaks wherever the line fills'); return true; }
note(field + ': "' + hit.join('", "') + '" is wider than the line even at the smallest size, so it was hyphenated across lines. Shorten it or use the common name if you can');
return true;
}
function visible(s) { return s.replace(new RegExp(SHY, 'g'), ''); }
function fit(e, lim, field, single) {
if (!e || !e.textContent) return;
var size = lim.max;
e.style.fontSize = size + 'px';
var over = function () {
if (single) return widthOver(e);
return lineCount(e) > lim.lines || longPieces(e).length > 0;
};
while (over() && size > lim.min) { size -= 1; e.style.fontSize = size + 'px'; }
if (size < lim.max) note(field + ' stepped down to ' + size + 'px to fit');
/* Still too wide at the smallest size: break the word, never let it run off the canvas. */
if (!single && longPieces(e).length && hyphenate(e, field)) {
over = function () { return lineCount(e) > lim.lines || e.scrollWidth > e.clientWidth + 1; };
/* Syllable breaks cost a line? Allow a break anywhere in the long word before losing words. */
if (over()) { e.__lines = lim.lines + ' lines'; hyphenate(e, field, true); }
}
if (over()) {
var full = e.textContent.replace(/…$/, ''), w = full.split(' '), lo = 1, hi = w.length, best = 0;
var tail = function (s) { return s.replace(new RegExp('[\\s,.;:' + SHY + '-]+$'), '') + '…'; };
while (lo <= hi) {
var mid = (lo + hi) >> 1;
e.textContent = tail(w.slice(0, mid).join(' '));
if (over()) hi = mid - 1; else { best = mid; lo = mid + 1; }
}
if (best) {
e.textContent = tail(w.slice(0, best).join(' '));
} else {
/* Even the first word does not fit. Cut it by letters, the copy check says so. */
var chars = visible(w[0]), clo = 1, chi = chars.length, cbest = 1;
while (clo <= chi) {
var cm = (clo + chi) >> 1;
e.textContent = tail(chars.slice(0, cm));
if (over()) chi = cm - 1; else { cbest = cm; clo = cm + 1; }
}
e.textContent = tail(chars.slice(0, cbest));
note(field + ': the first word is too long for this space and was cut mid-word. Rewrite it');
}
note(field + ' clamped to ' + lim.lines + ' line' + (lim.lines > 1 ? 's' : ''));
}
}
/* Last line of defence, run on the finished canvas. Any type that paints past its box or past
the side safe margin is reported in the copy check and marked on the canvas, never hidden. */
function edgeCheck(b) {
var cr = b.c.getBoundingClientRect(), side = parseFloat(getComputedStyle(b.c).getPropertyValue('--safe-s')) || 0;
var names = { eyebrow: 'Eyebrow', headline: 'Headline', 'reel-title': 'Title', sub: 'Sub', stat: 'Stat', 'stat-label': 'Stat label',
ep: 'Episode', credit: 'Credit', url: 'URL', 'fact-v': 'Fact value', 'fact-l': 'Fact label', 'icon-l': 'Icon label' };
var bad = 0;
Object.keys(names).forEach(function (k) {
Array.prototype.forEach.call(b.c.querySelectorAll('.' + k), function (e) {
if (!e.textContent) return;
var r = document.createRange(); r.selectNodeContents(e);
var tr = r.getBoundingClientRect(), br = e.getBoundingClientRect();
var right = Math.min(br.right, cr.right - side), optical = 0.06 * parseFloat(getComputedStyle(e).fontSize);
if (tr.right > right + 1 || tr.left < cr.left + side - optical - 1 || widthOver(e)) {
bad++; e.classList.add('is-overflow');
note('Did not fit: ' + names[k] + ' "' + visible(e.textContent).slice(0, 40) + '" runs past the edge of its space. Shorten it before posting');
}
});
});
b.c.setAttribute('data-overflow', String(bad));
return bad;
}
/* Pick the layout. The photo decides first, the copy second. A forced layout is allowed but reported. */
function chooseLayout(d, t, aspect) {
if (t === 'service' || t === 'stat') return 'panel';
if (t === 'reel-photo') return 'plate';
if (t === 'reel-series') return 'solid';
var auto = 'scrim';
if (aspect > SCRIM_MAX_ASPECT) { auto = 'panel'; note('Landscape photo, ' + aspect.toFixed(2) + ' wide to 1 tall. Full bleed would show ' + Math.round(100 * (1080 / 1920) / aspect) + '% of it, so the photo sits above the solid panel'); }
else if (words(d.headline) + words(d.sub) > WORDS_MAX_SCRIM) { auto = 'panel'; note('Copy runs past ' + WORDS_MAX_SCRIM + ' words, moved to the solid panel'); }
if (d.layout === 'scrim' || d.layout === 'panel') {
if (d.layout !== auto) note('Layout forced to ' + d.layout + ' in the fill. The engine would have picked ' + auto);
return d.layout;
}
return auto;
}
function build(d, t, layout, img, focus) {
var kind = TEMPLATES[t];
var c = document.getElementById('canvas');
c.className = 'canvas canvas--' + kind + ' t--' + t + ' layout--' + layout;
c.textContent = '';
if (layout !== 'solid') {
var ph = el('div', 'photo');
if (img) {
var im = el('img'); im.src = img.src; im.alt = ''; im.style.objectPosition = focus;
ph.appendChild(im);
} else {
ph.classList.add('photo--missing');
}
c.appendChild(ph);
c.appendChild(el('div', 'fade-top'));
}
var tab = el('div', layout === 'solid' ? 'tab tab--flat' : 'tab');
tab.appendChild(logo());
c.appendChild(tab);
var box = el('div', layout === 'scrim' ? 'scrim' : layout === 'plate' ? 'plate' : layout === 'solid' ? 'solid' : 'panel');
var copy = el('div', 'copy');
box.appendChild(copy);
if (t === 'service' && d.icons && d.icons.length) {
var ic = d.icons.filter(function (n) { return (window.MC_ICONS || {})[n]; });
if (ic.length < d.icons.length) note('Unknown icon names dropped');
if (ic.length > COUNTS.icons) { note(ic.length + ' icons given, kept the first ' + COUNTS.icons); ic = ic.slice(0, COUNTS.icons); }
var irow = el('div', 'icons optional');
ic.forEach(function (n) {
var cell = el('div', 'icon-cell');
cell.appendChild(icon(n, 'mc-icon--display'));
cell.appendChild(el('p', 'icon-l', ICON_SHORT[n] || n));
irow.appendChild(cell);
});
copy.appendChild(irow);
}
if (t === 'reel-series') {
copy.appendChild(el('div', 'bar'));
copy.appendChild(el('p', 'eyebrow', capChars(d.series || 'Marketing tips', LIMITS.series.chars, 'Series')));
var ep = String(d.ep || '').replace(/[^0-9]/g, '');
if (ep.length > LIMITS.ep.chars) { note('Episode ' + ep + ' has more than ' + LIMITS.ep.chars + ' digits, kept the first ' + LIMITS.ep.chars); ep = ep.slice(0, LIMITS.ep.chars); }
if (ep) copy.appendChild(el('p', 'ep', ep.length < 2 ? '0' + ep : ep));
copy.appendChild(el('h1', 'headline reel-title', capChars(d.headline || '', LIMITS.reelTitle.chars, 'Title')));
var sf = el('div', 'solid-foot');
sf.appendChild(el('p', 'url', capChars(d.url || 'marathoncreative.co', LIMITS.url.chars, 'URL')));
box.appendChild(sf);
c.appendChild(box);
return { t: t, kind: kind, layout: layout, c: c, box: box, copy: copy };
}
copy.appendChild(el('div', 'bar'));
var eb = d.eyebrow || (t === 'photo' && d.kind && KIND_LABEL[d.kind] ? 'Just shot, ' + KIND_LABEL[d.kind] : DEFAULT_EYEBROW[t]);
copy.appendChild(el('p', 'eyebrow', capChars(eb, LIMITS.eyebrow.chars, 'Eyebrow')));
if (t === 'stat') {
/* A number is never cut, a cut number is a wrong number. Too long only shrinks, and is reported. */
var st = String(d.stat || '').replace(/\s+/g, '');
if (st.length > LIMITS.stat.chars) note('Stat is ' + st.length + ' characters, write it in ' + LIMITS.stat.chars + ' or fewer, for example $148K');
copy.appendChild(el('p', 'stat', st));
copy.appendChild(el('p', 'stat-label', capChars(d.stat_label || '', LIMITS.stat_label.chars, 'Stat label')));
} else if (t === 'reel-photo') {
copy.appendChild(el('h1', 'headline reel-title', capChars(d.headline || '', LIMITS.reelTitle.chars, 'Title')));
} else {
copy.appendChild(el('h1', 'headline', capChars(d.headline || '', LIMITS.headline.chars, 'Headline')));
}
if (d.sub && t !== 'reel-photo') {
if (t === 'photo') note('Photo stories carry no sub line, it was left off. Put it in the caption');
else copy.appendChild(el('p', 'sub optional', capChars(d.sub, LIMITS.sub.chars, 'Sub')));
}
if (t === 'photo') {
var facts = (d.facts || []).filter(function (f) { return f && (f.v || f.l); });
if (facts.length > COUNTS.facts) { note(facts.length + ' facts given, kept the first ' + COUNTS.facts); facts = facts.slice(0, COUNTS.facts); }
if (facts.length) {
var row = el('div', 'facts facts--' + facts.length);
facts.forEach(function (f, i) {
var cell = el('div', 'fact');
cell.appendChild(el('p', 'fact-v', capChars(f.v, LIMITS.factValue.chars, 'Fact ' + (i + 1) + ' value')));
cell.appendChild(el('p', 'fact-l', capChars(f.l, LIMITS.factLabel.chars, 'Fact ' + (i + 1) + ' label')));
row.appendChild(cell);
});
copy.appendChild(row);
}
}
if (t === 'service') {
/* The CTA is the text on the Instagram link sticker, added in the app. The slot keeps its space clear. */
var slot = el('div', 'sticker-slot');
slot.setAttribute('data-cta', capChars(d.cta || 'Book a shoot', LIMITS.cta.chars, 'CTA'));
box.appendChild(slot);
}
if (t === 'photo' || t === 'stat') {
var foot = el('div', 'foot');
foot.appendChild(el('p', 'credit', t === 'photo' ? capChars(d.credit || '', LIMITS.credit.chars, 'Credit') : ''));
foot.appendChild(el('p', 'url', capChars(d.url || 'marathoncreative.co', LIMITS.url.chars, 'URL')));
copy.appendChild(foot);
}
c.appendChild(box);
return { t: t, kind: kind, layout: layout, c: c, box: box, copy: copy };
}
function copyHeight(b) {
var r = b.box.getBoundingClientRect(), cs = getComputedStyle(b.box);
if (b.layout === 'scrim') return r.height - parseFloat(cs.paddingTop) - parseFloat(cs.paddingBottom);
if (b.layout === 'plate') return r.height;
return r.height;
}
function enforce(b) {
var q = function (s) { return b.c.querySelector(s); };
var all = function (s) { return Array.prototype.slice.call(b.c.querySelectorAll(s)); };
fit(q('.eyebrow'), b.t === 'reel-series' ? LIMITS.series : LIMITS.eyebrow, b.t === 'reel-series' ? 'Series' : 'Eyebrow', true);
fit(q('.headline:not(.reel-title)'), LIMITS.headline, 'Headline');
fit(q('.reel-title'), LIMITS.reelTitle, 'Title');
fit(q('.sub'), b.t === 'service' ? LIMITS.serviceSub : LIMITS.sub, 'Sub');
fit(q('.ep'), LIMITS.ep, 'Episode', true);
fit(q('.stat'), LIMITS.stat, 'Stat', true);
fit(q('.stat-label'), LIMITS.stat_label, 'Stat label');
fit(q('.credit'), LIMITS.credit, 'Credit', true);
fit(q('.url'), LIMITS.url, 'URL', true);
var fv = all('.fact-v'), fl = all('.fact-l');
if (fv.length) {
var s = LIMITS.factValue.max, anyOver = function (list) { return list.some(widthOver); };
fv.forEach(function (e) { e.style.fontSize = s + 'px'; });
while (anyOver(fv) && s > LIMITS.factValue.min) { s -= 1; fv.forEach(function (e) { e.style.fontSize = s + 'px'; }); }
if (s < LIMITS.factValue.max) note('Fact values stepped down to ' + s + 'px, all three share one size');
fv.forEach(function (e, i) { if (widthOver(e)) fit(e, LIMITS.factValue, 'Fact ' + (i + 1) + ' value', true); });
fl.forEach(function (e, i) { fit(e, LIMITS.factLabel, 'Fact ' + (i + 1) + ' label', true); });
}
var H = b.c.getBoundingClientRect().height, budget = BUDGET[b.layout + '-' + b.t] || BUDGET[b.layout];
if (budget) {
var cap = budget * H, guard = 0;
while (copyHeight(b) > cap && guard++ < 12) {
var opt = all('.optional'), h1 = q('.headline'), tl = h1 && h1.classList.contains('reel-title') ? LIMITS.reelTitle : LIMITS.headline;
if (opt.length) { opt[opt.length - 1].remove(); note('Copy passed ' + Math.round(budget * 100) + '% of the canvas, dropped an optional line'); continue; }
if (h1 && lineCount(h1) > 2) { fit(h1, { lines: 2, max: parseFloat(h1.style.fontSize), min: tl.min }, 'Headline'); continue; }
var fs = all('.fact');
if (fs.length > 2) { fs[fs.length - 1].remove(); q('.facts').className = 'facts facts--' + (fs.length - 1); note('Dropped the last fact to stay in budget'); continue; }
break;
}
if (copyHeight(b) > cap) return false;
}
b.c.setAttribute('data-copy-share', (copyHeight(b) / H).toFixed(2));
return true;
}
/* Overlay, ?safe=1 or press S. Never in a posted file. */
function guides(b) {
var g = el('div', 'guides');
var top = el('div', 'g-zone g-top'), bot = el('div', 'g-zone g-bot');
top.appendChild(el('span', 'g-tag', b.kind === 'reel' ? 'Reel UI, top 240px. Nothing goes here' : 'Story UI, top 250px. Progress bar, name, close'));
bot.appendChild(el('span', 'g-tag', b.kind === 'reel' ? 'Reel UI, bottom 420px. Caption, audio, buttons' : 'Story UI, bottom 340px. Reply bar, send, like'));
g.appendChild(top); g.appendChild(bot);
g.appendChild(el('div', 'g-side g-side--l')); g.appendChild(el('div', 'g-side g-side--r'));
if (b.kind === 'reel') {
[['g-crop g-crop--1440', '3:4, 1080 x 1440, Instagram and TikTok profile grid'], ['g-crop g-crop--1350', '4:5, 1080 x 1350, feed preview'], ['g-crop g-crop--1080', '1:1, 1080 x 1080, square grid. Title lives in here']].forEach(function (x) {
var f = el('div', x[0]); f.appendChild(el('span', 'g-tag g-tag--crop', x[1])); g.appendChild(f);
});
}
var slot = b.c.querySelector('.sticker-slot');
if (slot) slot.appendChild(el('span', 'g-tag g-tag--slot', 'Link sticker here: ' + slot.getAttribute('data-cta')));
b.c.appendChild(g);
b.c.classList.add('has-guides');
}
function showReport(d, b, crop) {
var out = document.getElementById('report');
if (!out) return;
out.hidden = false;
out.appendChild(el('h2', '', 'Copy check'));
out.appendChild(el('p', 'share', 'Layout: ' + b.layout + '. Copy uses ' + Math.round(parseFloat(b.c.getAttribute('data-copy-share') || 0) * 100) + '% of the canvas.'));
if (crop) out.appendChild(el('p', 'share', crop));
if (!report.length) out.appendChild(el('p', 'ok', 'Everything fits as typed.'));
else if (b.c.getAttribute('data-overflow') === '0') out.appendChild(el('p', 'share', 'Edge check: every line sits inside the 80px side margins.'));
report.forEach(function (r) { out.appendChild(el('p', /^Did not fit/.test(r) ? 'warn fail' : 'warn', r)); });
var sl = b.c.querySelector('.sticker-slot');
if (sl) out.appendChild(el('p', 'share', 'In Instagram, add a link sticker in the slot and type: ' + sl.getAttribute('data-cta')));
(d._confirm || []).forEach(function (r) { out.appendChild(el('p', 'confirm', 'Confirm with Jacob: ' + r)); });
}
function loadImg(src) {
return new Promise(function (res) {
if (!src) return res(null);
var i = new Image();
i.onload = function () { res(i); };
i.onerror = function () { note('Photo did not load: ' + src); res(null); };
i.src = src;
});
}
var p = params();
loadData(p).then(function (all) {
var base = (p.id && all[p.id]) || {};
if (p.id && !all[p.id]) note('No story called "' + p.id + '" in the fill file');
var d = merge(base, p);
var t = TEMPLATES[d.t] ? d.t : 'photo';
if (t !== d.t) note('Unknown template "' + d.t + '", used photo');
if (t !== 'reel-series' && !d.photo) note('No photo given. Pick one from photos/, which holds brief/real-photos');
/* fonts.ready alone resolves before Montserrat is used, so measuring would run on the fallback face. Load every weight first. */
var faces = ['400', '600', '700', '800'].map(function (w) { return document.fonts.load(w + ' 40px Montserrat'); });
return Promise.all([Promise.all(faces).then(function () { return document.fonts.ready; }), loadImg(t === 'reel-series' ? null : d.photo)]).then(function (r) {
var img = r[1], aspect = img ? img.naturalWidth / img.naturalHeight : 0.5625;
var file = d.photo ? d.photo.split('/').pop() : '';
var focus = d.focus || ((all._focus || {})[file]) || '50% 50%';
var layout = chooseLayout(d, t, aspect);
var b = build(d, t, layout, img, focus);
if (!enforce(b) && layout === 'scrim') {
note('Copy would not fit over the photo, moved to the solid panel');
b = build(d, t, 'panel', img, focus); enforce(b);
}
edgeCheck(b);
var crop = '';
var box = b.c.querySelector('.photo');
if (img && box) {
var br = box.getBoundingClientRect(), sc = Math.max(br.width / img.naturalWidth, br.height / img.naturalHeight);
var shownW = Math.min(1, br.width / (img.naturalWidth * sc)), shownH = Math.min(1, br.height / (img.naturalHeight * sc));
crop = 'Photo shows ' + Math.round(shownW * 100) + '% of its width and ' + Math.round(shownH * 100) + '% of its height, focus ' + focus + '.';
if (sc > 1.25) note('Photo is enlarged ' + sc.toFixed(2) + ' times and will look soft. Use the full size file');
}
window.MC_FIT_REPORT = report;
if (p.safe) guides(b);
/* &sticker=1 previews the link sticker the way Instagram draws it. Preview only, never exported for posting. */
var ss = b.c.querySelector('.sticker-slot');
if (p.sticker && ss) {
var stk = el('div', 'sticker-mock');
stk.appendChild(icon('external-link', 'mc-icon--display'));
stk.appendChild(el('span', '', ss.getAttribute('data-cta')));
ss.appendChild(stk);
}
document.addEventListener('keydown', function (e) {
if (e.key !== 's' && e.key !== 'S') return;
var g = b.c.querySelector('.guides');
if (g) { g.remove(); b.c.classList.remove('has-guides'); var tg = b.c.querySelector('.g-tag--slot'); if (tg) tg.remove(); } else guides(b);
});
if (p.check) { document.body.classList.add('checking'); showReport(d, b, crop); }
document.body.setAttribute('data-ready', '1');
});
});
})();
stories.json109 lines, 9.5 KB
{
"_readme": "One entry per story or cover. t picks the template: photo, service, stat, reel-photo, reel-series. Anything here can be overridden in the URL. Every number in _confirm is a working figure for Jacob to confirm before it posts.",
"_focus": {
"mc_fullres_10.jpg": "50% 50%", "mc_fullres_11.jpg": "48% 55%", "mc_fullres_12.jpg": "42% 48%",
"mc_fullres_13.jpg": "50% 50%", "mc_fullres_14.jpg": "50% 50%", "mc_fullres_15.jpg": "50% 50%",
"mc_retouched_01.jpg": "50% 40%", "mc_retouched_02.jpg": "50% 50%", "mc_retouched_03.jpg": "38% 55%",
"mc_retouched_04.jpg": "50% 50%", "mc_retouched_05.jpg": "36% 55%", "mc_retouched_06.jpg": "50% 50%",
"mc_retouched_07.jpg": "50% 45%", "mc_retouched_08.jpg": "45% 40%", "mc_retouched_09.jpg": "55% 40%",
"mc_rosehill_16.jpg": "42% 55%", "mc_rosehill_17.jpg": "40% 60%", "mc_rosehill_18.jpg": "50% 60%"
},
"photo-interior": { "t": "photo", "photo": "photos/mc_retouched_05.jpg", "kind": "commercial",
"headline": "Cangelosi's Houston showroom, shot for the new site",
"facts": [{"v": "64", "l": "Edited photos"}, {"v": "1 day", "l": "On site"}, {"v": "48 hr", "l": "Turnaround"}],
"credit": "Shot for Cangelosi, Houston", "_confirm": ["64 edited photos and 48 hour turnaround for the Cangelosi shoot"] },
"photo-aerial": { "t": "photo", "photo": "photos/mc_rosehill_16.jpg", "kind": "community",
"headline": "Rosehill Reserve from 400 ft, the whole plan in one frame",
"facts": [{"v": "400 ft", "l": "Altitude"}, {"v": "38", "l": "Aerial stills"}, {"v": "4K", "l": "Drone video"}],
"credit": "Flown for Rosehill Reserve", "_confirm": ["38 aerial stills delivered to Rosehill Reserve"] },
"photo-portrait": { "t": "photo", "photo": "photos/mc_retouched_08.jpg", "kind": "product",
"headline": "Every slab on the wall, lit so the veining reads",
"facts": [{"v": "120", "l": "Slab close-ups"}, {"v": "3 hr", "l": "On site"}],
"credit": "Shot for Cangelosi, Houston", "_confirm": ["120 slab close-ups in a 3 hour session"] },
"photo-boundary": { "t": "photo", "photo": "photos/mc_fullres_12.jpg", "kind": "land",
"headline": "Wooded lot on the golf course, boundary drawn on every frame",
"facts": [{"v": "1.9", "l": "Acres"}, {"v": "240 ft", "l": "Road frontage"}, {"v": "22", "l": "Aerial stills"}],
"credit": "Drone and boundary overlay by Marathon", "_confirm": ["1.9 acres and 240 ft of frontage, from the listing broker"] },
"service-interior": { "t": "service", "photo": "photos/mc_retouched_05.jpg", "icons": ["photography", "video", "web"],
"eyebrow": "Commercial photography", "headline": "Your showroom, shot to sell what is on the wall",
"sub": "Interiors, product detail, and team portraits in one shoot day. Edited in house, delivered in 48 hours.",
"cta": "Book a shoot, link below", "_confirm": ["48 hour delivery on commercial shoots"] },
"service-aerial": { "t": "service", "photo": "photos/mc_rosehill_16.jpg", "icons": ["drone", "video", "tour-3d"],
"eyebrow": "Drone and aerial", "headline": "Show buyers the whole community, not one roofline",
"sub": "Licensed drone pilots, stills and 4K video, and a lot line drawn on every frame that needs one.",
"cta": "See drone packages" },
"service-portrait": { "t": "service", "photo": "photos/mc_retouched_08.jpg", "icons": ["photography", "social", "paid-ads"],
"eyebrow": "Product photography", "headline": "Close-ups that make a slab look like the real thing",
"sub": "Lit for veining and colour, cropped for your site, your feed, and your ads.",
"cta": "Book a product day" },
"service-boundary": { "t": "service", "photo": "photos/mc_fullres_12.jpg", "icons": ["drone", "print-signage", "web"],
"eyebrow": "Land listings", "headline": "Lot lines buyers can see before they drive out",
"sub": "We fly it, draw the boundary, and put the same frame on the sign, the flyer, and the listing.",
"cta": "Get a land quote" },
"stat-interior": { "t": "stat", "photo": "photos/mc_retouched_05.jpg", "eyebrow": "Result, Cangelosi",
"stat": "41%", "stat_label": "more showroom visit requests in 60 days",
"sub": "New photo set on their site and Google profile, Aug 1 to Sep 30.",
"_confirm": ["41% lift in showroom visit requests, Aug 1 to Sep 30"] },
"stat-aerial": { "t": "stat", "photo": "photos/mc_rosehill_16.jpg", "eyebrow": "Result, Rosehill Reserve",
"stat": "3.1x", "stat_label": "more lot tour bookings after the aerial reel",
"sub": "Reel plus paid ads, 30 days against the 30 days before.",
"_confirm": ["3.1x lot tour bookings, 30 day comparison"] },
"stat-portrait": { "t": "stat", "photo": "photos/mc_retouched_08.jpg", "eyebrow": "Result, Cangelosi",
"stat": "12.4K", "stat_label": "accounts reached by one slab carousel in seven days",
"sub": "Organic Instagram, no paid boost.", "_confirm": ["12.4K accounts reached, Instagram insights"] },
"stat-boundary": { "t": "stat", "photo": "photos/mc_fullres_12.jpg", "eyebrow": "Result, land listing",
"stat": "19", "stat_label": "days to contract on a 1.9 acre wooded lot",
"sub": "Drone set with the boundary drawn, plus a yard sign we printed.",
"_confirm": ["19 days to contract, from the listing broker"] },
"reel-interior": { "t": "reel-photo", "photo": "photos/mc_retouched_05.jpg", "eyebrow": "Behind the shoot",
"headline": "How we light a stone showroom" },
"reel-aerial": { "t": "reel-photo", "photo": "photos/mc_rosehill_16.jpg", "eyebrow": "Drone, start to finish",
"headline": "One flight, a whole community" },
"reel-portrait": { "t": "reel-photo", "photo": "photos/mc_retouched_08.jpg", "eyebrow": "Product photography",
"headline": "Shooting slabs so the veining reads" },
"reel-boundary": { "t": "reel-photo", "photo": "photos/mc_fullres_12.jpg", "eyebrow": "Land listings",
"headline": "Drawing a lot line buyers trust" },
"series-04": { "t": "reel-series", "series": "Marketing tips", "ep": "4",
"headline": "Post the listing in the first 48 hours" },
"series-12": { "t": "reel-series", "series": "Marketing tips", "ep": "12",
"headline": "Why your yard sign needs a QR code" },
"stress-photo": { "t": "photo", "photo": "photos/mc_retouched_04.jpg", "kind": "commercial",
"eyebrow": "Just shot for our friends over at the Cangelosi showroom in Houston",
"headline": "We spent the whole day inside the Cangelosi showroom shooting every single slab, every display tower, and the full team portrait for their brand new website launch",
"sub": "This is a sub line that nobody asked for on a photo story, and it keeps going for a while to see what happens.",
"facts": [{"v": "8,400 sq ft", "l": "Showroom floor space total"}, {"v": "64", "l": "Edited photos"}, {"v": "1 day", "l": "On site"}, {"v": "48 hr", "l": "Turnaround"}, {"v": "3", "l": "Videos"}],
"credit": "Shot for Cangelosi, Houston, with thanks to the whole showroom team" },
"stress-service": { "t": "service", "photo": "photos/mc_rosehill_17.jpg", "icons": ["drone", "video", "tour-3d", "photography", "web"],
"eyebrow": "Drone, aerial, video, and 3D tours for communities and builders",
"headline": "Show buyers the entire master-planned community, the retail, the entry monument, and every amenity, not just one roofline",
"sub": "Licensed drone pilots, stills, 4K video, 3D tours, floor plans, and a lot line drawn on every single frame that needs one, all edited in house by our own team in Houston and delivered fast.",
"cta": "Tap the link below to book your drone package today" },
"stress-stat": { "t": "stat", "photo": "photos/mc_fullres_12.jpg", "eyebrow": "Result for a land broker in north Houston",
"stat": "$147,800", "stat_label": "in closed land sales across three wooded lots on the golf course in a single quarter of this year",
"sub": "Drone set with the boundary drawn on every frame, plus yard signs and a postcard drop we printed in house." },
"stress-reel": { "t": "reel-photo", "photo": "photos/mc_rosehill_16.jpg", "eyebrow": "Drone, start to finish, at Rosehill Reserve",
"headline": "One flight, a whole master-planned community, and how we plan every pass before takeoff" },
"stress-series": { "t": "reel-series", "series": "Marketing tips for real estate agents", "ep": "104",
"headline": "Why your yard sign needs a QR code, a short URL, and a phone number that a human answers" },
"longword-photo": { "t": "photo", "photo": "photos/mc_rosehill_18.jpg", "kind": "community",
"headline": "New entry on Pfluegerville-Kleinschmidtsweilerstrassenparkway",
"facts": [{"v": "18", "l": "Entry stills"}, {"v": "4K", "l": "Drone video"}],
"credit": "Shot for Rosehill Reserve", "_confirm": ["18 entry stills delivered to Rosehill Reserve"] },
"longword-reel": { "t": "reel-photo", "photo": "photos/mc_rosehill_16.jpg", "eyebrow": "Drone, start to finish",
"headline": "Flying Kleinschmidtsweilerstrassenparkway" },
"longword-reel-cap": { "t": "reel-photo", "photo": "photos/mc_rosehill_16.jpg", "eyebrow": "Drone, start to finish",
"headline": "Pfluegerville-Kleinschmidtsweilerstrassenparkway" },
"longword-series": { "t": "reel-series", "series": "Marketing tips", "ep": "9",
"headline": "Signs on Kleinschmidtsweilerstrassenparkway" },
"longword-service": { "t": "service", "photo": "photos/mc_retouched_05.jpg", "icons": ["photography", "video", "web"],
"eyebrow": "Commercial photography", "headline": "Showroom shoots on Kleinschmidtsweilerstrassenparkway",
"sub": "Stills, video, and a site gallery from one shoot day, edited in house in Houston.", "cta": "Book a shoot" }
}
build_icons.py20 lines, 1.3 KB
# Copies the icons this piece uses out of the shared icon set into icons-inline.js.
# Run after the icon set changes: python3 build_icons.py. Never edit icons-inline.js by hand.
# Chrome blocks an external <use> href on file://, so the markup is inlined instead.
import json, os, re
here = os.path.dirname(os.path.abspath(__file__))
src = os.path.join(here, '..', '..', '..', 'icons', 'v', 'best')
names = ['photography', 'video', 'drone', 'tour-3d', 'floorplan', 'headshots', 'strategy', 'social',
'paid-ads', 'email-sms', 'crm', 'branding', 'web', 'print-signage', 'arrow-right', 'external-link', 'check']
out = {}
for n in names:
svg = open(os.path.join(src, 'svg', 'mc-icon-%s.svg' % n), encoding='utf-8').read().strip()
out[n] = re.search(r'<svg[^>]*>(.*)</svg>', svg, re.S).group(1).strip()
meta = json.load(open(os.path.join(src, 'icons.json')))
labels = {i['name']: i.get('label', i['name']) for i in meta['icons'] if i['name'] in names}
js = ('/* GENERATED by build_icons.py from ../../../icons/v/best/svg. Do not edit by hand. */\n'
'window.MC_ICONS = ' + json.dumps(out, indent=1) + ';\n'
'window.MC_ICON_LABELS = ' + json.dumps(labels, indent=1) + ';\n')
open(os.path.join(here, 'icons-inline.js'), 'w', encoding='utf-8').write(js)
print('wrote icons-inline.js with', len(out), 'icons')
build_stories.py10 lines, 655 bytes
# Turns stories.json, the fill file, into stories.js so the templates also open on file:// with no server.
# Edit stories.json, then run: python3 build_stories.py. Never edit stories.js by hand.
import json, os
here = os.path.dirname(os.path.abspath(__file__))
d = json.load(open(os.path.join(here, 'stories.json'), encoding='utf-8'))
open(os.path.join(here, 'stories.js'), 'w', encoding='utf-8').write(
'/* GENERATED by build_stories.py from stories.json. Do not edit by hand. */\nwindow.MC_STORIES = '
+ json.dumps(d, indent=1, ensure_ascii=False) + ';\n')
print('wrote stories.js with', len([k for k in d if not k.startswith('_')]), 'stories')
render_all.sh61 lines, 7.2 KB
#!/bin/bash
# Re-renders every image in renders/. Run from anywhere: bash build/social-story-reel/v/best/render_all.sh
# Uses the shared renderer, which drives Chrome in a throwaway profile, never your running Chrome.
set -e
HERE="$(cd "$(dirname "$0")" && pwd)"; ROOT="$(cd "$HERE/../../../.." && pwd)"; cd "$ROOT"
R="${HERE#$ROOT/}"; OUT="$R/renders"; PNG="node build/_shared/render.mjs png"
rm -rf "$OUT"; mkdir -p "$OUT/templates" "$OUT/photos" "$OUT/stress" "$OUT/longword"
shot() { $PNG "$R/story.html?$1" "$2" 1080 1920 0 1 >/dev/null; }
# 1. Every template, exact 1080 x 1920, clean and with the safe area overlay.
TEMPLATES="photo-portrait photo-interior service-interior stat-aerial reel-interior series-04"
for id in $TEMPLATES; do shot "id=$id" "$OUT/templates/$id.png" & shot "id=$id&safe=1" "$OUT/templates/$id-safe.png" & wait; done
shot "id=service-interior&sticker=1" "$OUT/templates/service-interior-sticker.png" &
for id in reel-aerial reel-portrait reel-boundary series-12; do shot "id=$id" "$OUT/templates/$id.png" & done; wait
# 2. Photo robustness. Every photo template on a tight interior, a wide aerial, a portrait, and a boundary lot.
for ph in interior aerial portrait boundary; do
for t in photo service stat reel; do shot "id=$t-$ph" "$OUT/photos/$t-$ph.png" & done
shot "id=photo-$ph&safe=1" "$OUT/photos/photo-$ph-safe.png" &
wait
done
# 3. The functional test, copy twice as long as it should be, with the copy check beside the canvas.
for id in stress-photo stress-service stress-stat stress-reel stress-series; do
$PNG "$R/story.html?id=$id&check=1" "$OUT/stress/$id.png" 1480 1920 0 1 >/dev/null &
done; wait
# 3b. Long unbroken words. A street name wider than the line is hyphenated, never clipped, and the check says so.
for id in longword-photo longword-reel longword-reel-cap longword-series longword-service; do
$PNG "$R/story.html?id=$id&check=1" "$OUT/longword/$id-check.png" 1480 1920 0 1 >/dev/null &
shot "id=$id" "$OUT/longword/$id.png" &
done; wait
shot "id=longword-reel&safe=1" "$OUT/longword/longword-reel-safe.png"
shot "id=longword-photo&safe=1" "$OUT/longword/longword-photo-safe.png"
# 4. Sheets. Paths inside a sheet are relative to the round folder.
sheet() { $PNG "$R/sheet.html?$1" "$2" 2400 1200 1 1 >/dev/null; }
enc() { python3 -c 'import sys,urllib.parse;print(urllib.parse.quote(sys.argv[1],safe="=&"))' "$1"; }
T=renders/templates; P=renders/photos; S=renders/stress
sheet "$(enc "eyebrow=Stories and reel covers, 1080 x 1920&title=Five templates, one fill file&cols=6&lede=Photo story on a portrait photo and on a landscape photo, service story, result story, photo reel cover, and series reel cover. Top row as posted, bottom row with the platform UI overlay on.&imgs=$T/photo-portrait.png|Photo story, scrim|Portrait photo, copy on the scrim;$T/photo-interior.png|Photo story, panel|Landscape photo, the engine picks the panel;$T/service-interior.png|Service story|Icons, offer, and a clear link sticker slot;$T/stat-aerial.png|Result story|One number, what moved, the source;$T/reel-interior.png|Reel cover, photo|Title plate inside the 1:1 crop;$T/series-04.png|Reel cover, series|Episode number for a running series;$T/photo-portrait-safe.png|Overlay on|Top 250px and bottom 340px UI;$T/photo-interior-safe.png|Overlay on|Nothing typed in a red zone;$T/service-interior-safe.png|Overlay on|Link sticker slot above the reply bar;$T/stat-aerial-safe.png|Overlay on|80px side margins;$T/reel-interior-safe.png|Overlay on|3:4, 4:5, and 1:1 crops drawn;$T/series-04-safe.png|Overlay on|Reel UI, top 240px, bottom 420px")" "$OUT/primary.png"
for ph in interior aerial portrait boundary; do
case $ph in
interior) F="mc_retouched_05, a tight showroom interior, landscape 3:2";;
aerial) F="mc_rosehill_16, the busiest aerial in the set, landscape 4:3";;
portrait) F="mc_retouched_08, a portrait original, 0.6 wide to 1 tall";;
boundary) F="mc_fullres_12, a lot with a red boundary line burned in, landscape 4:3. Every red in the template sits on solid navy, never on the photo";;
esac
sheet "$(enc "eyebrow=Photo robustness, $ph&title=Every photo template on one photo&cols=5&lede=$F. Same files, same rules, no hand adjustment. The engine reads the photo shape and picks the layout.&imgs=$P/photo-$ph.png|Photo story|As posted;$P/photo-$ph-safe.png|Photo story|Overlay on;$P/service-$ph.png|Service story|As posted;$P/stat-$ph.png|Result story|As posted;$P/reel-$ph.png|Reel cover|As posted")" "$OUT/photo-$ph.png"
done
sheet "$(enc "eyebrow=Functional test&title=Copy twice as long as it should be&cols=3&lede=Each story was filled with overlong copy, extra facts, extra icons, an eight character stat, and a three digit episode. The copy check beside each canvas lists every cut, every size step, and every figure Jacob has to confirm. Numbers are shrunk, never cut.&imgs=$S/stress-photo.png|Photo story|Brightest photo in the set, five facts given;$S/stress-service.png|Service story|Five icons given, 121 character headline;$S/stress-stat.png|Result story|Boundary lot photo, eight character stat;$S/stress-reel.png|Reel cover|Busiest aerial, 87 character title;$S/stress-series.png|Series cover|Episode 104, 88 character title")" "$OUT/stress.png"
L=renders/longword
sheet "$(enc "eyebrow=Functional test, long words&title=A street name wider than the canvas&cols=5&lede=Pfluegerville-Kleinschmidtsweilerstrassenparkway is wider than 920px at every allowed size. The engine steps the size down, then breaks at the hyphen, then hyphenates the long half with a visible hyphen. A title over the character cap is cut at the hyphen, never mid-word. Every case is listed in the copy check, and anything still past the 80px margin is outlined and listed in red.&imgs=$L/longword-photo.png|Photo story|Hyphenated over three lines;$L/longword-photo-safe.png|Photo story, overlay|Inside the side margins;$L/longword-reel.png|Reel cover|Title hyphenated on the plate;$L/longword-reel-safe.png|Reel cover, overlay|Still inside the 1:1 crop;$L/longword-series.png|Series cover|Same rule on solid navy")" "$OUT/longword.png"
sheet "$(enc "eyebrow=Functional test, long words&title=What the copy check tells you&cols=3&lede=Same five fills with the copy check beside the canvas. The 48 character title is over the 44 character cap, so it is cut at the hyphen and the check says what was lost.&imgs=$L/longword-photo-check.png|Photo story|Hyphenated, reported;$L/longword-reel-check.png|Reel cover|Hyphenated, reported;$L/longword-reel-cap-check.png|Reel cover, over the cap|Cut at the hyphen, reported;$L/longword-series-check.png|Series cover|Hyphenated, reported;$L/longword-service-check.png|Service story|Hyphenated, reported")" "$OUT/longword-check.png"
# 5. Reel cover grid crops, photo cover and series cover, plus a phone-size profile grid.
TILES="$T/reel-interior.png;$T/series-04.png;$T/reel-aerial.png;$T/reel-portrait.png;$T/series-12.png;$T/reel-boundary.png"
$PNG "$R/grid.html?cover=$T/reel-interior.png&tiles=$TILES" "$OUT/reel-grid-crop.png" 2000 1200 1 1 >/dev/null
$PNG "$R/grid.html?cover=$T/series-04.png&tiles=$TILES" "$OUT/reel-grid-crop-series.png" 2000 1200 1 1 >/dev/null
echo "renders done in $OUT"
