Skip to content

milhouse1337/hivetek-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HiveTek jQuery Toolkit

Tested with jQuery 1.5+ Tested with fancyBox 2.x Version 1.0.2

This is a simple jQuery function wrapper used at HiveTek and Trinary.

Requirements

Install

You can load the script from the CDN.

<script src="//cdn.jsdelivr.net/gh/milhouse1337/hivetek-js/dist/hivetek.min.js"></script>

Usage

There are a few basic functions you can use.

<script>
$(document).ready(function() {

    $.hivetek.loadTokenFromMeta(); // Add `X-CSRF-TOKEN` header on all AJAX requests.
    $.hivetek.loadLegacy(); // Inject some functions on the `window` object.

    $.hivetek.config('fadein_delay', 200); // Update fadeIn animation delay.
    $.hivetek.config('text_loading', 'Loading...'); // Update the loading text.

});
</script>

AJAX

// Simple GET request.
$.hivetek.doAjaxGet('/example', {'foo': 'bar'}, function(data) {
    // console.log(data);
}, function(error) {
    // console.log(error);
});
// Simple POST request.
$.hivetek.doAjaxPost('/example', {'foo': 'bar'}, function(data) {
    // console.log(data);
}, function(error) {
    // console.log(error);
});

Modal (with fancyBox)

$.hivetek.doAjaxFancybox('/example', {'foo': 'bar'}, false); // Open modal.
$.hivetek.closeModal(); // Close modal.

Modal (with Bootstrap)

$.hivetek.doAjaxModal('/example', {'foo': 'bar'}, false); // Open modal.
$.hivetek.closeModal(); // Close modal.

Build

npm install
npx gulp

License

The MIT License (MIT). Please see License File for more information.