How Can I activate a Javascript Library ?

More
2 months 3 weeks ago #174224 by GuilleVargas
GuilleVargas created the topic: How Can I activate a Javascript Library ?
Hello everybody,

I am interested in add a javascript library in order to be able to record voices on a survey.
This is the library : github.com/higuma/web-audio-recorder-js

The question is: where I should add this library? Should I make a plugin for it? I am looking inside limesurvey and there is a folder named "Third-Party". So I was wondering if that is the place in which I should add this library…

If you have any ideas or suggestions, I will really appreciate it…

Regards, Guillo

Please Log in or Create an account to join the conversation.

More
2 months 3 weeks ago #174226 by LouisGac
LouisGac replied the topic: How Can I activate a Javascript Library ?
if it's for front end extend a theme and edit the manifest
manual.limesurvey.org/New_Template_Syste...a_theme_from_scratch

Please Log in or Create an account to join the conversation.

More
2 months 3 weeks ago #174228 by GuilleVargas
GuilleVargas replied the topic: How Can I activate a Javascript Library ?
Hello LouisGac,

The real goal is to add a voice-recorder button to the survey. I was expecting to just add a script on the code section of questions, in order to call the function to insert a voice recorder button on the question ( in-tissu.artandfield.org/collecte-de-recits/ ).

This will be the very first time that I will transform limesurvey. So I am not sure of anything. I have been looking the way some plugins works. Unfortunately, anyone is adding a javascript functionality to a question on a survey. I have some knowledge on html, css and php, but Javascript is entirely new for me. I can read instructions and examples, and be able to learn quickly...

I am not sure that making a theme is what I need to do right here, but you know better than me how limesurvey works, so I will follow your suggestions. Do you think that I should create a theme in order to reach my goal?

Probably my first question is not clear enough: How can I use the WebAudioRecorder.js function on a limesurvey survey?

Please Log in or Create an account to join the conversation.

More
2 months 3 weeks ago - 2 months 3 weeks ago #174230 by LouisGac
LouisGac replied the topic: How Can I activate a Javascript Library ?
indeed, you'd rather create a question theme for that.

some doc here (read it entirely):
github.com/LimeSurvey/LimeSurvey/tree/master/themes/question

Look in details how we customized the multiple choice question, to add the "bootstrap button" theme.
Here the original code of multiple choice:
github.com/LimeSurvey/LimeSurvey/tree/ma...nswer/multiplechoice

here the customized version to use bootstrap button instead of checkboxes:
github.com/LimeSurvey/LimeSurvey/tree/ma...nswer/multiplechoice

it uses specific JS:
github.com/LimeSurvey/LimeSurvey/tree/ma...hoice/assets/scripts

it is registered in the manifest of the question theme:
github.com/LimeSurvey/LimeSurvey/blob/ma...hoice/config.xml#L31

because you want to save a sound file, I suggest you to extend the upload question type:
github.com/LimeSurvey/LimeSurvey/tree/ma...s/answer/file_upload



So here how I suggest you to proceed:

1. Try to make a custom PHP script using your JS lib to save some sound in a server. Not using limesurvey at all, just pure PHP. So you'll be sure you understood how to do it from scratch, and that you're using correctly the js lib, not being confused by LS specific problems.

2. Try to create a very simple question theme for LimeSurvey. Just to be sure you understand how it works. Loading a JS script file showing a "hello world" at load would be fine. So you'll be sure you understood question theming, not being confused by your JS lib specific problems

3. Then, customize the upload question type to use your library and to save the record file :
github.com/LimeSurvey/LimeSurvey/tree/ma...s/answer/file_upload

good luck ;)
Last Edit: 2 months 3 weeks ago by LouisGac.
The following user(s) said Thank You: GuilleVargas

Please Log in or Create an account to join the conversation.

More
2 months 3 weeks ago #174231 by GuilleVargas
GuilleVargas replied the topic: How Can I activate a Javascript Library ?
Perfect ! So now I have some work to do !!!

I will be back soon to give you news about this.

Please Log in or Create an account to join the conversation.

More
2 months 3 weeks ago #174233 by holch
holch replied the topic: How Can I activate a Javascript Library ?
And once that works, give it back to the community. ;-)

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
The following user(s) said Thank You: GuilleVargas

Please Log in or Create an account to join the conversation.

More
2 months 3 weeks ago #174264 by DenisChenu
DenisChenu replied the topic: How Can I activate a Javascript Library ?
I do it with plugin on my part : gitlab.com/SondagesPro/ExportAndStats/pdfReport#documentation

but need a lot php script here. Less for javascript recording

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
The following user(s) said Thank You: GuilleVargas

Please Log in or Create an account to join the conversation.

More
2 months 3 weeks ago #174316 by tpartner
tpartner replied the topic: How Can I activate a Javascript Library ?
Here is a custom question theme that includes the jQuery UI library. You can use it to see how to load a library and modify for your requirements.

github.com/tpartner/LimeSurvey-Card-Sorting-3.x

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu, LouisGac, f_funke, GuilleVargas

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!