Umlaut, opening link in new tab, select option key or click

PennController for IBEX Forums Support Umlaut, opening link in new tab, select option key or click

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #4674
    akira
    Participant

    Hi,

    For a university project, we’re working on an experiment and I have encountered three problems for which I have yet not found any solutions:

    1. Since the experiment is in german, we use Umlaute (ä, ö, ü) and the letter ß. In the experiment, these are displayed as “�”. How can I make sure they are properly shown in the experiment? (I know that there are html codes for those letters, but since I know nothing about html I hope that there’s a JavaScript solution for that.)

    2. When creating a hyperlink for a document to read prior to the experiment (with <a>), clicking on it in the experiment leads to loading the link on the current tab (and a warning that the experiment is not finished or so). How can I code that the link will automatically open in a new tab upon clicking?

    3. In the experiment, each trial we first show a sentence, then another sentence and then a question with a ‘continue’ button. after each sentence and for the button it would be nice to have the option of letting participants proceed by either pressing the space bar or a mouse click. I figure I have to use a Selector to select between newKey and a mouse click, but what is the coding for that mouse click and how do I apply this to the button?

    Thank you very much in advance!

    • This topic was modified 4 years, 10 months ago by Jeremy. Reason: made the A tag visible
    #4675
    akira
    Participant

    In the brackets before the hyperlink starts I put the code for that with ‘a’ and so on. So you can ignore the link, it doesn’t do anything anyways.

    #4677
    Jeremy
    Keymaster

    Hi,

    1. Using HTML codes, as you mention, is probably the solution that is best in terms of cross-browser compatibility. You can find a useful table here: https://www.starr.net/is/type/htmlcodes.html
    An example of a script:

    PennController(
      newButton("gr&uuml;&szlig;en")
        .print()
        .wait()
    )

    This is of course not ideal in terms of readability from the experimenter’s end. Another solution is to save your script using an UTF8 encoding. In order to do that, you need to edit your script file on your local device (using your own text editor) and make sure to save it with a UTF8 encoding, and then upload your script file back to your project. Note that opening the online editor and clicking “Save” will fall back to the old, non-UTF8 format, so you need to keep editing the file locally and uploading it later.

    2. You want to use the target attribute with the value '_blank', like this: <a href='https://expt.pcibex.net/' target='_blank'>Open the PCIbex Farm</a>

    3. You are right, you need to use a Selector element, but then you no longer need a Key element:

    newButton("continue", "Continue")
        .print()
    ,
    newSelector("next")
        .settings.add( getButton("continue") )
        .settings.keys( " " )
        .wait()

    Let me know if you still have questions

    Jeremy

    #4683
    akira
    Participant

    Hey Jeremy,

    thank you very much for the help so far. I successfully applied everything.

    I have one follow-up question to question 3:
    How do i apply that choice to proceed by either space bar or a click anywhere on the window between two lines of text? So I want to print one text and before printing the next one the participant right now has to press any key, but adding the option of a mouse click would be convenient.

    Best regards,
    Akira

    #4685
    Jeremy
    Keymaster

    Hi Akira,

    Giving the option to click anywhere on the screen is a little tricky in PennController: you need to create a Canvas that covers the entire surface o the window. Note that this will likely prevent any interactions with elements on the page until the Canvas is removed (which you should be fine with, in your case). Here’s an example:

    newText("instructions", "Please click anywhere on the screen or press the spacebar")
        .print()
    ,
    newCanvas("screen", "100vw", "100vh")
        .print("center at 50vw", "center at 50vh")
    ,
    newSelector("continue")
        .settings.add(getCanvas("screen"))
        .settings.keys( " " )
        .wait()
    ,
    getText("instructions").remove(),
    getCanvas("screen").remove()
    ,
    newText("thanks", "Thank you!")
        .print()

    Let me know if you have questions

    Jeremy

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.