Posts

Showing posts with the label jQuery

isFunction or isIENativeFunction ?

One truly common task in JavaScript is to determinate if a specific " reference " is a Function, as we know them, or not. For those guys whose think typeof , instanceof , or Object.prototype.toString are enough, here I am with the proof things are NOT that simple, and these things are really important, business speaking, since these checks are in the core of whatever library we create or use for our Web 2.0 Application, Enterprise or not. Different Behavior Problem: Internet Explorer As historical black sheep in the browser panorama for its non standard JavaScript implementation , even for a simple task like the right manifestation of a property or function in core level, Internet Explorer, whatever version, will return false in every case described below: // alert is a function, that is why I use // this function to demonstrate // that for IE alert is not a function // sounds fun? alert(typeof alert); // object alert(alert instanceof Function); // false alert(Object.protot...

jQuery plug-in distributed elements via If, ElseIf, and Else

After a couple of instant and consecutive releases, I ended up with a plug-in that fits minified into 240 bytes :) Here is the official plug-in page , while this is the example page and this is the summary: ;jQuery.fn.extend({ // Andrea Giammarchi - Mit Style Licence - V0.2 If:function(fn){ var __If__ = this.__If__ || this, $ = __If__.filter(fn); $.__If__ = __If__.filter(function(){return !~$.index(this)}); return $; }, Else:function(){ return this.__If__; }, Do:jQuery.fn.each }); jQuery.fn.ElseIf = jQuery.fn.If;

jQuery If, ElseIf, and Else plugin

Update Guys, I have to admit I created silly prototypes while all I need were much more simpler than I though :) Enjoy last version ! ------------------------------------- Try to imagine a page like this one: <body> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> <div>6</div> <div>7</div> <div>8</div> </body> .. and now try to imagine something like this: function oddNumbers(){ // return true if element contain an odd number return $(this).text() & 1; }; $(function(){ $("div") .If(function(){return $(this).text() == "3" || $(this).text() == "5"}) .text("match the 3 or 5 check") .ElseIf(oddNumbers) .text("odd numbers") .ElseIf(function(){return $(this).text() == 2}) .Do(function(){ // if you need a closure ... $(this).text(...

jSmile 0.4 - Stand alone Version

nic comment: hey. thank u for that awesome plugin. how can i download the smilie package? i want to host them on my webspace because i want to be independet from other hosters. I have recently updated my jQuery plugin, called jSmile , and the biggest news is that it does not require anymore external resources. Thanks to inline uri data, the script now comes " full optionals ", or better, with base64 encoded GIFs images included. Instead of external CSS classes, images, and cross host dependencies, jSmile can now easily be integrated in every http or http s site, and without network delays. Its size is obviously bigger than before, but using a minifier and gzip compression, it fits perfectly under 7Kb . Compatibility Chrome FireFox Internet Explorer 8 Opera Safari WebKit Enjoy ;)

jQuery + jQuery UI + Full Flora Theme ... less than 32Kb

Don't You trust me? It's so diabolically simple with packed.it ... and more than a professional Web Developer complained about " why on heart noone talk about that service " :D It's not packer, it's not YUICompressor, It's the only one that cache both CSS and JavaScript in a single file ... it's for PHP4, PHP5, Python wsgi, Python psp, C#.NET ... so, what are you waiting for? Ok, I'll let you try this full package: jQuery 1.2.3 and jQuery UI 1.5b with full Flora Theme included . Enjoy ;) P.S. jQueryUI.html example file calls jQueryUI.php, jut change estension in your server if you want python or .NET