|
Project Information
Members
Featured
Downloads
Links
|
ABOUTFluid, the site-specific browser host, allows you to add javascript to modify existing sites, with some specific extensions for better integration (such as Growl). However, neither Javascript nor Fluid, binds to the multimedia keys (play, forward, backward) found on Apple's full keyboard. This extension, written in Objective-C, adds this capability to Fluid written in a manner that directly binds to Javascript in a site-agnostic manner. Web sites can link against this, or userscripts can act as an interface to link site-specific behavior with the media-media keys. INSTALLATION1. Double click on the plugin available in the Downloads tab. 2. Use your favorite userscript or website that already integrates. For example, use this with my userscript for thesixtyone. APIThe API is simple. Upon pressing play, forward, or backward on the Apple keyboard, MediaKeys executes the following simple Javascript on the current main webview (this example is for play): if (mediaKeysPlugin && mediaKeysPlugin.play) {
mediaKeysPlugin.play();
};Simply define an object called mediaKeysPlugin that has functions play, prev, and next. Here is a sample userscript that integrates MediaKeysPlugin with the existing site thesixtyone.com using their site-specific Javascript API: // ==UserScript==
// @name t61 MediaKeysPlugin handler
// @namespace http://www.media.mit.edu/~azinman
// @description Wraps the MediaKeys plugin handlers to the sixtyone functions
// @include http://www.thesixtyone.com/*
// @author Aaron Zinman
// ==/UserScript==
mediaKeysPlugin = {};
(function () {
if (window.fluid) {
mediaKeysPlugin.forward = t61.miniplayer.next;
mediaKeysPlugin.backward = t61.miniplayer.prev;
mediaKeysPlugin.play = function () {
if (t61.current_song && t61.current_song.playing) {
t61.miniplayer.pause();
} else {
t61.miniplayer.play();
}
}
}
})();
|