New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

plugin-survey-text-button

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

plugin-survey-text-button - npm Package Compare versions

Comparing version 0.1.0 to 0.3.0

8

dist/index.browser.js

@@ -72,3 +72,3 @@ var jsPsychSurveyTextButton = (function (jspsych) {

pretty_name: "Skip Button label",
default: "Next Trial",
default: "Enter(End this Trial)",
},

@@ -141,3 +141,3 @@ /** Setting this to true will enable browser auto-complete or auto-fill for the form. */

question_index +
'" class="jspsych-survey-text-question" style="margin: 2em 0em;">';
'" class="jspsych-survey-text-question" style="margin: 2em 0em;" onKeyPress="return checkSubmit(event)">';
html += '<p class="jspsych-survey-text">' + question.prompt + "</p>";

@@ -188,7 +188,7 @@ var autofocus = i == 0 ? "autofocus" : "";

html +=
'<input type="submit" id="jspsych-survey-text-next" name="next" class="jspsych-btn jspsych-survey-text" value="' +
'<input type="submit" style="display: none;" id="jspsych-survey-text-next" name="next" class="jspsych-btn jspsych-survey-text" value="' +
trial.button_label +
'"></input>';
html +=
'<input type="submit" id="jspsych-survey-text-skip" name="skip" class="jspsych-btn jspsych-survey-text" value="' +
'<input type="submit" style="display: none;" id="jspsych-survey-text-skip" name="skip" class="jspsych-btn jspsych-survey-text" value="' +
trial.button_label2 +

@@ -195,0 +195,0 @@ '"></input>';

@@ -1,2 +0,2 @@

var jsPsychSurveyTextButton=function(e){"use strict";const t={name:"survey-text",parameters:{questions:{type:e.ParameterType.COMPLEX,array:!0,pretty_name:"Questions",default:void 0,nested:{prompt:{type:e.ParameterType.HTML_STRING,pretty_name:"Prompt",default:void 0},placeholder:{type:e.ParameterType.STRING,pretty_name:"Placeholder",default:""},rows:{type:e.ParameterType.INT,pretty_name:"Rows",default:1},columns:{type:e.ParameterType.INT,pretty_name:"Columns",default:40},required:{type:e.ParameterType.BOOL,pretty_name:"Required",default:!1},name:{type:e.ParameterType.STRING,pretty_name:"Question Name",default:""}}},randomize_question_order:{type:e.ParameterType.BOOL,pretty_name:"Randomize Question Order",default:!1},preamble:{type:e.ParameterType.HTML_STRING,pretty_name:"Preamble",default:null},button_label:{type:e.ParameterType.STRING,pretty_name:"Button label",default:"Continue"},button_label2:{type:e.ParameterType.STRING,pretty_name:"Skip Button label",default:"Next Trial"},autocomplete:{type:e.ParameterType.BOOL,pretty_name:"Allow autocomplete",default:!1}}};class s{constructor(e){this.jsPsych=e}trial(e,t){for(var s=0;s<t.questions.length;s++)void 0===t.questions[s].rows&&(t.questions[s].rows=1);for(s=0;s<t.questions.length;s++)void 0===t.questions[s].columns&&(t.questions[s].columns=40);for(s=0;s<t.questions.length;s++)void 0===t.questions[s].value&&(t.questions[s].value="");var a="";null!==t.preamble&&(a+='<div id="jspsych-survey-text-preamble" class="jspsych-survey-text-preamble">'+t.preamble+"</div>"),t.autocomplete?a+='<form id="jspsych-survey-text-form">':a+='<form id="jspsych-survey-text-form" autocomplete="off">';var r=[];for(s=0;s<t.questions.length;s++)r.push(s);t.randomize_question_order&&(r=this.jsPsych.randomization.shuffle(r));for(s=0;s<t.questions.length;s++){var n=t.questions[r[s]],o=r[s];a+='<div id="jspsych-survey-text-'+o+'" class="jspsych-survey-text-question" style="margin: 2em 0em;">',a+='<p class="jspsych-survey-text">'+n.prompt+"</p>";var i=0==s?"autofocus":"",u=n.required?"required":"";1==n.rows?a+='<input type="text" id="input-'+o+'" name="#jspsych-survey-text-response-'+o+'" data-name="'+n.name+'" size="'+n.columns+'" '+i+" "+u+' placeholder="'+n.placeholder+'"></input>':a+='<textarea id="input-'+o+'" name="#jspsych-survey-text-response-'+o+'" data-name="'+n.name+'" cols="'+n.columns+'" rows="'+n.rows+'" '+i+" "+u+' placeholder="'+n.placeholder+'"></textarea>',a+="</div>"}a+='<input type="submit" id="jspsych-survey-text-next" name="next" class="jspsych-btn jspsych-survey-text" value="'+t.button_label+'"></input>',a+='<input type="submit" id="jspsych-survey-text-skip" name="skip" class="jspsych-btn jspsych-survey-text" value="'+t.button_label2+'"></input>',a+="</form>",e.innerHTML=a,e.querySelector("#input-"+r[0]).focus(),e.querySelector("#jspsych-survey-text-form").addEventListener("submit",(s=>{s.preventDefault();for(var a=performance.now(),r=Math.round(a-l),n={},o=0;o<t.questions.length;o++){var i="Q"+o,u=document.querySelector("#jspsych-survey-text-"+o).querySelector("textarea, input"),p=u.value,y=u.attributes["data-name"].value;""==y&&(y=i);var m={};m[y]=p,Object.assign(n,m)}const c=s.submitter;console.log("submitter",c.id,"jspsych-survey-text-skip"==c.id);var d={rt:r,response:n,skip:"jspsych-survey-text-skip"==c.id};e.innerHTML="",this.jsPsych.finishTrial(d)}));var l=performance.now()}simulate(e,t,s,a){"data-only"==t&&(a(),this.simulate_data_only(e,s)),"visual"==t&&this.simulate_visual(e,s,a)}create_simulation_data(e,t){const s={};let a=1e3;for(const t of e.questions){const r=t.name?t.name:`Q${e.questions.indexOf(t)}`,n=1==t.rows?this.jsPsych.randomization.sampleExponential(.25):this.jsPsych.randomization.randomInt(1,10)*t.rows;s[r]=this.jsPsych.randomization.randomWords({exactly:n,join:" "}),a+=this.jsPsych.randomization.sampleExGaussian(2e3,400,.004,!0)}const r={response:s,rt:a},n=this.jsPsych.pluginAPI.mergeSimulationData(r,t);return this.jsPsych.pluginAPI.ensureSimulationDataConsistency(e,n),n}simulate_data_only(e,t){const s=this.create_simulation_data(e,t);this.jsPsych.finishTrial(s)}simulate_visual(e,t,s){const a=this.create_simulation_data(e,t),r=this.jsPsych.getDisplayElement();this.trial(r,e),s();const n=Object.entries(a.response).map((e=>e[1]));for(let e=0;e<n.length;e++)this.jsPsych.pluginAPI.fillTextInput(r.querySelector(`#input-${e}`),n[e],(a.rt-1e3)/n.length*(e+1));this.jsPsych.pluginAPI.clickTarget(r.querySelector("#jspsych-survey-text-next"),a.rt)}}return s.info=t,s}(jsPsychModule);
var jsPsychSurveyTextButton=function(e){"use strict";const t={name:"survey-text",parameters:{questions:{type:e.ParameterType.COMPLEX,array:!0,pretty_name:"Questions",default:void 0,nested:{prompt:{type:e.ParameterType.HTML_STRING,pretty_name:"Prompt",default:void 0},placeholder:{type:e.ParameterType.STRING,pretty_name:"Placeholder",default:""},rows:{type:e.ParameterType.INT,pretty_name:"Rows",default:1},columns:{type:e.ParameterType.INT,pretty_name:"Columns",default:40},required:{type:e.ParameterType.BOOL,pretty_name:"Required",default:!1},name:{type:e.ParameterType.STRING,pretty_name:"Question Name",default:""}}},randomize_question_order:{type:e.ParameterType.BOOL,pretty_name:"Randomize Question Order",default:!1},preamble:{type:e.ParameterType.HTML_STRING,pretty_name:"Preamble",default:null},button_label:{type:e.ParameterType.STRING,pretty_name:"Button label",default:"Continue"},button_label2:{type:e.ParameterType.STRING,pretty_name:"Skip Button label",default:"Enter(End this Trial)"},autocomplete:{type:e.ParameterType.BOOL,pretty_name:"Allow autocomplete",default:!1}}};class s{constructor(e){this.jsPsych=e}trial(e,t){for(var s=0;s<t.questions.length;s++)void 0===t.questions[s].rows&&(t.questions[s].rows=1);for(s=0;s<t.questions.length;s++)void 0===t.questions[s].columns&&(t.questions[s].columns=40);for(s=0;s<t.questions.length;s++)void 0===t.questions[s].value&&(t.questions[s].value="");var a="";null!==t.preamble&&(a+='<div id="jspsych-survey-text-preamble" class="jspsych-survey-text-preamble">'+t.preamble+"</div>"),t.autocomplete?a+='<form id="jspsych-survey-text-form">':a+='<form id="jspsych-survey-text-form" autocomplete="off">';var r=[];for(s=0;s<t.questions.length;s++)r.push(s);t.randomize_question_order&&(r=this.jsPsych.randomization.shuffle(r));for(s=0;s<t.questions.length;s++){var n=t.questions[r[s]],i=r[s];a+='<div id="jspsych-survey-text-'+i+'" class="jspsych-survey-text-question" style="margin: 2em 0em;" onKeyPress="return checkSubmit(event)">',a+='<p class="jspsych-survey-text">'+n.prompt+"</p>";var o=0==s?"autofocus":"",u=n.required?"required":"";1==n.rows?a+='<input type="text" id="input-'+i+'" name="#jspsych-survey-text-response-'+i+'" data-name="'+n.name+'" size="'+n.columns+'" '+o+" "+u+' placeholder="'+n.placeholder+'"></input>':a+='<textarea id="input-'+i+'" name="#jspsych-survey-text-response-'+i+'" data-name="'+n.name+'" cols="'+n.columns+'" rows="'+n.rows+'" '+o+" "+u+' placeholder="'+n.placeholder+'"></textarea>',a+="</div>"}a+='<input type="submit" style="display: none;" id="jspsych-survey-text-next" name="next" class="jspsych-btn jspsych-survey-text" value="'+t.button_label+'"></input>',a+='<input type="submit" style="display: none;" id="jspsych-survey-text-skip" name="skip" class="jspsych-btn jspsych-survey-text" value="'+t.button_label2+'"></input>',a+="</form>",e.innerHTML=a,e.querySelector("#input-"+r[0]).focus(),e.querySelector("#jspsych-survey-text-form").addEventListener("submit",(s=>{s.preventDefault();for(var a=performance.now(),r=Math.round(a-l),n={},i=0;i<t.questions.length;i++){var o="Q"+i,u=document.querySelector("#jspsych-survey-text-"+i).querySelector("textarea, input"),p=u.value,y=u.attributes["data-name"].value;""==y&&(y=o);var m={};m[y]=p,Object.assign(n,m)}const c=s.submitter;console.log("submitter",c.id,"jspsych-survey-text-skip"==c.id);var d={rt:r,response:n,skip:"jspsych-survey-text-skip"==c.id};e.innerHTML="",this.jsPsych.finishTrial(d)}));var l=performance.now()}simulate(e,t,s,a){"data-only"==t&&(a(),this.simulate_data_only(e,s)),"visual"==t&&this.simulate_visual(e,s,a)}create_simulation_data(e,t){const s={};let a=1e3;for(const t of e.questions){const r=t.name?t.name:`Q${e.questions.indexOf(t)}`,n=1==t.rows?this.jsPsych.randomization.sampleExponential(.25):this.jsPsych.randomization.randomInt(1,10)*t.rows;s[r]=this.jsPsych.randomization.randomWords({exactly:n,join:" "}),a+=this.jsPsych.randomization.sampleExGaussian(2e3,400,.004,!0)}const r={response:s,rt:a},n=this.jsPsych.pluginAPI.mergeSimulationData(r,t);return this.jsPsych.pluginAPI.ensureSimulationDataConsistency(e,n),n}simulate_data_only(e,t){const s=this.create_simulation_data(e,t);this.jsPsych.finishTrial(s)}simulate_visual(e,t,s){const a=this.create_simulation_data(e,t),r=this.jsPsych.getDisplayElement();this.trial(r,e),s();const n=Object.entries(a.response).map((e=>e[1]));for(let e=0;e<n.length;e++)this.jsPsych.pluginAPI.fillTextInput(r.querySelector(`#input-${e}`),n[e],(a.rt-1e3)/n.length*(e+1));this.jsPsych.pluginAPI.clickTarget(r.querySelector("#jspsych-survey-text-next"),a.rt)}}return s.info=t,s}(jsPsychModule);
//# sourceMappingURL=index.browser.min.js.map

@@ -70,3 +70,3 @@ import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";

readonly pretty_name: "Skip Button label";
readonly default: "Next Trial";
readonly default: "Enter(End this Trial)";
};

@@ -160,3 +160,3 @@ /** Setting this to true will enable browser auto-complete or auto-fill for the form. */

readonly pretty_name: "Skip Button label";
readonly default: "Next Trial";
readonly default: "Enter(End this Trial)";
};

@@ -163,0 +163,0 @@ /** Setting this to true will enable browser auto-complete or auto-fill for the form. */

@@ -71,3 +71,3 @@ import { ParameterType } from 'jspsych';

pretty_name: "Skip Button label",
default: "Next Trial",
default: "Enter(End this Trial)",
},

@@ -140,3 +140,3 @@ /** Setting this to true will enable browser auto-complete or auto-fill for the form. */

question_index +
'" class="jspsych-survey-text-question" style="margin: 2em 0em;">';
'" class="jspsych-survey-text-question" style="margin: 2em 0em;" onKeyPress="return checkSubmit(event)">';
html += '<p class="jspsych-survey-text">' + question.prompt + "</p>";

@@ -187,7 +187,7 @@ var autofocus = i == 0 ? "autofocus" : "";

html +=
'<input type="submit" id="jspsych-survey-text-next" name="next" class="jspsych-btn jspsych-survey-text" value="' +
'<input type="submit" style="display: none;" id="jspsych-survey-text-next" name="next" class="jspsych-btn jspsych-survey-text" value="' +
trial.button_label +
'"></input>';
html +=
'<input type="submit" id="jspsych-survey-text-skip" name="skip" class="jspsych-btn jspsych-survey-text" value="' +
'<input type="submit" style="display: none;" id="jspsych-survey-text-skip" name="skip" class="jspsych-btn jspsych-survey-text" value="' +
trial.button_label2 +

@@ -194,0 +194,0 @@ '"></input>';

{
"name": "plugin-survey-text-button",
"version": "0.2.0",
"version": "0.3.0",
"description": "adds a button on plugin-survey-text@1.1.0, supports to skip questions with an extra button",

@@ -5,0 +5,0 @@ "type": "module",

@@ -71,3 +71,3 @@ import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";

pretty_name: "Skip Button label",
default: "Next Trial",
default: "Enter(End this Trial)",
},

@@ -145,3 +145,3 @@ /** Setting this to true will enable browser auto-complete or auto-fill for the form. */

question_index +
'" class="jspsych-survey-text-question" style="margin: 2em 0em;">';
'" class="jspsych-survey-text-question" style="margin: 2em 0em;" onKeyPress="return checkSubmit(event)">';
html += '<p class="jspsych-survey-text">' + question.prompt + "</p>";

@@ -192,7 +192,7 @@ var autofocus = i == 0 ? "autofocus" : "";

html +=
'<input type="submit" id="jspsych-survey-text-next" name="next" class="jspsych-btn jspsych-survey-text" value="' +
'<input type="submit" style="display: none;" id="jspsych-survey-text-next" name="next" class="jspsych-btn jspsych-survey-text" value="' +
trial.button_label +
'"></input>';
html +=
'<input type="submit" id="jspsych-survey-text-skip" name="skip" class="jspsych-btn jspsych-survey-text" value="' +
'<input type="submit" style="display: none;" id="jspsych-survey-text-skip" name="skip" class="jspsych-btn jspsych-survey-text" value="' +
trial.button_label2 +

@@ -199,0 +199,0 @@ '"></input>';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc