JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
HTML Settings
Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
- var h = 2000, w = 2*h;
- var x = -.5*w, y = -.5*h;
- var d = .25*h, r = .5*d, r0 = Math.round(.03*r);
- var bw = 4*d, bh = .65*d;
- var bx = .5*(bw + r) - .5*r;
- var bf = .325;
- var by = .5*bh - bf*y;
- var sw = .004*h;
- var fs = Math.round(.075*h);
- var na = Math.round(.05*fs);
svg(viewBox=[x, 1.5*y, w, 1.3*h].join(' ')
xmlns='http://www.w3.org/2000/svg')
style
| * { font: #{fs}px segoe script, comic sans ms, cursive }
| [x] ~ * {
| stroke-width: #{sw};
| font: #{fs}px consolas, monaco, monospace;
| word-spacing: #{Math.round(-.375*fs)}px
| }
| [x] + [d] { stroke: #ccc; fill: none }
| [d] + [d] {
| stroke: #333;
| marker-start: url(#s);
| marker-end: url(#e)
| }
| rect, [r], #p *, g [x] + [d] { fill: none; stroke: #f90 }
| [r='#{r}'] { stroke: #b5a }
| rect ~ [r] { stroke: #b53 }
| [r] + [y] { opacity: .3; fill: url(#p) }
| #p * { stroke-width: #{bw}; stroke-dasharray: #{1.25*sw} }
| g [x] { fill: #f90 }
pattern#p(viewBox=[0, 0, bw, bh].join(' ') width='100%' height='100%')
path(d=`M0 0l${bw} ${Math.round(2.5*bh)}`)
marker#s(markerWidth=na markerHeight=na
viewBox='-8 -4 8 8' orient='auto' refX='-7')
path(d='M-8 0 0-4V4')
marker#e(markerWidth=na markerHeight=na
viewBox='0 -4 8 8' orient='auto' refX='7')
path(d='M8 0 0-4V4')
g
text(x=Math.round(.5*(bx - x) - 1.75*fs) y=Math.round(-3.25*fs)) bar gets
tspan(dx=Math.round(-4.25*fs) dy=Math.round(1.125*fs)) hidden
path(d=`M${.5*(bx - x)}${Math.round(-1.75*fs)}
Q${.5*(bx - x) - fs}${Math.round(by - bh - 1.5*fs)} ${.5*(bx - x) - fs} ${Math.round(by - bh - .5*fs)}
m${-.5*fs}${Math.round(-.75*fs)}
q${.5*fs} ${2*fs} ${fs} 0`)
text(x=-(bx + r) y=Math.round(1.5*y + fs)) assembly always middle aligned
text(x=x + .1*fs y=Math.round(bf*y - 2.375*r)) a = (w + r)/2
text(x=bx y=Math.round(.7*fs + 1.375*r - bf*y)) x = a - r
text(x=bx y=Math.round(1.7*fs + 1.375*r - bf*y)) x = (w - r)/2
text(x=Math.round(x + .25*fs) y=Math.round(fs - by)) expanded
text(x=Math.round(x + .25*fs) y=Math.round(2*fs - by)) state
text(x=Math.round(x + .25*fs) y=Math.round(by - bh + fs)) collapsed
text(x=Math.round(x + .25*fs) y=Math.round(by - bh + 2*fs)) state
text(x=bx - .5*r - .3*fs y=Math.round(bf*y - 1.375*r)) d
text(x=Math.round(-.25*(bw + r) - .3*fs) y=Math.round(bf*y - 2.375*r)) a
text(x=Math.round(.25*(bw + r) - .3*fs) y=Math.round(bf*y - 2.375*r)) a
text(x=-fs y=Math.round(bf*y - 3.375*r)) w + r
text(x=bx - r - .3*fs y=Math.round(.7*fs + (bf*y + 1.375*r))) r
text(x=bx - .3*fs y=Math.round(.7*fs + (bf*y + 1.375*r))) r
text(x=Math.round(.25*(bw - r) - .3*fs) y=Math.round(.7*fs + 1.375*r - bf*y)) x
text(x=Math.round(.25*(r - bw) - .3*fs) - r y=Math.round(.7*fs + 1.375*r - bf*y)) x
text(x=-.5*r - .3*fs y=Math.round(.7*fs + 1.375*r - bf*y)) r
text(x=-(.5*r + .3*fs) y=Math.round(.7*fs + 2.375*r - bf*y)) w
path(d=`M0${bf*y - 3*r}V${2*r - bf*y}
M${-(.5*r + bx)}${bf*y - 3.5*r}V${2.5*r - bf*y}
M${bx + .5*r}${bf*y - 3.5*r}V${1.5*r + bf*y}
M${bx - 1.5*r}${bf*y - 1.5*r}v${3*r}
M${bx - .5*r}${bf*y}V${2.5*r - bf*y}
M${-r} ${-bf*y}v${1.5*r}`)
path(d=`M${bx - 1.5*r} ${Math.round(bf*y + 1.25*r)}h${r}`)
path(d=`M${bx - .5*r} ${Math.round(bf*y + 1.25*r)}h${r}`)
path(d=`M${bx - 1.5*r}${Math.round(bf*y - 1.25*r)}h${d}`)
path(d=`M${-(.5*r + bx)}${Math.round(bf*y - 3.25*r)}H${.5*r + bx}`)
path(d=`M${-(.5*r + bx)}${Math.round(bf*y - 2.25*r)}H0`)
path(d=`M${.5*r + bx}${Math.round(bf*y - 2.25*r)}H0`)
path(d=`M${-(.5*r + bx)} ${Math.round(1.25*r - bf*y)}H${-r}`)
path(d=`M0 ${Math.round(1.25*r - bf*y)}h${bx - .5*r}`)
path(d=`M${-r} ${Math.round(1.25*r - bf*y)}H0`)
path(d=`M${-(.5*r + bx)} ${Math.round(2.25*r - bf*y)}h${bw}`)
circle(cx=bx - .5*r cy=bf*y r=r)
circle(cy=-bf*y r=r)
rect(x=-r y=Math.round(by - bh) width=bw height=bh)
rect(x=-(bx + .5*r) y=Math.round(-by) width=bw height=bh)
circle(cx=bx - 1.5*r cy=bf*y r=r0)
circle(cx=bx - .5*r cy=bf*y r=r0)
circle(cx=-(.5*r + bx) cy=bf*y r=r0)
circle(cx=bx + .5*r cy=bf*y r=r0)
circle(cx=-r cy=-bf*y r=r0)
circle(cy=-bf*y r=r0)
circle(cx=r cy=-bf*y r=r0)
<svg viewBox='-2000 -1500 4000 2600' xmlns='http://www.w3.org/2000/svg'><style>*{font:150px segoe script,comic sans ms,cursive}[x]~*{stroke-width:8;font:150px consolas,monaco,monospace;word-spacing:-56px}[x]+[d]{stroke:#ccc;fill:none}[d]+[d]{stroke:#333;marker-start:url(#s);marker-end:url(#e)}rect,[r],#p *,g [x]+[d]{fill:none;stroke:#f90}[r='250']{stroke:#b5a}rect~[r]{stroke:#b53}[r]+[y]{opacity:.3;fill:url(#p)}#p *{stroke-width:2000;stroke-dasharray:10}g [x]{fill:#f90}</style><pattern id='p' viewBox='0 0 2000 325' width='100%' height='100%'><path d='M0 0l2000 813'/></pattern><marker id='s' markerWidth='8' markerHeight='8' viewBox='-8 -4 8 8' orient='auto' refX='-7'><path d='M-8 0 0-4V4'/></marker><marker id='e' markerWidth='8' markerHeight='8' viewBox='0 -4 8 8' orient='auto' refX='7'><path d='M8 0 0-4V4'/></marker><g><text x='1238' y='-487'>bar gets <tspan dx='-637' dy='169'>hidden</tspan></text><path d='M1500-262Q1350-62 1350 88m-75-112q75 300 150 0'/></g><text x='-1250' y='-1350'>assembly always middle aligned</text><text x='-1985' y='-919'>a = (w+r)/2</text><text x='1000' y='774'>x = a-r</text><text x='1000' y='924'>x = (w-r)/2</text><text x='-1962' y='-337'>expanded</text><text x='-1962' y='-187'>state</text><text x='-1962' y='313'>collapsed</text><text x='-1962' y='463'>state</text><text x='830' y='-669'>d</text><text x='-607' y='-919'>a</text><text x='518' y='-919'>a</text><text x='-150' y='-1169'>w+r</text><text x='705' y='124'>r</text><text x='955' y='124'>r</text><text x='393' y='774'>x</text><text x='-732' y='774'>x</text><text x='-170' y='774'>r</text><text x='-170' y='1024'>w</text><path d='M0-1075V825M-1125-1200V950M1125-1200V50M625-700v750M875-325V950M-250 325v375'/><path d='M625-12h250'/><path d='M875-12h250'/><path d='M625-637h500'/><path d='M-1125-1137H1125'/><path d='M-1125-887H0'/><path d='M1125-887H0'/><path d='M-1125 638H-250'/><path d='M0 638h875'/><path d='M-250 638H0'/><path d='M-1125 888h2000'/><circle cx='875' cy='-325' r='250'/><circle cy='325' r='250'/><rect x='-250' y='163' width='2000' height='325'/><rect x='-1125' y='-487' width='2000' height='325'/><circle cx='625' cy='-325' r='8'/><circle cx='875' cy='-325' r='8'/><circle cx='-1125' cy='-325' r='8'/><circle cx='1125' cy='-325' r='8'/><circle cx='-250' cy='325' r='8'/><circle cy='325' r='8'/><circle cx='250' cy='325' r='8'/></svg>
body {
display: flex;
flex-direction: column;
margin: 0;
height: 100vh
}
Also see: Tab Triggers