Note: Penguins.js uses semantic versioning as defined as in Semantic Versioning 1.0
. Penguins.js is all about thePenguinsJS
function, which can also be written as:
_PenguinsJS
_
__
Functionality | Uses | Status |
---|---|---|
_('[CSS selector]') | Returns a Penguins.js object based on the input selector | |
_('...').set('[property]', '[value]') | Sets the property [property] to [value] for each element matching the CSS selector ... | |
_('...').add('[property]', '[value]') | Adds [value] to the property [property] of all elements matching the CSS selector ... | |
_('...').onEvent('[event]', [function]) | Adds an event listener to all elements matching the CSS selector .. | |
_('...').get('[property]') | Returns an array of the value of property [property] of all elements matching CSS selector ... | |
new _('[type]').requestTo('[URL]') | Returns a [type] AJAX request to [URL], asynchronous by default | |
request.onResponse = [callback] | Equivalent of the onreadystatechange Vanilla JS property. Does not require a check (if(this.status === 200 && this.readyState === 4)) | |
request.send() | Sends the AJAX request request (for GET requests) | |
request.send('[data]') | Semds the AJAX request request (for POST requests) | |
_('*').date | Returns the date as in Vanilla javaScript new Date() | |
PenguinsJS.version | Returns an object containing information about the version of Penguins.js used | |
browser | Returns an object containing information about the browser version and name etc. | |
_('[selector]').toDOMNodeList | Converts the Penguins.js object into a DOM node list | |
_('[selector]').toDOMNodeArray | Converts the Penguins.js object into an array of DOM nodes | |
metadata | Returns an object including information about the metadata of the HTML document ONLY if jQuery is included | |
metadata.addTag('[name]', '[value]') | Adds a <META> tag with NAME attribute set to [name] and CONTENT attribute set to [value] | |
metadata.removeTag('[name]') | Removes the first <META> tag with NAME attribute set to [name] | |
_('...').selector | Returns the initial selector ... | |
_('*').playAudioAt([obj]) | Plays audio at the source [obj].source and volume [obj].volume | |
JSONAt('[source]', [onerror]) | Gets the JSON at source [source]. [onerror] is optional, and is for error handling | |
_('...').addElement('[tag name]', '[voidity]', '[ID]') | Appends a [tag name] HTML tag with voidity [voidity] and an ID of [ID] to the elements matching CSS selector ... |