Loading repository data…
Loading repository data…
GLOBUS-studio / repository
GStime is a lightweight, feature-rich, and easy-to-use JavaScript library designed to simplify HTML document traversing, event handling, and manipulation of content, making it perfect for fast web development. It's a great choice if you're familiar with jQuery but are looking for a smaller library that offers the most commonly used features.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
v2.0.0 ships as UMD (browser global, CommonJS, AMD). See CHANGELOG.md for breaking changes from v1.x.
npm install @globus.studio/gstime
Or include from a CDN:
<script src="https://unpkg.com/@globus.studio/gstime/GStime.min.js"></script>
// Browser global (after <script>)
$('selector')
// CommonJS / Node
const { $, GStime } = require('@globus.studio/gstime');
// ESM (via bundler)
import { $, GStime } from '@globus.studio/gstime';
html(), append(), prepend(), before(), after() and constructor HTML strings use innerHTML/insertAdjacentHTML internally. Never pass untrusted user input to these methods. Sanitize first (e.g. with DOMPurify) or use plain text via .elements[0].textContent = value.
GStime.js is a lightweight JavaScript library for DOM manipulation, animation creation, and AJAX requests. It is designed as a modern lightweight alternative to jQuery, maintaining familiar syntax and popular functions, but optimized for modern browsers.
<!-- Include the library -->
<script src="GStime.js"></script>
<script>
// DOM ready
$(function() {
// Select elements and manipulate them
$('button').on('click', function() {
$('.box').fadeIn(500);
});
});
</script>
Select elements on the page using CSS selectors:
// Select by ID
$("#myElement");
// Select by class
$(".myClass");
// Select by tag
$("div");
// Combined selectors
$("ul.menu li");
Manipulate DOM elements:
// Change HTML content
$("#content").html("<h1>New heading</h1>");
// Add content
$(".container").append("<p>New paragraph</p>");
// Create elements
$("<div class='box'></div>").appendTo(".container");
// Work with classes
$(".item").addClass("active");
$(".item").removeClass("hidden");
$(".item").toggleClass("selected");
// Work with attributes
$("img").attr("src", "new-image.jpg");
$("input").val("New value");
Handle events:
// Basic events
$("#button").on("click", function() {
console.log("Button clicked");
});
// Event delegation
$(".container").on("click", ".button", function() {
console.log("Button inside container clicked");
});
// Remove event handlers
$("#element").off("click");
Create animations:
// Simple animations
$(".box").fadeIn(500);
$(".box").fadeOut(500);
// Slide effects
$(".panel").slideDown(500);
$(".panel").slideUp(500);
$(".panel").slideToggle(500);
// Custom animations
$(".element").animate({ width: "200px", height: "300px" }, 500);
// Color animations
$(".button").colorAnimate({ backgroundColor: "#ff0000" }, 500);
Perform asynchronous requests:
// GET request
GStime.get("api/users", { page: 1 })
.then(data => console.log(data))
.catch(error => console.error(error));
// POST request
GStime.post("api/users", { name: "John", age: 30 })
.then(response => console.log(response))
.catch(error => console.error(error));
// Advanced settings
GStime.ajax({
url: "api/data",
method: "POST",
data: { id: 123 },
headers: { "Authorization": "Bearer token" },
timeout: 5000,
beforeSend: function() {
$(".loader").show();
}
})
.then(data => console.log(data))
.catch(error => console.error(error))
.finally(() => $(".loader").hide());
$(selector)Creates a new GStime object with elements matching the selector.
Parameters:
selector (String|Element|NodeList|Array): CSS selector, HTML string, or DOM element..each(callback)Executes a function for each element in the set.
Parameters:
callback (Function): Function to execute for each element..on(event, [selector], callback)Attaches an event handler to elements.
Parameters:
event (String): Name of the event (e.g., "click").selector (String, optional): Selector for event delegation.callback (Function): Event handler function..off(event, callback)Removes an event handler from elements.
Parameters:
event (String): Name of the event.callback (Function): Function to remove. If omitted, removes all handlers for the event..val([newVal])Gets or sets the value of form elements.
Parameters:
newVal (String, optional): New value.Returns:
.html([content])Gets or sets the HTML content of elements.
Parameters:
content (String, optional): HTML content.Returns:
.css(prop, [value]) or .css(properties)Gets or sets CSS properties of elements.
Parameters:
prop (String): Name of the CSS property.value (String|Number, optional): Value of the CSS property.properties (Object): Object with CSS properties.Returns:
.animate(properties, duration, [callback])Animates CSS properties of elements.
Parameters:
properties (Object): Object with CSS properties and their target values.duration (Number): Duration of the animation in milliseconds.callback (Function, optional): Function to call once the animation is complete.Limitations:
.fadeIn(duration, [callback]) / .fadeOut(duration, [callback])Shows or hides elements with a fading effect.
Parameters:
duration (Number): Duration of the animation in milliseconds.callback (Function, optional): Function to call once the animation is complete..slideUp(duration, [callback]) / .slideDown(duration, [callback]) / .slideToggle(duration, [callback])Hides, shows, or toggles the visibility of elements with a sliding effect.
Parameters:
duration (Number): Duration of the animation in milliseconds.callback (Function, optional): Function to call once the animation is complete.Limitations:
.colorAnimate(properties, duration, [callback])Animates color CSS properties of elements.
Parameters:
properties (Object): Object with color CSS properties and their target values.duration (Number): Duration of the animation in milliseconds.callback (Function, optional): Function to call once the animation is complete.Limitations:
GStime.ajax(settings)Performs an AJAX request.
Parameters:
settings (Object): Object with request settings:
url (String): URL for the request.method (String): HTTP method (GET, POST, PUT, DELETE).data (Object|String): Data to send.headers (Object): HTTP headers.timeout (Number): Request timeout in milliseconds.beforeSend (Function): Function to call before sending the request.Returns:
Limitations:
GStime.get(url, [data], [options])Performs a GET request.
Parameters:
url (String): URL for the request.data (Object, optional): Request parameters.options (Object, optional): Additional settings.GStime.post(url, data, [options])Performs a POST request.
Parameters:
url (String): URL for the request.data (Object): Data to send.options (Object, optional): Additional settings.GStime.put(url, data, [options]) / GStime.delete(url, [data], [options])Performs a PUT or DELETE request.
Parameters:
url (String): URL for the request.data (Object): Data to send.options (Object, optional): Additional settings.GStime.js supports the following browsers:
GStime.js is distributed under the MIT license.