Blockstrap Functions
Blockstrap Functions & Variables
These functions are not attached to any modules and are in most cases used prior to the initialization of the core functions.
They are often called by first setting $bs = blockstrap_functions;
- where you can then use the following functions anywhere:
$bs.array_length
(obj)$bs.check
(options, callback)$bs.exists
(url)$bs.get_css
(attributes)$bs.include
(blockstrap, start, files, callback, dependency)$bs.initialize
()$bs.js
(id, src, callback)$bs.json
(string)$bs.slug
(slug)$bs.unslug
(slug)$bs.update
(version, callback)$bs.vars
(variable)
$bs.array_length
(obj) - back to top
This function takes and array or an object and returns the number of first-level items it contains.
$bs.check
(options, callback) - back to top
This function is called prior the Plugin Construct and is designed to ensure that the current device has the minimum requirements. The options
are those obtained from defaults.json
but is currently not used. In fact, at the moment, the only check that is performed by this function is to ensure that localStorage is functioning normally.
$bs.exists
(attributes) - back to top
This function checks to see whether the url
exists or not.
$bs.get_css
(attributes) - back to top
This function emulates jQuery.getScript()
but is used for including CSS files. It is based upon Intesso's getCSS.
$bs.include
(blockstrap, start, files, callback, dependency) - back to top
This function is used to include multiple files
and then perform the necessary callback
function upon completion.
$bs.initialize
() - back to top
This function is used to initiate core upon first completing the necessary prerequisites.
$bs.js
(id, src, callback) - back to top
This function is used to add a JavaScript file to the header of the DOM.
$bs.json
(string) - back to top
This function is check whether or not a string is a JSON array.
$bs.slug
(slug) - back to top
This function is used to convert a string into something more sensible for URL structures.
$bs.unslug
(slug) - back to top
This function is used in an attempt to convert a slug back to a more sensible text string.
$bs.update
(version, callback) - back to top
This function is used to check the version numbers in confguration against those stored locally to determine if an update is required.
$bs.vars
(variable) - back to top
This function is used for two things. If no variable
is provided it will return the variables in the current window.location
as an array of objects. If a variable
is provided it will return the value of that variable should it exist within the current window.location
else it will return false.