JSandbox 0.2

2009 August 26
by Eli

I have recently released JSandbox version 0.2. JSandbox is a JavaScript sandboxing library. Version 0.2 is, for the most part, a complete re-write. It introduces many new features, such as load (for loading external scripts) and exec (faster than eval but no return value). There is now an additional fixed-position arguments API along with the version 0.1 API.

mumbl

2009 August 22
tags: ,
by Eli

mumbl is a JavaScript library I created that makes it easy to play music and create playlists on web pages. It abstracts audio-playing functionality of HTML5 <audio> and Songbird (SoundManager 2 support will be added in version 0.1).

Demo

You can try out the live demo to see mumbl in action. Please note that mumbl is not the player in the demo, but the back-end. The demo is just an example of using mumbl to create a music player.

read more…

RetargetMouseScroll

2009 July 31
by Eli

Yesterday I made a simple JavaScript micro-library named RetargetMouseScroll that provides a simple API to retarget/redirect mouse scroll events. I named it this because RedirectMouseScroll sounded weird. At first glance it seems pretty useless but there are some cool things you can do with the library which are listed in the examples section of this post.

Demo

The test suite functions as a great demo.

Usage

RetargetMouseScroll(
    element         :Node,    // default: document
    targetWindow    :Window,  // default: window
    preventDefault  :Boolean, // default: true
    scrollMultiplier:Number   // default: 1.0
)

RetargetMouseScroll returns an object containing a restore method. Calling the method restores the default scrolling.

Examples

  • RetargetMouseScroll(myElement, myFrame) – Per-element mouse scroll retargetting to a frame
  • RetargetMouseScroll(document, window, true, 0.5) – Slow down scrolling
  • RetargetMouseScroll(document, window, true, -1) – Invert scrolling
  • RetargetMouseScroll(document, window, true, 2) – Speed up scrolling

More advanced example using a popup:

var win = window.open("/", "example", "w=" + (screen.availWidth / 3.5)
                                      + ",h=" + (screen.availHeight / 3.5)
                                      + ",scrollbars=yes,resize=yes");
win.addEventListener("DOMContentLoaded", function() {
    var retargetting = RetargetMouseScroll(document, win);
    win.onunload = function () {
        retargetting.restore();
    };
}, false);

In the previous example, all mouse scrolling on the main document is retargetted to the popup until it is closed.

Moving projects to GitHub

2009 July 20
by Eli

I’m moving every significant project on code.eligrey.com to git repositories on my GitHub account. I may or may not delete projects moved to GitHub from code.eligrey.com. I’m pretty sure I won’t remove very small code & tools, testcases, my customized JavaScript Shell (though that will be on GitHub too), and possibly my Mozilla Jetpack features. I might just make a subdomain on github.com and move those things there and make code.eligrey.com redirect there.

Update: I finished moving all my projects over to GitHub.

jsandbox JavaScript Library

2009 July 2
tags:
by Eli

Recently, I created a JavaScript library named jsandbox. jsandbox is used for evaluating JavaScript code safely in a sandbox. jsandbox uses web worker threads to do this.

The API for using the jsandbox library is described in detail and with an example on the project page.