Last active
May 28, 2016 08:47
-
-
Save jeandrek/87523d7ea2cb34dd3bf31f087f180983 to your computer and use it in GitHub Desktop.
Better clickbait (more clickbaity) http://jonathan50.github.io/clickbait.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Words(...templates) { | |
this.templates = templates | |
} | |
Words.prototype.generate = function() { | |
return this.templates.map(generate).join(' ') | |
} | |
function generate(template) { | |
if(template instanceof Words) | |
return template.generate() | |
if(template instanceof Function) | |
return template() | |
if(!(template instanceof Array)) | |
return template | |
return template.map(generate)[Math.floor(Math.random() * template.length)] | |
} | |
const scratchers = ['mres', 'Paddle2See', 'kaj', 'speakvisually', 'griffpatch', 'Gobo', 'ScratchCat'] | |
var bigRandom = () => Math.floor(Math.random() * 99999) | |
const marks = ['!', '!', '!', '!', '1'] | |
var exclamations = () => '!'.repeat(Math.floor(Math.random() * 10) + 2) | |
.split('') | |
.map(x => marks[Math.floor(Math.random() * marks.length)]) | |
.join('') | |
const template = [ | |
new Words( | |
['Learn these', 'Click to learn these', 'Find out'], | |
bigRandom, | |
['great tricks', 'stunning amazing tricks', 'weird ways'], | |
'to', | |
['eat', 'hack', 'follow', 'get followed by', 'lose weight with the help of', 'get hacked by'], | |
['yourself', scratchers], | |
exclamations | |
), | |
new Words( | |
[ | |
new Words( | |
['Mods', 'Moderators', 'ST', 'The Scratch Team', 'Scratchers', scratchers], | |
'hate him', | |
exclamations | |
), | |
new Words() | |
], | |
['He', 'She', scratchers], | |
[ | |
'got banned', | |
'shared a project', | |
new Words(['followed', 'ate', 'hacked', 'got followed by'], ['himself', 'herself', scratchers]), | |
'lost weight' | |
], | |
',', | |
['you will be amazed by', 'it is absolutely shocking', "you'll never guess"], | |
['what happened next', 'the consequences'], | |
exclamations | |
), | |
new Words( | |
['Find out', 'Learn', 'Discover'], | |
['how', 'why'], | |
['he', 'she', scratchers], | |
[ | |
'lost weight', | |
'got banned', | |
new Words(['followed', 'ate', 'hacked', 'got followed by'], ['himself', 'herself', scratchers]) | |
], | |
[ | |
new Words( | |
'in', | |
bigRandom, | |
['easy', 'simple'], | |
'steps!', | |
exclamations | |
), | |
new Words( | |
'by watching this', | |
bigRandom, | |
['second', 'hour'], | |
'video', | |
exclamations | |
) | |
] | |
), | |
new Words( | |
bigRandom, | |
['amazing', 'shocking'], | |
['things', 'facts', 'secrets'], | |
'you', | |
["DIDN'T KNOW", "didn't know", 'never knew'], | |
'about', | |
['the ST', 'the Scratch Team', scratchers] | |
) | |
] | |
function clickbait() { | |
return generate(template) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment