Jaxit is an easy-to-use library that makes an interactive terminal for your programs.

Overview

Jaxit

Jaxit is an easy-to-use library that makes an interactive terminal for your programs.

Jaxit was made by Codeverse, so check on Codeverse's Profile, CoderUltraSonic.


Getting Started with Jaxit

To use Jaxit's CSS File, simply type this in the HTML File.

">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/CoderUltraSonic/[email protected]/jaxit.css">

You can also import directly into your existing CSS File.

@import url('https://cdn.jsdelivr.net/gh/CoderUltraSonic/[email protected]/jaxit.css');

You can import Jaxit's JavaScript File like this in HTML.

Note: You can use the jaxit.js for development, but use the jaxit.min.js for production.

">
<script src="https://cdn.jsdelivr.net/gh/CoderUltraSonic/[email protected]/jaxit.js">script>
<script src="https://cdn.jsdelivr.net/gh/CoderUltraSonic/[email protected]/jaxit.min.js">script>

You can import Jaxit's Javascript File like this directly into your existing JavaScript File.

Note: You have to make your existing JavaScript File a module before you import Jaxit like this.

">
<script type="module" src="script.js">script>

Note: You can use the jaxit.module.js for development, but use the jaxit.module.min.js for production.

import {createJaxit} from 'https://cdn.jsdelivr.net/gh/CoderUltraSonic/[email protected]/jaxit.module.js';
import {createJaxit} from 'https://cdn.jsdelivr.net/gh/CoderUltraSonic/[email protected]/jaxit.module.min.js';

Setting up the Console

Jaxit makes a simple console place which you can style if you want. If you do not want to style, Jaxit will do it for you.

This is what your JavaScript File should look like at the beginning. I am using ES6 modules.

import {createJaxit} from 'https://cdn.jsdelivr.net/gh/CoderUltraSonic/[email protected]/jaxit.module.js';

//This will put the 'jax' variable as the Jaxit Object.
var jax = createJaxit();

//This will start up the Jaxit Object.
jax.init();

//If you do not want to style the console, you can default style the Jaxit Console using this method.
jax.defaultStyle();

Great Job! You just finished setting up your JavaScript File. You are one step closer to learning Jaxit.


Printing a line with Jaxit

Printing a line will write whatever you want into the console.

Here is how to do it.

//The first parameter is the text you want to output.
//The second parameter is the color you want it outputed it. Default is "white".
jax.print('Hello World!', '#FF0000');

Simple, right?


Scanning for User Input with Jaxit

Sometimes you want the user to give some kind of an input.

Doing this is very easy with Jaxit.

Here is how to do it.

/*
First parameter: The text you want to output before the scanning. It is like an incentive to give an input.

Second parameter: The color of the pre-scanning text. Default is "white".

Third parameter: The color of the text in the user scanning area. Default is "white".

Fourth parameter: Should be set as "true" if you want the input to be parsed into an integer. Should be set as "false" if you want the input to be parsed into a string. Default is "false".

Fifth parameter: The callback. What will you do with the user input.

*/
jax.scan('What is your name', "white", "white", false, function(userInput) {
  jax.print('Hello, ' + userInput + '!');
});

Delaying the Code

Jaxit provides a delay function for your code.

Here is how to do it.

/*
First parameter: The function you want to do.
Second parameter: The duration you want to wait for in seconds. Accepts decimals until three decimal places.
*/
jax.delay(function() {
  jax.print('Hello World!');
}, 3);

Clearing the Console

You can clear the console if you want.

Here is how to do it.

jax.clear();

Slowprinting the Print Message

Sometimes you want to slowprint the message for added effect. It might seem like a huge struggle to make by yourself, so let Jaxit do the work for you. If you wanted to do this by yourself, you would need to make asynchronous functions synchronous and make a recursive function. That would make your code very messy and huge.

Here is how to do it.

/*
First parameter: The text you want to slowprint.
Second parameter: The duration for the entire string to be printed out. This is in milliseconds and does not support decimals.
Third parameter: The color of the text. (Rainbow colors are not supported.)
Fourth parameter: Since this code is asynchronous, Jaxit has a callback to do after the message is slowprinted.
*/
jax.slowprint('Hello World', 400, "green", function() {
  jax.print('Finished the slowprint!');
});

Jaxit's Color Scheme

Jaxit has a color scheme that is usuable.

It supports these following colors. (More will be added in future updates.)

  • red
  • lightgreen
  • blue
  • white
  • gray
  • green
  • purple
  • pink
  • yellow
  • lightblue
  • yellowgreen
  • cyan
  • teal
  • hotpink

To get these colors, simply type wherever you need a color the following line (The [color] portion will be filled with the color in Jaxit's color scheme list.)

Here is how to do it.

jax.colors.[color]


Adding Custom Colors in Jaxit

Some users need custom colors that are not there in the colors object.

You can use this function to add your color in the object, so you can refer back to the same color over and over again in the project.

Here is how to do it.

/* 
First parameter: The name of the color that you want. Take note that the name can be whatever you want.
Second parameter: This is the color code of the color you want. You use Hex (Ex. #000000), RGB and RGBA 
(Ex. rgba(100, 100, 100, 0.7) and rgb(100, 100, 100)), or the name of the color in CSS (Ex: lightgreen)
*/
jax.customColor("myNewColor", "#94D9F3");

// Now I can access the color wherever I need in the code.

jax.colors.myNewColor;

Styling the Console using CSS

Here is how to do it.

/* First, get the Jaxit's console's class. And if you want, take out jax.defaultStyle() */

.jaxit-console {
  /* You can put whatever you want here. */
  opacity: 0.5;
}

Styling the Console using JS

Here is how to do it.

jax.jaxconsole.style.opacity = "0.5";

Styling the Console using Built-in Functions

You can use:

jax.changeConsoleFont(newfont);
// Remember that you have to put the new font in your html file. You can use Google Fonts for this.

jax.changeConsoleColor(newcolor);
//This changes the background color of the console.

jax.changeConsoleColorGradient(arr, type, direction);
/*
First parameter: The array of colors you want to use.
Second parameter: The type of gradient; this is default to linear but also supports radial.
Third parameter: This only applies to linear gradient; the direction of the linear gradient.
*/

jax.changeConsoleSize(wantedwidth, wantedHeight, width_measurement_type, height_measure_type);
//If you don't want to change something, leave it as an empty string.

jax.changeLocation(loc);
//Changes the location of the console.
//You can do: top, bottom, left, right, or fullscreen.

Example JavaScript File

{ if (res == 'y') { jax.clear(); curques = 0; correct = 0; incorrect = 0; jax.print('This is a text', jax.colors.white); jax.print(''); askQuestion(); } else { jax.print('Goodbye!', jax.colors.red); } }); } } askQuestion();">
import {createJaxit} from 'https://cdn.jsdelivr.net/gh/CoderUltraSonic/[email protected]/jaxit.module.js';

let jax = createJaxit();

jax.init();
jax.defaultStyle();
jax.changeLocation('fullscreen');
jax.customColor('myLightBlue', '#94D9F3');

questions = [
  ['What is Jaxit?', 'library'],
  ['Jaxit makes a ___ console.', 'interactive'],
  ['Who made Jaxit?', 'coderultrasonic'],
  ['Can you delay a function in Jaxit? (y/n)', 'y'],
  ['Which Jaxit version was made in May 2021?', 'v3.01.1'
]

jax.print('This is a test.', jax.colors.myLightBlue);
jax.print('');

let curques = 0;
let correct = 0;
let incorrect = 0;

function askQuestion() {
  if (curques < questions.length) {
    jax.scan(questions[curques][0], jax.colors.lightgreen, jax.colors.white, false, res => {
      if (res.toLowerCase() == questions[curques][1]) {
        jax.print('Great Job!', jax.colors.green);
        correct += 1;
      } else {
        jax.print('Aww... You missed that!', jax.colors.red);
        incorrect += 1;
      }
      curques += 1;
      askQuestion();
    });
  } else {
    jax.print(`You got ${correct} question(s) correct, and you missed ${incorrect} question(s). There was a total of ${questions.length} questions on the test.`, jax.colors.lightblue);

    jax.scan('Do you want to take the test again? (y/n)', jax.colors.lightgreen, "white", false, res => {
      if (res == 'y') {
        jax.clear();
        curques = 0;
        correct = 0;
        incorrect = 0;

        jax.print('This is a text', jax.colors.white);
        jax.print('');

        askQuestion();
      } else {
        jax.print('Goodbye!', jax.colors.red);
      }
    });
  }
}

askQuestion();

Thank you for reading!

You might also like...

Cookbook Method is the process of learning a programming language by building up a repository of small programs that implement specific programming concepts.

Cookbook Method is the process of learning a programming language by building up a repository of small programs that implement specific programming concepts.

CookBook - Hacktoberfest Find the book you want to read next! PRESENTED BY What is CookBook? A cookbook in the programming context is collection of ti

Nov 17, 2022

Lavanstax project - Makes it easy and fun to use İnstagram. Also first userbot for İnstagram

Lavanstax project - Makes it easy and fun to use İnstagram. Also first userbot for İnstagram

Lavanstax Lavanstax project - Makes it easy and fun to use İnstagram. Also first userbot for İnstagram | İnstagram | Telegram Channel | Telegram Group

Oct 15, 2022

a lightweight, dependency-free JavaScript plugin which makes a HTML table interactive

JSTable The JSTable is a lightweight, dependency-free JavaScript plugin which makes a HTML table interactive. The plugin is similar to the jQuery data

Oct 20, 2022

The JSTable is a lightweight, dependency-free JavaScript plugin which makes a HTML table interactive

The JSTable is a lightweight, dependency-free JavaScript plugin which makes a HTML table interactive. The plugin is similar to the jQuery data

Oct 20, 2022

Buildable's core open-source offering for actions that makes it easy to collect, centralize and action your backend system activity

Buildable's core open-source offering for actions that makes it easy to collect, centralize and action your backend system activity

What are Action Templates? Action Templates are open-source functions that save developers hundreds of hours when integrating databases, apps and othe

Nov 5, 2022

Brew-Near-You - An app that makes it easy to find a brewery near you

Brew-Near-You - An app that makes it easy to find a brewery near you

Brew Near You An app that makes it easy to find a brewery near you Built With HT

Aug 3, 2022

⚡️ Makes writing scripts absurdly easy

haxx easily create and run scripts using javascript getting started • commands • api Features 🔀 Process DX - easily manage and run processes 📦 Javas

Apr 15, 2022

Inferrd makes Machine Learning deployment easy and scalable.

Inferrd makes Machine Learning deployment easy and scalable.

Introduction ML Deployment made simple, scalable and collaborative The new open-source standard to deploy, monitor and secure Machine Learning service

Dec 16, 2022

Makes downloading Scratch projects easy. Simply enter two project IDs and click start.

Makes downloading Scratch projects easy. Simply enter two project IDs and click start. No need to pick the right format or include the assets, all of this is done automatically and in the browser.

May 27, 2022
Releases(v3.03.1)
Owner
I am a programmer who specializes in JavaScript coding.
null
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
A Browser extension that not only makes your browsing experience safe but makes it optimized

Sia Sia is a browser extension that not only makes your browsing experience safe but makes it optimized Table of Contents About The Project Built With

Arun Govind M 14 Feb 23, 2022
A JavaScript module that shortens your code, makes life easier, and makes development faster!

Quxt A JavaScript module that shortens your code, makes life easier, and makes development faster! Installation npm install quxt Quick Start Check ind

Qux App 5 May 8, 2022
Quickly develop, deploy and test Solana programs from the browser.

Solana Playground SolPg allows you to quickly develop, deploy and test Solana programs(smart contracts) from the browser. Note SolPg is still in beta

solana-playground 176 Dec 29, 2022
Command-line toolkit for parsing, compiling, transpiling, optimizing, linking, dataizing, and running EOLANG programs

First, you install npm and Java SE. Then, you install eolang package: $ npm install eolang Then, you write a simple EO program in hello.eo file in th

objectionary 17 Nov 17, 2022
A decentralised portal that aims to help Government Educational organisations to track student and colleges data to provide them with fellowships and programs.

DeSIDB A decentralised database built on Ethereum & Solidity. Introduction - India is a country with a population of 6.8 crore students graduating eac

Sachin Pandey 14 Jul 10, 2022
Contribute some nodejs programs here ;)

Nodejs Programs Showcase Table Of Contents Prerequisites Contributing Prerequisites In God we trust. All others must bring data. Need to be courageous

koderDev 3 Oct 9, 2022
The repository shows the compiler (simulator) of the Little Man Computer, which also contains some programs in the LMC programming language for implementing different functions.

Little Man Computer The repository shows the compiler (simulator) of the Little Man Computer, which also contains some programs in the LMC programming

Cow Cheng 2 Nov 17, 2022