Skip to content

Instantly share code, notes, and snippets.

@JoseInTheArena
Last active July 11, 2023 18:38
Show Gist options
  • Save JoseInTheArena/3a62cafbfe69222ed74b4dca624bd0c1 to your computer and use it in GitHub Desktop.
Save JoseInTheArena/3a62cafbfe69222ed74b4dca624bd0c1 to your computer and use it in GitHub Desktop.
Script for adding questions to a geekbot random question type
/**
* Disclaimer: This works as of the date of writing (3/30/2022) but there's no guarantees it will work in the future
* as it depends on selectors on geekbot's web UI, which may change at any time. Use at your own risk.
*
* To use this:
* 1. Navigate to your geekbot random question settings
* 2. Open your devtools
* 3. Pasting this script into the console
* 4. Hit enter
*/
let newQuestionsText = ["Visited any place for the first time lately?",
"What is the biggest challenge you ever faced?",
"What is your fondest childhood memory?",
"What is the next thing you would like to experience for the first time?",
"What's your favorite book?",
"What makes you feel hopeful?",
"Are you superstitious about anything?",
"Ever talked your way out of a tough spot?",
"Do you prefer working from home or the office?",
"Heard any good songs lately?",
"What do you wish you spent more of your time on?",
"What was the most interesting museum you've ever seen?",
"Do you have a morning routine?",
"What is your favorite ice cream flavor?",
"What's the scariest situation you've ever been in?",
"Do you believe in something that most people disagree with?",
"Have you seen any good movies lately?",
"Have you ever seen an exotic animal up close?",
"Do you live near family?",
"What brings you joy?",
"What’s your favorite breakfast?",
"Ever re-connected with old childhood friends?",
"What was the proudest moment in your life?",
"Do you like sweet or salty flavours?",
"Are you reading anything these days?",
"Given the opportunity what kind of class would you like to teach?",
"What do you eat for breakfast usually?",
"What made you laugh lately?",
"What is your favourite TED talk?",
"What is your favorite band?",
"What's your favorite holiday season?",
"What’s the smartest pun you’ve ever heard?",
"Which language would you like to learn?",
"What do you think is more important than money?",
"What is the one thing you ever built by hand that you are proud of?",
"What is your favourite cartoon character?",
"What do you miss most from your childhood?",
"What is your most guilty pleasure?",
"If you could live anywhere in the world, where would that be?",
"Who's your favorite book author?",
"What's the best place you've ever been to?",
"What makes you feel nostalgic?",
"What's the best gift anyone ever gave you?",
"What's the best decision you've ever made?",
"When you were a child, what did you want to be when you grew up?",
"Do you keep a journal?",
"What have you done lately, you've never done before?",
"What's puts you in a good mood instantly?",
"What have you bought recently that you'd recommend?",
"Do you have a favorite quote?",
"As a kid what was the most embarrassing haircut you ever had?",
"What is the one place you go to find peace?",
"What's the best advice someone ever gave you?",
"Ever slept under the stars?",
"What’s your favorite emoji?",
"Have you ever been in a band?",
"What's your favorite food?",
"What's your favorite smell?",
"Do you know CPR?",
"What song do you have stuck in your head right now?",
"Which one of the five senses matters most to you?",
"What is your favorite season, summer, spring, fall or winter?",
"What’s the biggest turning point in your life?",
"Have you ever eaten anything weird?",
"How important is money to you?",
"Do you have a favorite game show?",
"Have you returned anything you've purchased recently? Why?",
"What do you spend too much time doing?",
"Nature vs. nurture – which do you think influences people more?",
"What have you done lately that surprised even yourself?",
"What’s a common misconception people might have about you?",
"What's the one smell you'll always remember?",
"Who do you really admire?",
"When’s the last time you felt most creative?",
"What's the farthest you've ever walked?",
"What advice would you give to your 17 year-old self today?",
"Ever lost something important in plain sight?",
"What’s the best photo you’ve ever shot?",
"Who was your favorite teacher growing up?",
"What’s the best meal you’ve ever cooked?",
"Who in your family are you closest to?",
"Got a favorite piece of trivia?",
"Were your parents thinking of naming you differently when you were born?",
"What question would you ask a stranger?",
"Ever had your name in the news?",
"Who's your favorite athlete?",
"What's the first concert you've ever been to?",
"What's the earliest thing you remember from childhood?",
"Do you have a favorite board game?",
"What family tradition is your favorite?",
"When does time seem to slow down for you?",
"What's the coldest you've ever been?",
"Which sport do you enjoy the most?",
"What's the best concert you've been to?",
"What did you get in trouble for when you were young?",
"Do you know any magic tricks?",
"Do you consider yourself a good swimmer?",
"What's the most beautiful thing you've ever seen?",
"What is your definition of happiness?",
"Is there something you love that you never though you would?",
"Do you think empathy can be learned?",
"What's the best costume you've ever worn?",
"What's the one sound you just can't stand?",
"What's the longest you've been away from your computer?",
"Do you believe in luck?",
"What's your favorite number?",
"What's the longest you've waited in line for something?",
"Ever been wrong about your first impression of someone?",
"Who's been your best mentor?",
"How long can you hold your breath for?",
"When you have 30' to yourself what do you usually do?",
"Have you ever broken a bone?",
"What do you wish you had learned when you were younger?",
"Puppies or kittens?",
"Coffee or tea?",
"Do you grow any plants?",
"Have you eaten at a good restaurant lately?",
"What still makes you nervous?",
"What type of weather do you prefer?",
"What is the funniest meme you’ve seen lately?",
"What's your favorite movie and how many times have you seen it?",
"Do you have a favorite outdoor activity?",
"Which of your parents do you take after more?",
"What's the best customer service you've ever received?",
"Have you ever been pranked?",
"If you could be anyone else for a day, who would it be?",
"If nobody would judge you, what would you do differently?",
"What's the weirdest thing about you?",
"What can you do today that you couldn’t do a year ago?",
"Were you ever voted 'Most likely to...' in high school?",
"Do you believe in ghosts?",
"What historical event would you like to experience?",
"Do you have a favorite memory of visiting the zoo?",
"What’s the first thing you do when you wake up?",
"What was the first thing you bought with your own money?",
"Who do you trust the most?",
"What's the most comfortable piece of furniture you own?",
"What was your first job?",
"Are you a morning person or a night owl?",
"What’s the farthest you’ve ever run?",
"Do you believe that some people are just talented or that anyone can learn anything?",
"What's the nicest thing someone's ever done for you?",
"Is there a snack that you simply can't resist?",
"If you needed bail money, who would you call?",
"What is the last thing that made you smile?",
"Do you have any phobias you'd like to overcome?",
"If you decided to write a book, what would it be about?",
"What food puts you in the best mood?",
"Are you double-jointed?",
"How do you like your eggs?",
"Where's your favorite place to grab a slice of pizza?",
"What's your favorite family recipe?",
"Do you collect anything?",
"What's the trait you admire the most in people?",
"What's the hottest place you've ever been to?",
"What is your nickname?",
"Where was your first airplane ride to?",
"Who was your childhood hero?",
"What's your most embarrassing email goof?",
"Picked up any new hobbies recently?",
"Do you believe in aliens?",
"What’s the best sporting event you’ve ever been to?",
"Are you watching any TV shows these days?",
"Where's the best sunset you've ever seen?",
"Do you have a favorite charity you wish more people knew about?",
"What is success to you?",
"What do most people not know about you?",
"Who's the best dressed at the company?",
"What was your favorite activity as kid?",
"What's the first thing you do when you get home from work?",
"Have you seen a random act of kindness lately?",
"Who's the person you're most proud of?",
"Ever met a famous person?",
"What should there be a word for that there isn't?",
"Do you prefer smooth or crunchy peanut butter?",
"Ever caught anything while fishing?",
"Are you an extrovert or an introvert?",
"Got a favorite recipe to share?",
"Ever had a part in a play?",
"Seen anything lately that impressed you?",
"Do you know someone you consider to be wise?",
"What advice would you give to yourself 5 years ago?",
"What gives you goosebumps?",
"Who is your favorite comedian?",
"If you could master a skill today, what would it be?",
"What do you treasure most?",
"Has anything pleasantly surprised you recently?",
"Have you ever lied to your parents about something silly?",
"If you didn't need sleep, what would you do with the extra time?"];
//This is a workaround for an issue I had where dispatching the "input" event for the question input box was being ignored which
//caused the form validation to think there was no text on the last box and keep the "Add Question" button disabled
//See more info about the workaround here: https://github.com/facebook/react/issues/10135#issuecomment-314441175
function setNativeValue(element, value) {
const valueSetter = Object.getOwnPropertyDescriptor(element, 'value').set;
const prototype = Object.getPrototypeOf(element);
const prototypeValueSetter = Object.getOwnPropertyDescriptor(prototype, 'value').set;
if (valueSetter && valueSetter !== prototypeValueSetter) {
prototypeValueSetter.call(element, value);
} else {
valueSetter.call(element, value);
}
}
const inputEvent = new Event('input', { bubbles: true });
const changeEvent = new Event('change');
newQuestionsText.forEach((newQuestionText, index) => {
document.querySelector('.c-question-options-list__new-button').click();
let geekbotQuestions = document.querySelectorAll('.c-question-options-list__input-wrapper .gb-input input.gb-input__input');
let location = geekbotQuestions.length - 1;
if (index === 0 || index === 1) {
location = index;
}
setNativeValue(geekbotQuestions[location], newQuestionText);
geekbotQuestions[location].dispatchEvent(inputEvent);
geekbotQuestions[location].dispatchEvent(changeEvent);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment