@@ -12,7 +12,6 @@ var today; var Kalendae = function (targetElement, options) { - if (typeof document.addEventListener !== 'function' && !util.isIE8()) return; //if the first argument isn't an element and isn't a string, assume that it is the options object var is_element = false; @@ -574,10 +573,19 @@ }, $$: function (selector) { + if (typeof jQuery !== 'undefined') { + return jQuery(selector).get(); + } return document.querySelectorAll(selector); }, make: function (tagName, attributes, attach) { + if (typeof jQuery !== 'undefined') { + var $e = $('<' + tagName + '/>').attr(attributes); + if (attach) + $e.appendTo(attach); + return $e.get(0); + } var k, e = document.createElement(tagName); if (!!attributes) for (k in attributes) if (attributes.hasOwnProperty(k)) e.setAttribute(k, attributes[k]); if (!!attach) attach.appendChild(e); @@ -743,7 +751,7 @@ //auto-initializaiton code -if (typeof document.addEventListener === 'function') Kalendae.util.domReady(function () { +Kalendae.util.domReady(function () { var els = util.$$('.auto-kal'), i = els.length, e, @@ -765,8 +773,8 @@ } }); + Kalendae.Input = function (targetElement, options) { - if (typeof document.addEventListener !== 'function' && !util.isIE8()) return; var $input = this.input = util.$(targetElement), overwriteInput; @@ -1725,7 +1733,7 @@ today = moment().stripTime(); -if (typeof jQuery !== 'undefined' && typeof document.addEventListener === 'function') { +if (typeof jQuery !== 'undefined') { jQuery.fn.kalendae = function (options) { this.each(function (i, e) { if (e.tagName === 'INPUT') { @@ -1737,7 +1745,7 @@ } }); return this; - } + }; }