Pure Libs
How do I make an pure libs?
Like mad libs but with no prompts. Inspired by the horrible sentences you come up with by only clicking smartphone keyboard recommended words.. What is a pure libs? How do you make a pure libs? This script and codes were developed by Sheodox on 26 December 2022, Monday.
Pure Libs - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Pure Libs</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <p id=instructions></p>
<div id=simple-question> <label id=simple-prompt for=answer></label> <input id=simple-answer />
</div>
<div id=filler-question> <span id=filler-before></span> <input id=filler-answer /> <span id=filler-after></span>
</div>
<p id=story></p> <script src="js/index.js"></script>
</body>
</html>
Pure Libs - Script Codes CSS Codes
input { text-align: center; font-size: 2rem;
}
body { font-size: 2rem;
}
Pure Libs - Script Codes JS Codes
function q(sel) { return document.querySelector(sel);
}
function resolveOnEnter(resolve, input) { function keydown(e) { if (e.which === 13) { input.removeEventListener("keydown", keydown); resolve(input.value); input.value = ""; } } input.addEventListener("keydown", keydown); input.focus();
}
const instructions = q("#instructions"), simple = { container: q("#simple-question"), prompt: q("#simple-prompt"), answer: q("#simple-answer") }, filler = { container: q("#filler-question"), before: q("#filler-before"), after: q("#filler-after"), answer: q("#filler-answer") };
let groups = [];
function askSimple(prompt) { return function() { return new Promise(res => { simple.container.style.display = ""; filler.container.style.display = "none"; simple.prompt.textContent = prompt; resolveOnEnter(function(word) { groups.push([word]); res(); }, simple.answer); }); };
}
function askFiller(group, index) { return new Promise(res => { filler.container.style.display = ""; simple.container.style.display = "none"; filler.before.textContent = group[index]; filler.after.textContent = group[index + 1] || ""; resolveOnEnter(function(word) { group.splice(index + 1, 0, word); res(); }, filler.answer); });
}
function instruct(instruction) { return function() { instructions.textContent = instruction; };
}
function rng(max) { return Math.floor(Math.random() * max);
}
function fillGroups() { return new Promise(resolve => { function randomInsert() { return new Promise(res => { const group = groups[rng(groups.length)], index = rng(group.length); askFiller(group, index).then(res); }); } let prompts = Promise.resolve(); for (let i = 0; i < 20; i++) { prompts = prompts.then(randomInsert); } prompts.then(resolve); });
}
function spliceFiller(group1, group2) { return new Promise(res => { log(group1); log(group2); filler.before.textContent = group1[group1.length - 1]; filler.after.textContent = group2[0]; resolveOnEnter(res, filler.answer); });
}
function spliceGroups() { return new Promise(res => { function combine(group1, group2) { return function() { return spliceFiller(group1, group2).then(fillWord => { done += " " + group1.join(" ") + " " + fillWord; }); }; } let done = ""; Promise.resolve() .then(combine(groups[0], groups[1])) .then(combine(groups[1], groups[2])) .then(combine(groups[2], groups[3])) .then(combine(groups[3], groups[4])) .then(function() { res(done + " " + groups[4].join(' ')); }); });
}
function storytime(story) { q("#story").textContent = story;
}
function log(m) { console.log(m);
}
Promise.resolve() .then(instruct("Please input some words to start")) .then(askSimple("First word")) .then(askSimple("Second word")) .then(askSimple("Third word")) .then(askSimple("Forth word")) .then(askSimple("Fifth word")) .then(instruct("Enter a word that makes sense given the surrounding words")) .then(fillGroups) .then(spliceGroups) .then(storytime);
Developer | Sheodox |
Username | sheodox |
Uploaded | December 26, 2022 |
Rating | 3 |
Size | 2,656 Kb |
Views | 10,120 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Angular todo list test | 1,664 Kb |
Cool squares. | 1,894 Kb |
Text Highlighter | 2,562 Kb |
Remove JavaScript event handlers from HTML | 2,095 Kb |
A Pen by sheodox | 1,388 Kb |
Format time function | 1,546 Kb |
Pretty print JSON | 1,833 Kb |
Clean Dialog | 2,484 Kb |
Animated Statusbar Message Area | 3,975 Kb |
Customizable Loading Indicator | 2,558 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
SVG Basics | HipsterBrown | 1,852 Kb |
Experiment | Toddmoy | 2,849 Kb |
Bootstrap Responsive Menu Drawer | JesseGlacken | 3,777 Kb |
IbrahimJabbari-Effect14 | Ibrahimjabbari | 1,919 Kb |
Responsive scrolling text | Ashdurham | 2,259 Kb |
Brown by pure CSS, no image, no javascript | Aaronchuo | 2,652 Kb |
Toggle menu | Seyedi | 2,279 Kb |
Working around OS X Dynamic Scrollbars | Jrjenk | 2,279 Kb |
Mega Menu by Joni | Asakasinsky | 3,171 Kb |
Search Box in Content Moves to Fixed Header | Chriscoyier | 2,768 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!