Great work Chris -

For those of you who aren't familiar with the CF functions, they are very
helpful real-world functions.  A fantastic reference site for many different
code APIs can be found here:  http://gotapi.com/  For Cold Fusion, look
under Macromedia.  Try looking under functions for examples of the new
functions Chris just added.  There is also a search box above that left
column to save you from digging ;)

Hmm - sure would be nice to get the jQuery API up here...

On 3/17/07, Christopher Jordan <[EMAIL PROTECTED]> wrote:

 Hi folks!

Well, I've updated the plug-in to include the following new functions:

StructKeyExists,
ListRest,
DateFormat,
TimeFormat

Here are the valid date and time format masks:

*   mmmm    = Long month (eg. January)
*   mmm     = Short month (eg. Jan)
*   mm      = Numeric date (eg. 07)
*   m       = Numeric date (eg. 7)
*   dddd    = Long day (eg. Monday)
*   ddd     = Short day (eg. Mon)
*   dd      = Numeric day (eg. 07)
*   d       = Numeric day (eg. 7)
*   yyyy    = Year (eg. 1999)
*   yy      = Year (eg. 99)

*   h:    Hours;    no leading zero for single-digit hours (12-hour clock)
*   hh:   Hours;    leading zero for single-digit hours (12-hour clock)
*   H:    Hours;    no leading zero for single-digit hours (24-hour clock)
*   HH:   Hours;    leading zero for single-digit hours (24-hour clock)
*   m:    Minutes;  no leading zero for single-digit minutes
*   mm:   Minutes;  a leading zero for single-digit minutes
*   s:    Seconds;  no leading zero for single-digit seconds
*   ss:   Seconds;  leading zero for single-digit seconds
*
*   t:    One-character lower-case time marker string, such as a or p
*   tt:   Multiple-character lower-case time marker string, such as am or
pm
*   T:    One-character upper-case time marker string, such as A or P
*   TT:   Multiple-character upper-case time marker string, such as AM or
PM
*
*   short:   equivalent to h:mm TT
*   medium:  equivalent to h:mm:ss TT
*   long:    medium followed by three-letter time zone; as in, 2:34:55 PM
EST
*   full:    same as long

 The plug-in is now available in a compressed version. It's 7KB instead of 18KB.

Keep the suggestions and comments coming. :o)

Here are some examples of how to use the plug-in:
<script src="path/to/jquery.js"></script>
<script src="path/to/jquery.cfjs.packed.js"></script>
<script src="path/to/jqyery.dates.js"></script>
<script>
    var myList = "1,2,3,4,5,6";
    var modifiedList = $.ListRest(myList);
    // or maybe...
    $("#someID").empty().append($.ListRest(myList));

    // or...
    var myStruct = {};
    myStruct.value1 = "jQuery";
    myStruct.value2 = "ROCKS!";
    myStruct.value3 = "So does ColdFusion";

    if(!$.StructKeyExists(myStruct, "value4")){
        //do something cool if the struct key doesn't exist
    }

    if($.StructKeyExists(myStruct, "value3")){
        //do something cool if the struct key exists
    }

    // or...
    var str, str1, str2;
    str = $("#TimeStringID").val();
    str = $.parseODBCDateTime(str); // this function is in the jquery.dates.js
    str1 = $.DateFormat(str, "mm/dd/yyyy");
    str2 = $.TimeFormat(str, "hh:mm:ss");
    $("#someID").empty().append(str1 + " " + str2);

</script>
<input id="TimeStringID" type="text" value="{ts '2007-03-17 00:00:00'}">
<span id="someID"></span>

Do those examples help?

I'll work on putting these up on my website (http://cjordan.us)

Cheers,
Chris

Dan G. Switzer, II wrote:

 Please add:

        StructKeyExists: function(s,k){
                for(var n in s){
                        if (n == k) return true;
                }
                return false;
        },


Shall we post additions and updates here?

 This would be much more efficient:

StructKeyExists: function(s,k){
        return !!s[k];
},

However, it's also important to remember that a ColdFusion "structure" isn't
the exact same thing as a JavaScript Object.

-Dan


_______________________________________________
jQuery mailing list
[EMAIL PROTECTED]://jquery.com/discuss/


--
http://cjordan.info


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to