Articles Tagged 'Prototype'


Objective-C: subclassing and Categories

In Objective-C you can extend a class given in two ways: by running a classic subclassing (see also inheritance) or using the so-called categories .

Note: there is also a third way in Objective-C indicated by the name of Posing we might call a mix of subclass (because it defines a new name) and categories (for a given moment all classes of one type behave like new) .

Continued ...

Shadowbox 3.0 beta

It was released right now (thanks to alert the author Michael JI Jackson ) release 3.0 beta Shadowbox.js . In addition to the new site design here is the most important changes prior to this release:

Continued ...

Very short snippet: Actionscript extend an array by the method shuffle ()

I had already talked about how to implement the method shuffle () in Javascript and Actionscript . I realized, tuttaavia, not pointing out that it is able to extend Actionscript, Javascript in the same way, its object Array :

Continued ...

Very short snippet: shuffle () in Javascript and Actionscript

In PHP there is a handy feature called shuffle() that allows you to mix an array (see Very short trick: take random elements from an array in PHP ). An excellent version of the javascript I found here . Slightly revised the code below:

Continued ...

Camelize, CamelCase

As seen in the post Variety of coding and coding approaches that a developer may have to solve a problem are multiple and diverse for the same programming language used. Here's how some of the most popular JavaScript frameworks have solved a simple function of CamelCase :

Prototype.js

Prototype.js , version 1.6.0.3, explicitly proposes a method camelize() to make the camelcase on a string. The author's approach is quite simple and the code is self-explanatory. In this case it was not made any use of Regular Expression!

1
2
3
4
5
6
7
8
9
10
11
12
13
( ) { camelize: function () {
this . split ( '-' ) , len = parts. length ; var parts = this. split ('-'), len = parts. length;
len == 1 ) return parts [ 0 ] ; if (len == 1) return parts [0];

this . charAt ( 0 ) == '-' camelized var = this. charAt (0) == '-'
0 ] . charAt ( 0 ) . toUpperCase ( ) + parts [ 0 ] . substring ( 1 ) ? Parts [0]. CharAt (0). ToUpperCase () + parts [0]. Substring (1)
0 ] ; : Parts [0];

var i = 1 ; i < len ; i ++ ) for (var i = 1, i <len; i + +)
i ] . charAt ( 0 ) . toUpperCase ( ) + parts [ i ] . substring ( 1 ) ; camelized + = parts [i]. charAt (0). toUpperCase () + parts [i]. substring (1);

camelized return;
}

Continued ...

Google AJAX Library API: a turning point for developers

AJAX Libraries API Google , in the latter period, has released a multitude of tools for developers, constantly updating their releases. Now holds an agreement with popular AJAX framework, and not only to centralize the distribution of library jQuery , Prototype , script.aculo.us , MooTools and dojo !

In practice it is possible to access these libraries taking advantage of the infrastructure and the Google network, with significant advantages in terms of speed and safety.

The speed, loading, is guaranteed by the same network that Google, in addition to providing in itself a structure of distributed servers, allows (by default) to load compressed (gzip / minify) libraries. The hosting Google closest to the request will be used to send the code and, if not to achieve a temporary or down, however, the network will ensure the delivery of Google Javascript code!

Continued ...

Shadowbox assetURL: set the image path

When Shadowbox opens his window to show content (images, iframes, Movie, etc ...), displays, waiting, an animated gif that comes in the package. If the page is using Shadowbox is at the same level of the images folder, everything works fine. By default, in fact, look for the animated gif below Shadowbox images / loading.gif - or images / loading-light.gif if you chose light styles (shadowbox-light.css). Otherwise, there is a risk and often not even accorgesene, if we are in a different tree, it generates a nice code 404 - page not girder, in our case file not found!

To resolve this problem sufficient to initialize Shadowbox with an appropriate parameter which indicates the absolute path of your images folder: undolog.com of, for example, I placed the animated gif of loading directly into the images folder present in root (like a billion others sites :) . To make this folder accessible to Shadowbox, regardless of the path, I put semplicemenete:

1
2
/ / Init assetURL shadowbox with parameter
assetURL : 'http://www.undolog.com/' } ) ; Shadowbox. Init ({assetURL: 'http://www.undolog.com/'});

Continued ...

All Lightbox clones in a dynamic array

Planetozh has created a beautiful scenery of the dynamic tool that can list all of the Javascript libraries like Lightbox.

image

image Using a panel (see picture on left) with a series of "ticks" (checkbox), which indicate the various features of the libraries, you can run a filter, obtaining the list of one or more libraries that do the job. We hope that the author maintains updated this great page, very useful in extricating one of the numerous and powerful libraries of this type.

Continued ...

Scriptaculous Effect.Tween: how it works

Of all the libraries 'Web 2.0' available, scriptaculous is certainly the most poorly documented! On the official website, often slow, the documentation is incomplete, poorly made ​​and difficult to use. With the latest releases, then, some new features are completely missing, just as the new core effect Tween (Effect.Tween). The latter, similarly to Tween in Flash, allows you to manipulate custom transitions. SYNOPSIS Its basis is the following:

Continued ...

Light gallery: 2.0.0_rc1 Lightview

Lightview Here is yet another newly released Unobtrusive JavaScript library for image galleries and more. Lightview in 2.0.0_rc1 release , also added the functions to "open" Window with the content that goes beyond simple image: Flash movies, QuickTime , Form and IFRAME! Compared to the previous version (1.1.0 - which handles only images), then, this release candidate is enhanced features are also present in other libraries . . The tools required by Lighview to work very well known are the Prototype 1.6.0.2 and Scriptaculous 1.8.1 . Gliattributi library are used to manage the class and rel .

Interesting one aspect of this library is the extreme care with which the graphic appears.

Score: 9 - Home Lightview

Continued ...