[{"id": 1, "created": "2022-07-16T20:45:24.836149", "updated": "2023-07-31T14:58:17.559000", "name": "AuthCrowd", "short_name": "authcrowd", "description": "AuthCrowd", "long_description": "AuthCrowd", "featured": false, "owner_id": 1, "category_id": 1, "info": {"task_presenter": "<head>\r\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\r\n\t<meta name=\"viewport\" content=\"width=device-width, initial-scale = 1.0, maximum-scale = 1.0, user-scalable=no\">\r\n\t\t<style type=\"text/css\">\r\n\r\n\r\n#pdf-main-container {\r\n\tmargin: 20px auto;\r\n}\r\n\r\n#pdf-loader {\r\n\tdisplay: none;\r\n\ttext-align: center;\r\n\tcolor: #999999;\r\n\tfont-size: 13px;\r\n\tline-height: 100px;\r\n\theight: 100px;\r\n}\r\n\r\n\r\n#pdf-meta {\r\n\toverflow: hidden;\r\n\tmargin: 0 0 20px 0;\r\n}\r\n\r\n#pdf-buttons {\r\n\tfloat: left;\r\n}\r\n\r\n#page-count-container {\r\n\tfloat: right;\r\n}\r\n\r\n#pdf-current-page,#pdf-current-page2 {\r\n\tdisplay: inline;\r\n}\r\n\r\n#pdf-total-pages,#pdf-total-pages2 {\r\n\tdisplay: inline;\r\n}\r\n\r\n#pdf-canvas,#pdf-canvas2 {\r\n\tborder: 1px solid rgba(0,0,0,0.2);\r\n\tbox-sizing: border-box;\r\n}\r\n\r\n\r\n#page-loader {\r\n\theight: 100px;\r\n\tline-height: 100px;\r\n\ttext-align: center;\r\n\tdisplay: none;\r\n\tcolor: #999999;\r\n\tfont-size: 13px;\r\n}\r\n\r\n#text-layer { \r\n   position: absolute;\r\n\tleft: 0;\r\n\ttop: 0;\r\n\tright: 0;\r\n\tbottom: 0;\r\n\toverflow: hidden;\r\n\topacity: 0.2;\r\n\tline-height: 1.0;\r\n}\r\n\r\n#text-layer > div {\r\n\tcolor: transparent;\r\n\tposition: absolute;\r\n\twhite-space: pre;\r\n\tcursor: text;\r\n\ttransform-origin: 0% 0%;\r\n}\r\n\r\n#text-layer2 { \r\n   position: absolute;\r\n\tleft: 0;\r\n\ttop: 0;\r\n\tright: 0;\r\n\tbottom: 0;\r\n\toverflow: hidden;\r\n\topacity: 0.2;\r\n\tline-height: 1.0;\r\n}\r\n\r\n#text-layer2 > div {\r\n\tcolor: transparent;\r\n\tposition: absolute;\r\n\twhite-space: pre;\r\n\tcursor: text;\r\n\ttransform-origin: 0% 0%;\r\n}\r\n\r\n</style>\r\n\t\t<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css\" />\r\n\t\t<link href=\"https://cdnjs.cloudflare.com/ajax/libs/survey-jquery/1.7.12/survey.css\" type=\"text/css\" rel=\"stylesheet\" />\r\n</head>\r\n<body>\r\n\t<br />\r\n\r\n\t\t<div class=\"ui disabled inverted dimmer\" id=\"taskLoaderPDF\">\r\n\t\t  <div class=\"ui indeterminate text loader\">Preparing Task</div>\r\n\t\t</div>\r\n\t\r\n\r\n\t\t<div class=\"row skeleton\">\r\n\t\t\t\t<div id=\"question\" class=\"col-md-12 col-lg-12\">\r\n\t\t\t\t\t<p style=\"font-size:40px;padding: 20px;\" id=\"Titulo\"></p>\r\n\t\t\t</div>\r\n\r\n\t\t\t\r\n\t\t\t<div class=\"row skeleton\">\r\n\t\t\t\t<!-- Answer buttons -->\r\n\t\t\t\t<div id=\"answer\"  class=\"col-md-12 col-lg-12\" style=\"text-align:center;\">\r\n\t\t\t\t\t<!-- ***Survey Container for either pre-questionnaire or post-questionnaire.***-->\r\n\t\t\t\t\t<div id=\"surveyContainer\"  style=\"display: none;\"></div>\r\n\r\n\t\t\t\t\t<p id=\"task2_confidence\"  style=\"display: none;\">\r\n\t\t\t\t\t\t<label>What is your level of confidence about this decision? [1 to 5]   </label>\r\n\t\t\t\t\t\t<input type=\"number\" id=\"confidenceInput\" name=\"confidenceInput\" min=\"1\" max=\"5\">\r\n\t\t\t\t\t</p>\r\n\r\n\t\t\r\n\t\t\t\t\t<div id=\"T5info\"  style=\"display: none;\">\r\n\t\t\t\t\t\t<label id=\"T5infoTitle\"></label>\r\n\t\t\t\t\t\t<form class=\"form-inline\">\r\n\t\t\t\t\t\t\t<textarea id=\"textT5\" rows=\"3\" style=\"width:100%;\"></textarea>\r\n\t\t\t\t\t\t</form>\r\n\t\t\t\t\t\t<button id=\"t6button\" class=\"btn btn-success btn-answer\">Submit</button>\r\n\t\t\t\t\t</div>\r\n\r\n\t\t\t\r\n\t\t\t\t\t<div id=\"YesNoIDK\" style=\"padding-bottom: 15px;\" style=\"display: none;\">\r\n\t\t\t\t\t\t<!-- If the user clicks this button, the saved answer will be value=\"yes\"-->\r\n\t\t\t\t\t\t<button class=\"btn btn-success btn-answer\" value='Yes'>Yes</button>\r\n\t\t\t\t\t\t<!-- If the user clicks this button, the saved answer will be value=\"no\"-->\r\n\t\t\t\t\t\t<button class=\"btn btn-danger btn-answer\" value='No'>No</button>\r\n\t\t\t\t\t\t<!-- If the user clicks this button, the saved answer will be value=\"NotKnown\"-->\r\n\t\t\t\t\t\t<button class=\"btn btn-answer\" value='NotKnown'>I don't know</button>\r\n\t\t\t\t\t</div>\r\n\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t<!-- ***Beggining the layout for the pdf container.***-->\r\n\t\t\t\t\r\n\t\t\t\t\t<div id=\"pdf-main-container\"  style=\"display: none;\"> \r\n\r\n\t\t\t\t\t\t<div id=\"pdf-loader\">Loading document ...</div>\r\n\t\t\t\t\t\t<div id=\"pdf-contents\">\r\n\t\t\t\t\t\t\t<div id=\"page-loader\">Loading page ...</div>\r\n\t\t\t\t\t\t\t<div class=\"ui center aligned container\">\r\n\t\t\t\t\t\t\t\t<button class=\"btn btn-zoom\" value=0>1:1</button>\r\n\t\t\t\t\t\t\t\t<button class=\"btn btn-zoom\" value=-1>\r\n\t\t\t\t\t\t\t\t\t<i class=\"fa fa-white fa-search-minus\"></i>\r\n\t\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t\t\t<button class=\"btn btn-zoom\" value=1>\r\n\t\t\t\t\t\t\t\t\t<i class=\"fa fa-white fa-search-plus\"></i>\r\n\t\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t<div class=\"ui center aligned container\">\r\n\t\t\t\t\t\t\t\t<p> \r\n\t\t\t\t\t\t\t\t\t<span id=\"pdfVisualizationSuggestion\" class=\"label label-info\">If the pdf file(s) cannot be visualized correctly, please click in the above zoom buttons!</span>\r\n\t\t\t\t\t\t\t\t</p>\r\n\t\t\t\t\t\t\t\t<br/>\r\n\t\t\t\t\t\t\t</div>\r\n\r\n\r\n\t\t\t\t\t\t\t<div class=\"ui stackable grid container \">\r\n\t\t\t\t\t\t\t\t<div class=\"sixteen wide column\" style=\"margin: 0 auto;\" id=\"pdfViewer\" style=\"display: none;\">\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<div style=\"margin: 0 auto;\">\r\n\t\t\t\t\t\t\t\t\t\t<button id=\"pdf-prev\" class=\"btn btn-navigate disabled\" value=\"prev\" style=\"  display: inline-block;\">\r\n\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-arrow-left\"></i> Previous\r\n\t\t\t\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t<div id=\"pages\" style=\"  display: inline-block;\">\r\n\t\t\t\t\t\t\t\t\t\t\t<div id=\"page-count-container\">Page \r\n\t\t\t\t\t\t\t\t\t\t\t\t<div id=\"pdf-current-page\"></div> of \r\n\t\t\t\t\t\t\t\t\t\t\t\t<div id=\"pdf-total-pages\"> </div>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t<button id=\"pdf-next\" class=\"btn btn-navigate\" value=\"next\" style=\"  display: inline-block;\">Next \r\n\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-arrow-right\"></i>\r\n\t\t\t\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t\t<canvas id=\"pdf-canvas\" ></canvas>\r\n\t\t\t\t\t\t\t\t\t<div id=\"text-layer\"></div>\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t<div class=\"eight wide column\"  id=\"pdfViewer_2\" style=\"display: none;\">\r\n\t\t\t\r\n\t\t\t\t\t\t\t\t\t<!-- ***Beggining the layout of the optional second PDF Viewer. It is necessary to include the eight wide column as part of the second PDF Viewer, due to problems in calculating the offset for the text layer logic.***-->\r\n\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t<div style=\"margin: 0 auto;\">\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t<button id=\"pdf-prev2\" class=\"btn btn-navigate disabled\" value=\"prev\" style=\"  display: inline-block;\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-arrow-left\"></i> Previous\r\n\t\t\t\t\t\t\t\t\t\t\t</button>\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t<div id=\"pages2\" style=\"  display: inline-block;\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t<div id=\"page-count-container2\">Page \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div id=\"pdf-current-page2\"></div> of \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div id=\"pdf-total-pages2\"> </div>\r\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t<button id=\"pdf-next2\" class=\"btn btn-navigate\" value=\"next\" style=\"  display: inline-block;\">Next \r\n\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-arrow-right\"></i>\r\n\t\t\t\t\t\t\t\t\t\t</button>\r\n\r\n\t\t\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t<canvas id=\"pdf-canvas2\" ></canvas>\r\n\t\t\t\t\t\t\t\t\t\t<div id=\"text-layer2\"></div>\r\n\t\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t\t\t\t<!-- ***End the layout of the optional second PDF Viewer***-->\r\n\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t</div>\r\n\t\t\t\t<div id=\"taskStats\">\r\n\t\t\t\t\r\n\t\t\t\t<p>You have completed: \r\n\t\t\t\t\t<span id=\"done\" class=\"label label-info\"></span> tasks from\r\n\r\n\t\t\t\t\t<span id=\"total\" class=\"label label-inverse\"></span>\r\n\t\t\t\t</p>\r\n\t\t\t\t<div class=\"progress progress-striped\">\r\n\t\t\t\t\t<div id=\"progress\" rel=\"tooltip\" title=\"#\" class=\"progress-bar\" style=\"width: 0%;\"></div>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</div>\r\n\t\t</div>\r\n\r\n\r\n\t\t\t\t\t<script src=\"https://cdnjs.cloudflare.com/ajax/libs/pdf.js/1.9.661/pdf.min.js\" type=\"text/javascript\" ></script>\r\n\t\t\t\t\t<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js\"></script>\r\n\t\t\t\t\t<script src=\"https://code.jquery.com/ui/1.9.1/jquery-ui.js\"></script>\r\n\t\t\t\t\r\n\t\t\t\t\t<script src=\"https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js\"></script>\r\n\t\t\t\t\t<script src=\"https://raw.githubusercontent.com/mozilla/pdf.js/master/web/ui_utils.js\"></script>\r\n\t\t\t\t\t<script src=\"https://cdnjs.cloudflare.com/ajax/libs/survey-jquery/1.7.12/survey.jquery.min.js\"></script>\r\n<script>\r\nfunction checkASD(survey) {\r\n  // Get the answers from page 2\r\n  const page2Data = survey.data.asd_screening_questions;\r\n\r\n  // Check if the answers meet the specified criteria\r\n  const passedASD = page2Data.q1 <= 3 && page2Data.q2 <= 3 && page2Data.q3 >= 4 &&\r\n    page2Data.q4 <= 4 && page2Data.q5 <= 2 && page2Data.q6 >= 4 && page2Data.q7 <= 3 &&\r\n    page2Data.q8 >= 4 && page2Data.q9 >= 4 && page2Data.q10 <= 3 && page2Data.q11 >= 4 &&\r\n    page2Data.q12 >= 4 && page2Data.q13 >= 4 && page2Data.q14 >= 4 && page2Data.q15 <= 2 &&\r\n    page2Data.q16 <= 3;\r\n\r\n  // Set the custom property \"passed\" to indicate if the user passed the ASD screening\r\n  console.log(\"Passed ASD: Boolean \" + passedASD);\r\n}\r\n  \r\n  \r\nvar surveyCode=Math.floor(100000 + Math.random() * 900000);\r\n\r\n//Survey.StylesManager.applyTheme(\"modern\");\r\nvar surveyPreQuestionnaireJSON = {  \"title\": \"Questionnaire\",  \"showProgressBar\": \"top\",  \"pages\": [{   \"name\": \"page1\",   \"elements\": [{    \"type\": \"panel\",    \"name\": \"panel_sociodemographic\",    \"title\": \"Section 1 - Sociodemographic Screening\",    \"elements\": [{     \"type\": \"text\",     \"name\": \"age\",     \"title\": \"Age:\",     \"isRequired\": true    }, {     \"type\": \"text\",     \"name\": \"gender\",     \"title\": \"Gender:\",     \"isRequired\": true    }, {     \"type\": \"text\",     \"name\": \"education_level\",     \"title\": \"Level of education:\",     \"isRequired\": true    }, {     \"type\": \"text\",     \"name\": \"nationality\",     \"title\": \"Nationality:\",     \"isRequired\": true    }, {     \"type\": \"text\",     \"name\": \"autism_diagnosis\",     \"title\": \"Have you been diagnosed with Autism Spectrum Disorder by a qualified healthcare professional?\",     \"isRequired\": true    }, {     \"type\": \"text\",     \"name\": \"autism_diagnosis_details\",     \"title\": \"If so, when did it happen and where?\",     \"isRequired\": true    }, {     \"type\": \"text\",     \"name\": \"adhd_diagnosis\",     \"title\": \"Have you been diagnosed with Attention Deficit Hyperactivity Disorder by a qualified health professional?\",     \"isRequired\": true    }, {     \"type\": \"text\",     \"name\": \"adhd_diagnosis_details\",     \"title\": \"If so, when did it happen and where?\",     \"isRequired\": true    }]   }]  }, {   \"name\": \"page2\",   \"elements\": [{    \"type\": \"panel\",    \"name\": \"panel_asd_screening\",    \"title\": \"Section 2 - ASD Screening\",    \"elements\": [{     \"type\": \"matrix\",     \"name\": \"asd_screening_questions\",     \"title\": \"Generally...\",     \"isRequired\": true,     \"columns\": [{      \"value\": 1,      \"text\": \"never\"     }, {      \"value\": 2,      \"text\": \"rarely\"     }, {      \"value\": 3,      \"text\": \"sometimes\"     }, {      \"value\": 4,      \"text\": \"oftentimes\"     }, {      \"value\": 5,      \"text\": \"almost always\"     }, {      \"value\": 6,      \"text\": \"always\"     }],     \"rows\": [{      \"value\": \"q1\",      \"text\": \"I can understand the perspective of others\"     }, {      \"value\": \"q2\",      \"text\": \"I can understand the context of a situation through other people's body language\"     }, {      \"value\": \"q3\",      \"text\": \"Can't/don't like to make eye contact for more than a few seconds\"     }, {      \"value\": \"q4\",      \"text\": \"Casual conversations put me completely at ease\"     }, {      \"value\": \"q5\",      \"text\": \"I show compassion when people are feeling sad/bad\"     }, {      \"value\": \"q6\",      \"text\": \"I feel that there is an \u201cinstruction manual\u201d when it comes to social interactions and I am not sure how to follow it\"     }, {      \"value\": \"q7\",      \"text\": \"I find it easy to \u201cmake conversation\u201d and have casual conversations\"     }, {      \"value\": \"q8\",      \"text\": \"I cannot differentiate between a sense of humor and the use of sarcasm and irony\"     }, {      \"value\": \"q9\",      \"text\": \"I try to limit my social contact as much as possible\"     }, {      \"value\": \"q10\",      \"text\": \"I don't have very specific interests, I'm a person with varied interests\"     }, {      \"value\": \"q11\",      \"text\": \"I have few areas in which I feel interest, but the ones I feel, I have above average knowledge in them\"     }, {      \"value\": \"q12\",      \"text\": \"I like repetitive movements, I feel that they comfort me (moving certain parts of the body repeatedly, biting my nails, touching my hair, etc.)\"     }, {      \"value\": \"q13\",      \"text\": \"I think I've been physically uncoordinated for as long as I can remember\"     }, {      \"value\": \"q14\",      \"text\": \"Certain sounds, textures, aromas, and flavors can annoy me immensely\"     }, {      \"value\": \"q15\",      \"text\": \"I don't like it when life becomes routine, I prefer unpredictability\"     }, {      \"value\": \"q16\",      \"text\": \"If something in my day-to-day life is done differently, I don't care too much.\"     }]    }]   }]  }, {   \"name\": \"page3\",   \"elements\": [{    \"type\": \"panel\",    \"name\": \"panel_adhd_screening\",    \"title\": \"Section 3 - ADHD Screening\",    \"elements\": [{     \"type\": \"matrix\",     \"name\": \"adhd_screening_questions\",     \"title\": \"Generally...\",     \"columns\": [{      \"value\": 1,      \"text\": \"never\"     }, {      \"value\": 2,      \"text\": \"rarely\"     }, {      \"value\": 3,      \"text\": \"sometimes\"     }, {      \"value\": 4,      \"text\": \"oftentimes\"     }, {      \"value\": 5,      \"text\": \"almost always\"     }, {      \"value\": 6,      \"text\": \"always\"     }],     \"rows\": [{      \"value\": \"q1\",      \"text\": \"I find it difficult to finish a project once the challenging part is over\"     }, {      \"value\": \"q2\",      \"text\": \"I have no difficulty keeping my things in order when I have a task to do that requires organization\"     }, {      \"value\": \"q3\",      \"text\": \"I have trouble remembering appointments or obligations\"     }, {      \"value\": \"q4\",      \"text\": \"I avoid or delay starting a more demanding task\"     }, {      \"value\": \"q5\",      \"text\": \"I don't usually fidget in my seat, no matter how long I have to sit down\"     }, {      \"value\": \"q6\",      \"text\": \"I feel very active and willing to do all sorts of things, as if I were connected to a motor\"     }, {      \"value\": \"q7\",      \"text\": \"I don't tend to make careless mistakes when I have to work on a project, even if it is difficult or uninteresting\"     }, {      \"value\": \"q8\",      \"text\": \"I have difficulty sustaining my attention when I find myself doing repetitive or uninteresting work\"     }, {      \"value\": \"q9\",      \"text\": \"I find it difficult to concentrate on what people say to me, even when they say it directly to me\"     }, {      \"value\": \"q10\",      \"text\": \"It is not customary to \u201close\u201d or \u201cforget\u201d where I have kept things at home or at work\"     }, {      \"value\": \"q11\",      \"text\": \"The sounds around me don't distract me\"     }, {      \"value\": \"q12\",      \"text\": \"I realize that I end up \u201ctalking too much\u201d in social situations\"     }, {      \"value\": \"q13\",      \"text\": \"When I'm having a conversation, I find myself finishing the sentences of the people I'm talking to before they can finish themselves\"     }, {      \"value\": \"q14\",      \"text\": \"I have no trouble waiting my turn, whatever the occasion\"     }, {      \"value\": \"q15\",      \"text\": \"I interrupt others, even when they are busy\"     }]    }]   }]  }, {   \"name\": \"page4\",   \"elements\": [{    \"type\": \"panel\",    \"name\": \"panel_education_employability\",    \"title\": \"Section 4 - Questions about education and employability as a person with SEN - special educational needs\",    \"elements\": [{     \"type\": \"comment\",     \"name\": \"school_career\",     \"title\": \"How do you consider your school career in childhood and adolescence?\",     \"isRequired\": true    }, {     \"type\": \"comment\",     \"name\": \"difficulties_encountered\",     \"title\": \"Have you encountered any difficulties?\",     \"isRequired\": true    }, {     \"type\": \"comment\",     \"name\": \"bullying_victim\",     \"title\": \"Have you ever been a victim of bullying?\",     \"isRequired\": true    }, {     \"type\": \"comment\",     \"name\": \"academic_career\",     \"title\": \"How is your academic career going?\",     \"isRequired\": true    }, {     \"type\": \"comment\",     \"name\": \"difficulty_feeling\",     \"title\": \"Do you feel any difficulty?\",     \"isRequired\": true    }, {     \"type\": \"comment\",     \"name\": \"future_with_sen\",     \"title\": \"How do you think your future will be, taking into account your SEN?\",     \"isRequired\": true    }, {     \"type\": \"comment\",     \"name\": \"employability_difficulty\",     \"title\": \"Do you consider that employability will be more difficult as a person with SEN?\",     \"isRequired\": true    }]   }]  }],  \"onComplete\": \"checkASD\" };\r\n    //{\"title\":\"Pre-Questionnaire | AuthCrowd \",\"description\":\"We are researchers investigating the use of crowdsourcing for author name disambiguation and entity matching in heterogeneous bibliographic networks. The results of this study will be used as input to the design of a system that will be developed within the SciCrowd project, a hybrid approach for supporting scholars, students, and general public on their scientific research activities. Thank you for taking the time to answer these questions.\",\"pages\":[{\"name\":\"page1\",\"elements\":[{\"type\":\"html\",\"name\":\"panelDisclaimer\",\"readOnly\":true,\"title\":\"Disclaimer\",\"html\":\"Disclaimer: The data provided in this questionnaire can be used by the SciCrowd project research team for evaluating the participants' behavior in crowdsourcing research tasks. Results of the project will be published in scientific publications and technical reports. Rest assured that the information you share here is confidential and this questionnaire will be used for research purposes only. By filling and submitting this form you agree to provide your data to the SciCrowd project research team for the described purposes. Any questions please send them to antonio.g.correia@inesctec.pt\",\"state\":\"expanded\"},{\"type\":\"radiogroup\",\"name\":\"gender\",\"title\":\"What is your gender?\",\"isRequired\":true,\"choices\":[{\"value\":\"item1\",\"text\":\"Female\"},{\"value\":\"item2\",\"text\":\"Male\"},{\"value\":\"item3\",\"text\":\"Other\"},{\"value\":\"item4\",\"text\":\"Prefer not to answer\"}],\"otherText\":\"Prefer not to answer\"},{\"type\":\"radiogroup\",\"name\":\"age\",\"title\":\"What is your age?\",\"isRequired\":true,\"choices\":[{\"value\":\"item1\",\"text\":\"18-24\"},{\"value\":\"item2\",\"text\":\"25-34\"},{\"value\":\"item3\",\"text\":\"35-44\"},{\"value\":\"item4\",\"text\":\"45-54\"},{\"value\":\"item5\",\"text\":\"55-64\"},{\"value\":\"item6\",\"text\":\"65 or more\"}]},{\"type\":\"radiogroup\",\"name\":\"levelEducation\",\"title\":\"What is the highest level of education you have completed?\",\"isRequired\":true,\"hasOther\":true,\"choices\":[{\"value\":\"item1\",\"text\":\"Less than High School Diploma\"},{\"value\":\"item2\",\"text\":\"High School Diploma\"},{\"value\":\"item4\",\"text\":\"Bachelor's Degree\"},{\"value\":\"item5\",\"text\":\"Master's Degree\"},{\"value\":\"item6\",\"text\":\"Doctoral Degree\"}],\"otherText\":\"Other\"},{\"type\":\"dropdown\",\"name\":\"proficiencyOnline\",\"title\":\"I am proficient in performing online tasks\",\"isRequired\":true,\"choices\":[{\"value\":\"item1\",\"text\":\"Strongly Disagree\"},{\"value\":\"item2\",\"text\":\"Disagree\"},{\"value\":\"item3\",\"text\":\"Agree\"},{\"value\":\"item4\",\"text\":\"Strongly Agree\"}]},{\"type\":\"dropdown\",\"name\":\"familiarDisambiguation\",\"title\":\"I am familiar with name disambiguation problems\",\"isRequired\":true,\"choices\":[{\"value\":\"item1\",\"text\":\"Strongly Disagree\"},{\"value\":\"item2\",\"text\":\"Disagree\"},{\"value\":\"item3\",\"text\":\"Agree\"},{\"value\":\"item4\",\"text\":\"Strongly Agree\"}]},{\"type\":\"panel\",\"name\":\"thankYouLabel\",\"readOnly\":true,\"title\":\"Thank You!\"}]}]}\r\n\r\nvar surveyPostQuestionnaireJSON = {\"title\":\"Post-Questionnaire | AuthCrowd Feedback\",\"pages\":[{\"name\":\"page1\",\"elements\":[{\"type\":\"rating\",\"name\":\"question21\",\"title\":\"Overall reaction to the AuthCrowd system itself\",\"isRequired\":true,\"rateValues\":[{\"value\":1,\"text\":\"1\"},2,3,4,{\"value\":5,\"text\":\"5\"}],\"minRateDescription\":\"terrible\",\"maxRateDescription\":\"wonderful\"},{\"type\":\"rating\",\"name\":\"question1\",\"title\":\"Starting up (ease of use)\",\"isRequired\":true,\"minRateDescription\":\"difficult\",\"maxRateDescription\":\"easy\"},{\"type\":\"rating\",\"name\":\"question2\",\"title\":\"Perceived utility\",\"isRequired\":true,\"minRateDescription\":\"frustrating\",\"maxRateDescription\":\"satisfying\"},{\"type\":\"rating\",\"name\":\"question3\",\"title\":\"Interface\",\"isRequired\":true,\"minRateDescription\":\"terrible\",\"maxRateDescription\":\"wonderful\"},{\"type\":\"rating\",\"name\":\"question4\",\"title\":\"Reading characters on the screen\",\"isRequired\":true,\"minRateDescription\":\"hard\",\"maxRateDescription\":\"easy\"},{\"type\":\"rating\",\"name\":\"question5\",\"title\":\"Highlighting simplifies task\",\"isRequired\":true,\"minRateDescription\":\"Not at all\",\"maxRateDescription\":\"Very much\"},{\"type\":\"rating\",\"name\":\"question6\",\"title\":\"Organization of information\",\"isRequired\":true,\"minRateDescription\":\"confusing\",\"maxRateDescription\":\"very clear\"},{\"type\":\"rating\",\"name\":\"question7\",\"title\":\"Terminology related to task\",\"isRequired\":true,\"minRateDescription\":\"confusing\",\"maxRateDescription\":\"clear\"},{\"type\":\"rating\",\"name\":\"question8\",\"title\":\"Prompts for input\",\"isRequired\":true,\"minRateDescription\":\"confusing\",\"maxRateDescription\":\"clear\"},{\"type\":\"rating\",\"name\":\"question9\",\"title\":\"Performing tasks is straightforward\",\"isRequired\":true,\"minRateDescription\":\"never\",\"maxRateDescription\":\"always\"},{\"type\":\"rating\",\"name\":\"question10\",\"title\":\"AuthCrowd speed\",\"isRequired\":true,\"minRateDescription\":\"too slow\",\"maxRateDescription\":\"fast enough\"},{\"type\":\"rating\",\"name\":\"question11\",\"title\":\"AuthCrowd reliability\",\"isRequired\":true,\"minRateDescription\":\"unreliable\",\"maxRateDescription\":\"reliable\"},{\"type\":\"rating\",\"name\":\"question12\",\"title\":\"Correcting your mistakes\",\"isRequired\":true,\"minRateDescription\":\"difficult\",\"maxRateDescription\":\"easy\"},{\"type\":\"rating\",\"name\":\"question13\",\"title\":\"Designed for all levels of users\",\"isRequired\":true,\"minRateDescription\":\"never\",\"maxRateDescription\":\"always\"},{\"type\":\"boolean\",\"name\":\"question14\",\"title\":\"Did you know any author?\"},{\"type\":\"text\",\"name\":\"question17\",\"visible\":false,\"visibleIf\": \"{question14} = true\", \"title\": \"Which author(s)?\", \"enableIf\": \"{question14} = true\"},{\"type\":\"boolean\",\"name\":\"question15\",\"title\":\"Would you like to carry on collaborating in this project?\",\"labelTrue\":\"Yes\",\"labelFalse\":\"No\"},{\"type\":\"comment\",\"name\":\"question16\",\"title\":\"Add here any further observations/comments you would like to make (you can comment on the challenges or benefits that you encounter while completing the online tasks and/or make suggestions to improve future projects)\"}],\"title\":\"Evaluate your experience of performing name disambiguation and entity matching tasks using AuthCrowd\"}]}\r\nvar surveyPreQuestionnaire = new Survey.Model(surveyPreQuestionnaireJSON);\r\nsurveyPreQuestionnaire.checkErrorsMode = \"onValueChanged\";\r\nsurveyPreQuestionnaire.onComplete.add(function(survey, options) {\r\n   checkASD(survey);//\r\n});\r\nvar surveyPostQuestionnaire = new Survey.Model(surveyPostQuestionnaireJSON);\r\nsurveyPostQuestionnaire.checkErrorsMode = \"onValueChanged\";\r\nvar userLogTask = null; // contains the log of all actions done by the user while is doing the task\r\nvar pdfRendering=0;\r\n\r\nfunction incrementPdfRenderingAndEnablePDFLoader()\r\n{\r\n\tpdfRendering++;\r\n\r\n\tif(pdfRendering==1)\r\n\t{\t$(\"#taskLoaderPDF\").removeClass( \"disabled\" );\r\n\t\t$(\"#taskLoaderPDF\").addClass( \"active\" );\r\n\t}\r\n}\r\n\r\nfunction subtractPdfRenderingAndDisablePDFLoader()\r\n{\r\n\tif(pdfRendering>0)\r\n\t\tpdfRendering--;\r\n\r\n\tif(pdfRendering==0)\r\n\t\t{$( \"#taskLoaderPDF\" ).removeClass( \"active\" );\r\n\t\t$( \"#taskLoaderPDF\" ).addClass( \"disabled\" );\r\n\r\n\r\n\t\t}\r\n}\r\n\r\n\r\nvar userLog = (function() {\r\n      //\r\n      // Private variables\r\n      //\r\n      var defaults = {\r\n          // Available functionality\r\n          clickCount: true,\r\n          clickDetails: true,\r\n          mouseMovement: false,\r\n          context: true,\r\n          keyLogger: true,\r\n\r\n          // Action Item\r\n          actionItem: {\r\n            processOnAction: false,\r\n            selector: \"\",\r\n            event: \"\"\r\n          },\r\n          processTime: 15,\r\n          processData: function(results) {\r\n            console.log(results);\r\n          }\r\n        },\r\n        // End results, what is shown to the user\r\n    results =null;\r\n\r\n\tvar   support = !!document.querySelector && !!document.addEventListener,\r\n        settings;\r\n      // Helper Functions\r\n      var helperActions = {\r\n        /**\r\n         * Set the timer interval, will increment time on page if the user is\r\n         * active on the page, totalTime counter always increments\r\n         * @private\r\n         */\r\n        timer: function() {\r\n          window.setInterval(function() {\r\n            if (document[\"visibilityState\"] === \"visible\") {\r\n              results.time.timeOnPage++;\r\n            }\r\n            results.time.totalTime++;\r\n          }, 1000);\r\n        },\r\n        /**\r\n         * Detect the X,Y coordinates of the mouse movement\r\n         * @private\r\n         */\r\n        mouseMovement: function() {\r\n          document.addEventListener(\"mousemove\", function() {\r\n            results.mouseMovements.push({\r\n              timestamp: Date.now(),\r\n              x: event.pageX,\r\n              y: event.pageY\r\n            });\r\n          });\r\n        },\r\n        /**\r\n         * Check if the user is navigating to a different page\r\n         * @private\r\n         */\r\n        contextChange: function() {\r\n          document.addEventListener(\"visibilitychange\", function() {\r\n            results.contextChange.push({\r\n              timestamp: Date.now(),\r\n              type: document[\"visibilityState\"]\r\n            });\r\n          });\r\n        },\r\n        /**\r\n         * Log the pasted information and keys pressed\r\n         * @private\r\n         */\r\n        keyLogger: function() {\r\n          document.addEventListener(\"paste\", function() {\r\n            var pastedText = undefined;\r\n            // Get Pasted Text\r\n            if (window.clipboardData && window.clipboardData.getData) {\r\n              pastedText = window.clipboardData.getData(\"Text\");\r\n            } else if (event.clipboardData && event.clipboardData.getData) {\r\n              pastedText = event.clipboardData.getData(\"text/plain\");\r\n            }\r\n\r\n            if (!!pastedText) {\r\n              results.keyLogger.push({\r\n                timestamp: Date.now(),\r\n                data: pastedText,\r\n                type: \"paste\"\r\n              });\r\n            }\r\n          });\r\n          document.addEventListener(\"keyup\", function() {\r\n            var charCode = event.keyCode || event.which,\r\n              charString = String.fromCharCode(charCode);\r\n\r\n            results.keyLogger.push({\r\n              timestamp: Date.now(),\r\n              data: charString,\r\n              type: \"keypress\"\r\n            });\r\n          });\r\n        }\r\n      };\r\n\r\n\t    /**\r\n       * Initialize the results object\r\n       * @public\r\n       */\r\nfunction setInitialResultsObject()\r\n{\r\n\tresults= {\r\n          userInfo: {\r\n            appCodeName: navigator.appCodeName || \"\",\r\n            appName: navigator.appName || \"\",\r\n            vendor: navigator.vendor || \"\",\r\n            platform: navigator.platform || \"\",\r\n            userAgent: navigator.userAgent || \"\"\r\n          },\r\n          time: {\r\n            totalTime: 0,\r\n            timeOnPage: 0\r\n          },\r\n          clicks: {\r\n            clickCount: 0,\r\n            clickDetails: []\r\n          },\r\n          mouseMovements: [],\r\n          contextChange: [],\r\n          keyLogger: []\r\n        };\r\n\r\n}\r\n\r\n\r\n      /**\r\n       * Merge defaults with options\r\n       * @private\r\n       * @param {Object} default settings\r\n       * @param {Object} user options\r\n       * @returns {Object} merged object\r\n       */\r\n      function getSettings(defaults, options) {\r\n        var option;\r\n        for (option in options) {\r\n          if (options.hasOwnProperty(option)) {\r\n            defaults[option] = options[option];\r\n          }\r\n        }\r\n        return defaults;\r\n      }\r\n\r\n      /**\r\n       * Initialize the event listeners\r\n       * @public\r\n       * @param {Object} user options\r\n       */\r\n      function init(options) {\r\n\t\tsetInitialResultsObject();\r\n        if (!support) return;\r\n\r\n        // Extend default options\r\n        if (options && typeof options === \"object\") {\r\n          settings = getSettings(defaults, options);\r\n        } else settings = getSettings(defaults, {});\r\n\r\n        document.addEventListener(\"DOMContentLoaded\", function() {\r\n          // Countdown Timer\r\n          window.setInterval(function() {\r\n            if (document[\"visibilityState\"] === \"visible\") {\r\n              results.time.timeOnPage++;\r\n            }\r\n            results.time.totalTime++;\r\n            // Check if we need to process results\r\n            if (\r\n              settings.processTime > 0 &&\r\n              results.time.totalTime % settings.processTime === 0\r\n            ) {\r\n              processResults();\r\n            }\r\n          }, 1000);\r\n\r\n          // Click registration, increment click counter and save click time+position\r\n          if (settings.clickCount || settings.clickDetails) {\r\n            document.addEventListener(\"mouseup\", function() {\r\n              if (settings.clickCount) {\r\n                results.clicks.clickCount++;\r\n              }\r\n              if (settings.clickDetails) {\r\n                results.clicks.clickDetails.push({\r\n                  timestamp: Date.now(),\r\n                  node: event.target.outerHTML,\r\n                  x: event.pageX,\r\n                  y: event.pageY\r\n                });\r\n              }\r\n            });\r\n          }\r\n\r\n          // Mouse movements\r\n          if (settings.mouseMovement) {\r\n            helperActions.mouseMovement();\r\n          }\r\n\r\n          // Check context change\r\n          if (settings.context) {\r\n            helperActions.contextChange();\r\n          }\r\n\r\n          // Key Logger\r\n          if (settings.keyLogger) {\r\n            helperActions.keyLogger();\r\n          }\r\n\r\n          // Event Listener to porcess\r\n          if (settings.actionItem.processOnAction) {\r\n            var node = document.querySelector(settings.actionItem.selector);\r\n            if (!!!node) throw new Error(\"Selector was not found.\");\r\n            node.addEventListener(settings.actionItem.event, function() {\r\n              return processResults();\r\n            });\r\n          }\r\n        });\r\n      }\r\n\r\n      function processResults() {\r\n        if (settings.hasOwnProperty(\"processData\")) {\r\n          return settings.processData.call(undefined, results);\r\n        }\r\n        return false;\r\n      }\r\n      // Module pattern, only expose necessary methods\r\n      return {\r\n        init: init,\r\n        processResults: processResults,\r\n\t\tsetInitialResultsObject:setInitialResultsObject\r\n      };\r\n    })();\r\n\r\n    getFilteredUserLog = rawLog => {\r\n      var filteredLog = rawLog;\r\n      if (\r\n        rawLog.hasOwnProperty(\"clicks\") &&\r\n        rawLog.clicks.hasOwnProperty(\"clickDetails\")\r\n      ) {\r\n        var clickDetailsFiltered = [];\r\n        rawLog.clicks.clickDetails.forEach(clickDetail => {\r\n          var clickDetailFiltered = clickDetail;\r\n          clickDetailFiltered.node = clickDetailFiltered.node.replace(\r\n            /<img[^>]*>/g,\r\n            \"<img/>\"\r\n          );\r\n          if (\r\n            clickDetailFiltered.node.includes(\"leaflet-touch\") ||\r\n            clickDetailFiltered.node.includes(\"leaflet-touch-zoom \") ||\r\n            clickDetailFiltered.node.includes(\"leaflet-grab\") ||\r\n            clickDetailFiltered.node.includes(\"leaflet-touch-drag\")\r\n          )\r\n            clickDetailFiltered.node =\r\n              \"<div>Inside Leaflet Map - clicked on layer element</div>\";\r\n          clickDetailsFiltered.push(clickDetailFiltered);\r\n        });\r\n        filteredLog.clicks.clickDetails = clickDetailsFiltered;\r\n      }\r\n\r\n\t  if (\r\n        rawLog.hasOwnProperty(\"keyLogger\")\r\n      ) {\r\n\t\tvar clickDetailsFiltered = [];\r\n\r\n\t\trawLog.keyLogger.forEach(clickDetail => {\r\n          var clickDetailFiltered = clickDetail;\r\n          clickDetailFiltered.data = clickDetailFiltered.data.replace(\r\n\t\t\t'\\0', ''\r\n          );\r\n\t\t  clickDetailsFiltered.push(clickDetailFiltered);\r\n\t\t});\r\n\t\tfilteredLog.keyLogger = clickDetailsFiltered;\r\n\t  }\r\n\r\n      return filteredLog;\r\n    };\r\n\r\n    userLog.init({\r\n      processTime: 2,\r\n      processData: function(results) {\r\n        if (typeof userLogTask !== \"undefined\")\r\n          // the variable is defined\r\n          userLogTask = getFilteredUserLog(results);\r\n      }\r\n });\r\n\r\n\r\n\r\n\r\n\r\n$(function () {\r\n\r\n       $( \"#confidenceInput\" ).change(function() {\r\n\t\t   //Validates that the confidence input is in range of the HTML values max abd min\r\n          var max = parseInt($(this).attr('max'));\r\n          var min = parseInt($(this).attr('min'));\r\n          if ($(this).val() > max)\r\n          {\r\n              $(this).val(max);\r\n          }\r\n          else if ($(this).val() < min)\r\n          {\r\n              $(this).val(min);\r\n          }       \r\n        }); \r\n    });\r\n\r\n    class AuthCrowdPDFViewer {\r\n\t\t// This class serves to encapsulate the code related with the PDF Viewer, including the canvas, navigation buttons and zoom options. The object of this class represents one PDF viewer that will be added to the html. It can be inserted on the interface more than one pdf viewer, creating \r\n\r\n    constructor(pdfDocIN, htmlCanvasPDFIdIN,htmlTextLayerPDFIdIN,zoom)\r\n\t{// initiates this object of PDFViewer, by setting the initial properties of the Viewer, including creating the html layout\r\n\t\tthis.pdfDoc=pdfDocIN;\r\n\t\tthis.currentPage=1;\r\n\t\tthis.totalPages=this.pdfDoc.numPages;\r\n\t\tthis.pageRenderingInProcess=0;\r\n\t\tthis.htmlCanvasPDFId=htmlCanvasPDFIdIN;\r\n\t\tthis.htmlTextLayerPDFId=htmlTextLayerPDFIdIN;\r\n\r\n\t\tvar canvas = document.querySelector('#'+htmlCanvasPDFIdIN);\r\n\t\t//this.fitCanvasToContainer(canvas);\r\n\r\n\t\tthis.canvasPDF=  $('#'+htmlCanvasPDFIdIN).get(0);\r\n\t\r\n\r\n\t\tthis.canvasPDFCTX = this.canvasPDF.getContext('2d');\r\n\t\tthis.scale=zoom;\r\n\r\n    }\r\n\t\tgetPDFDoc()\r\n\t\t{ \r\n\t\t\treturn this.pdfDoc;\r\n\t\t}\r\n\r\n\t\tsetCurrentPage(currentPageIN)\r\n\t\t{ \r\n\t\t\tthis.currentPage= currentPageIN;\r\n\t\t}\r\n\t\tgetCurrentPage()\r\n\t\t{ \r\n\t\t\treturn this.currentPage;\r\n\t\t}\r\n\r\n\t\tgetTotalPages()\r\n\t\t{ \r\n\t\t\treturn this.totalPages;\r\n\t\t}\r\n\r\n\t\tsetPageRenderingInProcess(pageRenderingInProcessIN)\r\n\t\t{ \r\n\t\t\tthis.pageRenderingInProcess= pageRenderingInProcessIN;\r\n\t\t}\r\n\r\n\t\tgetPageRenderingInProcess()\r\n\t\t{ \r\n\t\t\treturn this.pageRenderingInProcess;\r\n\t\t}\r\n\r\n\t\tgetCanvasPDF()\r\n\t\t{ \r\n\t\t\treturn this.canvasPDF;\r\n\t\t}\r\n\t\tsetCanvasPDF(canvasPDFIN)\r\n\t\t{ \r\n\t\t\tthis.canvasPDF=canvasPDFIN;\r\n\r\n\t\t}\r\n\t\tgetCanvasPDFCTX()\r\n\t\t{ \r\n\t\t\treturn this.canvasPDFCTX;\r\n\t\t}\r\n\t\tgetHtmlCanvasPDFId()\r\n\t\t{ \r\n\t\t\treturn this.htmlCanvasPDFId;\r\n\t\t}\r\n\t\tsetZoomScale(zoomScale)\r\n\t\t{ \r\n\t\t\tthis.scale= zoomScale;\r\n\t\t}\r\n\r\n\t\tgetZoomScale()\r\n\t\t{ \r\n\t\t\treturn this.scale;\r\n\t\t}\r\n\r\n\t\tgetHtmlTextLayerPDFId()\r\n\t\t{\r\n\t\t\treturn this.htmlTextLayerPDFId;\r\n\t\t}\r\n\r\n\r\n\t\t fitCanvasToContainer(canvas){\r\n\t\t// Make it visually fill the positioned parent\r\n\t\t\tcanvas.style.width ='100%';\r\n\t\t\tcanvas.style.height='100%';\r\n\t\t\t// ...then set the internal size to match\r\n\t\t\tcanvas.width  = canvas.offsetWidth;\r\n\t\t\tcanvas.height = canvas.offsetHeight;\r\n\t}\r\n    }\r\n\r\n\r\n\r\n\r\nvar listPDFViewers=[]; // this list contains the objects AuthCrowdPDFViewer present in the UI\r\n\r\n\r\nfunction sendDataToServer(survey,idTask) {\r\n    //send Ajax request to your web server.\r\n    alert(\"The results are: \" + idTask + JSON.stringify(survey.data));\r\n}\r\nfunction showPDF(pdf_url,pdfCanvasId, pdfTextLayerId,zoom) {\r\n\t//This method will be called for loading the pdf to the UI. First it will appear a loader component to inform the user while the PDF is being loaded, then it will be used the PDFJS to load the PDF file. It will be instatied a AuthCrowdPDFViewer to set the specific UI PDF Viewer properties and save in a global list variable.\r\n\r\n\tincrementPdfRenderingAndEnablePDFLoader();\r\n\r\n\r\n\tPDFJS.getDocument({ url: pdf_url }).then(function(pdf_doc) {\r\n\t\t\r\n\t\t// Instatiate the AuthCrowdPDFViewer with the pdf_doc file and the html id of the pdf-canvas\r\n\t\tlet authCrowdPDFViewer = new AuthCrowdPDFViewer(pdf_doc,pdfCanvasId,pdfTextLayerId,zoom);\r\n\t\tlistPDFViewers.push(authCrowdPDFViewer);\r\n\t\t// Hide the pdf loader and show pdf container in HTML\r\n\t\tsubtractPdfRenderingAndDisablePDFLoader();\r\n\r\n\r\n\t\tlet idPDFTotalPages=\"\";\r\n\t\tif(authCrowdPDFViewer.getHtmlCanvasPDFId()==\"pdf-canvas\")\r\n\t\t\tidPDFTotalPages=\"pdf-total-pages\";\r\n\t\telse if(authCrowdPDFViewer.getHtmlCanvasPDFId()==\"pdf-canvas2\")\r\n\t\t\tidPDFTotalPages=\"pdf-total-pages2\";\r\n\r\n\t\t$(\"#\"+idPDFTotalPages).text(authCrowdPDFViewer.totalPages);\r\n\r\n\t\t// Show the first page\r\n\t\tshowPage(authCrowdPDFViewer,1);\r\n\t\t\r\n\t}).catch(function(error) {\r\n\t\t// If an error occur, alert the user\r\n\t\tsubtractPdfRenderingAndDisablePDFLoader();\r\n\t\t\r\n\t\talert(error.message);\r\n\t});\r\n}\r\nfunction zoom( valueZoom) {\r\n\t//renders the page on the PDF Viewer, and sets the zoom that could be changed inside that method. This will be done in all pdfViewers, as the zoom will be syncronous for all viewers\r\n\tlistPDFViewers.forEach(authCrowdPDFViewerElement => {\r\n\t\tlet changedAuthCrowdPDFViewerElement=renderPageInPdfViewer(authCrowdPDFViewerElement,authCrowdPDFViewerElement.getCurrentPage(), valueZoom)\r\n\t});\r\n\t\r\n\r\n}\r\n\r\nfunction enableDisabledNavButtons(authCrowdPDFViewer){\r\n\t// Inside this method, it will be enabled or diasbled the previous/next buttons of the PDF Viewer. Because in the UI it can be presented multiple PDF Viewers, first it will be identify what is the corresponding ID of the buttons elements.\r\n\t\r\n\tlet pdfPreviousButtonId=\"\";\r\n\tlet pdfNextButtonId=\"\";\r\n\r\n\r\n\tif(authCrowdPDFViewer.getHtmlCanvasPDFId()==\"pdf-canvas\")\r\n\t{\r\n\t\tpdfPreviousButtonId=\"pdf-prev\";\r\n\t\tpdfNextButtonId=\"pdf-next\";\r\n\t}\r\n\telse if (authCrowdPDFViewer.getHtmlCanvasPDFId()==\"pdf-canvas2\")\r\n\t{\r\n\t\tpdfPreviousButtonId=\"pdf-prev2\";\r\n\t\tpdfNextButtonId=\"pdf-next2\";\r\n\t}\r\n\r\n\r\n    if (authCrowdPDFViewer.getCurrentPage() === 1) {\r\n\t\t$(\"#\"+pdfPreviousButtonId).addClass(\"disabled\");\r\n        $(\"#\"+pdfNextButtonId).removeClass(\"disabled\");\r\n       \r\n    }\r\n    else if (authCrowdPDFViewer.getCurrentPage()  ===authCrowdPDFViewer.getTotalPages()) {\r\n        $(\"#\"+pdfPreviousButtonId).removeClass(\"disabled\");\r\n        $(\"#\"+pdfNextButtonId).addClass(\"disabled\");\r\n    }\r\n    else {\r\n        $(\"#\"+pdfPreviousButtonId).removeClass(\"disabled\");\r\n        $(\"#\"+pdfNextButtonId).removeClass(\"disabled\");\r\n    }\r\n}\r\n\r\nfunction renderPageInPdfViewer(authCrowdPDFViewer,page_no, newValueZoom)\r\n{// Fetch the page from the PDF.  Be careful with the rendermethod, because if called multiple times instanteously, it will render the PDF backwards.\r\n\tauthCrowdPDFViewer.getPDFDoc().getPage(page_no).then(function(page) {\r\n\t\t// As the canvas is of a fixed width we need to set the scale of the viewport accordingly\r\n\t\t//var scale_required = __CANVAS.width / page.getViewport(1).width;\r\n\t\t// Get viewport of the page at required scale\r\n\t\r\n\t\tlet valueZoomToUpdate=authCrowdPDFViewer.getZoomScale(); //gets the previous value to be updated\r\n  \t\tif (newValueZoom === 1) {\r\n            valueZoomToUpdate = valueZoomToUpdate + 0.1;\r\n            if (valueZoomToUpdate >= 1.8) {\r\n                valueZoomToUpdate = 1.8;\r\n            }\r\n        }\r\n        if (newValueZoom === -1) {\r\n            valueZoomToUpdate = valueZoomToUpdate - 0.1;\r\n            if (valueZoomToUpdate <= 0.5) {\r\n                valueZoomToUpdate = 0.5;\r\n            }\r\n        }\r\n        if (newValueZoom === 0) {\r\n            valueZoomToUpdate = 0.8;\r\n        }\r\n\r\n\t\tauthCrowdPDFViewer.setZoomScale(valueZoomToUpdate);\r\n\t\tvar viewport = page.getViewport(valueZoomToUpdate);\r\n\r\n\t\t// Set canvas height\r\n\t\tlet __CANVAS = $('#'+authCrowdPDFViewer.getHtmlCanvasPDFId())[0];\r\n\t\t__CANVAS.height = viewport.height;\r\n\t\t__CANVAS.width = viewport.width;\r\n\t\tauthCrowdPDFViewer.setCanvasPDF(__CANVAS);\r\n\r\n\t\tvar renderContext = {\r\n\t\t\tcanvasContext: __CANVAS.getContext('2d'),\r\n\t\t\tviewport: viewport\r\n\t\t};\r\n\t\t\r\n\t\t// Render the page contents in the canvas\r\n\t\tpage.render(renderContext).then(function() {\r\n\t\r\n\r\n\t\t\t// Return the text contents of the page after the pdf has been rendered in the canvas\r\n\t\t\treturn page.getTextContent();\r\n\t\t}).then(function(textContent) {\r\n\t\t\t// Get canvas offset\r\n\t\t\tvar canvas_offset = $(__CANVAS).offset();\r\n\t\t\t\r\n\t\t\t// Clear HTML for text layer\r\n\t\t\t$(\"#\"+authCrowdPDFViewer.getHtmlTextLayerPDFId()).html('');\r\n\r\n\t\t\t// Thanks to this answer (https://stackoverflow.com/a/25934753/5449842), it was found an important aspect: being aware of the parent HTML element offset. This code will fetch the offset of the parent and next discount, to correctly apply the text layer over the canvas.\r\n\t\t\tvar offsetL = $(\"#\"+authCrowdPDFViewer.getHtmlTextLayerPDFId()).parent().offset().left;\r\n\t\t\tvar offsetT = $(\"#\"+authCrowdPDFViewer.getHtmlTextLayerPDFId()).parent().offset().top; \r\n\r\n\r\n\t\t\t// Assign the CSS created to the text-layer element\r\n\t\t\t$(\"#\"+authCrowdPDFViewer.getHtmlTextLayerPDFId()).css({ left: canvas_offset.left-offsetL, top: canvas_offset.top-offsetT , height: __CANVAS.height + 'px', width: __CANVAS.width + 'px' });\r\n\r\n\r\n\r\n\t\t\t// Pass the data to the method for rendering of text over the pdf canvas.\r\n\t\t\tPDFJS.renderTextLayer({\r\n\t\t\t    textContent: textContent,\r\n\t\t\t    container: $(\"#\"+authCrowdPDFViewer.getHtmlTextLayerPDFId()).get(0),\r\n\t\t\t    viewport: viewport,\r\n\t\t\t    textDivs: []\r\n\t\t\t});\r\n\t\t});\r\n\t});\r\n\t\treturn authCrowdPDFViewer;\r\n\t\r\n\t}\r\n\r\n\tfunction showPage(authCrowdPDFViewer,page_no) {\r\n\t//Shows the page from the selected PDFViewer\r\n\tlet idPDFLabelCurrentPage=\"\";\r\n\tif(authCrowdPDFViewer.getHtmlCanvasPDFId()==\"pdf-canvas\")\r\n\t\tidPDFLabelCurrentPage=\"pdf-current-page\";\r\n\telse if(authCrowdPDFViewer.getHtmlCanvasPDFId()==\"pdf-canvas2\")\r\n\t\tidPDFLabelCurrentPage=\"pdf-current-page2\";\r\n\r\n\tauthCrowdPDFViewer.setCurrentPage(page_no)\r\n\r\n\tenableDisabledNavButtons(authCrowdPDFViewer);\r\n\t// Update current page in HTML\r\n\r\n\t$(\"#\"+idPDFLabelCurrentPage).text(page_no);\r\n\t//renders the page on the PDF Viewer, and sets the zoom that could be changed inside that method. For the show page, the valueZoom is the value already defined in the PDFViewer. But in the zoom method, the value passed is the updated value chosen from the user.\r\n\tlet changedAuthCrowdPDFViewerElement=renderPageInPdfViewer(authCrowdPDFViewer,page_no, authCrowdPDFViewer.getZoomScale())\r\n\r\n\t\r\n\t}\r\n\r\nfunction getAuthCrowdPDFViewerFromHTMLCanvasID(canvasID)\r\n{// returns the AuthCrowdPDFViewer if exists on the listPDFViewers, from the canvasID of the respective HTML Tag\r\n\t\r\n\tlet authCrowdPDFViewer=null;\r\n\tlistPDFViewers.forEach(authCrowdPDFViewerElement => {\r\n\t\tif(authCrowdPDFViewerElement.getHtmlCanvasPDFId()==canvasID)\r\n\t\tauthCrowdPDFViewer=authCrowdPDFViewerElement;\r\n\t});\r\n\t return authCrowdPDFViewer;\r\n}\r\n\r\n\r\nfunction goToPreviousPageOnThePDFViewer(idPreviousPDFViewerButton)\r\n{// From the Id of the HTML Previous PDF button, it will be determined what is the corresponding pdf-canvas Id and subsquently, call the method to go back one page (if it is not in the first page) on the respective PDFViewer.\r\n\r\n\tlet pdfCanvasIdFromButtonId=null;\r\n\tif (idPreviousPDFViewerButton==\"pdf-prev\")\r\n\t\tpdfCanvasIdFromButtonId=\"pdf-canvas\"\r\n\telse if(idPreviousPDFViewerButton==\"pdf-prev2\")\r\n\t\tpdfCanvasIdFromButtonId=\"pdf-canvas2\"\r\n\r\n\t\r\n\tlet authCrowdPDFViewerToUpdate=getAuthCrowdPDFViewerFromHTMLCanvasID(pdfCanvasIdFromButtonId);\r\n\r\n\tif(authCrowdPDFViewerToUpdate!=null && authCrowdPDFViewerToUpdate.getCurrentPage() != 1)\r\n\t\t// This condition verifies  that the pdfViewer exist and the current page is not one and then calls the showPage that renders the respective page and updates the pdfViewer to set the current page number.\r\n\t\tshowPage(authCrowdPDFViewerToUpdate,authCrowdPDFViewerToUpdate.getCurrentPage()-1);\r\n\r\n}\r\n\r\n\r\nfunction goToNextPageOnThePDFViewer(idNextPDFViewerButton)\r\n{// From the Id of the HTML Next PDF button, it will be determined what is the corresponding pdf-canvas Id and subsquently, call the method to move on to the next page  (if it is not in the last page) on the respective PDFViewer.\r\n\r\n\tlet pdfCanvasIdFromButtonId=null;\r\n\tif (idNextPDFViewerButton==\"pdf-next\")\r\n\t\tpdfCanvasIdFromButtonId=\"pdf-canvas\"\r\n\telse if(idNextPDFViewerButton==\"pdf-next2\")\r\n\t\tpdfCanvasIdFromButtonId=\"pdf-canvas2\"\r\n\r\n\tlet authCrowdPDFViewerToUpdate=getAuthCrowdPDFViewerFromHTMLCanvasID(pdfCanvasIdFromButtonId);\r\n\t\r\n\tif(authCrowdPDFViewerToUpdate!=null && authCrowdPDFViewerToUpdate.getCurrentPage() != authCrowdPDFViewerToUpdate.getTotalPages())\r\n\t\t// This condition verifies  that the pdfViewer exist and the current page is not the number of total pages and then calls the showPage that renders the respective page and updates the pdfViewer to set the current page number.\r\n\t\tshowPage(authCrowdPDFViewerToUpdate,authCrowdPDFViewerToUpdate.getCurrentPage()+1);\r\n\t\r\n}\r\n\r\n$(\"#pdf-prev\").on('click', function() {\r\n\t// Previous page of the PDF\r\n\tgoToPreviousPageOnThePDFViewer(\"pdf-prev\");\r\n});\r\n\r\n$(\"#pdf-next\").on('click', function() {\r\n\t// Next page of the PDF\r\n\tgoToNextPageOnThePDFViewer(\"pdf-next\")\r\n});\r\n\r\n$(\"#pdf-prev2\").on('click', function() {\r\n\t// Previous page of the PDF\r\n\tgoToPreviousPageOnThePDFViewer(\"pdf-prev2\");\r\n});\r\n\r\n$(\"#pdf-next2\").on('click', function() {\r\n\t// Next page of the PDF\r\n\tgoToNextPageOnThePDFViewer(\"pdf-next2\")\r\n});\r\n\r\n\r\nfunction loadUserProgress() {\r\n\t// Shows user statistics on the progress for the tasks performed and to perform\r\n    pybossa.userProgress('authcrowd').done(function(data){\r\n        var pct = Math.round((data.done*100)/data.total);\r\n        $(\"#progress\").css(\"width\", pct.toString() +\"%\");\r\n        $(\"#progress\").attr(\"title\", pct.toString() + \"% completed!\");\r\n        $(\"#progress\").tooltip({'placement': 'left'}); \r\n        $(\"#total\").text(data.total);\r\n        $(\"#done\").text(data.done);\r\n    });\r\n}\r\n\r\nfunction cleanAndResetVariablesForNewTask()\r\n{ //Cleans and restore the variables and layout for the new task\r\n\r\n\t$('#Titulo').html(\"\");\r\n\t$('#confidenceInput').val(\"\");\r\n\tif($('#pdfViewer').hasClass(\"eight\") && $('#pdfViewer').hasClass(\"wide\") && $('#pdfViewer').hasClass(\"column\")  )\r\n\t{$('#pdfViewer').removeClass(\"eight wide column\")\r\n\t$('#pdfViewer').addClass(\"sixteen wide column\");\r\n\t}\r\n\t$('#pdf-canvas').html(\"\");\r\n\t$('#pdf-canvas2').html(\"\");\r\n\r\n\t$('#pdfViewer').css('display','none');\r\n\t$('#pdfViewer_2').css('display','none');\r\n\t$('#pdf-main-container').css('display','none');\r\n\t$(\"#surveyContainer\").html(\"\");\r\n\t$('#surveyContainer').css('display','none');\r\n\r\n\tlistPDFViewers=[];\r\n\r\n\t$('#task2_confidence').css('display','none');\r\n    $('#MultipleChoice').css('display','none');\r\n\t$('#T5info').css('display','none');\r\n\r\n\t//cleans the log object\r\n\tuserLogTask = null;\r\n\tuserLog.setInitialResultsObject();\r\n\tpybossaNotify(\"Ooops! You have to fill all the fields. Please set the confidence level!\", false, \"error\");\r\n\tpybossaNotify(\"Ooops! You have to fill all the fields.\", false, \"error\");\r\n}\r\n\r\npybossa.taskLoaded(function(task, deferred)\r\n{//The task loaded method will be loaded the current task and the next one to otimize performance (see https://stackoverflow.com/a/44848986/5449842). However for this project and to Keep it Simple S ;), it will be ignore this method and do the loading stuff on presentTask\r\n    if ( !$.isEmptyObject(task) ) {\r\n  \r\n        if (task.state=='completed') {\r\n            $('#answer').hide();\r\n            $('#taskcompleted').show();\r\n        }\r\n\r\n\t\tdeferred.resolve(task);\r\n    \r\n    }\r\n    else {\r\n        deferred.resolve(task);\r\n    }\r\n\r\n});\r\nfunction submitTask(task,deferred, buttonValue){\r\n\t\r\n\tlet readyToSubmitTaskBool=false; // This variable will be set true if in the respective type of task, is decided that is ready to submit the task. Else it will be kept false so that the task is not submitted and the user could correct/edit the answer (Meanwhile, it could be shown a notification regarding some errors or lack of fields required).\r\n\t\tlet answer={}; // variable to store the answer from the crowdworker\r\n\t\t\tswitch(task.info.idTypeOfTask){\r\n\t\t\t\tcase 0:\r\n                     answer = {'answer':  surveyPreQuestionnaire.data};\r\n\t\t\t\t\treadyToSubmitTaskBool=true;\r\n                    break;\r\n                case 1:\r\n                     answer = {'answer': buttonValue};\r\n\t\t\t\t\treadyToSubmitTaskBool=true;\r\n                    break;\r\n                case 2:\r\n                    if(document.getElementById('confidenceInput').value==\"\"||document.getElementById('confidenceInput').value==null){\r\n\t\t\t\t\t\tpybossaNotify(\"Ooops! You have to fill all the fields. Please set the confidence level!\", true, \"error\");\r\n\t\t\t\t\t\treadyToSubmitTaskBool=false;\r\n                    }\r\n                    else{\r\n                        answer = {\r\n                            'answer':buttonValue,\r\n                            'confidence': document.getElementById('confidenceInput').value\r\n                        };\r\n\t\t\t\t\t\treadyToSubmitTaskBool=true;\r\n                    }\r\n                    break;\r\n\r\n                case 3:\r\n                    answer = {'answer':buttonValue};\r\n\t\t\t\t\treadyToSubmitTaskBool=true;\r\n                    break;\r\n                \r\n                case 4:\r\n                    if(document.getElementById('fname').value==\"\"||document.getElementById('fname').value==null){\r\n\t\t\t\t\t\treadyToSubmitTaskBool=false;\r\n                        pybossaNotify(\"Ooops! You have to fill all the fields.\", true, \"error\");\r\n                    }\r\n                    else{\r\n                        answer = {\r\n                            'answer': $('#multi-select').val(),\r\n                            'reasoning': document.getElementById('fname').value\r\n                        };\r\n\t\t\t\t\t\treadyToSubmitTaskBool=true;\r\n                    }\r\n                    break;\r\n                \r\n                case 5:\r\n                    if(document.getElementById('textT5').value==\"\"||document.getElementById('textT5').value==null){\r\n\t\t\t\t\t\treadyToSubmitTaskBool=false;\r\n                        pybossaNotify(\"Ooops! You have to fill all the fields.\", true, \"error\");\r\n                    }\r\n                    else{\r\n                        answer = {\r\n                            'answer':buttonValue,\r\n                            'info': document.getElementById('textT5').value\r\n                        };\r\n                        document.getElementById('textT5').value=\"\";\r\n\t\t\t\t\t\treadyToSubmitTaskBool=true;\r\n                    }\r\n                    break;\r\n                \r\n                case 6:\r\n                    if(document.getElementById('textT5').value==\"\"||document.getElementById('textT5').value==null){\r\n\t\t\t\t\t\treadyToSubmitTaskBool=false;\r\n                        pybossaNotify(\"Ooops! You have to fill all the fields.\", true, \"error\");\r\n                    }\r\n                    else{\r\n                        answer = {\r\n                            'answer': document.getElementById('textT5').value\r\n                        };\r\n\t\t\t\t\t\treadyToSubmitTaskBool=true;\r\n                    }\r\n                    break;\r\n                case 7:\r\n                    answer = {'answer':  surveyPostQuestionnaire.data};\r\n\t\t\t\t\treadyToSubmitTaskBool=true;\r\n                    break;\r\n                default:\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\t\t\r\n\t\t\t\r\n\t\t\t\t//add the log object to the answer object\r\n\t\t\t\tanswer['userLogTask']=\tuserLogTask;\r\n\t\t\t\r\n\t\t\tif(readyToSubmitTaskBool)\r\n\t\t\t// If the user as in the respective task, fill up the required fields, then it can submit the task and move on.\r\n\t\t\t{\r\n              answer['surveyCode']=surveyCode;\r\n              pybossa.saveTask(task.id, answer).done(function(data){\r\n\t\t\t\t\tdeferred.resolve();\r\n\t\t\t\t\t$(\"#success\").fadeIn();\r\n\t\t\t\t\tsetTimeout(function() { $(\"#success\").fadeOut() }, 2000);\r\n\t\t\t\t});\r\n            }\r\n   \r\n}\r\npybossa.presentTask(function(task, deferred){\r\n\t// This method is the principal way given by the PyBOSSA Platform to load the task. This method will load the pdf files and the PDFViewer on the showPDF methods.\r\n    if ( !$.isEmptyObject(task) ) {\r\n\t\tcleanAndResetVariablesForNewTask();\r\n\t\t\r\n\t\tswitch(task.info.idTypeOfTask){\r\n            //TASK 1\r\n            case 1:\r\n                $('#Titulo').html(\"Determining if two documents are written by the same author. Do these papers belong to the same author? (<strong>\"+task.info.author1+\"</strong>)\");\r\n                break;\t\r\n            //TASK 2    \r\n            case 2:\r\n                $('#Titulo').html(\"Determining if two documents are written by the same author. For the articles shown below, please indicate if they belong to the same author. (<strong>\"+task.info.author1+\"</strong>)\");\r\n                break;\r\n            \r\n            //TASK 3\r\n            case 3:\r\n                $('#Titulo').html(\"Identifying the corresponding author. Is '<strong>\"+task.info.author1+\"</strong>' the corresponding author of this paper?\");\r\n                break;\r\n\r\n            //TASK 4\r\n            case 4:\r\n                $('#Titulo').html(\"Please classify this article into (at least) one of the following fields of research*:\");\r\n                break;\r\n            \r\n            //TASK 5\r\n            case 5:\r\n                $('#Titulo').html(\"Are you able to find information about the affiliation of the main author?\");\r\n                break;\r\n            \r\n            //TASK 6\r\n            case 6:\r\n                $('#Titulo').html(\"Do the authors make a claim about the method used in their study?\");\r\n                break;\r\n            default:\r\n                break;\r\n        }\r\n\t\tif(task.info.idTypeOfTask==0||task.info.idTypeOfTask==7){\r\n\t\t\t//Activate the layout of the survey if the ID is from a pre-questionnaire (0) or a post-questionnaire (7)\r\n\t\t\t$('#surveyContainer').css('display','block');\r\n\t\t\tif(task.info.idTypeOfTask==0)\r\n\t\t\t\t$(\"#surveyContainer\").Survey({\r\n\t\t\t\t\tmodel: surveyPreQuestionnaire,\r\n\t\t\t\t\t onComplete: (function (result) {\r\n\t\t\t\t\t\t submitTask(task,deferred, null);\r\n   \t\t\t\t\t\t })});\r\n\t\t\telse if(task.info.idTypeOfTask==7)\r\n\t\t\t\t$(\"#surveyContainer\").Survey({\r\n\t\t\t\t\tmodel: surveyPostQuestionnaire,\r\n\t\t\t\t\tonComplete: (function (result) {\r\n\t\t\t\t\t\t submitTask(task,deferred,null);\r\n   \t\t\t\t })});\r\n\t\t}\r\n\t\telse{\r\n\t\t\t\t//Activate the PDF Container and the first PDF Viewer\r\n\t\t\t\t$('#pdf-main-container').css('display','block');\r\n\t\t\t\t$('#pdfViewer').css('display','block');\r\n\r\n\t\t}\r\n\r\n        //$('#author1').html(task.info.author1);\r\n        if(task.info.idTypeOfTask==4 || task.info.idTypeOfTask==6|| task.info.idTypeOfTask==0|| task.info.idTypeOfTask==7){ //tasks 4 e 6 n\u00e3o tem respostas \"sim, n\u00e3o ou n\u00e3o sei\"\r\n\t\t\t$('#YesNoIDK').css('display','none');\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\t$('#YesNoIDK').css('display','block');\r\n\t\t}\r\n\r\n        if((task.info.idTypeOfTask==1 || task.info.idTypeOfTask==2)){ //apenas mostra 2\u00ba pdf na primeira e segunda tasks\r\n\t\t\t//Activate the second PDF Viewer, shortening the length of the first so it can be presented equaly divided in the container\r\n\t\t\t$('#pdfViewer').removeClass(\"sixteen wide column\")\r\n\t\t\t$('#pdfViewer').addClass(\"eight wide column\");\r\n\t\t\t$('#pdfViewer_2').css('display','block');\r\n\t\t\tshowPDF(\"/static/\"+task.info.pdf2+\".pdf\",\"pdf-canvas2\",\"text-layer2\",0.9);\r\n        }\r\n\r\n        if(task.info.idTypeOfTask==2){ //TASK 2\r\n            $('#task2_confidence').css('display','block');\r\n        }\r\n\r\n        /* if(task.info.id==\"4\"){ //TASK 4\r\n            $('#MultipleChoice').show();\r\n        } */\r\n\r\n\r\n        if(task.info.idTypeOfTask==5){ //TASK 5\r\n            $('#T5info').css('display','block');\r\n            $('#T5infoTitle').html(\"Enter the affiliation of the main author here:\");\r\n            $('#t6button').css('display','none');\r\n        }\r\n/* \r\n        if(task.info.idTypeOfTask==\"6\"){ //TASK 6\r\n            $('#YesNoIDK').hide();\r\n            $('#T5info').show();\r\n            $('#T5infoTitle').html(\"Copy and paste the method here:\");\r\n            $('#t6button').show();\r\n        } */\r\n\r\n\t\t//If the task is not one of a survey, then proceed with the loading of the PDF File, the main component of each task to perform.\r\n        if(task.info.idTypeOfTask!=0 &&task.info.idTypeOfTask!=7 )\r\n\t\t{\r\n\t\t\tif((task.info.idTypeOfTask==1 || task.info.idTypeOfTask==2))\r\n\t\t \t\tshowPDF(\"/static/\"+task.info.pdf1+\".pdf\",\"pdf-canvas\",\"text-layer\",0.9);\r\n\t\t\telse\r\n\t\t\t\tshowPDF(\"/static/\"+task.info.pdf1+\".pdf\",\"pdf-canvas\",\"text-layer\",1.6);\r\n\t\t}\r\n\t\t \r\n\r\n\t\t//Activate the boxTranscription\r\n\t\t$('#boxTranscription').css('display','block');\r\n\r\n        loadUserProgress();\r\n\t\t$(\".btn-zoom\").off('click').on('click', function(evt){\r\n            zoom( parseInt($(this).attr(\"value\")));\r\n        });\r\n\r\n\t\t$(\"#question h1\").text(task.info.question);\r\n       \r\n        $(\"#loading\").hide();\r\n    \r\n        $(\".btn-answer\").off('click').on('click', function(){\r\n\t\t\tsubmitTask(task,deferred, $(this).attr(\"value\"));\r\n\t\t});\r\n\r\n\t}\r\n\telse {\r\n        $(\".skeleton\").hide();\r\n     \r\n\t\tpybossaNotify(\"Thanks! You have participated in all available tasks. Please go back to the Amazon Mechanical Turk page and insert this survey code:\" + surveyCode, true, \"info\");\r\n      \r\n    }\r\n\r\n});\r\n  pybossa.setEndpoint('https://reality.utad.net/pybossa/');\r\npybossa.run('authcrowd');\r\n\r\n</script>\r\n</body>\r\n"}, "owners_ids": [1], "links": ["<link rel='category' title='category' href='https://reality.utad.net/pybossa/api/category/1'/>"], "link": "<link rel='self' title='project' href='https://reality.utad.net/pybossa/api/project/1'/>"}, {"id": 17, "created": "2022-10-13T14:15:15.795209", "updated": "2023-10-19T10:41:40.793233", "name": "teste_postman72314", "short_name": "testeaula", "description": "testeaula_72314", "long_description": null, "featured": false, "owner_id": 322, "category_id": 1, "info": {"task_presenter": "<!--\r\n    Task DOM for loading the Flickr Images\r\n    It uses the class=\"skeleton\" to identify the elements that belong to the\r\n    task.\r\n-->\r\n<div class=\"row skeleton\"> <!-- Start Skeleton Row-->\r\n    <div class=\"col-md-6 \"><!-- Start of Question and Submission DIV (column) -->\r\n        <h1 id=\"question\"><span id=\"i18n_question\">Can you see a human face in the image?</span></h1> <!-- The question will be loaded here -->\r\n        <div id=\"answer\"> <!-- Start DIV for the submission buttons -->\r\n            <!-- If the user clicks this button, the saved answer will be value=\"yes\"-->\r\n            <button class=\"btn btn-success btn-answer\" value='Yes'><i class=\"icon icon-white icon-thumbs-up\"></i> <span id=\"i18n_yes\">Yes</span></button>\r\n            <!-- If the user clicks this button, the saved answer will be value=\"no\"-->\r\n            <button class=\"btn btn-danger btn-answer\" value='No'><i class=\"icon icon-white icon-thumbs-down\"></i> No</button>\r\n            <!-- If the user clicks this button, the saved answer will be value=\"NoPhoto\"-->\r\n            <button class=\"btn btn-answer\" value='NoPhoto'><i class=\"icon icon-exclamation\"></i> <span id=\"i18n_no_photo\">No photo</span></button>\r\n            <!-- If the user clicks this button, the saved answer will be value=\"NotKnown\"-->\r\n            <button class=\"btn btn-answer\" value='NotKnown'><i class=\"icon icon-white icon-question-sign\"></i> <span id=\"i18n_i_dont_know\">I don't know</span></button>\r\n        </div><!-- End of DIV for the submission buttons -->\r\n        <!-- Feedback items for the user -->\r\n        <p><span id=\"i18n_working_task\">You are working now on task:</span> <span id=\"task-id\" class=\"label label-warning\">#</span></p>\r\n        <p><span id=\"i18n_tasks_completed\">You have completed:</span> <span id=\"done\" class=\"label label-info\"></span> <span id=\"i18n_tasks_from\">tasks from</span>\r\n        <!-- Progress progress-bar for the user -->\r\n        <span id=\"total\" class=\"label label-inverse\"></span></p>\r\n        <div class=\"progress progress-striped\">\r\n            <div id=\"progress\" rel=\"tooltip\" title=\"#\" class=\"progress-bar\" style=\"width: 0%;\"></div>\r\n        </div>\r\n     \r\n    </div><!-- End of Question and Submission DIV (column) -->\r\n    <div class=\"col-md-6\"><!-- Start of Photo DIV (column) -->\r\n        <a id=\"photo-link\" href=\"#\">\r\n            <img id=\"photo\" src=\"http://i.imgur.com/GeHxzb7.png\" style=\"max-width=100%\">\r\n        </a>\r\n    </div><!-- End of Photo DIV (columnt) -->\r\n</div><!-- End of Skeleton Row -->\r\n\r\n<script type=\"text/javascript\">\r\n(function() {\r\n\r\nfunction loadUserProgress() {\r\n    pybossa.userProgress('testeaula').done(function(data){//EDIT THIS LINE TO SET THE PROJECT NAME\r\n        var pct = Math.round((data.done*100)/data.total);\r\n        $(\"#progress\").css(\"width\", pct.toString() +\"%\");\r\n        $(\"#progress\").attr(\"title\", pct.toString() + \"% completed!\");\r\n        $(\"#progress\").tooltip({'placement': 'left'}); \r\n        $(\"#total\").text(data.total);\r\n        $(\"#done\").text(data.done);\r\n    });\r\n}\r\n\r\npybossa.taskLoaded(function(task, deferred) {\r\n//Loading before task. Ideal for long asyncronous operations that is necessary to load for the task.\r\n    if ( !$.isEmptyObject(task) ) {\r\n        // load image from flickr\r\n        var img = $('<img />');\r\n        img.attr('src', task.info.link).css('height', 460);\r\n        img.addClass('img-polaroid');\r\n        task.info.image = img;\r\n        // continue as soon as the image is loaded\r\n        deferred.resolve(task);\r\n        pybossaNotify(\"\", false, \"loading\");\r\n      \r\n        \r\n    }\r\n    else {\r\n        deferred.resolve(task);\r\n    }\r\n});\r\nfunction renderTasksRunsInfoFromOtherVolunteersAnnotations(tasksRuns)\r\n{//This method should be used to render the results from the other volunteers annotations\r\n    console.log(tasksRuns);\r\n}\r\n\r\nfunction fetchTaskResultInfo(taskId) {\r\n    //fetchs the information related to the results done by other volunteers in this task\r\n\r\n    $.ajax({\r\n        url: 'https://reality.utad.net/pybossa/api/task/' + taskId + '?related=True',\r\n        dataType: 'json',\r\n        error: function () {\r\n            console.log(\r\n                \"An error occured while retrieved the results from the tasks made by other volunteers.\"\r\n            )\r\n        },\r\n        success: function (data) {\r\n            if (data.hasOwnProperty(\"task_runs\") && data.task_runs.length > 0)\r\n                renderTasksRunsInfoFromOtherVolunteersAnnotations(data.task_runs)\r\n\r\n        }\r\n    });\r\n\r\n    return;\r\n}\r\n\r\npybossa.presentTask(function(task, deferred) {\r\n        // Present the current task to the user\r\n        // Load the task data into the HTML DOM\r\n    if ( !$.isEmptyObject(task) ) {\r\n        fetchTaskResultInfo(task.id)\r\n        loadUserProgress();\r\n        $('#photo-link').html('').append(task.info.image);\r\n        $(\"#photo-link\").attr(\"href\", task.info.link);\r\n        $(\"#i18n_question\").html(task.info.question);\r\n        $('#task-id').html(task.id);\r\n        $('.btn-answer').off('click').on('click', function(evt) {\r\n            var btn = $(this);\r\n            var answer = btn.attr(\"value\");\r\n            if (typeof answer != 'undefined') {\r\n                pybossa.saveTask(task.id, answer).done(function() {\r\n                    pybossaNotify(\"Loading picture...\", true, \"loading\");\r\n                    deferred.resolve();\r\n                }); \r\n            }\r\n            else {\r\n                pybossaNotify(\"Oops... Something went wrong.\", true, \"error\");\r\n            }\r\n        });\r\n        pybossaNotify(\"Loading picture...\", false, \"loading\");\r\n    }\r\n    else {\r\n        $(\".skeleton\").hide();\r\n        pybossaNotify(\"Loading picture...\", false, \"loading\");\r\n        pybossaNotify(\"Thanks! You have participated in all available tasks. Enjoy some of your time!\", true, \"info\");\r\n    }\r\n});\r\npybossa.setEndpoint('https://reality.utad.net/pybossa');\r\npybossa.run('testeaula');//EDIT THIS LINE TO SET THE PROJECT NAME\r\n})();\r\n</script>\r\n"}, "owners_ids": [322], "links": ["<link rel='category' title='category' href='https://reality.utad.net/pybossa/api/category/1'/>"], "link": "<link rel='self' title='project' href='https://reality.utad.net/pybossa/api/project/17'/>"}, {"id": 18, "created": "2022-10-13T14:16:49.621338", "updated": "2023-01-08T20:25:06.387507", "name": "UTAD.MEI.CROWDSOURCING", "short_name": "crowdsourcing", "description": "teste", "long_description": "teste", "featured": false, "owner_id": 352, "category_id": 1, "info": {"task_presenter": "<div class=\"row skeleton\"> <!-- Start Skeleton Row-->\r\n    <div class=\"col-md-6 \"><!-- Start of Question and Submission DIV (column) -->\r\n        <h1 id=\"question\"><span id=\"i18n_question\">What emoji do you associate this text with?</span></h1>\r\n        <div id=\"answer\"> <!-- Start DIV for the submission buttons -->\r\n            <button class=\"btn btn-success btn-answer\" value='\ud83d\ude0a'><i class=\"icon icon-white icon-thumbs-up\"></i>\r\n                \ud83d\ude0a</button>\r\n            <button class=\"btn btn-danger btn-answer\" value='\ud83d\ude02'><i class=\"icon icon-white icon-thumbs-up\"></i>\r\n                \ud83d\ude02</button>\r\n            <button class=\"btn btn-warning btn-answer\" value='\ud83d\ude32'><i class=\"icon icon-white icon-thumbs-up\"></i>\r\n                \ud83d\ude32</button>\r\n            <button class=\"btn btn-info btn-answer\" value='\ud83d\ude2d'><i class=\"icon icon-white icon-thumbs-up\"></i>\r\n                \ud83d\ude2d</button>\r\n        </div><!-- End of DIV for the submission buttons -->\r\n        <!-- Feedback items for the user -->\r\n        <p>\r\n            <span id=\"i18n_working_task\">You are working now on task:</span>\r\n            <span id=\"task-id\" class=\"label label-warning\">#</span>\r\n        </p>\r\n        <p>\r\n            <span id=\"i18n_tasks_completed\">You have completed:</span>\r\n            <span id=\"done\" class=\"label label-info\"></span>\r\n            <span id=\"i18n_tasks_from\">tasks out of 25</span>\r\n            <!-- Progress bar for the user -->\r\n            <span id=\"total\" class=\"label label-inverse\"></span>\r\n        </p>\r\n        <div class=\"progress progress-striped\">\r\n            <div id=\"progress\" rel=\"tooltip\" title=\"#\" class=\"bar\" style=\"width: 0%;\"></div>\r\n        </div>\r\n    </div><!-- End of Question and Submission DIV (column) -->\r\n    <div class=\"col-md-6\"><!-- Start of Photo DIV (column) -->\r\n        <a id=\"photo-link\" href=\"#\">\r\n            <img id=\"photo\" src=\"https://i.imgur.com/5hQlmux.png\" style=\"max-width:80%;\">\r\n        </a>\r\n    </div><!-- End of Photo DIV (columnt) -->\r\n</div><!-- End of Skeleton Row -->\r\n\r\n<meta charset=\"utf-8\">\r\n<!--<script src=\"https://code.jquery.com/jquery-3.6.0.min.js\"></script>-->\r\n<script type=\"text/javascript\">\r\n    (function () {\r\n        function loadUserProgress() {\r\n            pybossa.userProgress('UTAD.MEI.CROWDSOURCING').done(function (data) {\r\n                var pct = Math.round((data.done * 100) / data.total);\r\n                $(\"#progress\").css(\"width\", pct.toString() + \"%\");\r\n                $(\"#progress\").attr(\"title\", pct.toString() + \"% completed!\");\r\n                $(\"#progress\").tooltip({'placement': 'left'});\r\n                $(\"#total\").text(data.total);\r\n                $(\"#done\").text(data.done);\r\n            });\r\n        }\r\n\r\n        pybossa.taskLoaded(function (task, deferred) {\r\n           if (!$.isEmptyObject(task)) {\r\n                // load image from flickr\r\n                var img = $('<img />');\r\n                img.attr('src', task.info.link).css('height', 460);\r\n                img.addClass('img-polaroid');\r\n                task.info.image = img;\r\n                // continue as soon as the image is loaded\r\n                deferred.resolve(task);\r\n                pybossaNotify(\"\", false, \"loading\");\r\n            }\r\n            else {\r\n                deferred.resolve(task);\r\n            }\r\n         });\r\n\r\n        function renderTasksRunsInfoFromOtherVolunteersAnnotations(tasksRuns) {//This method should be used to render the results from the other volunteers\r\n            console.log(tasksRuns);\r\n        }\r\n\r\n        function fetchTaskResultInfo(taskId) {\r\n            //fetchs the information related to the results done by other volunteers in this task\r\n\r\n            $.ajax({\r\n                url: 'https://reality.utad.net/pybossa/api/task/' + taskId + '?related=True',\r\n                dataType: 'json',\r\n                error: function () {\r\n                    console.log(\r\n                        \"An error occured while retrieved the results from the tasks made by other volunteers.\"\r\n                    )\r\n                },\r\n                success: function (data) {\r\n                    if (data.hasOwnProperty(\"task_runs\") && data.task_runs.length > 0)\r\n                        renderTasksRunsInfoFromOtherVolunteersAnnotations(data.task_runs)\r\n                }\r\n            });\r\n            return;\r\n        }\r\n\r\n        pybossa.presentTask(function (task, deferred) {\r\n            if (!$.isEmptyObject(task)) {\r\n                fetchTaskResultInfo(task.id)\r\n                loadUserProgress();\r\n                $('#photo-link').html('').append(task.info.image);\r\n                $(\"#photo-link\").attr(\"href\", task.info.link);\r\n                $(\"#i18n_question\").html(task.info.question);\r\n                $('#task-id').html(task.id);\r\n                $('.btn-answer').off('click').on('click', function (evt) {\r\n                    var btn = $(this);\r\n                    var answer = btn.attr(\"value\");\r\n                    if (typeof answer != 'undefined') {\r\n                        pybossa.saveTask(task.id, answer).done(function () {\r\n                            pybossaNotify(\"Loading...\", true, \"loading\");\r\n                            deferred.resolve();\r\n                        });\r\n                    }\r\n                    else {\r\n                        pybossaNotify(\"Oops... Something went wrong.\", true, \"error\");\r\n                    }\r\n                });\r\n                pybossaNotify(\"Loading...\", false, \"loading\");\r\n\r\n            }\r\n            else {\r\n                $(\".skeleton\").hide();\r\n                pybossaNotify(\"Loading...\", false, \"loading\");\r\n                pybossaNotify(\"Thanks! You have participated in all available tasks. Enjoy some of your time!\", true, \"info\");\r\n            }\r\n        });\r\n        pybossa.setEndpoint('https://reality.utad.net/pybossa');\r\n        pybossa.run('UTAD.MEI.CROWDSOURCING');\r\n    })();\r\n</script>"}, "owners_ids": [352], "links": ["<link rel='category' title='category' href='https://reality.utad.net/pybossa/api/category/1'/>"], "link": "<link rel='self' title='project' href='https://reality.utad.net/pybossa/api/project/18'/>"}, {"id": 23, "created": "2022-10-13T14:17:40.908879", "updated": "2023-10-19T10:42:57.368056", "name": "aula_postman", "short_name": "teste_postman", "description": "Aula teste postman", "long_description": null, "featured": false, "owner_id": 326, "category_id": 1, "info": {"task_presenter": "<div class=\"row skeleton\"> <!-- Start Skeleton Row-->\r\n    <div class=\"col-md-6 \"><!-- Start of Question and Submission DIV (column) -->\r\n        <h1 id=\"question\"><span id=\"i18n_question\">Can you see a human face in the image?</span></h1> <!-- The question will be loaded here -->\r\n        <div id=\"answer\"> <!-- Start DIV for the submission buttons -->\r\n            <!-- If the user clicks this button, the saved answer will be value=\"yes\"-->\r\n            <button class=\"btn btn-success btn-answer\" value='Yes'><i class=\"icon icon-white icon-thumbs-up\"></i> <span id=\"i18n_yes\">Yes</span></button>\r\n            <!-- If the user clicks this button, the saved answer will be value=\"no\"-->\r\n            <button class=\"btn btn-danger btn-answer\" value='No'><i class=\"icon icon-white icon-thumbs-down\"></i> No</button>\r\n            <!-- If the user clicks this button, the saved answer will be value=\"NoPhoto\"-->\r\n            <button class=\"btn btn-answer\" value='NoPhoto'><i class=\"icon icon-exclamation\"></i> <span id=\"i18n_no_photo\">No photo</span></button>\r\n            <!-- If the user clicks this button, the saved answer will be value=\"NotKnown\"-->\r\n            <button class=\"btn btn-answer\" value='NotKnown'><i class=\"icon icon-white icon-question-sign\"></i> <span id=\"i18n_i_dont_know\">I don't know</span></button>\r\n        </div><!-- End of DIV for the submission buttons -->\r\n        <!-- Feedback items for the user -->\r\n        <p><span id=\"i18n_working_task\">You are working now on task:</span> <span id=\"task-id\" class=\"label label-warning\">#</span></p>\r\n        <p><span id=\"i18n_tasks_completed\">You have completed:</span> <span id=\"done\" class=\"label label-info\"></span> <span id=\"i18n_tasks_from\">tasks from</span>\r\n        <!-- Progress progress-bar for the user -->\r\n        <span id=\"total\" class=\"label label-inverse\"></span></p>\r\n        <div class=\"progress progress-striped\">\r\n            <div id=\"progress\" rel=\"tooltip\" title=\"#\" class=\"progress-bar\" style=\"width: 0%;\"></div>\r\n        </div>\r\n     \r\n    </div><!-- End of Question and Submission DIV (column) -->\r\n    <div class=\"col-md-6\"><!-- Start of Photo DIV (column) -->\r\n        <a id=\"photo-link\" href=\"#\">\r\n            <img id=\"photo\" src=\"http://i.imgur.com/GeHxzb7.png\" style=\"max-width=100%\">\r\n        </a>\r\n    </div><!-- End of Photo DIV (columnt) -->\r\n</div><!-- End of Skeleton Row -->\r\n\r\n<script type=\"text/javascript\">\r\n(function() {\r\n\r\nfunction loadUserProgress() {\r\n    pybossa.userProgress('teste_postman').done(function(data){//EDIT THIS LINE TO SET THE PROJECT NAME\r\n        var pct = Math.round((data.done*100)/data.total);\r\n        $(\"#progress\").css(\"width\", pct.toString() +\"%\");\r\n        $(\"#progress\").attr(\"title\", pct.toString() + \"% completed!\");\r\n        $(\"#progress\").tooltip({'placement': 'left'}); \r\n        $(\"#total\").text(data.total);\r\n        $(\"#done\").text(data.done);\r\n    });\r\n}\r\n\r\npybossa.taskLoaded(function(task, deferred) {\r\n//Loading before task. Ideal for long asyncronous operations that is necessary to load for the task.\r\n    if ( !$.isEmptyObject(task) ) {\r\n        // load image from flickr\r\n        var img = $('<img />');\r\n        img.attr('src', task.info.link).css('height', 460);\r\n        img.addClass('img-polaroid');\r\n        task.info.image = img;\r\n        // continue as soon as the image is loaded\r\n        deferred.resolve(task);\r\n        pybossaNotify(\"\", false, \"loading\");\r\n      \r\n        \r\n    }\r\n    else {\r\n        deferred.resolve(task);\r\n    }\r\n});\r\nfunction renderTasksRunsInfoFromOtherVolunteersAnnotations(tasksRuns)\r\n{//This method should be used to render the results from the other volunteers annotations\r\n    console.log(tasksRuns);\r\n}\r\n\r\nfunction fetchTaskResultInfo(taskId) {\r\n    //fetchs the information related to the results done by other volunteers in this task\r\n\r\n    $.ajax({\r\n        url: 'https://reality.utad.net/pybossa/api/task/' + taskId + '?related=True',\r\n        dataType: 'json',\r\n        error: function () {\r\n            console.log(\r\n                \"An error occured while retrieved the results from the tasks made by other volunteers.\"\r\n            )\r\n        },\r\n        success: function (data) {\r\n            if (data.hasOwnProperty(\"task_runs\") && data.task_runs.length > 0)\r\n                renderTasksRunsInfoFromOtherVolunteersAnnotations(data.task_runs)\r\n\r\n        }\r\n    });\r\n\r\n    return;\r\n}\r\n\r\npybossa.presentTask(function(task, deferred) {\r\n        // Present the current task to the user\r\n        // Load the task data into the HTML DOM\r\n    if ( !$.isEmptyObject(task) ) {\r\n        fetchTaskResultInfo(task.id)\r\n        loadUserProgress();\r\n        $('#photo-link').html('').append(task.info.image);\r\n        $(\"#photo-link\").attr(\"href\", task.info.link);\r\n        $(\"#i18n_question\").html(task.info.question);\r\n        $('#task-id').html(task.id);\r\n        $('.btn-answer').off('click').on('click', function(evt) {\r\n            var btn = $(this);\r\n            var answer = btn.attr(\"value\");\r\n            if (typeof answer != 'undefined') {\r\n                pybossa.saveTask(task.id, answer).done(function() {\r\n                    pybossaNotify(\"Loading picture...\", true, \"loading\");\r\n                    deferred.resolve();\r\n                }); \r\n            }\r\n            else {\r\n                pybossaNotify(\"Oops... Something went wrong.\", true, \"error\");\r\n            }\r\n        });\r\n        pybossaNotify(\"Loading picture...\", false, \"loading\");\r\n    }\r\n    else {\r\n        $(\".skeleton\").hide();\r\n        pybossaNotify(\"Loading picture...\", false, \"loading\");\r\n        pybossaNotify(\"Thanks! You have participated in all available tasks. Enjoy some of your time!\", true, \"info\");\r\n    }\r\n});\r\npybossa.setEndpoint('https://reality.utad.net/pybossa');\r\npybossa.run('teste_postman');//EDIT THIS LINE TO SET THE PROJECT NAME\r\n})();\r\n</script>"}, "owners_ids": [326], "links": ["<link rel='category' title='category' href='https://reality.utad.net/pybossa/api/category/1'/>"], "link": "<link rel='self' title='project' href='https://reality.utad.net/pybossa/api/project/23'/>"}]