Skip to content

Repository files navigation

Render Response

RenderResponse is a open source vanilla javascript library that gives you tools to render things/create elements like a list, paragraph, embedded paragraph link, and link lists. Uses JavaScript ES6

Created by Lucky

Lucky's GitHub | Contact Lucky

Installation

Download | CDN

Documentation

Syntax

You can create an variable with an array of the info you want to display or use the functions parameters

newResponse(['question',['response'],'type',display]);

Display

  • true - displays the question
  • false - doesn't display the question

Types

  • list - simple list for multiple responses
  • embedLink - embedded link inside of p element
  • link - simple link with name
  • par - simple paragraph
  • linkList - list of links with names

Response

Whatever you want it to send back in the formatted form

Question

What the formatted response is answering This can be displayed using the display argument, by typing true the question will be shown with the response

List

//using parametersnewResponse('What does math class sound like?',['blah','blah','blah'],'list',true);//using variablesletresponse=['What does math class sound like?',['blah','blah','blah'],'list',true];newResponse(response);

Result:

What does math class sound like?

  1. blah
  2. blah
  3. blah

Embed Link

//syntax examplenewResponse(['Question',['text','linkTitle','url'],'embedLink',display]);//real examplenewResponse(['Wheres my shoes?',['You can find my shoes','here','https://youtube.com'],'embedLink',true]);

Result:

Wheres my shoes? You can find my shoes here

Link

//syntaxnewResponse('question',['linkTitle','url'],'link',true);//examplenewResponse('Wheres my supersuit?',['Supersuit','https://youtube.com'],'link',true);

Result:

Wheres my supersuit? supersuit

Paragraph

takes only one argument in answers

//syntaxnewResponse('question','response','par',true);//examplenewResponse('Wheres my supersuit?','Probably downstairs, did you check the pantry?','par',true);

Result:

Wheres my supersuit? Probably downstairs, did you check the pantry?

Link List

//syntaxnewResponse('question',['linkname','url','linkname','url'],'linkList',true);//examplenewResponse('I need some good websites',['YouTube','https://youtube.com','Google','https://google.com'],'linkList',true);

Result:

I need some good websites

Image

You can use the customID to give it an id you want use to customize or us js to manipulate The customID doesn't have to be a pre-existing ID

//syntaxnewResponse('question',['img-title','src','customID'],'img',display);//examplenewResponse('What does a dolphin look like?',['Dolphin','images/dolphin.jpg','dolphin-img'],'img',true);

Result:

What does a dolphin look like? dolphin-img dolphin

About

Open Source JS rendering library

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

4 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages