Avitar Environmentaly Friendly API Documentation:
Table of Contents:


Program Information:

Program: Avitar's Environmentaly Freindly Aplication Program Interface
Filename: AEF_API.js
Author: David Smith (
see Credits as well)
E-mail: skyceo@aol.com
website: Avitar.net



Purpose:

To create a robust, extendable, and stable cross browser DHTML API for web developers.


Background:

Developed to fill a growing need for a powerfull API for professional and amature developers alike.

This code is an effort to aid production a cross browser, DOM compatible media within a reduced amount of time.

In addition some of the included functions make it almost effortless for anyone to add effects to their website that are more interactive.

By Design the code will be highly resuable with little or no changes for years with the exception of new functions.
times square hotel


Planned additions:



Revision History:









Version 1.2 Release: 11-02-2003 [DD-MM-YYYY] Size: About 1.4 KB (1,422 bytes)


Version 1.1 Release: 06-02-2003 [DD-MM-YYYY] Size: About 1.1KB (1149 bytes)


Version 1.0 Release: 04-02-2003 [DD-MM-YYYY] Size: About 1KB (901 bytes)




Credits:

This API was designed to conceptualy fill the same roll as the following DHTML/DOM API's.
Although it was initially planned to be mearly a spin-off as the other API's were,
requests and feedback (or from some the lack there of) of my fellow developers have
encouraged me to bring it to a the API it is today.

The most powerfull aspect of the api is that it accesses function support for decisions
rather than browser sniffing or making assumptions of which broser it is. For instance
my API does not assume that because of the presence of "document.all" that the
browser is IE. This is primarly because browser makers try to support even non-standard
code for better compatibility (ie. Opera implemented "document.all").

This Api backbone has been built off concepts developers dreams of what types of things
could be done to make their life easier.

заказ пиццы кропоткинская


Compatability:

Supports tested DOM1 & DOM2 Compliant Browsers quite well. The API is released after testing the code successfully in the following browsers. All DOM version 1 compatible (almost all new browsers) should work if they implemented the DOM model properly as indicated by w3.org. Even though these standards (as set by the community and browser makers) has been extablished for several years, sadly enough no browser truely complies with all of even the first draft of DOM standards. This makes the burden fall upon the shoulders of every individual web developer. If you would like to see just how pathetic the support is take a look at A HREF="http://www.quirksmode.org/?dom/contents.html">http://www.quirksmode.org/. Why would else would there be an incompatibility in browsers? Here are some reasons why:



Compatibility Matrix for the most recent version under Windows browsers:
IE 4 IE 5.x IE 6 NS 6.x NS 7.x Moz FB Moz 1.5.x Moz 1.6.x Op 6 Op 7
api_aE()
api_cB()
api_cC()
api_cS()
api_cX()
api_cY()
api_eC()
api_eR()
api_gC()
api_gE()
api_gO()
api_gS()
api_rE()
api_wH()
api_gH()
api_gP()
api_nN()
api_eL()
api_rW()
api_rN()
api_cP()
api_DeA()
api_DeV()


Compatibility Matrix for the most recent version under Mac browsers:
Safari 1.x IE 5.x Moz 1.5.x Moz 1.6.x NS 6.x NS 7.x Op 5.x Op 6.x
api_aE()
api_cB()
api_cC()
api_cS()
api_cX()
api_cY()
api_eC()
api_eR()
api_gC()
api_gE()
api_gO()
api_gS()
api_rE()
api_wH()
api_gH()
api_gP()
api_nN()
api_eL()
api_rW()
api_rN()
api_cP()
api_DeA()
api_DeV()


Compatibility Matrix for the most recent version under Linux/Unix browsers:
KDE 1.x KDE 2.x KDE 3.x Moz 1.4.x Moz 1.5.x Moz 1.6.x Op 5 Op 6 Op 7
api_aE()
api_cB()
api_cC()
api_cS()
api_cX()
api_cY()
api_eC()
api_eR()
api_gC()
api_gE()
api_gO()
api_gS()
api_rE()
api_wH()
api_gH()
api_gP()
api_nN()
api_eL()
api_rW()
api_rN()
api_cP()
api_DeA()
api_DeV()
Key:


Contact me.


Global Variables:

The Program Declares the following Global Variables that can be used by other scripts:

All global varibles in the beta release of the API have been removed for performance reasons.
Global Variables for the script reflect Version and Author Info and are environmetally freindly.
These Varibles should remain intact for widgets sniffing for version info.
Except for updating the variable info (not adding or altering variable names) I expect no futher changes here ever.
Variable Comments
api_version Numerical version as a decimal number for major.minor version sniffing.
api_program Program Name. Note this will not change.
api_author The name of the person who created this program (Me).
api_title The full title of the API
api_filename The filename of the API if you ned to load/unload it.


Functional Reference:

Below parameters in "[]" (square brackets) represent optional parameters.
Almost no error handeling is done within the functions so the code stays compact, though the code is extreemly stable. If you have any problems be sure you are using the right parameters, right data types, and that you are handeling returned values properly. Be sure to validate your inputs if extensive error checking is required. In addition a list of dependent functions is maintained in the rare event you wish to use only a couple functions of the api to try and reduce the api file size.

Below is a list of functions and their usages:

Function Name Returned Data Type Function Param Comments Dependencies
Client Browser Sniff int api_cB (string browserInfo)
 
Returns IndexOf "browserInfo" Client Browser
If it is not within the browser -1 is returned.
None
Get Element HTMLElement api_gE (string id)
 
Get element from text ID
Returns the HTML/DHTML Element Object
None
Write Html void api_wH (HTMLElement elm,
 string html
 [, bool append])
 
Write html in element, or append None
Change Class void api_cC (HTMLElement elm,
 string className)
 
Change elements class. Note that you usually get better performance using Change Class/api_cS() None
Change Style void api_cS (HTMLElement elm,
 string styleName,
 string styleValue)
 
Change elements style. None
Current X int api_cX (object.Event) Returns the Left Position of the Mouse for a given element None
Current Y int api_cY (object.Event) Returns the Top Position of the Mouse for a given element None
Attach Event int api_aE (HTMLElement elm,
 string eventType,
 string function,
 string useCapture)
 
Add/attach listener event; Returns a numerical status that means:
  • -1:no Browser Method support
  • 1:addEventListener (DOM2 Method Supported)
  • 2:attachedEvent
  • None
    Remove Event int api_rE (HTMLElement elm,
     string eventType,
     string function,
     string useCapture)
     
    Remove/detach listener event; Returns a numerical status that means:
  • -1:no Browser Method support
  • 1:removeEventListener (DOM2 Method Supported)
  • 2:detachedEvent
  • None
    Get Offset int api_gO (HTMLElement elm,
     string offsetType)
     
    Returns a numeric value of a style for a given element and style.
    Note the limited support in browsers, usually you can get: Top,Left,Width,Height & Display
    (Yes please capitalize the first letter of those listed to get them to work.)
    None
    Get Sytle Value string api_gS (HTMLElement elm,
     string styleName)
     
    Returns a styles value for a given element and style None
    Get Class Value string api_gC (HTMLElement elm)
     
    Returns the current class for given element None
    Get HTML string api_gH (HTMLElement elm)
     
    gets the html of an object None
    Get Property string or int api_gP (HTMLElement elm,HTMLElement Property)
     
    Returns the value of an element's Property None
    Nearest Number string api_nN (int v,int n)
     
    Returns the next nearest value. Rounds v to the nearest unit of n. None
    Element Lock void api_eL (HTMLElement elm,
     [ boolean v ])
     
    Enable & Disable an element. If v is unspecified it toggles the lock state. If v is True the element is disabled; if v is false it enables the object. None
    Resize Window void api_rW ([int h],
     [int w],
     [int x],
     [int y])
     
    Resize and Reposition a window dynamically. [0]:int height (default avalible); [1]:int width (default avalible); [2]:int left (default 0); [2]:int top (default 0); None
    Round Number Percision string api_rN (int n,
     [int l])
     
    Returns a string of N decimal Places. int n: number; int l: length/number of decimal places,default is 2 decimal places None
    Copy to Clipboard void api_cP (HTMLElement elm)
     
    Copies Data to the Clipboard. You can only use it on some text based form objects (not DIV or SPAN). A known workaround is copying/buffering data to a hidden input object and then executing this command on the hidden element. None
    Copy to Clipboard void api_rK (String t,
     String f,
     String r,
     [boolean c])
     
    WARNING: As of this writing only IE supports this function, however this does not cause an error in other browsers. Does a search and replace in string t for string f; replaceing string f with string r. By default it is not case sensitive. You can make it case sensitive by setting the optional bool value c to 'true'. returns undefined if no search term is entered. granite countertops marietta ga None
    Preload Images void api_pI (String URL (or array of URL's))
     
    Preloads the image to your browsers cache. Extreemly fast since only downloads, and does not render each image. You may call 1 ore more images at a time by this function. Status of current load is in document.imgs.loaded (as a decimal representation of a percent of total curent load procesed.) and can be accessed by other scripts. Call images normally in your page. None
    Dependent Functions
    Element Alpha void api_DeA (HTMLElement elm,
     int v)
     
    Applies element alpha transparncy properly. e:object element; v: int amount 100 to 1 api_cS()
    Element Visibility void api_DeV (HTMLElement elm,
     [boolean d])
     
    Changes element visibility OR element toggle visibility.e:object element; [d]: boolean (hide element[true:hides||false:shows]) api_cS(),
    api_gS()

    For returned data type 'void' means no data is returned.



    Examples:

    So you say that's great but show me what it can do? Below are examples of the api in usage (refresh the page to reset the object). Also if you go to my site (
    Avitar.net) you can download extensions to get more use out of the API as they become avalible.To iterate: there are several uses of the robust API functions, which usually turn up to be API extensions, or dependent functions. Below are some basic usages you can use for individual functions. We hope they spark your imagination to develop code. If you would like to contribute a few minutes of time to repay the developers, you can test the API code in your web browser. Then look up at the comptibility matrix for the appropriate browser and Operating system. If you are testing for an untested combination, please drop us a note to tell us what your results were. If your results are conflicking tou ours, let us know that too. Include the function(s) you were testing, OS, Web browser, name and email address. Note the last two are so we can give you credit =). Signifigant contributors usualy end up getting free commercial copies of this software so don't be shy.
    testObject
    testObject2


    Function
    Code & Test
    Result Comment
    api_gE() returns an [object]
    api_cB() index of string in browser user agent if found, or -1
    api_wH() Changes the text or appends it in an element
    api_aE() Adds an Event listener (alert) on testobject
    api_rE() Removes event listener from a element (if it exists)
    api_cC() changes class of element
    api_cS() Changes a style of element
    api_cX() Gets the Left Position of the Mouse; uses helper functions in Mozilla & NS due to architecture; Currently developing a workaround.
    api_cY() Gets the Top Position of the Mouse; uses helper functions in Mozilla & NS due to architecture; Currently developing a workaround.
    api_gO() Gets value of element offset
    api_gS() Gets value of element Style; Some properties are quircky in diffrent browsers. For example in IE you would access a style using: backgroundColor where in Mozilla or NS you would access the same info using background-Color
    api_gC() Gets value of element Class
    api_gH() Gets the HTML of an object
    api_gP() Returns the value of weather the item is disabled or not.
    api_nN() Returns 12.75 from the deafult input.
    api_eL() Disables/Locks testObject, and the test feild.
    api_rW() Makes the window 300 by 300 at cords (50,50) for the default values (for 3 seconds).
    api_rN() Alerts: New Number: 11.20
    api_cP() Copies the textfeild to the left to the clipboard.
    api_DeA() Changes TestObjects Alpha Opacity to 75%, then moves it up above text so you can see.
    api_DeV() Hides/Unhides TestObject
    api_rK() Alerts with a string where all the occurances of bob are replaced with Ike.
    api_pI() Runs a the image preloader.


    Perform a Custom Test:




    Legal Information:



    Notes:

    If you want to work on the code with me and have signifigant positive contributions, I am more than happy to place your name near mine in the credits.

    If you wish to use this for a business get in touch with me for licensing.


    © 2003, David Smith. Whittier, CA