pwnt.be

Bovine Spongiform Encephalopathy

I’ve made it my purpose in life to be all Web 2.0. Until Web 3.0 comes out, anyway—I like to think that one will mark the return of marquees.

A cow!Anyway, I’ve just installed a major JavaScript overhaul. Mainly, all the client-side scripting now relies on the awesome MooTools instead of my homebrew library. Hence the cow, yes. Because a cow says moo.

Since I’d never used MooTools before, and I couldn’t be bothered to refactor the entire codebase, I’m sure I’m not (yet) harvesting the true potential of the framework. However, a lot of the stuff my own mini library already had was pretty much identical to MooTools’s implementation, which was reassuring.

Now, even though I’m just diving into MooTools, I’ve already got two gripes, because, well, otherwise I wouldn’t be me.

Firstly, even for an experienced coder, the docs aren’t always that useful, despite the nice visual style, and the “Mootorial” is both horribly incomplete and chaotic. Luckily, the code itself does not seem to suffer from similar issues.

Secondly, the code may not be a blatant mess like in the case of, oh, I dunno, PHP, but a little more consistency would still be welcome. I’m well aware that cross-browser scripting is a bitch, and I do appreciate any attempt to make it easier, but, at the very least, I could come up with these two functions for good measure:

// Now uses Class:implement instead of Class:extend
// More about this here

// Array.getRandom() but no shuffle()? BURN.
Array.implement({
  'shuffle': function() {
    var temp;
    for (var i = this.length - 1; i > 0; i--) {
      var j = $random(0, i);
      temp = this[i];
      this[i] = this[j];
      this[j] = temp;
    }
    return this;
  }
});

// There’s an Element.setOpacity(), so …
Element.implement({
  'getOpacity': function() {
    return this.getStyle('opacity');
  }
});

I’m not sure how well the other popular frameworks compare. If anyone can tell me why Scriptaculous, Prototype, YUI, jQuery or any other framework would be suitable for my needs, or just in general, then please let me know.

Post a Comment

This contraption supports Gravatar, as well as Markdown with SmartyPants. If none of that made sense to you, feel free to ignore it and start typing.

  • :)
  • :D
  • ;)
  • :-O
  • :P
  • :@
  • :$
  • :S
  • :(
  • :'(
  • :|
  • :-#
  • 8-|
  • ^o)
  • :-*
  • +o(
  • :^)
  • *-)
  • 8-)
  • |-)
Disorientation
Continuity
Tangentiality
Retributions
Automating OpenVPN Connection on Windows XP
blanky, sky, Tim, Geb, 12vpn, Tim, neecom
Simple Linear Regression with JFreeChart
Nicolas Machado, Sascha, Tim, Sascha, Tim, Sascha
De Canvascrack: een epiloog
Tim, Steven Noels
Lplayer for the Rest of Us
jesus2099, Tim, jesus2099, Tim, jesus2099, Tim, PixelPirate
Proximus, Universiteit Gent, Kafka: schrappen wat niet past
Tim, Bart Coppens, Tim, Steven, Tim, Femke
Colophonics