No time to go through 6000 themes? Slaughter the worst cliches with this script!
Quick usage
First, copy the following code into a text editor:
```js (() => { // Time to wait between requests, in milliseconds. Defaults to 0.5 seconds. const WAIT_MS = 500;
const wait = (ms) => {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(), ms);
});
};
const slaughterAll = async (themes) => {
let ok = 0;
let failed = 0;
for (const set of themes) {
for (const key in set) {
let response = await fetch(`https://api.ldjam.com/vx/theme/idea/vote/no/${key}`, {
credentials: 'include',
});
await wait(WAIT_MS);
if (response.ok) {
console.log(`Slaughtered ${key} (${set[key]})`);
ok += 1;
}
else {
console.warn(`Error slaughtering ${key} (${set[key]}): ${response.status} ${response.statusText}`);
failed += 1;
}
}
}
return {
ok, failed,
};
};
slaughterAll([
// ---------- Paste lists after this line! ----------
// ---------- Paste lists before this line! ----------
])
.then((results) => console.log(`Done! ${results.ok} ok, ${results.failed} failed.`));
})() ```
Then, paste one or more of these lists between the separators:
- Control/buttons: https://pastebin.com/yLm4DadV
- Virus: https://pastebin.com/mYu0n5NR
- Currency: https://pastebin.com/XPBFb2tS
- Die/lose to win: https://pastebin.com/J3ArHEdW
- Thing is key: https://pastebin.com/AfVXxjSS
- You are bad: https://pastebin.com/VnGLV4Y5
- Colors: https://pastebin.com/D1M3zWnR
After you're done, the slaughterAll section should look somewhat like:
```js slaughterAll([ // ---------- Paste lists after this line! ----------
// Themes that contain: words, words, words, words, words { "12345": "theme content", "12345": "theme content", "12345": "theme content", },
// Themes that contain: words, words, words, words, words { "12345": "theme content", "12345": "theme content", "12345": "theme content", },
// ...
// ---------- Paste lists before this line! ----------
])
```
Finally, go to https://ldjam.com/events/ludum-dare/46/theme, and paste the entire file into the web Console (F12). Press Enter and relax!
Note: Don't refresh or close the page until "Done! X ok, X failed." is printed, or you will lose your progress. It's normal for the pie chart to not update.
Making your own lists
To make your own lists, you'll need a JSON of all themes. You may find the URL by looking at the requests sent while loading https://ldjam.com/events/ludum-dare/46/theme. The URL should look like https://api.ldjam.com/vx/theme/idea/vote/get/<some_number>.
After you have obtained the list, save it as theme.json somewhere. Then, save the following Node.js script as gen_list.js in the save folder as theme.json:
```js const fs = require('fs'); const process = require('process');
let themes = fs.readFileSync('themes.json', { encoding: 'utf8', }); themes = JSON.parse(themes);
const blacklist = process.argv.slice(2); const blacklistMap = {}; for (const word of blacklist) { blacklistMap[word] = true; }
const trailingDots = /(.)+$/; const wordSeparator = /[\W_]/;
const words = {}; const killList = {};
for (const key in themes.ideas) { const theme = themes.ideas[key]; for (let word of theme.split(wordSeparator)) { word = word.replace(trailingDots, ''); word = word.toLowerCase();
if (word.length < 1) {
continue;
}
if (blacklistMap[word]) {
killList[key] = theme;
break;
}
}
}
process.stdout.write('// Themes that contain: '); process.stdout.write(blacklist.join(', ')); process.stdout.write(' '); process.stdout.write(JSON.stringify(killList, null, 4)); process.stdout.write(', '); ```
You can now generate your own lists by running this file from the command line!
node gen_list.js keyword_1 keyword_2 keyword3
Stay healthy and flatten the curve!