KBD

Keith Devens .com

Thursday, March 18, 2010 Flag waving
Simplicity takes effort-- genius, even. – Paul Graham

Tag: Javascript

Parents:

Children:

Page 1 →

Daily link icon Tuesday, May 12, 2009

  1. Douglas Crockford on JavaScript: The Good Parts (via).

       (0) Tags: [Javascript]

Daily link icon Thursday, April 30, 2009

  1. High Performance Web Sites :: Loading Scripts Without Blocking (via).

       (0) Tags: [Javascript, Web Development]

Daily link icon Monday, April 13, 2009

  1. "Protovis is a visualization toolkit for JavaScript using the canvas element." (via).

       (0) Tags: [Javascript]

Daily link icon Monday, December 22, 2008

  1. Stevey's Blog Rants: Rhinos and Tigers (via). A presentation about the Rhino Javascript engine on the JVM. To finish reading.

       (0) Tags: [Javascript]

Daily link icon Monday, September 29, 2008

  1. jQuery: » jQuery, Microsoft, and Nokia:

    Both Microsoft and Nokia are taking the major step of adopting jQuery as part of their official application development platform. Not only will they be using it for their corporate development but they will be providing it as a core piece of their platform for developers to build with... This means that jQuery will be distributed with Visual Studio (which will include jQuery intellisense, snippets, examples, and documentation).

       (0) Tags: [Javascript]

Daily link icon Wednesday, September 3, 2008

  1. [squeak-dev] Using V8 for other languages (via):

    One thing is clear: JavaScript is the assembly language of the Internet, at least for a few years now.

    Edit: here was the thing I'd read on TraceMonkey a while back (via Simon).

    Edit: One more post on TraceMonkey (to read).

       (0) Tags: [Javascript]

Daily link icon Thursday, August 21, 2008

W3C Selectors API

Just learned about the W3C Selectors API from Simon's blog. Turns out a native implementation is forthcoming in Firefox 3.1 (as well as Opera, IE 8, and WebKit), but in the meantime many Javascript libraries already implement the spec, Mootools, jQuery, and Prototype to name a few.

WebKit provides a speed test of a native implementation of querySelectorAll vs popular Javascript libraries (obviously the native implementation won't work for you unless you're using a Firefox beta). It's based on Mootools' test.

Daily link icon Wednesday, August 13, 2008

  1. Javascript Drag and Drop. Old, but pretty concise tutorial.

       (1) Tags: [Javascript]

Code to get the browser viewport size in javascript

function getViewport(){
  var e = window, a = 'inner';
  
  if(!('innerWidth' in e)){
    var t = document.documentElement
    e = t && t.clientWidth ? t : document.body 
    a = 'client';
  }
  
  return {width: e[a+'Width'], height: e[a+'Height']}
}

Modified slightly from a comment here.

Edit: the code in that comment didn't fully implement the original, and broke when I tried it in IE. So I've updated the code above.

Daily link icon Thursday, August 7, 2008

  1. Raphaël—JavaScript Library (via).

    Raphaël is small JavaScript library that should simplify your work with vector graphics on the web. In case you want to create your own specific chart or image crop-n-rotate widget, you can simply achieve it with this library.

    Raphaël uses SVG and VML as a base for graphics creation. Because of that every created object is a DOM object so you can attach JavScript event handlers or modify objects later. Raphaël’s goal is to provide adapter that will make drawing cross-browser and easy. Currently library supports Firefox 3.0+, Safari 3.0+, Opera 9.5+ and Internet Explorer 6.0+.

       (0) Tags: [Javascript]

Daily link icon Thursday, July 24, 2008

  1. SitePen Blog » window.name Transport (via Keith and Simon). To read.

       (0) Tags: [Javascript, To Read]

Daily link icon Monday, May 12, 2008

  1. John Resig - Processing.js (via):

    I've ported the Processing visualization language to JavaScript, using the Canvas element.

    Impressive, to say the least.

       (0) Tags: [Javascript]

Daily link icon Wednesday, April 23, 2008

  1. JavaScript: The Good Parts, by Douglas Crockford (via).

       (0) Tags: [Books, Javascript]
  2. Reading binary files using Ajax « nagoon97’s Weblog (via).

       (0) Tags: [Ajax]

Daily link icon Tuesday, April 15, 2008

  1. Javascript getElementsByClass function. I know there's one built into prototype, but I didn't want to include the whole library since I wasn't already using it. This seems to work.

       (4) Tags: [Javascript]

Daily link icon Monday, April 7, 2008

  1. JSLint, The JavaScript Verifier (via).

       (0) Tags: [Javascript]

Daily link icon Thursday, February 14, 2008

  1. JavaScript Kit- DOM Table Object Methods.

       (0) Tags: [Javascript, Web Development]

Daily link icon Tuesday, January 29, 2008

  1. Faster JavaScript Trim.

       (0) Tags: [Javascript]

Daily link icon Friday, January 11, 2008

  1. ASP.NET AJAX Control Toolkit.

       (2) Tags: [ASP.NET, Javascript]

Daily link icon Monday, December 17, 2007

  1. AppJet: Instant Web Programming (via).

       (0) Tags: [Javascript, Web Development]

Daily link icon Monday, December 10, 2007

  1. Jash: JavaScript Shell (via, via).

       (0) Tags: [Javascript]

Daily link icon Thursday, August 16, 2007

  1. Simon Willison: jQuery for JavaScript programmers. Maybe I'll use jQuery instead of Prototype for future development.

       (0) Tags: [Javascript, Web Development]

Daily link icon Wednesday, August 8, 2007

  1. Emprise JavaScript Charts :: 100% Pure JavaScript Charts.

       (2) Tags: [Javascript]
  2. SproutCore (via):

    Sprout Core is a application framework written in Java Script. It’s designed for creating full applications that run inside the web browser.

    MIT license.

       (0) Tags: [Javascript]

Daily link icon Friday, July 13, 2007

Javascript toggle functions

Some more handy Javascript (depends on Prototype):

function toggleByClass(id, className, callback){
    // shows the element with id 'id'
    // and hides all other elements with class 'className'
    $A($$('.'+className)).each(function(element){
        $(element).style.display = "none";
    })
    if(id) // call it with a false id to hide all
        $(id).style.display = "block";
    if(callback)
        callback(id, className);
}

function toggleById(id1, id2){
    var a = $(id1).style;
    var b = $(id2).style;
    if(a.display == 'none' || a.display == ''){
        a.display = 'block';
        b.display = 'none';
    }else{
        a.display = 'none';
        b.display = 'block';
    }
}

Daily link icon Friday, June 29, 2007

<select> utility javascript functions

I always wind up needing functions to dynamically populate the options on a <select> list, or select a given item in an existing <select>. So I've finally written them out in a reusable form:

<select id="foo" onchange="alert(this.value)"/>

<script language="javascript" type="text/javascript">
function loadSelectOptions(selectId, keys, values, selectedOption){
    var list = document.getElementById(selectId)
    if(!list)
        return;

    var selectedIndex = 0;
    list.length = 0;

    var found = false;
    for(var i=0,n=keys.length; i<n; i++){
        list.options[i] = new Option(values[i], keys[i]);
        if(selectedOption == keys[i]){
            list.selectedIndex = i;
            found = true;
        }
    }
    return found;
}

function selectSelectOption(selectId, value, runEvent){
    var list = document.getElementById(selectId)
    if(!list)
        return;

    var options = list.options;
    for(var i=0,n=options.length; i<n; i++){
        if(options[i].value == value){
            list.selectedIndex = i;
            if(runEvent)
                list.onchange();
            return true;
        }
    }
    return false;
}

loadSelectOptions("foo",['foo','bar','baz'], ['FOO','BAR','BAZ'],'baz')
var list = document.getElementById("foo")
list.remove(1)
selectSelectOption("foo","baz")
</script>

Daily link icon Thursday, June 7, 2007

  1. Because I'm sure it'll come in handy later, here's a javascript object clone function:

    function clone(obj){
        if(obj == null || typeof(obj) != 'object')
            return obj;

        var temp = {};
        for(var key in obj)
            temp[key] = clone(obj[key]);
        return temp;
    }

    Update: From feedback in the comments, a better version is:

    function clone(obj){
        if(obj == null || typeof(obj) != 'object')
            return obj;

        var temp = new obj.constructor(); // changed (twice)
        for(var key in obj)
            temp[key] = clone(obj[key]);

        return temp;
    }
       (29) Tags: [Code, Javascript]

Daily link icon Monday, April 9, 2007

  1. Destroydrop » Javascripts » Tree. dTree has worked great for me so far.

       (3) Tags: [Javascript, Web Development]

Daily link icon Thursday, October 26, 2006

  1. Video: Douglas Crockford, “An Inconvenient API: The Theory of the Dom” » Yahoo! User Interface Blog (via Joseph Scott). To watch later.

       (0) Tags: [Javascript, Videos]

Daily link icon Wednesday, October 18, 2006

window.event

MSDN: event Object (window). In Firefox, the event object is passed as a parameter to the event handler. In IE, there's a global window.event object. To get the element that threw the event in both Firefox and IE, you can simply use:

target = event ? event.target : window.event.srcElement

where event is the name of the parameter to the function. In Firefox it's populated, in IE it's left undefined.

Page 1 →
March 2010
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
28293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 2 posts

Recent comments XML

I hate ASP.NET

I hate ASP... I was doing wonders​with PHP, then suddenly one of my​clients...

Johnies: Mar 17, 6:14am

Quantum physics and free will

I knew you were going to say that....

Tom Massey: Mar 15, 9:26pm

Generated in about 0.255s.

(Used 11 db queries)