Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Implicit association test

  • GabrielleCaron10
  • GabrielleCaron10's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 months 1 day ago #254997 by GabrielleCaron10
Implicit association test was created by GabrielleCaron10
Please help us help you and fill where relevant:
Your LimeSurvey version: [see right hand bottom of your LimeSurvey admin screen]
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Hi,

Does anyone know how to create an implicit association test with LimeSurvey version 6.4.3? 

Thank you !

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 months 1 day ago #255000 by Joffm
Replied by Joffm on topic Implicit association test
Hi,
1. there is a question theme
[url] github.com/tpartner/LimeSurvey-Implicit-Association-Test-3x [/url]
You did not answer the question about hosting. Therefore I do not know if you are allowed to install it.
Also I do not know if it works in LS 6.x.
You may try.

2. There is a script (nearly the same), developped before it was programmed as question theme.
This works in 6.x

First the javascript code
Code:
<script>
// A plugin to insert an IAT interface
function implicitAssociation(el, showAnswers) {
    
    $(el).each(function() {
            
        var thisQuestion = $(this);
        var thisQuestionHelp = $('div.ls-questionhelp', thisQuestion);
        var thisQuestionAnswers = $('table.subquestion-list', thisQuestion).parent();
        var startTime = '';
        var endTime = '';    
        var agent = navigator.userAgent.toLowerCase();
        var mobile = false;
        if( /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent) ) { // Mobile devices
            mobile = true;
        }
        
        // Some classes
        $(thisQuestion).addClass('iat-question');
        $('tr.subquestion-list', thisQuestion).addClass('unanswered');
        
        // Hide the question help element
        $(thisQuestionHelp).hide();
        $(thisQuestionHelp).closest('.question-help-container').hide();
        
        // Hide the answers
        if(showAnswers != true) {
            $('table.subquestion-list', thisQuestion).hide();
        }
        
        // Insert IAT display
        var iatTexts = $(thisQuestionHelp).html().split('||');
        var iatDisplayHTML = '<div class="iatWrapper">\
                                <div class="iatLeftLabel">'+iatTexts[0]+'</div>\
                                <div class="iatRightLabel">'+iatTexts[1]+'</div>\
                                <div class="iatWord"></div>\
                                <div class="iatInstructions">'+iatTexts[2]+'</div>\
                            </div>\
                            <div class="iatMobileButtonWrapper">\
                                <div class="iatButton iatLeftButton">E</div>\
                                <div class="iatButton iatRightButton">I</div>\
                                <div style="width:100%; clear:both;"></div>\
                            </div>';
        $(thisQuestionAnswers).prepend(iatDisplayHTML);
        
        // Show a word
        function iatShowWord() {
            $('div.iatWord', thisQuestion).html($('tr.subquestion-list.unanswered:first .answertext', thisQuestion).html());
            startTime = new Date();
            
            $(document).bind('keypress.iatKeypress', function(e) {
                if(e.which == 101 || e.which == 105) {
                    var thisRow = $('tr.subquestion-list.unanswered:eq(0)', thisQuestion);
                    $(thisRow).removeClass('unanswered');
                    endTime = new Date();
                    $('input[type="text"]:eq(1)', thisRow).val(endTime.valueOf() - startTime.valueOf());
                    if(e.which == 101) {
                        $('input[type="text"]:eq(0)', thisRow).val('E');
                    }
                    else {
                        $('input[type="text"]:eq(0)', thisRow).val('I');
                    }
                    $(document).unbind('keypress.iatKeypress');
                    if($('tr.subquestion-list.unanswered', thisQuestion).length > 0) {
                        iatShowWord();
                    }
                    else {
                        $('.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions', thisQuestion).fadeOut('slow', function() {
                            $('div.iatWord', thisQuestion).text('done');
                            $('.iatWord', thisQuestion).addClass('done').fadeIn('slow');
                        });
                    }
                }
            });
        }
        function iatShowWordMobile() {
            $('div.iatWord', thisQuestion).html($('tr.subquestion-list.unanswered:first .answertext', thisQuestion).text());
            startTime = new Date();
            
            $('.iatButton', thisQuestion).bind('click.iatButtonClick', function(e) {
                var thisRow = $('tr.subquestion-list.unanswered:eq(0)', thisQuestion);
                $(thisRow).removeClass('unanswered');
                endTime = new Date();
                $('input[type="text"]:eq(1)', thisRow).val(endTime.valueOf() - startTime.valueOf());
                $('input[type="text"]:eq(0)', thisRow).val($(this).text());
                $('.iatButton', thisQuestion).unbind('click.iatButtonClick');
                if($('tr.subquestion-list.unanswered', thisQuestion).length > 0) {
                    iatShowWordMobile();
                }
                else {
                    $('.iatLeftLabel, .iatWord, .iatRightLabel, .iatInstructions, .iatMobileButtonWrapper', thisQuestion).fadeOut('slow', function() {
                        $('div.iatWord', thisQuestion).text(iatTexts[3]);
                        $('.iatWord', thisQuestion).addClass('done').fadeIn('slow');
                    });
                }
            });
        }
        
        // Start the IAT display
        if(mobile == true) { // Mobile devices
            $('.iatMobileButtonWrapper', thisQuestion).show();
            $('.iatButton', thisQuestion).bind('click.iatStartMobile', function(e) {
                $('.iatButton', thisQuestion).unbind('click.iatStartMobile');
                iatShowWordMobile();
            });
        }
        else {
            $(document).bind('keypress.iatStart', function(e) { // Non-mobile devices
                if(e.which == 101 || e.which == 105) {
                    $(document).unbind('keypress.iatStart');
                    iatShowWord();
                }
            });
        }
    });
}
 
 
 $(document).ready(function() {
        // Apply the IAT plugin to this question
        implicitAssociation('#question{QID}');
    });    
</script>

And some styling:
Code:
<style type="text/css">
/* IAT questions */
.iatWrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 300px;
    margin: 0 auto;
    color: #D0DBE5;
    background-color: #2C3E50;
    font-size: 21px;
}
 
.iatLeftLabel {
    float: left;
    padding: 10px;
}
 
.iatRightLabel {
    float: right;
    padding: 10px;
}
 
.iatWord {
    position: absolute;
    width: 100%;
    top: 35%;
    text-align: center;
    font-size: 36px;
    color: #C4D1DE;
}
 
.iatWord.done {
    color: #C4D1DE;
}
 
.iatInstructions {
    position: absolute;
    width: 100%;
    bottom: 0px;
    padding-bottom: 10px;
    text-align: center;
}
 
.iatMobileButtonWrapper {
    display: none;
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    font-size: 36px;
}
 
.iatButton {
    float: left;
    margin: 20px;
    width: 100px;
    padding: 2px 0 5px 0;
    border: 5px solid #233140;
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    -khtml-border-radius: 10px;
    border-radius: 10px;
    text-align: center;
    line-height: normal;
    cursor: pointer;
}
 
.iatLeftButton {
    float: left;
}
 
.iatRightButton {
    float: right;
}
</style>

Here in "fruity_twentythree" to show that it is really 6.x
 

And you may read this
[url] forums.limesurvey.org/forum/can-i-do-thi...tion-task-workaround [/url]

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose