Archive for the ‘JavaScript’ Category

Mootools Idle State Notifier

5

Oct
22

Last year I wrote a simple JavaScript function, for prototype, to mimic an idle state event. The code was very simple and was quickly picked up on by think web2 (perfection kills) where they extended the idea and developed a self containing class which fires active and idle custom events.

After using this code on several projects I decided to port it over to Mootools 1.2 (also works in Mootools 1.1) so check it out the demo below and if you like it feel free to download the code.

demo

Mootools Idle State Notifier demo.

download

Mootools Idle State Notifier download.

sIFR 3

8

Sep
10

This a quick post to demonstrate the power of sIFR 3. Most of you will have heard about sIFR and its benefits, but for those of you that haven’t “sIFR lets you use your favorite font on your websites by working with Flash, JavaScript and CSS”. It enables developers to build templates as close to the creative as possible without the use of images and compromising accessibility/usability.

Click the link below to see a few of the sIFR showcases I have put together.

I have used sIFR for some time now and decided it was about time that I created a few examples to give a quick overview as to its power.

View the sIFR 3 example

JavaScript Clone Object Function

1

Mar
20

Here’s a pretty useful function that clones objects with the use of recursion allowing deep cloning:

function cloneObj(o) {
     if(typeof(o) != ‘object’) return o;
     if(o == null) return o;
   
     var newO = new Object();
   
     for(var i in o) newO[i] = cloneObj(o[i]);
      return newO;
 }

 

Original source snipplr.com.

JavaScript GUID Generator

3

Mar
19

I recently found an interesting forum post which detailed how to generate GUIDs using JavaScript on the fly.  Its very simple and looks as follows:

function S4() {
    return (((1+Math.random())*0×10000)|0).toString(16).substring(1);
}

function generateGuid(){
        return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4()).toUpperCase();
}

 

Originally posted by  Dr John Stockton on thescripts.com.

HTML Forms on the fly

6

Feb
19

I have been looking about at form generators recently and I think it’s fair to say pForm have created one of the best. The generator offers many options including; theme/colour scheme selection, the choice of a multitude of field elements (from a textbox to a file upload) to add to your form, editable form and form field properties and finally ability to download your recently created form.

This is a really nice generator so if your interested have a look at pForm (HTML Forms on the fly).