Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplement study-cats from new study-base #25

Open
wants to merge 13 commits into
base: v2-dev-base
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/study-base/js/study-bundle.min.js

Large diffs are not rendered by default.

273 changes: 176 additions & 97 deletions src/study-base/package-lock.json

Large diffs are not rendered by default.

140 changes: 140 additions & 0 deletions src/study-cats-old/cat-calculations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
let niceCatCount = 0;
let meanCatCount = 0;
let progress = 0;
let niceCatIsChosen = false;
let meanCatIsChosen = false;
let countHasIncreased = false;
let niceCatsArray = ["img/stim-img/cat1.jpg", "img/stim-img/cat4.jpg", "img/stim-img/cat6.jpg", "img/stim-img/cat8.jpg", "img/stim-img/cat10.jpg"];
let meanCatsArray = ["img/stim-img/cat2.jpg", "img/stim-img/cat3.jpg", "img/stim-img/cat5.jpg", "img/stim-img/cat7.jpg", "img/stim-img/cat9.jpg"];

function initPractice() {
progress = 9;
let niceCat = document.getElementById("cat1");
let meanCat = document.getElementById("cat2");
niceCat.addEventListener("click", viewNextButton);
meanCat.addEventListener("click", viewNextButton);
document.onkeydown = function(e) {
if (e.keyCode === 49) {
viewNextButton();
} else if(e.keyCode == 50) {
viewNextButton();
}
}
}

function viewNextButton() {
$('#btn-next-page').attr('style', 'display:block;');
$('#btn-next-page')[0].scrollIntoView();
}

function initTrial() {
niceCatCount = 0;
meanCatCount = 0;
progress = 0;
chooseRandomCatImages();
let niceCat = document.getElementById("cat1");
let meanCat = document.getElementById("cat2");
niceCat.addEventListener("click", incrementNiceCatCount);
meanCat.addEventListener("click", incrementMeanCatCount);
document.onkeydown = function(e) {
if (e.keyCode === 49) {
incrementNiceCatCount();
} else if(e.keyCode == 50) {
incrementMeanCatCount();
}
}
}

function incrementNiceCatCount() {
let counter = document.getElementById("counter");
counter.textContent = progress + 1 + "/10";
niceCatCount++;
console.log("mean:" + meanCatCount);
console.log("nice:" +niceCatCount);
console.log("progress:" + progress);
let container = document.getElementById("cat-container");
let niceCat = document.getElementById("cat1");
let meanCat = document.getElementById("cat2");
container.removeChild(niceCat);
container.removeChild(meanCat);
chooseRandomCatImages();
}

function incrementMeanCatCount() {
let counter = document.getElementById("counter");
counter.textContent = progress + 1 + "/10";
meanCatCount++;
console.log("mean:" + meanCatCount);
console.log("nice:" +niceCatCount);
console.log("progress:" + progress);
let container = document.getElementById("cat-container");
let niceCat = document.getElementById("cat1");
let meanCat = document.getElementById("cat2");
container.removeChild(niceCat);
container.removeChild(meanCat);
chooseRandomCatImages();
}

function checkProgress() {
progress++;
if (progress >= 10) {
let niceCat = document.getElementById("cat1");
let meanCat = document.getElementById("cat2");
document.onkeydown = null;
niceCat.removeEventListener("click", incrementNiceCatCount);
meanCat.removeEventListener("click", incrementMeanCatCount);
viewNextButton();
}
}

function chooseRandomCatImages() {
setNiceCatImage();
setMeanCatImage();
checkProgress();
}

function selectRandomNiceCat() {
let randomNum = Math.floor(Math.random() * 5);
return niceCatsArray[randomNum];
}

function selectRandomMeanCat() {
let randomNum = Math.floor(Math.random() * 5);
return meanCatsArray[randomNum];
}

function setNiceCatImage() {
let container = document.getElementById("cat-container");
let image = document.createElement("img");
image.setAttribute("id", "cat1");
image.src = selectRandomNiceCat();
image.alt = "a nice cat";
image.addEventListener("click", incrementNiceCatCount);
container.appendChild(image);
}

function setMeanCatImage() {
let container = document.getElementById("cat-container");
let image = document.createElement("img");
image.setAttribute("id", "cat2");
image.src = selectRandomMeanCat();
image.alt = "a mean cat";
image.addEventListener("click", incrementMeanCatCount);
container.appendChild(image);
}

function calculateResults() {
/*if (niceCatCount > meanCatCount) {
setNiceCatImage();
} else {
setMeanCatImage();
}*/
}

function calcResults() {
if (niceCatCount > meanCatCount) {
setNiceCatImage();
} else {
setMeanCatImage();
}
}
File renamed without changes.
100 changes: 100 additions & 0 deletions src/study-cats-old/i18n/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"@metadata": {
"authors": [
"LITW Team"
],
"locale": "en",
"message-documentation": "qqq"
},
"litw-template-title": "The Vax Project",
"litw-template-loading": "Loading...",
"litw-irb-header": "Welcome to the LabintheWild VAX Study!",
"litw-irb-subheader-1": "You're about to take a test on LabintheWild. Your contribution to our research allows us to learn more about cognitive differences around the world. The results from your test will also tell you something about yourself!",
"litw-irb-subheader-2": "Please read the following information carefully before proceeding.",
"litw-irb-body-1-p1": "Why we are doing this research?",
"litw-irb-body-1-p2": "We are trying to learn what people from different cultural and demographic backgrounds think about cats.",
"litw-irb-body-2-p1": "What you will have to do?",
"litw-irb-body-2-p2": "You will be shown a series of pictures of cats. You will need to indicate which cat you prefer among those shown.",
"litw-irb-body-3-p1": "What you will get out of it?",
"litw-irb-body-3-p2": "We will give you feedback on how your results compare to those of other participants. The final results from this experiment will be posted on our blog page. The experiment is not designed to benefit you, but you may enjoy it and enjoy comparing your results with those of other participants.",
"litw-irb-body-4-p1": "Privacy and Data Collection:",
"litw-irb-body-4-p2": "We will not ask you for your name. Any data that we collect will be securely stored on our servers.",
"litw-irb-body-5-p1": "Duration:",
"litw-irb-body-5-p2": "Approximately 3 minutes.",
"litw-irb-body-6-p1": "Contact information:",
"litw-irb-body-6-p2": "If you have questions about this research, you may contact Professor Buttons, Head of Feline Research, University of Washington.",
"litw-irb-body-final": "If you have questions about your rights as a research participant, or wish to obtain information, ask questions or discuss any concerns about this study with someone other than the researcher(s), please contact the Unversity of Washington IRB.",
"litw-irb-consent": "By ticking this box, you are agreeing to be in the study. Be sure that questions you have about the study have been answered and that you understand what you are being asked to do. You may contact the researcher if you think of a question later. You are free to leave the experiment at any time, and refusing to be in the experiment or stopping participation will involve no penalty or loss of benefits to which you are otherwise entitled.",
"litw-irb-warning": "You must check the box to continue.",
"litw-demographics-title": "Please tell us a little bit about yourself.",
"litw-demographics-required": "To proceed, please properly answer all fields below. (The ones marked with * are mandatory.)",
"litw-demographics-title-tip": "We need this information for data analysis. Please note that none of the answers are personally identifiable. We take your privacy very seriously. You may email us at [email protected] for more information.",
"litw-demographics-title-tip-text": "Why?",
"litw-demographics-minor-alert1": "Sorry, we currently do not have approval from our Institutional Review Board to conduct this study with minors younger than 14 years old.",
"litw-demographics-minor-alert2": "In five seconds, we're redirecting you to our home page where you can participate in other studies.",
"litw-demographics-retake": "Have you taken this test before?",
"litw-demographics-yes": "Yes",
"litw-demographics-no": "No",
"litw-demographics-unsure": "Not sure",
"litw-demographics-pet-allergy": "Are you allergic to pets?",
"litw-demographics-gender": "What is your gender?",
"litw-demographics-male": "Male",
"litw-demographics-female": "Female",
"litw-demographics-nonbinary": "Non-binary",
"litw-demographics-nodisclose": "Prefer not to disclose",
"litw-demographics-other": "Prefer to self-describe",
"litw-demographics-gender-other": "Please, describe your gender:",
"litw-demographics-age": "How old are you?",
"litw-demographics-education": "What is your highest level of formal education?",
"litw-demographics-education1": "No formal education",
"litw-demographics-education2": "Incomplete primary school",
"litw-demographics-education3": "Complete primary school",
"litw-demographics-education4": "Incomplete secondary school or high school",
"litw-demographics-education5": "Complete secondary school or high school",
"litw-demographics-education6": "Some university education without degree",
"litw-demographics-education7": "University-level education with degree",
"litw-demographics-education8": "Incomplete graduate or professional school",
"litw-demographics-education9": "Complete graduate or professional school",
"litw-demographics-country": " What country are you from? (If you have lived in several countries, please indicate the country you have lived in longest.)",
"litw-demographics-culture": "Which country is most representative of your cultural background?",
"litw-demographics-culture-tip": "For most people, this will be the country they were born in and probably still live in.",
"litw-demographics-race": "Your ethnicity/race (select all that apply)?",
"litw-demographics-race-other": "Please, describe your race:",
"litw-demographics-race-asian": "Asian or Asian-American",
"litw-demographics-race-latino": "Latino or Latina/Hispanic",
"litw-demographics-race-islander": "Native Hawaiian or Other Pacific Islander",
"litw-demographics-race-black": "Black or African-American",
"litw-demographics-race-native": "American Indian or Alaska Native",
"litw-demographics-race-white": "White",
"litw-practice-header": "Which picture do you identify with most?",
"litw-pretrialbreak-header":"Nice job!",
"litw-pretrialbreak-body1":"Now that you have the hang of it, we'll start the study.",
"litw-pretrialbreak-body2":"Click the arrow when you are ready to begin.",
"litw-comment-title": "Thank you for your participation!",
"litw-comment-subtitle": "Before you continue to your results, please let us know what you thought of the study!",
"litw-comment-q1": "Do you have any comments for the researcher? Questions, Suggestions, or Concerns?",
"litw-comment-q21": "Did you encounter any technical difficulties during this study?",
"litw-comment-q22": "Please specify the issue:",
"litw-comment-q31": "Did you cheat or in any way provide false information?",
"litw-comment-q32": "Please specify how:",
"litw-comment-email-p1": "You can also email us at",
"litw-comment-email-p2": "[email protected]",
"litw-instruct-header": "Please read these instructions carefully.",
"litw-instruct-body-1-p1": "You'll be shown images like these:",
"litw-instruct-body-2-p1": "Your job is to decide which picture you identify with most. You'll do this by pressing 1 on your keyboard to select the left image and 2 to select the right image. You may also use your mouse to select an image.",
"litw-instruct-body-2-p2": "After your choice, we will run some hyper-complicated algorithms to predict your future. Let's give it a try!",
"litw-instruct-body-2-p1-touch": "Your job is to decide which picture you identify with most. You'll do this by tapping on the image you identify with to select it.",
"litw-instruct-body-2-p2-touch": "After your choice, we will run some hyper-complicated algorithms to predict your future. Let's give it a try!",
"litw-results-header": "Here are your results!",
"litw-results-explanation": "Based on your selections, here is a cat we think you would enjoy:",
"litw-results-citation1": "You can read more about this different mindsets and global trends HERE...",
"litw-more-title": "If you enjoyed this study, there's more!",
"litw-more-step1": "Visit and follow us on Facebook to learn about new studies:",
"litw-more-step2": "Share this study with your friends!",
"litw-more-step3": "And consider participating in some of our other studies:",
"litw-more-participate": "Participate now!",
"litw-more-study1-slogan": "How well can AI understand your speech?",
"litw-more-study1-description": "Find out how well AI can understand your speech by reading out loud a few words and sentences! The test takes around 7 minutes.",
"litw-more-study2-slogan": "Learn to be a better writer!",
"litw-more-study2-description": "Can you identify the writing strategies of experts? Improve your reading and writing while comparing yourself to experts in this 10 minute study!"
}
Loading