globalMessage(str,param,ID,sender)
send a message globally, all Sensors contain a mandatory function gMsg(str,param) to which the str is forwarded. param is used to identify the message, or by the receiver to filter incoming informations.
All Sensors will get the globalMessage if ID == null
If sender == null also the sender will get the globalMessage
If ID exists the message will be delivered only to the relative Instance
example:
globalMessage("hallo!","my custom param",7,myInstanceID);
There are some standard message to which a custom sensor should answer, see Display IMS
msg(str)
Send a message to the Message Board inside Console
When no Console is specified, the Default_Interface will be loaded, including Message Board and Input_panel.
If the Message Board is available the message will be delivered.
clearPage()
Remove all Boards form Page
createSensors()
Create Sensor Boards starting from the url CODES ( parameter s= ...|...|... )
Instance Finder
self(item)
Used inside event handlers functions in order to find the owner of a triggered event
self( item whose attribute name = Instance ID given by Display during creation )
// Memory
addMemory(code,name)
Add a CODE to Memory in order to keep track of it and its NAME. the name is needed to create new Instances, the code is needed to find the script
sensorName(code)
Extracts the name of a Sensor from the Memory starting from its CODE
clearMemory()
Clear the Memory ( just the <div> )
openMemory()
closeMemory()
open and close Memory Panel
// Console
defaultConsole()
Add the Default Console to Console, containing Input Panel and Message Board
loadConsole()
Load the Controls inside Console starting from the url parameter c=...|...|...
clearConsole()
Removes all objects from Console
openConsole()
closeConsole()
open and close Console
control(id,location)
Creates a standard Control panel inside Console at the given location passing the id of the instance.
Returns a <div>
Used inside a Sensor to create a Standard Control container, then append to it the sensor GUI items.
Possible Locations:
C1, C2, C3
example:
this.control = control(this.id,"C1");
this.control.append("<div>hallo world!</div>");
display(id,location);
Creates a standard Board panel inside Page at the given location passing the id of the instance
Returns a <div>
Used inside a Sensor to create a Standard Control container, then append to it the sensor GUI items
Possible Locations:
Top, Left, Center, Bottom, Right
example:
this.display= control(this.id,"Center");
this.display.append("<div>hallo world!</div>");
General utility functions:
Link
string link(label,scr,target,action)
Display can show Controls and Boards, and they can contain things similar to links, able to allow navigation from a script to another one, building and deleting modules in real time.
With this logic Display works like a kind of browser, moving from a script to the nex one.
Thanks to Links, you can easy create connections and networks of connections and build any kind of interface.
Display offers a function to directly create GUI Links.
Links are standard objects with a general event handler, so you just have to follow the standard offered by Display. Links are built over 4 basic informations:
1) LABEL = the label for your link
2) SCR = the script you want to "visit"
3) ACTION = since you are clicking a link in Page or in Console, the link may produce a complete cleaning action of the Page/Console before to load the next script, so
there's an easy way to append a link to your GUI assuming you have a ready div:
- 0 nothing
- 1 Clean Console
- 2 Clean Page
- 3 Clean Page and Console
4) TARGET
the new GUI object (a new Control/Board) will be built in the Console or in the Page
- c1 opens the new script in the Console position 1
- c2 opens the new script in the Console position 1
- c3 opens the new script in the Console position 1
- s opens the new script in the Page in Center position
- t opens the new script in the Page in Top position
- l opens the new script in the Page in Left position
- r opens the new script in the Page in Right position
- b opens the new script in the Page in Bottom position
- ec1 opens the new script in a new browser page in the Console position 1
- ec2 opens the new script in a new browser page the Console position 1
- ec3 opens the new script in a new browser page the Console position 1
- es opens the new script in a new browser page in the Page in Center position
- et opens the new script in a new browser page in the Page in Top position
- el opens the new script in a new browser page in the Page in Left position
- er opens the new script in a new browser page in the Page in Right position
- eb opens the new script in a new browser page in the Page in Bottom position
- web opens the webpage at "scr" in a new browser page
link(label,scr,target,action)
how to use, assuming youhave a ready div and you want to add a link inside:
var temp_str = link("click me","gist-da6e8ac73c824ae86860","c",0);
$("#my_div").append(link);
Load and Play a Sensor
loads the script for a Sensor, creates an instance, builds the GUI at the given target.
If the object is a Control will fire its Control, if the object is a Board it will fire its Board
loadPlay(scr,target)
examples:
loadPlay("gist-da6e8ac73c824ae86860","c");
loadPlay("gist-da6e8ac73c824ae86860","s");
Play
Play a script, the script must be previously loaded
play(scr,target)
examples:
play("gist-da6e8ac73c824ae86860","c");
play("gist-da6e8ac73c824ae86860","s");
Load Script and add to Memory
load_script(scr)
After loading the script will be visible in Memory
example:
load("gist-da6e8ac73c824ae86860");
Get CODES
var my_arr = get_codes( parameter );
tipical use:
var my_codes = get_url_parameter("s");
or
var my_codes = get_url_parameter("c");
Get URL parameters
var my_string = get_url_parameter(param)
used by Display in order to read the CODES
tipical use:
var my_codes = get_url_parameter("s");
returns something like:
gist-da6e8ac73c824ae86860|gist-da6e8ac73c824ae86860
or
1-BTC_ETH|1-BTC_LTC
Remove duplicates from array
array uniq(array)
example:
var my_arr=["hallo","ciao",""hallo];
my_arr=uniq(my_arr);
my_arr is now ["hallo","ciao"]
addressCODES(codes)
str getLocation(url-par)
accepts the name of a URL par and answers the corresponding div ID in Page or Console
Parameters accepted
c,c1,c2 become C1,C2,C3
s,t,l,r,b become Center,Top,Left,Right,Bottom
loadLayout("layout-00000000000000")
Substitutes #Page.html() with a remote custom layout.
scriptIsLoaded(CODE)
getPrefix(CODE) returns a string prefix
getGISTID(CODE) returns a string GIST ID
getCustomCODE(CODE) returns a string with Custom Information