A collection of handy and reusable Node.js and vanilla JS scripts. More scripts will be added gradually based on their usefulness.
- Clone the repository:
git clone https://github.com/EvoLandEco/WebToolBox
cd WebToolBox
- Install dependencies:
npm install
- Start express server:
node server.js --path . --port 3000
- Now you can open the html files located at /examples:
http://localhost:3000/examples/treeview.html
Click to see the details
The server script sets up a simple Express server to serve static files from a specified directory.
node server.js --path <string> --port <number>
To serve files from the public directory on port 3000:
node server.js --path ./public --port 3000
Click to see the details
The pdfgen
script generates a PDF from a specified HTML URL using headless browser. It provides various customization options including DPI, scale, page size, margins, and background settings.
node pdfgen.js --url <string> --output <string> [--dpi <number>] [--scale <number>] [--pageSize <string> | --width <number> --height <number>] [--top <number>] [--right <number>] [--bottom <number>] [--left <number>] [--no-background] [--no-margin]
With default parameters:
node pdfgen.js --url http://localhost:3000/example.html --output c:/test/test.pdf
With custom page size and margins:
node pdfgen.js --url http://localhost:3000/example.html --output c:/test/test.pdf --width 8.5 --height 11 --top 10 --right 10 --bottom 10 --left 10
Click to see the details
The treeview
script is an enhanced version of Directory Tree Viewer (Vanilla JS). Now the sub-directory icons are nudged to the right by 23px level-wise. I added support to display distinguishable icons for a number of file extensions. I also added a button to conveniently expand and collapse all the directories.
Express server is required to run a minimal examplary html file. /styles/treeview.css
will be sourced by the html file.
http://localhost:3000/examples/treeview.html
Click to see the details
The csvtable
script uses jquery
to fetch a csv file and display it as a table. The script also requires dataTables
and PapaParse
to function.
Express server is required to run a minimal examplary html file.
http://localhost:3000/examples/csvtable.html
Click to see the details
The phylovis
script provides functions to simulate and visualize phylogenies under the Yule model and display corresponding encodings of the underlying graph representations. It supports interactive highlighting on-hover to easily trace connections between nodes/edges and their entries in the encodings. Graph visualization is based on vis.js
.
Express server is required to run a minimal examplary html file.
http://localhost:3000/examples/phylovis.html
Click to see the details
The heatwave
script is empowered by d3.js
. One step further from the static Radial area chart, heatwave
illustrates an interactive way to visualize periodic time series data.
Express server is required to run a minimal examplary html file.
http://localhost:3000/examples/heatwave.html