var commonResLoc = (typeof commonResourcesLoc) == "undefined" ? "../common/" : commonResourcesLoc; function getCommonImageLinksArray() { return [commonResLoc + "img/ajax-loader.gif", commonResLoc + "img/fail.png", commonResLoc + "img/logo.png", commonResLoc + "img/next.png", commonResLoc + "img/next_active.png"]; } function getHeaderWithoutShareHTML() { return "
 
"; } function getLikertScaleHTML(left_text, right_text) { return '' + '' + '' + '' + '
' + left_text + '' + '
' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
' + right_text + '
'; } function getAJAXWorkingHTML() { return '
ajax loader Please wait one moment...'; } function getFatalErrorHTML() { return "frowny
" + "

A Fatal Error Occurred!


" + "

Lab in the Wild has been notified of the problem, and a team of highly trained whales are on it. We apologize for the inconvenience.

" + "

Need to vent? (Or feeling especially helpful?) Email us at info@labinthewild.org to tell us how this happened and how it made you feel.

" + "


Try this test again

Return to Lab in the Wild

"; } function getBrowserErrorHTML(error) { return "frowny
" + "

Your browser or device is not compatible!


" + "

" + error + "

" + "

Feel like we made a mistake and that you should be able to take this test with the device or browser you are using? Email us at info@labinthewild.org!

" + "


Return to Lab in the Wild

"; } /* * Handles test errors arising from bad AJAX requests (e.g., when demographics and/or * data info via the server goes kaput) by attempting another (hopefully successful) * AJAX request with debugging info and persuading the participant to e-mail us, too. * * Parameter: err, a string of the original error to send through the AJAX request * Returns: nothing * Questions? E-mail dhu@college.harvard.edu || artemis1593@gmail.com */ function handleError(err) { // create showFailPage (and accompanying error div) if necessary if (typeof showFailPage !== "function") { $('
').appendTo("body"); $$$("error").innerHTML = getFatalErrorHTML(); function showFailPage() { // assume we have content div $$$("content").style.display = "none"; window.onbeforeunload = null; $$$("error").style.display = "block"; throw new Error('Fatal Error'); } } // data to send via ajax var data = { participant_id: vars.participant_id, test_url: window.location.toString(), user_agent: navigator.userAgent, ajax0: err, ajax1: "", database_id: -1 }; // try to send data via ajax request, and update data based on success $.ajax({ type: 'POST', url: commonResLoc + 'include/testerror.php', data: data }).done(function (response) { try { response = $.parseJSON(response); data.ajax1 = response.ajax1; data.database_id = response.database_id; } catch (e) { data.ajax1 += "\n" + e.toString(); } }) .fail(function () { data.ajax1 = "Failed!"; }) .always(function () { failAwesomely(); }); // now that we have standard showFailPage, amp it up to display more info function failAwesomely () { var msg = "

Be our hero! If you e-mail us, it would be awesomely helpful if you could copy and paste to your message the information in curly braces below:

" + "

" + JSON.stringify(data, null, " ") + "

" + "

Also let us know if we can get in touch with you to troubleshoot the error or let you know when we release a fix! In the meantime...

"; $(msg).insertBefore("#error p:last-child"); showFailPage(); } } /* * To the bottom of the results page, adds cool sharing buttons, links to other * tests, and the copyright thing. To use this, make sure that the test's index.php * already has the following HTML somewhere after the results div:
* Parameter: testTitles, a string array of the titles of tests you want to link to * MAKE SURE THIS IS GETTEXTED! * Returns: nothing * Questions? E-mail dhu@college.harvard.edu || artemis1593@gmail.com */ function showFooter(testTitles) { // insert preliminary footer before we get to sharing buttons var begin_share = "
 
" + "

" + "Thanks again! Thought that was fun?

" + "
Tell your friends:
"; $(begin_share).insertBefore("#end_share"); // now begin links to other stuff var links = "

" + "And consider taking some of our other tests:

" + ""; // json info of other tests to link to var tests = $.parseJSON( '{"1":{"title":"Can we guess your age?","img":"images\/color_age-150x100.png","desc":"Test how old you are based on how well you can distinguish between colors! This test will take around 5 minutes.","lang":"en zh es","url":"http:\/\/www.labinthewild.org\/studies\/color_age\/"},"2":{"title":"Where in the world should you have a meal?","img":"images\/mealtime_v2.png","desc":"Different countries have different mealtime phone etiquettes. Tell us about your own habits and we will tell you where you fit in. This survey should take around 4 minutes.","lang":"en zh pt es ja","url":"http:\/\/www.labinthewild.org\/studies\/mealtime\/"},"3":{"title":"What is your website aesthetic?","img":"images\/aesthetics3.png","desc":"Compare your visual preferences to people around the world. This experiment takes around 10 minutes.","lang":"en zh es pt ja","url":"http:\/\/www.labinthewild.org\/studies\/aesthetics\/"},"4":{"title":"How fast is your memory?","img":"images\/memory-small.png","desc":"See how quickly you can retrieve information you have just memorized. This experiment takes around 10 minutes.","lang":"en zh es pt ja","url":"http:\/\/www.labinthewild.org\/studies\/memory-beta\/"},"5":{"title":"What is your thinking style?","img":"images\/brain.png","desc":"Find out how your thinking style compares to others. This experiment takes around 5 minutes.","lang":"en ja pt es","url":"http:\/\/www.labinthewild.org\/studies\/analytic_test\/"},"6":{"title":"Are you more Eastern or Western?","img":"images\/frame-line.png","desc":"In this test, you will learn whether you are more sensitive to a focal object (as most Americans) or more attuned to the context (as many Japanese). This experiment takes around 8 minutes.","lang":"en zh es pt ja","url":"http:\/\/www.labinthewild.org\/studies\/frame-line\/"},"7":{"title":"Can you spot trends in our data?","img":"images\/trends_english_only.png","desc":"Explore this interactive visualization and see if you find trends in data from our aesthetics research.","lang":"en","url":"http:\/\/www.labinthewild.org\/studies\/visualization\/"},"8":{"title":"Test your social intelligence!","img":"images\/intelligence2_english_only.png","desc":"Test how well you can read emotions of others just by looking at their eyes. This experiment takes around 10 minutes.","lang":"en","url":"http:\/\/socialintelligence.labinthewild.org\/mite\/?"},"9":{"title":"Do you have the reaction time of a cheetah?","img":"images\/reaction_time_share_english_only.png","desc":"How quickly do you notice visual changes? This experiment takes about 5 minutes.","lang":"en","url":"http:\/\/www.labinthewild.org\/studies\/reaction-time\/"},"10":{"title":"Multitasking Test","img":"images\/multitasking_english_only.png","desc":"How well can you multitask? Compare yourself to others by taking this test! Takes about 10 minutes.","lang":"en","url":"http:\/\/multitasking.labinthewild.org\/multitasking\/"}}' ); // add test info to table for tests we want to display $.each(tests, function (index, t) { // if title is in our array of desired test titles if ($.inArray(t.title, testTitles) !== -1) { // correct img url (absolute) t.img = "http://labinthewild.org/"+t.img; links += "" + "" + "" + ""; } }); // finish off the table and officially append to results links += "
" + "" + "" + "

" + t.title + "

" + "

" + t.desc + " " + "Participate now!" + "" + "

" + "
"; $(links).appendTo("#results2"); // link back to home page and put copyright at bottom var home = "

" + "Or Return to the Wild!" + "

" + "
 
Copyright 2013, Intelligent and Interactive Systems Group, Harvard University.
"; $(home).appendTo("#results2"); // show the whole dang thang $$$("results2").style.display = "block"; }