LiteGUI Class
Core namespace of LiteGUI library, it holds some useful functions
Constructor
LiteGUI
()
Item Index
Methods
Methods
add
-
litegui_element
Appends litegui widget to the global interface
Parameters:
-
litegui_elementObject
addCSS
-
code
Insert some CSS code to the website
Parameters:
-
codeString | Objectit could be a string with CSS rules, or an object with the style syntax.
alert
-
content -
options
Shows an alert dialog with a message
Parameters:
-
contentString -
optionsObject( title, width, height, content, noclose )
choice
-
content -
callback -
options
Shows a choice dialog with a message
Parameters:
-
contentString -
callbackFunction -
optionsObject( title, width, height, content, noclose )
cloneObject
-
object -
target
Clones object content
Parameters:
-
objectObject -
targetObject
confirm
-
content -
callback -
options
Shows a confirm dialog with a message
Parameters:
-
contentString -
callbackFunction -
optionsObject( title, width, height, content, noclose )
createButton
-
id -
content -
callback -
style
Request script and inserts it in the DOM
Parameters:
-
idString -
contentString -
callbackFunctionwhen the button is pressed
-
styleObject | String
createDropArea
-
element -
callback_drop -
callback_enter
Helper, makes drag and drop easier by enabling drag and drop in a given element
Parameters:
-
elementHTMLElementthe element where users could drop items
-
callback_dropFunctionfunction to call when the user drops the item
-
callback_enterFunction[optional] function to call when the user drags something inside
createElement
-
tag -
id_class -
content -
style
Request script and inserts it in the DOM
Parameters:
-
tagString -
id_classStringstring containing id and classes, example: "myid .someclass .anotherclass"
-
contentString -
styleObject
draggable
-
container -
dragger
Makes one element draggable
Parameters:
-
containerHTMLEntitythe element that will be dragged
-
draggerHTMLEntitythe area to start the dragging
getById
-
id return
wrapper of document.getElementById
Parameters:
-
id returnString{HTMLEntity}
getLocalClipboard
()
String
Reads from the secondary clipboard (only can read if the data was stored using the toClipboard)
Returns:
clipboard
getUrlVars
()
Returns the URL vars ( ?foo=faa&foo2=etc )
init
-
options
initializes the lib, must be called
Parameters:
-
optionsObjectsome options are container, menubar,
popup
-
content -
options
Shows a dialog with a message
Parameters:
-
contentString -
optionsObject( min_height, content, noclose )
prompt
-
content -
callback -
options
Shows a prompt dialog with a message
Parameters:
-
contentString -
callbackFunction -
optionsObject( title, width, height, content, noclose )
remove
-
litegui_element
Remove from the interface, it is is an HTML element it is removed from its parent, if it is a widget the same.
Parameters:
-
litegui_elementObjectit also supports HTMLentity, selector string or Array of elements
request
-
request -
on_complete
Request file from url (it could be a binary, text, etc.). If you want a simplied version use
Parameters:
-
requestObjectobject with all the parameters like data (for sending forms), dataType, success, error
-
on_completeFunction
requestBinary
-
url -
on_complete -
on_error
Request binary file from url
Parameters:
-
urlString -
on_completeFunction -
on_errorFunction
requestJSON
-
url -
on_complete -
on_error
Request file from url
Parameters:
-
urlString -
on_completeFunction -
on_errorFunction
requestText
-
url -
on_complete -
on_error
Request file from url
Parameters:
-
urlString -
on_completeFunction -
on_errorFunction
requireCSS
-
url -
on_complete
Requires a new CSS
Parameters:
-
urlStringstring with url or an array with several urls
-
on_completeFunction
requireScript
-
url -
on_complete -
on_error -
on_progress
Request script and inserts it in the DOM
Parameters:
-
urlString | Arraythe url of the script or an array containing several urls
-
on_completeFunction -
on_errorFunction -
on_progressFunction(if several files are required, on_progress is called after every file is added to the DOM)
setCursor
-
cursor
Change cursor
Parameters:
-
cursorString
setCursor
-
cursor
Test if the cursor is inside an element
Parameters:
-
cursorString
sizeToCSS
-
size
Convert sizes in any format to a valid CSS format (number to string, negative number to calc( 100% - number px )
Parameters:
-
sizeString | | Number
Returns:
valid css size string
toClipboard
-
data -
force_local
Copy a string to the clipboard (it needs to be invoqued from a click event)
Parameters:
-
dataString -
force_localBooleanforce to store the data in the browser clipboard (this one can be read back)
trigger
-
element -
event_name -
params -
origin
Triggers a simple event in an object (similar to jQuery.trigger)
Parameters:
-
elementObjectcould be an HTMLEntity or a regular object
-
event_nameStringthe type of the event
-
paramsit will be stored in e.detail
-
originit will be stored in e.srcElement
trigger
-
element -
event -
callback
Binds an event in an object (similar to jQuery.bind) If the element is not an HTML entity a new one is created, attached to the object (as non-enumerable, called __events) and used
Parameters:
-
elementObjectcould be an HTMLEntity, a regular object, a query string or a regular Array of entities
-
eventStringthe string defining the event
-
callbackFunctionwhere to call
unbind
-
element -
event -
callback
Unbinds an event in an object (similar to jQuery.unbind)
Parameters:
-
elementObjectcould be an HTMLEntity or a regular object
-
eventStringthe string defining the event
-
callbackFunctionwhere to call
