jQuery.timeRule

Release 1.0 Ready for Download


jquery.timerule-1.0.zip
File Size: 23 kb
File Type: zip
Download File

What is it?

jQuery.timeRule is a function scheduler & customizable clock.  It's GMT based so it's accurate no matter where you're viewing the webpage from.

Why use it?

Because not all functions should run all the time.  For example: If you have an e-commerce website and want to notify a customer of something at a certain time - jQuery.timeRule is the answer.  You simply create a time rule to attach to a function.

Every second! That's a bit accessive.

Your right!  Some functions don't need to run every second. That's why there is a simple API. If you need to check the year/month/day/hour/second, after initiation, you can use the following:

$.timeRule.getDay() - return proper name for current day
$.timeRule.getMonth() - returns proper name for current month
$.timeRule.getDate() - returns today's date as integer
$.timeRule.getYear() - returns this year as integer
$.timeRule.getHour() - returns this hour as integer
$.timeRule.getMin() - returns this minute as integer
$.timeRule.getSec() - returns this second as integer
$.timeRule.getAmPm() - returns capitolized AM or PM

Examples

This example rules a anonymous function on Monday & Tuesday between 12am & 12pm.
$(document).ready(function() {
    $('#timeRule').timeRule({
        rules: [
            $.timeule.makeRule('Monday|Tuesday',     '1-12:AM|12:PM',     function() {}),
        ]
    });
});

A "time rule" looks like this - which runs at all hours, on all days, every second:
$.timeRule.makeRule('Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday', '1-12:PM|1-12:AM', function() {});

This example runs all the time every second:
$(document).ready(function() {
    $('#timeRule').timeRule({
        rules: [
            $.timeRule.makeRule(false, false, function() {});
        ]
    });
});