There are countless popular JavaScript libraries, jQuery, MooTools, Prototype, Dojo, YUI. These JavaScript libraries are feature-rich, and with their plugins, they can do almost any job. However, this comes at a cost. These libraries often cause your web pages to be bloated in size. In some cases, if you only want to complete a specific job, you can use some lightweight libraries with more specialized functions. This article introduces 40 excellent lightweight JavaScript libraries.
This is the second part of this article. For the first part, see 40 Lightweight JavaScript Libraries (Part 1) .
Date.js
Working with dates is not easy, there are many formats to deal with. Datejs handles simple or complex date functions very well. Dates can be parsed into formats such as "Next Thursday" and "+2 years", and all date formats are supported, such as 2009.01.08, 12/6/2001.
Sylvester
A mathematical JavaScript library for handling vectors and lattices, including multi-dimensional vector and lattice modeling classes, as well as some models in 3D space.
Pretty Date
An excellent JavaScript library that displays dates in a beautiful and friendly way, as shown in the figure below.
XRegExp
The RegExp object in JavaScript already supports regular expressions, and XRegExp adds more features that future browsers may include (ECMAScript 4 - ES4). This library caches and reuses RegExp objects and adds many new features.
JavaScript URL Library
A JavaScript library for processing URLs that can process any part of the URL.
typeface.js
This library allows you to use any font in a web page, but unlike Flash-based solutions such as sIFR and FLIR, typeface.js is 100% based on JavaScript. Just upload your font file to a web-based generator. Then download the generated JavaScript file and include it in the web page.
Cufón
Much like typeface.js, Cufón also allows you to use any font in a web page. Similarly, it also uses a generator to convert the font into VML and include the generated .js file into the web page.
Blackbird
People often use Alert() to debug JavaScript programs, and Blackbird provides a beautiful console to record, view, and filter the running of the program.
NitobiBug
Browser-based cross-browser JavaScript object logging and inspection tool.
Firebug Lite
Currently, the best JavaScript debugging tool is Firebug . However, this tool only supports FireFox. By inserting the Firebug Lite .js file into your web page, you can implement the FireBug function in all browsers.
swfobject
This is one of the most popular methods of referencing Flash objects. Can generate standard swf reference code and detect user player version. If the user's version is not supported, alternative content will be displayed.
sorttable and dragtable
Like it or not, tables are still the best way to represent data, but they can be put to better use. sorttable can sort tabular data by adding a class="sortable" flag to the table and excluding specified columns. Dragtable allows the columns of the table to be dragged. Just add the class="dragable" flag to the table. These two classes can be used in combination. Just add class="sortable dragtable".
DD_roundies and DD_belatedPNG
DD_roundies can implement rounded corners without relying on images. It is only for IE and implemented through VML. Other browsers will be skipped because those browsers natively support CSS rounded corners.
DD_belatedPNG was developed to solve the problem of IE6's poor support for PNG. Whether the PNG image is used for src or background-image, DD_belatedPNG can provide repairs.
Custom JavaScript Dialog Boxes
A lightweight JavaScript library of only 4.5K, you can create user-customized dialog boxes and display 4 types of message boxes, alerts, warnings, prompts, and success. You can set the message box title, content, and how long to display it.
GameJS
GameJS is a porting of Microsoft's XNA game framework to JavaScript, using canvas objects as output devices. JavaScript isn't the best platform for gaming, but it's fine for games with lower frame rates.
Shortcuts.js
Starting with Google Reader and Gmail, shortcut keys in web programs became popular. Shorcuts.js makes handling shortcut keys easy.
Mapstraction
There are many map providers that provide different APIs. If you want to change providers, such as from Google Maps to MapQuest, you need to update the code. Mapstraction provides APIs of commonly used map providers, and the conversion can be completed with just one line of code.
Amberjack
A tiny 4K JavaScript library that can add beautiful tutorial functionality to your website. A modal window will display any content in the form of a tutorial. The steps in the tutorial can be implemented by hand coding or automatically generated online. You can control the formatting of your content using themes or CSS.
JsLoad
JsLoad can remotely load various JavaScript libraries from Google server, and can automatically load various versions of support libraries.