views:

19

answers:

0

Hi guys,

Has anyone come across a port of the flashLightBoxInjector code from Bramus? Currently it's in Prototype, but I really need to get it working with jQuery as the whole site I'm working in is running on this - not an option to use noConflict(). I'm ok with jQuery, but certainly no guru, can anyone help?

The purpose of the code is that images are loaded into a Flash CoverFlow-esq gallery, which in turn calls the lightBoxInjector (code below) and injects this content into the HTML markup so when a gallery image is clicked, a larger version is displayed in a lighbox.

The Prototype code in use currently is:

var flashLightBoxInjector = Class.create();

flashLightBoxInjector.prototype = {

    initialize : function() {
        var objBody = document.getElementsByTagName("body").item(0);
        var objContainer = document.createElement("div");
        objContainer.setAttribute('id','flashLightBoxInjectionBox');
        objContainer.style.display = 'none';
        objBody.appendChild(objContainer);
    },

    reset : function() {
        $('flashLightBoxInjectionBox').innerHTML = "";
        return true;
    },

    appendElement : function(link, title, id, setId) {
        new Insertion.Bottom('flashLightBoxInjectionBox', '<a href="' + link + '" title="' + title + '" id="' + id + '" rel="lightbox[' + setId + ']">' + link + '</a>');
    },

    prependElement : function(link, title, id, setId) {
        new Insertion.Top('flashLightBoxInjectionBox', '<a href="' + link + '" title="' + title + '" id="' + id + '" rel="lightbox[' + setId + ']">' + link + '</a>');
    },

    updateImageList : function() {
        myLightbox.updateImageList();   
    },

    start   : function(id) {
        myLightbox.start($(id));
    }

}

function initFlashLightBoxInjector() { myFlashLightBoxInjector = new flashLightBoxInjector(); }
Event.observe(window, 'load', initFlashLightBoxInjector, false);

Any help would be hugely appreciated. Thanks.