11 Windows
KaKi87 edited this page 2018-11-01 19:21:26 +01:00

Windows

Everything happens in the sWindow object.

UI

A window is animated : when it appears, its width will progressively increase from 0 to its maximum value.

Then, the same will happens for the height.

Windows are movable by holding left click and closable by double left clicking on them.

By default, a window's max height is 300px and it is scrollable.

Create a new window

Use the sWindow.new function.

Available parameters :

  • id : string unique identifier for the window
  • class : string custom HTML class attribute
  • title : (optional) string window title
  • red : (optional) boolean [false] red triangle and title
  • position : object window positioning in absolute values
    • top/bottom : number CSS unit
    • left/right : number CSS unit
  • customCSS : (optional) object JS-defined CSS properties for the window
  • closable : (optional) boolean [true]
  • maxHeight : (optional) number [300px] window's max height in pixels
  • forceHeight : (optional) boolean [false] force window's maw height if > 300px
  • content : array window contents

The window will not be created if the ID already exists.

Window contents (objects)

Title

  • type : string [title]
  • text : string value

Adding "red" in type will apply glow red background color to the title.

Note : not to be confused with the window's title.

Normal text

  • type : string [normal]
  • text : string value

Make line breaks with \n in the text property.

Adding "red"

Data

  • type : string [data]
  • text : string value

Custom type attributes

Add these in type (next to the initial type).

  • redText : apply red color
  • red : apply red background color (+ glow for titles)

Multiple aligned contents

Just make an array of contents (objects). Tested only with normal text + data.

Special windows

These windows can't be replicated.

Clock

This window's id is clock.

Display clock

clock();

Timer

This window's id is timer.

Display & start timer

timer();

This feature is very incomplete.

Countdown

This window's id is countdown.

Create the countdown window

countdown.create();

Start countdown from date

countdown.from(t);

  • t : string date in DD.MM.YYYY HH:MM:SS format

Start countdown to date

countdown.to(t);

  • t : string date in HH:MM:SS format (with unlimited number of H)

Stop countdown

countdown.stop();

NLP

nlp(sentence, keywords, final);

  • sentence : string
  • keywords : (optional) array [empty] relevant keywords in sentence (highlighted in red)
  • final : (optional) boolean [false] execute sentence as command and destroy NLP window

Destroy a window

sWindow.destroy(id);

Destroy all windows

sWindow.destroyAll();