Published
Edited
Jun 10, 2021
Insert cell
Insert cell
el=html`<div style="color:#fff;padding:10px;width=100px;height=100px">This Ad is a work of experimental writing disguised as a provocation.</div>`
Insert cell
t(el);
Insert cell
t=function(e){
e.style.background='#A2B6C0';
e.style.width='800px';
//e.style.height='400px';
e.style.fontSize='58px';
e.style.overflowY='scroll';
const font = e.style.fontFamily||'Bench9';
e.style.fontFamily=font;
const content="This Ad is a work of experimental writing disguised as a provocation and."
e.innerText=content;
return checkOrphan(content,e);
//console.log(content)
}
Insert cell
function checkOrphan(content, e) {
let len = content.length;
let words = content.split(' ');

e.innerText = words[0];
let height = e.offsetHeight;
let num = 0; // # of lines

// append words one by one
for (var i = 1; i < words.length; i++) {
e.innerText += ' ' + words[i];
if (e.offsetHeight > height) {
// is a new line
num++;
height = e.offsetHeight;
if (i === words.length - 1) {
return true;
}
}
}
return false;
}
Insert cell
Insert cell
Insert cell
Insert cell
import {RiTa, pulse} from '@dhowe/rita'
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more