<docbook><section><title>OATDOCloader</title><para> </para>
<title> loader.js</title> loader.js
<para>This is the basic library.
 Can be considered a toolkit on its own, as it provides many useful functions and shortcuts.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> Functions</bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> $(element)</bridgehead>
<para>This function is very popular and appears in almost every <ulink url="JavaScript">JavaScript</ulink> framework available.
 Its purpose is to provide a shortcut for longer <computeroutput>document</computeroutput>.<computeroutput>getElementById()</computeroutput> functions.
 Basic usage is:</para>
<programlisting>var object = $(&quot;some_id&quot;);
alert(object.tagName);
</programlisting><para> In this example, we assume that there is a HTML node with id &quot;some_id&quot;.
 The <computeroutput>$()</computeroutput> function converts a string to the object.
 Note that it is perfectly correct to pass an object reference to <computeroutput>$()</computeroutput> function, although not very useful.</para>
<para>Due to the presence of this function in toolkit, every other function that accepts a node reference as an argument can also accept its id.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> $$(className, element)</bridgehead>
<para>This function returns a list of HTML nodes below <computeroutput>element</computeroutput> (document when not specified), belonging to a specified className.</para>
<para> <emphasis>NOTE!</emphasis> Prior to OAT version 2.8, this function was identical to <computeroutput>$v()</computeroutput>.
 Please update your code to reflect this change and use <computeroutput>$v()</computeroutput> where appropriate.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> $v(element)</bridgehead>
<para>This function is a shortcut for <computeroutput>$().value.</computeroutput> You should use it when getting a value of any form element.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.create(tagName, [styleObj], [className])</bridgehead>
<para>Used for dynamic creation of HTML nodes.
 Three parameters are accepted; the first one is mandatory.
 Example:</para>
<programlisting>var myDiv = OAT.Dom.create(&quot;div&quot;); var myStyledDiv = OAT.Dom.create(&quot;div&quot;, {color : &quot;#f00&quot;, fontWeight : &quot;bold&quot;}, &quot;myDiv_class&quot;);
</programlisting><para> The second (optional) argument style <computeroutput>Obj</computeroutput> is an object comprised of CSS properties.
 For a full list of valid properties, see Mozilla documentation and MSDN.
 CSS properties are not the same for all browsers, so specifying a floating element looks like:</para>
<programlisting>var element = OAT.Dom.create(&quot;div&quot;, {cssFloat:&quot;left&quot;, styleFloat:&quot;left&quot;}); 
</programlisting><para> The first declaration is for Gecko; the latter is for MSIE.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.createNS(namespace, tagName)</bridgehead>
<para>Used for dynamic creation of HTML nodes in particular namespace.
 See also <computeroutput>OAT.Dom.create()</computeroutput>, above.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.text(text)</bridgehead>
<para>Creates and returns DOM text node with value of argument text.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.button(label)</bridgehead>
<para>Creates and returns DOM button with specified <computeroutput>label</computeroutput>.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.radio(name)</bridgehead>
<para>Creates and returns DOM radio input with specified <computeroutput>name</computeroutput>.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.image(src, srcBlank, width, height)</bridgehead>
<para>Creates and returns DOM image node.
 <computeroutput>src</computeroutput> is image&#39;s URL; when PNG is used, specify srcBlank(url of transparent image) for Internet Explorer&#39;s workaround.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.option(name, value, [parent])</bridgehead>
<para>Creates and returns DOM name value parent.</para>
<programlisting>var s = OAT.Dom.create(&quot;select&quot;); OAT.Dom.option(&quot;apples&quot;,1,s); OAT.Dom.option(&quot;bananas&quot;,2,s); OAT.Dom.option(&quot;cherries&quot;,3,s);
</programlisting><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.append([parent1, child1, child2, ...], [parent2, child1, ...],...)</bridgehead>
<para>Links any number of DOM nodes.
 Takes variable amount of arguments, each argument must be an array.
 For each argument:</para>
<itemizedlist mark="bullet" spacing="compact"><listitem>First value is taken as parent node </listitem>
<listitem>All other values are appended to parent (in order in which they appear)</listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.hide(element)</bridgehead>
<para>Hides specified element by setting its <computeroutput>style.visibility</computeroutput> property.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.show(element)</bridgehead>
<para>Unhides previously hidden element by setting its <computeroutput>style.visibility</computeroutput> to default value.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.clear(element)</bridgehead>
<para>This function clears all child nodes from an element.
 May be called with either object reference or id-string as an argument.</para>
<para>For instance, the following would remove all options from existing &lt;select%gt; element with id &quot;my select_element&quot; --</para>
<programlisting>OAT.Dom.clear(&quot;my_select_element&quot;);
</programlisting><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.unlink(element)</bridgehead>
<para>Unlinks element from DOM tree.
 Notice that the element is not destroyed as long as it can be referenced</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.center(element, x, y, [reference])</bridgehead>
<para>Centers element relative to its parent node.
 If <computeroutput>reference</computeroutput> is specified, this node is used instead of parent node.
 <computeroutput>x</computeroutput> and <computeroutput>y</computeroutput> are bools, specifying whether horizontal and/or vertical centering should be done.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.isChild(child, parent)</bridgehead>
<para>Tests whether a <computeroutput>child</computeroutput> is a subnode of nodeparent.
 The depth is not important here.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.isClass(element, className)</bridgehead>
<para>HTML elements may be of multiple classes, this function returns true when at least one of element&#39;s classes is className.
 Example:</para>
<programlisting>var div = OAT.Dom.create(&quot;div&quot;); div.className = &quot;big red fox&quot;; alert( OAT.Dom.isClass(div,&quot;fox&quot;); ); // true
</programlisting><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.addClass(element, className)</bridgehead>
<para>Adds class className to element.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.removeClass(element, className)</bridgehead>
<para>Removes class className from element.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.getViewport()</bridgehead>
<para>Returns size (2-item array) of current view port.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.getScroll()</bridgehead>
<para>Returns amount of scroll (2-item array) of current view port.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.position(element)</bridgehead>
<para>Returns x and y coordinates of element&#39;s top left corner, relative to page&#39;s top left corner.
 Coordinates are returned in an array of two elements.
 To count this value, the whole tree of offsetParents must be climbed up, so it is not wise to call this function too often.
 Example:</para>
<programlisting>var coords = OAT.Dom.position(div);
alert(&quot;x: &quot; + coords[0]+&quot;, y:&quot; + coords[1]);
</programlisting><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.getLT(element)</bridgehead>
<para>Returns x and y coordinates of element&#39;s top left corner, relative to its offsetParent, in form of array with two elements.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.getWH(element)</bridgehead>
<para>Returns width and height of element(in pixels), in form of array with two elements.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.moveBy(element, dx, dy)</bridgehead>
<para>Moves element by dx pixels horizontally and dy pixels vertically.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.resizeBy(element, dx, dy)</bridgehead>
<para>Resizes element by dx pixels horizontally and dy pixels vertically.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.removeSelection()</bridgehead>
<para>Unselects everything selected.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.uriParams()</bridgehead>
<para>Returns an object of current URI parameters.
 So, for/?a=b&amp;c[]=d&amp;c[]=e, this returns:</para>
<programlisting>{
        a:&quot;b&quot;,
        c:[&quot;d&quot;,&quot;e&quot;]
}
</programlisting><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.changeHref(element, newHref)</bridgehead>
<para>Changes the href attribute of the given element.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.toSafeXML(string)</bridgehead>
<para>Convert HTML special chars in the given string into entities.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Dom.toSafeXML(string)</bridgehead>
<para>Decrypt entities in the given string.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Event.attach(element, event, callback)</bridgehead>
<para>Attaches function specified with callback to event detected on element.
 The event is specified without the &quot;on&quot; prefix.
 Function reference callback will be called with one argument, the event object reference.
 Example:</para>
<programlisting>OAT.Event.attach(&quot;myDiv&quot;, &quot;click&quot;, function() { alert(&quot;!&quot;); });
</programlisting><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Event.detach(element, event, callback)</bridgehead>
<para>Removes attached callback from element fired with event.
 Note that only non-anonymous functions can be detached.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Event.source(event)</bridgehead>
<para>Converts event to reference to element which fired it.
 This can be useful when multiple elements fire the same callback and one needs to know which element fired it.
 Example:</para>
<programlisting>var callback = function(event) {
        var id = OAT.Event.source(event).id;
        alert(&quot;Event fired by &quot; + id);
}
var div = OAT.Dom.create(&quot;div&quot;);
div.id = &quot;myDiv&quot;;
OAT.Dom.attach(div, &quot;click&quot;, callback);
</programlisting><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Event.cancel(event)</bridgehead>
<para>Cancels bubbling of <computeroutput>event</computeroutput>.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Event.position(event)</bridgehead>
<para>Returns coordinates of event, relative to top left corner of page.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Event.prevent(event)</bridgehead>
<para>Prevents default action if event(form submit, context menu, image-to-new-tab drag, ...).</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Style.include(filename,force)</bridgehead>
<para>Include CSS stylesheet filename into the page.
 (See <computeroutput>OAT.Preferences.stylePath</computeroutput> property.) Stylesheet will be reincluded if force option is passed.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Style.get(element, property)</bridgehead>
<para>Returns a style property of element.
 This is different from accessing the <computeroutput>element.style.property</computeroutput> value, as this function returns the computed style (i.e., set by stylesheets, etc.) instead of a dynamically created one.
 Example:</para>
<programlisting>var family = OAT.Style.get(&quot;elementId&quot;, &quot;fontFamily&quot;);
alert(family); // returns actual font-family for this element, wherever it is set
</programlisting><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Style.apply(element, styleObj)</bridgehead>
<para>Applies style Obj to element.
 <computeroutput>styleObj</computeroutput> follows the same conventions defined in <computeroutput>OAT.Dom.create()</computeroutput>.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Style.opacity(element, opacity)</bridgehead>
<para>Sets element&#39;s opacity to opacity.
 Acceptable range: 0 (transparent) - 1 (opaque).</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Style.background(element, url)</bridgehead>
<para>Sets element&#39;s background image to the one specified by url.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> Preferences</bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Preferences.showAjax</bridgehead>
<para>Show Ajax window even if not explicitly requested by application.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Preferences.useCursors</bridgehead>
<para>Use scrollable cursors.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Preferences.windowTypeOverride</bridgehead>
<para>Do not guess window type.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Preferences.xsltPath</bridgehead>
<para>Path to the XSLT stylesheets.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Preferences.imagePath</bridgehead>
<para>Path to the images.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Preferences.stylePath</bridgehead>
<para>Path to the CSS stylesheets.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Preferences.httpError</bridgehead>
<para>Show HTTP errors.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> Properties</bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Browser.isIE</bridgehead>
<para>Returns true if used browser is Internet Explorer.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Browser.isIE6</bridgehead>
<para>Returns true if used browser is Internet Explorer 6.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Browser.isIE7</bridgehead>
<para>Returns true if used browser is Internet Explorer 7.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Browser.isGecko</bridgehead>
<para>Returns true if used browser is Gecko-based (Firefox, Mozilla).</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Browser.isOpera</bridgehead>
<para>Returns true if used browser is Opera.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Browser.isWebKit</bridgehead>
<para>Returns true if used browser is Apple <ulink url="WebKit">WebKit</ulink>.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Browser.isKonqueror</bridgehead>
<para>Returns true if used browser is KDE Konqueror.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Browser.isKHTML</bridgehead>
<para>Returns true if used browser is KHTML-based (practically, this means Konqueror or Safari).</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Browser.isMac</bridgehead>
<para>Returns true if used operating system is Mac OS.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Browser.isLinux</bridgehead>
<para>Returns true if used operating system is Linux.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Browser.isWindows</bridgehead>
<para>Returns true if used operating system is Windows.</para>
<para><ulink url="CategoryDocumentation">CategoryDocumentation</ulink> <ulink url="CategoryOAT">CategoryOAT</ulink> <ulink url="CategoryOpenSource">CategoryOpenSource</ulink></para>
</section></docbook>