Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

plugin-survey-likert-images

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

plugin-survey-likert-images - npm Package Compare versions

Comparing version 0.1.2 to 0.1.4

27

dist/index.browser.js

@@ -38,12 +38,19 @@ var jsPsychSurveyLikertImages = (function (jspsych) {

},
left: {
type: jspsych.ParameterType.STRING,
pretty_name: "left category",
default: "",
},
right: {
type: jspsych.ParameterType.STRING,
pretty_name: "right category",
default: "",
},
images: {
type: jspsych.ParameterType.COMPLEX,
array: true,
pretty_name: "Questions",
nested: {
left: {
type: jspsych.ParameterType.STRING,
pretty_name: "left category",
default: "",
},
right: {
type: jspsych.ParameterType.STRING,
pretty_name: "right category",
default: "",
},
}
}
},

@@ -50,0 +57,0 @@ },

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

var jsPsychSurveyLikertImages=function(e){"use strict";function t(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function r(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||a(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}var i={name:"survey-likert-images",parameters:{questions:{type:e.ParameterType.COMPLEX,array:!0,pretty_name:"Questions",nested:{prompt:{type:e.ParameterType.HTML_STRING,pretty_name:"Prompt",default:void 0},labels:{type:e.ParameterType.STRING,array:!0,pretty_name:"Labels",default:void 0},required:{type:e.ParameterType.BOOL,pretty_name:"Required",default:!1},name:{type:e.ParameterType.STRING,pretty_name:"Question Name",default:""},left:{type:e.ParameterType.STRING,pretty_name:"left category",default:""},right:{type:e.ParameterType.STRING,pretty_name:"right category",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},scale_width:{type:e.ParameterType.INT,pretty_name:"Scale width",default:null},button_label:{type:e.ParameterType.STRING,pretty_name:"Button label",default:"Continue"},autocomplete:{type:e.ParameterType.BOOL,pretty_name:"Allow autocomplete",default:!1}}},s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.jsPsych=t}var n,i,s;return n=e,(i=[{key:"trial",value:function(e,t){var r=this;if(null!==t.scale_width)var a=t.scale_width+"px";else a="100%";var n="";n+='<style id="jspsych-survey-likert-css">',n+=".jspsych-survey-likert-statement { display:block; font-size: 16px; padding-top: 40px; margin-bottom:10px; }.jspsych-survey-likert-opts { list-style:none; width:"+a+"; margin:auto; padding:0 0 35px; display:block; font-size: 14px; line-height:1.1em; }.jspsych-survey-likert-opt-label { line-height: 1.1em; color: #444; }.jspsych-survey-likert-opts:before { content: ''; position:relative; top:11px; /*left:9.5%;*/ display:block; background-color:#efefef; height:4px; width:100%; }.jspsych-survey-likert-opts:last-of-type { border-bottom: 0; }.jspsych-survey-likert-opts li { display:inline-block; /*width:19%;*/ text-align:center; vertical-align: top; }.jspsych-survey-likert-opts li input[type=radio] { display:block; position:relative; top:0; left:50%; margin-left:-6px; }",n+="</style>",null!==t.preamble&&(n+='<div id="jspsych-survey-likert-preamble" class="jspsych-survey-likert-preamble">'+t.preamble+"</div>"),t.autocomplete?n+='<form id="jspsych-survey-likert-form">':n+='<form id="jspsych-survey-likert-form" autocomplete="off">';for(var i=[],s=0;s<t.questions.length;s++)i.push(s);for(t.randomize_question_order&&(i=this.jsPsych.randomization.shuffle(i)),s=0;s<t.questions.length;s++){var l=t.questions[i[s]];n+='<label class="jspsych-survey-likert-statement">'+l.prompt+"</label>";var o=100/l.labels.length/1.5,u='<ul class="jspsych-survey-likert-opts" data-name="'+l.name+'" data-radio-group="Q'+i[s]+'">';n+='<div class="leftImages" style="float: left;"><p style="margin-bottom: 20px;"></p>'.concat(l.left.split(";").map((function(e){return"<img src='https://raw.githubusercontent.com/TangyiyiYi/MDS_pictures/main/"+e+'\' style="width: 150px; height: auto; margin-bottom: 10px;"/>'})).join(""),"</div>")+'<div class="rightImages" style="float: right;"><p style="margin-bottom: 20px;"></p>'.concat(l.right.split(";").map((function(e){return"<img src='https://raw.githubusercontent.com/TangyiyiYi/MDS_pictures/main/"+e+'\' style="width: 150px; height: auto; margin-bottom: 10px;"/>'})).join(""),"</div>");for(var y=0;y<l.labels.length;y++)u+='<li style="width:'+o+'%"><label class="jspsych-survey-likert-opt-label"><input type="radio" name="Q'+i[s]+'" value="'+y+'"',l.required&&(u+=" required"),u+=">"+l.labels[y]+"</label></li>";n+=u+="</ul>"}n+='<input type="submit" id="jspsych-survey-likert-next" class="jspsych-survey-likert jspsych-btn" value="'+t.button_label+'"></input>',n+="</form>",e.innerHTML=n,e.querySelector("#jspsych-survey-likert-form").addEventListener("submit",(function(t){t.preventDefault();for(var a=performance.now(),n=Math.round(a-p),s={},l=e.querySelectorAll("#jspsych-survey-likert-form .jspsych-survey-likert-opts"),o=0;o<l.length;o++){var u=l[o].dataset.radioGroup,y=e.querySelector('input[name="'+u+'"]:checked');if(null===y)var c="";else c=parseInt(y.value);var m={};if(""!==l[o].attributes["data-name"].value)var h=l[o].attributes["data-name"].value;else h=u;m[h]=c,Object.assign(s,m)}var f={rt:n,response:s,question_order:i};e.innerHTML="",r.jsPsych.finishTrial(f)}));var p=performance.now()}},{key:"simulate",value:function(e,t,r,a){"data-only"==t&&(a(),this.simulate_data_only(e,r)),"visual"==t&&this.simulate_visual(e,r,a)}},{key:"create_simulation_data",value:function(e,t){var n,i={},s=1e3,l=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=a(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,l=!0,o=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return l=e.done,e},e:function(e){o=!0,s=e},f:function(){try{l||null==r.return||r.return()}finally{if(o)throw s}}}}(e.questions);try{for(l.s();!(n=l.n()).done;){var o=n.value;i[o.name?o.name:"Q".concat(e.questions.indexOf(o))]=this.jsPsych.randomization.randomInt(0,o.labels.length-1),s+=this.jsPsych.randomization.sampleExGaussian(1500,400,.005,!0)}}catch(e){l.e(e)}finally{l.f()}var u={response:i,rt:s,question_order:e.randomize_question_order?this.jsPsych.randomization.shuffle(r(Array(e.questions.length).keys())):r(Array(e.questions.length).keys())},y=this.jsPsych.pluginAPI.mergeSimulationData(u,t);return this.jsPsych.pluginAPI.ensureSimulationDataConsistency(e,y),y}},{key:"simulate_data_only",value:function(e,t){var r=this.create_simulation_data(e,t);this.jsPsych.finishTrial(r)}},{key:"simulate_visual",value:function(e,t,r){var a=this.create_simulation_data(e,t),n=this.jsPsych.getDisplayElement();this.trial(n,e),r();for(var i=Object.entries(a.response),s=0;s<i.length;s++)this.jsPsych.pluginAPI.clickTarget(n.querySelector('input[type="radio"][name="'.concat(i[s][0],'"][value="').concat(i[s][1],'"]')),(a.rt-1e3)/i.length*(s+1));this.jsPsych.pluginAPI.clickTarget(n.querySelector("#jspsych-survey-likert-next"),a.rt)}}])&&t(n.prototype,i),s&&t(n,s),Object.defineProperty(n,"prototype",{writable:!1}),e}();return s.info=i,s}(jsPsychModule);
var jsPsychSurveyLikertImages=function(e){"use strict";function t(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function r(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||a(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}var i={name:"survey-likert-images",parameters:{questions:{type:e.ParameterType.COMPLEX,array:!0,pretty_name:"Questions",nested:{prompt:{type:e.ParameterType.HTML_STRING,pretty_name:"Prompt",default:void 0},labels:{type:e.ParameterType.STRING,array:!0,pretty_name:"Labels",default:void 0},required:{type:e.ParameterType.BOOL,pretty_name:"Required",default:!1},name:{type:e.ParameterType.STRING,pretty_name:"Question Name",default:""},images:{type:e.ParameterType.COMPLEX,array:!0,pretty_name:"Questions",nested:{left:{type:e.ParameterType.STRING,pretty_name:"left category",default:""},right:{type:e.ParameterType.STRING,pretty_name:"right category",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},scale_width:{type:e.ParameterType.INT,pretty_name:"Scale width",default:null},button_label:{type:e.ParameterType.STRING,pretty_name:"Button label",default:"Continue"},autocomplete:{type:e.ParameterType.BOOL,pretty_name:"Allow autocomplete",default:!1}}},s=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.jsPsych=t}var n,i,s;return n=e,(i=[{key:"trial",value:function(e,t){var r=this;if(null!==t.scale_width)var a=t.scale_width+"px";else a="100%";var n="";n+='<style id="jspsych-survey-likert-css">',n+=".jspsych-survey-likert-statement { display:block; font-size: 16px; padding-top: 40px; margin-bottom:10px; }.jspsych-survey-likert-opts { list-style:none; width:"+a+"; margin:auto; padding:0 0 35px; display:block; font-size: 14px; line-height:1.1em; }.jspsych-survey-likert-opt-label { line-height: 1.1em; color: #444; }.jspsych-survey-likert-opts:before { content: ''; position:relative; top:11px; /*left:9.5%;*/ display:block; background-color:#efefef; height:4px; width:100%; }.jspsych-survey-likert-opts:last-of-type { border-bottom: 0; }.jspsych-survey-likert-opts li { display:inline-block; /*width:19%;*/ text-align:center; vertical-align: top; }.jspsych-survey-likert-opts li input[type=radio] { display:block; position:relative; top:0; left:50%; margin-left:-6px; }",n+="</style>",null!==t.preamble&&(n+='<div id="jspsych-survey-likert-preamble" class="jspsych-survey-likert-preamble">'+t.preamble+"</div>"),t.autocomplete?n+='<form id="jspsych-survey-likert-form">':n+='<form id="jspsych-survey-likert-form" autocomplete="off">';for(var i=[],s=0;s<t.questions.length;s++)i.push(s);for(t.randomize_question_order&&(i=this.jsPsych.randomization.shuffle(i)),s=0;s<t.questions.length;s++){var l=t.questions[i[s]];n+='<label class="jspsych-survey-likert-statement">'+l.prompt+"</label>";var o=100/l.labels.length/1.5,u='<ul class="jspsych-survey-likert-opts" data-name="'+l.name+'" data-radio-group="Q'+i[s]+'">';n+='<div class="leftImages" style="float: left;"><p style="margin-bottom: 20px;"></p>'.concat(l.left.split(";").map((function(e){return"<img src='https://raw.githubusercontent.com/TangyiyiYi/MDS_pictures/main/"+e+'\' style="width: 150px; height: auto; margin-bottom: 10px;"/>'})).join(""),"</div>")+'<div class="rightImages" style="float: right;"><p style="margin-bottom: 20px;"></p>'.concat(l.right.split(";").map((function(e){return"<img src='https://raw.githubusercontent.com/TangyiyiYi/MDS_pictures/main/"+e+'\' style="width: 150px; height: auto; margin-bottom: 10px;"/>'})).join(""),"</div>");for(var y=0;y<l.labels.length;y++)u+='<li style="width:'+o+'%"><label class="jspsych-survey-likert-opt-label"><input type="radio" name="Q'+i[s]+'" value="'+y+'"',l.required&&(u+=" required"),u+=">"+l.labels[y]+"</label></li>";n+=u+="</ul>"}n+='<input type="submit" id="jspsych-survey-likert-next" class="jspsych-survey-likert jspsych-btn" value="'+t.button_label+'"></input>',n+="</form>",e.innerHTML=n,e.querySelector("#jspsych-survey-likert-form").addEventListener("submit",(function(t){t.preventDefault();for(var a=performance.now(),n=Math.round(a-p),s={},l=e.querySelectorAll("#jspsych-survey-likert-form .jspsych-survey-likert-opts"),o=0;o<l.length;o++){var u=l[o].dataset.radioGroup,y=e.querySelector('input[name="'+u+'"]:checked');if(null===y)var c="";else c=parseInt(y.value);var m={};if(""!==l[o].attributes["data-name"].value)var h=l[o].attributes["data-name"].value;else h=u;m[h]=c,Object.assign(s,m)}var f={rt:n,response:s,question_order:i};e.innerHTML="",r.jsPsych.finishTrial(f)}));var p=performance.now()}},{key:"simulate",value:function(e,t,r,a){"data-only"==t&&(a(),this.simulate_data_only(e,r)),"visual"==t&&this.simulate_visual(e,r,a)}},{key:"create_simulation_data",value:function(e,t){var n,i={},s=1e3,l=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=a(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,l=!0,o=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return l=e.done,e},e:function(e){o=!0,s=e},f:function(){try{l||null==r.return||r.return()}finally{if(o)throw s}}}}(e.questions);try{for(l.s();!(n=l.n()).done;){var o=n.value;i[o.name?o.name:"Q".concat(e.questions.indexOf(o))]=this.jsPsych.randomization.randomInt(0,o.labels.length-1),s+=this.jsPsych.randomization.sampleExGaussian(1500,400,.005,!0)}}catch(e){l.e(e)}finally{l.f()}var u={response:i,rt:s,question_order:e.randomize_question_order?this.jsPsych.randomization.shuffle(r(Array(e.questions.length).keys())):r(Array(e.questions.length).keys())},y=this.jsPsych.pluginAPI.mergeSimulationData(u,t);return this.jsPsych.pluginAPI.ensureSimulationDataConsistency(e,y),y}},{key:"simulate_data_only",value:function(e,t){var r=this.create_simulation_data(e,t);this.jsPsych.finishTrial(r)}},{key:"simulate_visual",value:function(e,t,r){var a=this.create_simulation_data(e,t),n=this.jsPsych.getDisplayElement();this.trial(n,e),r();for(var i=Object.entries(a.response),s=0;s<i.length;s++)this.jsPsych.pluginAPI.clickTarget(n.querySelector('input[type="radio"][name="'.concat(i[s][0],'"][value="').concat(i[s][1],'"]')),(a.rt-1e3)/i.length*(s+1));this.jsPsych.pluginAPI.clickTarget(n.querySelector("#jspsych-survey-likert-next"),a.rt)}}])&&t(n.prototype,i),s&&t(n,s),Object.defineProperty(n,"prototype",{writable:!1}),e}();return s.info=i,s}(jsPsychModule);
//# sourceMappingURL=index.browser.min.js.map

@@ -36,12 +36,19 @@ import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";

};
readonly left: {
readonly type: ParameterType.STRING;
readonly pretty_name: "left category";
readonly default: "";
readonly images: {
readonly type: ParameterType.COMPLEX;
readonly array: true;
readonly pretty_name: "Questions";
readonly nested: {
readonly left: {
readonly type: ParameterType.STRING;
readonly pretty_name: "left category";
readonly default: "";
};
readonly right: {
readonly type: ParameterType.STRING;
readonly pretty_name: "right category";
readonly default: "";
};
};
};
readonly right: {
readonly type: ParameterType.STRING;
readonly pretty_name: "right category";
readonly default: "";
};
};

@@ -126,12 +133,19 @@ };

};
readonly left: {
readonly type: ParameterType.STRING;
readonly pretty_name: "left category";
readonly default: "";
readonly images: {
readonly type: ParameterType.COMPLEX;
readonly array: true;
readonly pretty_name: "Questions";
readonly nested: {
readonly left: {
readonly type: ParameterType.STRING;
readonly pretty_name: "left category";
readonly default: "";
};
readonly right: {
readonly type: ParameterType.STRING;
readonly pretty_name: "right category";
readonly default: "";
};
};
};
readonly right: {
readonly type: ParameterType.STRING;
readonly pretty_name: "right category";
readonly default: "";
};
};

@@ -138,0 +152,0 @@ };

@@ -37,12 +37,19 @@ import { ParameterType } from 'jspsych';

},
left: {
type: ParameterType.STRING,
pretty_name: "left category",
default: "",
},
right: {
type: ParameterType.STRING,
pretty_name: "right category",
default: "",
},
images: {
type: ParameterType.COMPLEX,
array: true,
pretty_name: "Questions",
nested: {
left: {
type: ParameterType.STRING,
pretty_name: "left category",
default: "",
},
right: {
type: ParameterType.STRING,
pretty_name: "right category",
default: "",
},
}
}
},

@@ -49,0 +56,0 @@ },

{
"name": "plugin-survey-likert-images",
"version": "0.1.2",
"version": "0.1.4",
"description": "a jspsych plugin for measuring items on a likert scale",

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

@@ -37,12 +37,19 @@ import { JsPsych, JsPsychPlugin, ParameterType, TrialType } from "jspsych";

},
left: {
type: ParameterType.STRING,
pretty_name: "left category",
default: "",
},
right: {
type: ParameterType.STRING,
pretty_name: "right category",
default: "",
},
images: {
type: ParameterType.COMPLEX,
array: true,
pretty_name: "Questions",
nested: {
left: {
type: ParameterType.STRING,
pretty_name: "left category",
default: "",
},
right: {
type: ParameterType.STRING,
pretty_name: "right category",
default: "",
},
}
}
},

@@ -49,0 +56,0 @@ },

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