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_element
Object
addCSS
-
code
Insert some CSS code to the website
Parameters:
-
code
String | 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:
-
content
String -
options
Object( title, width, height, content, noclose )
choice
-
content
-
callback
-
options
Shows a choice dialog with a message
Parameters:
-
content
String -
callback
Function -
options
Object( title, width, height, content, noclose )
cloneObject
-
object
-
target
Clones object content
Parameters:
-
object
Object -
target
Object
confirm
-
content
-
callback
-
options
Shows a confirm dialog with a message
Parameters:
-
content
String -
callback
Function -
options
Object( title, width, height, content, noclose )
createButton
-
id
-
content
-
callback
-
style
Request script and inserts it in the DOM
Parameters:
-
id
String -
content
String -
callback
Functionwhen the button is pressed
-
style
Object | String
createDropArea
-
element
-
callback_drop
-
callback_enter
Helper, makes drag and drop easier by enabling drag and drop in a given element
Parameters:
-
element
HTMLElementthe element where users could drop items
-
callback_drop
Functionfunction to call when the user drops the item
-
callback_enter
Function[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:
-
tag
String -
id_class
Stringstring containing id and classes, example: "myid .someclass .anotherclass"
-
content
String -
style
Object
draggable
-
container
-
dragger
Makes one element draggable
Parameters:
-
container
HTMLEntitythe element that will be dragged
-
dragger
HTMLEntitythe area to start the dragging
getById
-
id return
wrapper of document.getElementById
Parameters:
-
id return
String{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:
-
options
Objectsome options are container, menubar,
popup
-
content
-
options
Shows a dialog with a message
Parameters:
-
content
String -
options
Object( min_height, content, noclose )
prompt
-
content
-
callback
-
options
Shows a prompt dialog with a message
Parameters:
-
content
String -
callback
Function -
options
Object( 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_element
Objectit 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:
-
request
Objectobject with all the parameters like data (for sending forms), dataType, success, error
-
on_complete
Function
requestBinary
-
url
-
on_complete
-
on_error
Request binary file from url
Parameters:
-
url
String -
on_complete
Function -
on_error
Function
requestJSON
-
url
-
on_complete
-
on_error
Request file from url
Parameters:
-
url
String -
on_complete
Function -
on_error
Function
requestText
-
url
-
on_complete
-
on_error
Request file from url
Parameters:
-
url
String -
on_complete
Function -
on_error
Function
requireCSS
-
url
-
on_complete
Requires a new CSS
Parameters:
-
url
Stringstring with url or an array with several urls
-
on_complete
Function
requireScript
-
url
-
on_complete
-
on_error
-
on_progress
Request script and inserts it in the DOM
Parameters:
-
url
String | Arraythe url of the script or an array containing several urls
-
on_complete
Function -
on_error
Function -
on_progress
Function(if several files are required, on_progress is called after every file is added to the DOM)
setCursor
-
cursor
Change cursor
Parameters:
-
cursor
String
setCursor
-
cursor
Test if the cursor is inside an element
Parameters:
-
cursor
String
sizeToCSS
-
size
Convert sizes in any format to a valid CSS format (number to string, negative number to calc( 100% - number px )
Parameters:
-
size
String | | 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:
-
data
String -
force_local
Booleanforce 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:
-
element
Objectcould be an HTMLEntity or a regular object
-
event_name
Stringthe type of the event
-
params
it will be stored in e.detail
-
origin
it 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:
-
element
Objectcould be an HTMLEntity, a regular object, a query string or a regular Array of entities
-
event
Stringthe string defining the event
-
callback
Functionwhere to call
unbind
-
element
-
event
-
callback
Unbinds an event in an object (similar to jQuery.unbind)
Parameters:
-
element
Objectcould be an HTMLEntity or a regular object
-
event
Stringthe string defining the event
-
callback
Functionwhere to call