API Docs for:
Show:

LiteGUI Class

Defined in: ../src/core.js:2

Core namespace of LiteGUI library, it holds some useful functions

Constructor

LiteGUI

()

Defined in ../src/core.js:2

Methods

add

(
  • litegui_element
)

Defined in ../src/core.js:174

Appends litegui widget to the global interface

Parameters:

  • litegui_element Object

addCSS

(
  • code
)

Defined in ../src/core.js:355

Insert some CSS code to the website

Parameters:

  • code String | Object

    it could be a string with CSS rules, or an object with the style syntax.

alert

(
  • content
  • options
)

Defined in ../src/core.js:782

Shows an alert dialog with a message

Parameters:

  • content String
  • options Object

    ( title, width, height, content, noclose )

choice

(
  • content
  • callback
  • options
)

Defined in ../src/core.js:899

Shows a choice dialog with a message

Parameters:

  • content String
  • callback Function
  • options Object

    ( title, width, height, content, noclose )

cloneObject

(
  • object
  • target
)

Defined in ../src/core.js:1086

Clones object content

Parameters:

  • object Object
  • target Object

confirm

(
  • content
  • callback
  • options
)

Defined in ../src/core.js:803

Shows a confirm dialog with a message

Parameters:

  • content String
  • callback Function
  • options Object

    ( title, width, height, content, noclose )

createButton

(
  • id
  • content
  • callback
  • style
)

Defined in ../src/core.js:665

Request script and inserts it in the DOM

Parameters:

  • id String
  • content String
  • callback Function

    when the button is pressed

  • style Object | String

createDropArea

(
  • element
  • callback_drop
  • callback_enter
)

Defined in ../src/core.js:1179

Helper, makes drag and drop easier by enabling drag and drop in a given element

Parameters:

  • element HTMLElement

    the element where users could drop items

  • callback_drop Function

    function 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
)

Defined in ../src/core.js:619

Request script and inserts it in the DOM

Parameters:

  • tag String
  • id_class String

    string containing id and classes, example: "myid .someclass .anotherclass"

  • content String
  • style Object

draggable

(
  • container
  • dragger
)

Defined in ../src/core.js:1011

Makes one element draggable

Parameters:

  • container HTMLEntity

    the element that will be dragged

  • dragger HTMLEntity

    the area to start the dragging

getById

(
  • id return
)

Defined in ../src/core.js:215

wrapper of document.getElementById

Parameters:

  • id return String

    {HTMLEntity}

getLocalClipboard

() String

Defined in ../src/core.js:338

Reads from the secondary clipboard (only can read if the data was stored using the toClipboard)

Returns:

String:

clipboard

getUrlVars

()

Defined in ../src/core.js:981

Returns the URL vars ( ?foo=faa&foo2=etc )

init

(
  • options
)

Defined in ../src/core.js:26

initializes the lib, must be called

Parameters:

  • options Object

    some options are container, menubar,

popup

(
  • content
  • options
)

Defined in ../src/core.js:757

Shows a dialog with a message

Parameters:

  • content String
  • options Object

    ( min_height, content, noclose )

prompt

(
  • content
  • callback
  • options
)

Defined in ../src/core.js:839

Shows a prompt dialog with a message

Parameters:

  • content String
  • callback Function
  • options Object

    ( title, width, height, content, noclose )

remove

(
  • litegui_element
)

Defined in ../src/core.js:184

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 Object

    it also supports HTMLentity, selector string or Array of elements

request

(
  • request
  • on_complete
)

Defined in ../src/core.js:406

Request file from url (it could be a binary, text, etc.). If you want a simplied version use

Parameters:

  • request Object

    object with all the parameters like data (for sending forms), dataType, success, error

  • on_complete Function

requestBinary

(
  • url
  • on_complete
  • on_error
)

Defined in ../src/core.js:520

Request binary file from url

Parameters:

  • url String
  • on_complete Function
  • on_error Function

requestJSON

(
  • url
  • on_complete
  • on_error
)

Defined in ../src/core.js:508

Request file from url

Parameters:

  • url String
  • on_complete Function
  • on_error Function

requestText

(
  • url
  • on_complete
  • on_error
)

Defined in ../src/core.js:496

Request file from url

Parameters:

  • url String
  • on_complete Function
  • on_error Function

requireCSS

(
  • url
  • on_complete
)

Defined in ../src/core.js:380

Requires a new CSS

Parameters:

  • url String

    string with url or an array with several urls

  • on_complete Function

requireScript

(
  • url
  • on_complete
  • on_error
  • on_progress
)

Defined in ../src/core.js:533

Request script and inserts it in the DOM

Parameters:

  • url String | Array

    the 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
)

Defined in ../src/core.js:260

Change cursor

Parameters:

  • cursor String

setCursor

(
  • cursor
)

Defined in ../src/core.js:270

Test if the cursor is inside an element

Parameters:

  • cursor String

sizeToCSS

(
  • size
)
String

Defined in ../src/core.js:1162

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:

String:

valid css size string

toClipboard

(
  • data
  • force_local
)

Defined in ../src/core.js:293

Copy a string to the clipboard (it needs to be invoqued from a click event)

Parameters:

  • data String
  • force_local Boolean

    force to store the data in the browser clipboard (this one can be read back)

trigger

(
  • element
  • event_name
  • params
  • origin
)

Defined in ../src/core.js:88

Triggers a simple event in an object (similar to jQuery.trigger)

Parameters:

  • element Object

    could be an HTMLEntity or a regular object

  • event_name String

    the type of the event

  • params

    it will be stored in e.detail

  • origin

    it will be stored in e.srcElement

trigger

(
  • element
  • event
  • callback
)

Defined in ../src/core.js:109

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 Object

    could be an HTMLEntity, a regular object, a query string or a regular Array of entities

  • event String

    the string defining the event

  • callback Function

    where to call

unbind

(
  • element
  • event
  • callback
)

Defined in ../src/core.js:159

Unbinds an event in an object (similar to jQuery.unbind)

Parameters:

  • element Object

    could be an HTMLEntity or a regular object

  • event String

    the string defining the event

  • callback Function

    where to call