7
The main aie-container, event and command syntax and usage for AIE including ONLOAD, TOGGLE / INSERT / REMOVE CLASS, TRIGGER, RESET AND RESET ALL. Updated: 2014-07-18
The AIE Event Module defines a number of structures, keyterms and assembly syntax rules to make it possible to create simple, large and even massive event-drive interactive content.
This section covers the basic scripting commands for directly manipulating class statements within target HTML elements identified by ID or a CSS class attribute.
EVENT Fixed. Literal An event must be declared, named, have an ID reference and an action. There must be a matching Event Container that uses the same name.
EVENTSTART Fixed. Literal. Must have the event name after it. This declares the start of an Event Container.
EVENTEND Fixed. Literal. Must have the event name after it. This declares the end of an Event Container.
This is the required syntax to set up any AIE script within an HTML section or page. The AIE script is contained in a <pre class="aie-events"> ... </pre> element within the body of the HTML.
<pre> is used to allow any text layout to be applied. The pre element is hidden from user view using standard CSS syntax.
.aie-events {display: none; }
<pre class="aie-events"> EVENT name id="abc" click EVENTSTART name <!-- Event instructions go here --> EVENTEND name </pre>
A command event item consists of:
Examples:
0 element-z COMMAND TOGGLECLASS "hide"
0 XX COMMAND TRIGGER event-name
0 XX COMMAND RESET
All of the event item instructions are written in one line separated by a single space
TRIGGER references the target event, not a CSS selector
RESET and RESET all do not have a final event as they are self referencing.
There must be only one space between event instruction line elements. If there is more than one space between any two statements the event will not run.
An event can contain any standard AIE timed instruction or COMMAND
ONLOAD An onload event is triggered when a page is opened.
COMMAND TOGGLECLASS The CSS class in the target element is changed between two states.
COMMAND ADDCLASS The CSS class in the target element has a class statement inserted.
COMMAND REMOVECLASS The CSS class in the target element has a class statement removed.
COMMAND TRIGGER An event calls and starts another event by Event Name.
COMMAND RESET Resets an event to its initial CSS state.
COMMAND RESETALL Resets a full script and all the events within the script to it initial CSS state.
This is a special event to allow something to happen in a controlled manner when a page is opened. It particularly allows operational things such as loading delays for audio and other elements. It allows "scene setting" for larger event scripts.
ONLOAD is used in Event declarations
EVENT eventx id=XX ONLOAD EVENT eventx id=event1 click EVENTSTART eventx <!-- Event instructions go here --> EVENTEND eventx
This event will be called on page load. Because it does not have an ID the standard XX (no ID required) placeholder is used.
The event being called must be correctly defined in the event declarations. (In this example eventx).
EVENT eventx id=event1 click. It is possible for another event to be tied to the eventx
This is a standard event.
Syntax: COMMAND TOGGLECLASS
EVENT eventx id="element-y" click EVENTSTART eventx 0 element-z COMMAND TOGGLECLASS "color" EVENTEND eventx
This is a standard event. Syntax: COMMAND ADDCLASS
EVENT eventx id="element-y" click EVENTSTART eventx 0 element-z COMMAND ADDCLASS "color" EVENTEND eventx
This is a standard event.
Syntax: COMMAND REMOVECLASS
EVENT eventx id="element-y" click EVENTSTART eventx 0 element-z 0 COMMAND REMOVECLASS "color" EVENTEND eventx
This is a special event that starts a new event from inside an event..
Syntax: XX COMMAND TRIGGER.
Trigger references another event so does not need an HTML ID or class reference. Trigger uses the XX ID placeholder.
EVENT event-x id="element-x" click EVENT event-y id="element-y" click EVENT event-z id="element-z" click EVENTSTART event-x 1000 XX COMMAND TRIGGER event-y EVENTEND event-x EVENTSTART event-y 0 element-x COMMAND ADDCLASS "hide" 1000 XX COMMAND TRIGGER event-z EVENTEND event-y EVENTSTART event-z 0 element-x COMMAND REMOVECLASS "hide" EVENTEND event-z
When element-x was clicked event-x started.
After 1 second event-x TRIGGERed event-y which applied class "hide" to the element with ID element-y.
After 1 more second event-y TRIGGERed eventz which removed the class "hide" from the element with ID element-x
This is an artificial example but illustrates that triggers can be used in a waterfall (or even recursively).
This is a special event that resets an element to the opening CSS state.
Syntax: COMMAND RESET
EVENT eventx id="element-y" click EVENTSTART eventx 0 id-z COMMAND RESET 100 .class COMMAND RESET EVENTEND eventx
In the first ID case only the id-z will be reset to its opening state.
In the second .class case, any and all elements using this class will be reset.
Note that Timeline can be used for these events for any reason. They can all be set to 0 as well.
This is a special event that resets all class statements to the opening CSS state.
Syntax: XX COMMAND RESETALL
EVENT resetall id=reset-button click EVENTSTART resetall 0 XX COMMAND RESETALL EVENTEND resetall
This is a very powerful command and can be called from within any Event.